soyrsoyr commited on
Commit
0dab512
·
verified ·
1 Parent(s): 10d9a07

simplify model card to recipe and usage

Browse files
Files changed (1) hide show
  1. README.md +22 -63
README.md CHANGED
@@ -9,73 +9,32 @@ tags:
9
  - test-fixture
10
  ---
11
 
12
- # GLM-5-0.88B-MTP-PR3225
13
 
14
- Toy-trained BF16 source for [LLM Compressor PR #3225](https://github.com/vllm-project/llm-compressor/pull/3225). This is a small architecture and checkpoint test fixture, not a production language model. Its backbone was initialized randomly and trained on the repository tiny-model skill's toy text corpus; no pretrained base-model weights were used.
15
 
16
- ## Model and provenance
17
 
18
- - Original architecture/tokenizer: [zai-org/GLM-5](https://huggingface.co/zai-org/GLM-5), revision `c183ef8c61faee82855eca1ed9bb3a9a7ce3b0b2`.
19
- - Transformers class: `GlmMoeDsaForCausalLM`.
20
- - Total source parameters including synthetic MTP: **881,036,032** (0.881B).
21
- - Backbone parameters: **765,051,392**; MTP parameters: **115,984,640**.
22
- - Estimated active backbone parameters: **708,428,288**. This routing estimate includes embeddings/dense components, excludes MTP, and is not a FLOP measurement.
23
- - Precision: BF16.
24
- - Checkpoint: 5 indexed safetensors shards; 192 indexed tensors. Tokenizer assets are included.
25
-
26
- ## Configuration
27
-
28
- | Field | Original | Tiny |
29
- | --- | --- | --- |
30
- | `num_hidden_layers` | 78 | 4 |
31
- | `hidden_size` | 6144 | 1536 |
32
- | `intermediate_size` | 12288 | 6144 |
33
- | `moe_intermediate_size` | 2048 | 1024 |
34
- | `n_routed_experts` | 256 | 16 |
35
- | `num_experts_per_tok` | 8 | 4 |
36
- | `num_attention_heads` | 64 | 16 |
37
- | `num_key_value_heads` | 64 | 16 |
38
- | `q_lora_rank` | 2048 | 2048 |
39
- | `kv_lora_rank` | 512 | 512 |
40
- | `num_mtp_layers` | not explicitly set | 1 |
41
-
42
- The saved `config.json` is authoritative. Depth is reduced; the limitations below apply.
43
-
44
-
45
- ## Validation and scope
46
-
47
- The BF16 backbone reload passed. Model-based MTP loading fails for this reduced-depth fixture: the upstream registered checkpoint pattern expects layer 78, while this fixture's MTP tensors begin at layer 4. No loader or architecture override was applied. MFPTQ successfully quantized 136 modules, including 56 MTP modules. Its Transformers backbone reload had toy perplexity 1.440128 (BF16: 1.439453). MTP execution remains unverified; the vLLM attempt encountered a DeepGEMM extension ABI mismatch.
48
-
49
- The reloaded **BF16 backbone** toy perplexity was **1.439453** on the same small corpus used for training. This demonstrates learning/reload integrity, not generalization or benchmark quality.
50
-
51
- MTP projections are synthetic initializations and decoder weights were copied from trained backbone blocks. **MTP was not separately trained**, so these artifacts do not establish draft acceptance quality or inference acceleration.
52
-
53
- The tested model-based environment used **Transformers 5.17.0**, Torch 2.14.0+cu130, LLM Compressor [`2d52420`](https://github.com/vllm-project/llm-compressor/commit/2d5242056a8a00028686a303771ffc8e2fe27d07), and compressed-tensors [`e69c8dc`](https://github.com/vllm-project/compressed-tensors/commit/e69c8dc58aa152e5f5e36e85800ec1d2e7de5271). Serving smoke checks used vLLM 0.30.0. GLM/DeepSeek model-based MTP loading failed on Transformers **5.15.0**; **5.16 was not tested**. Calibration-dependent MTP quantization remains follow-up work.
54
-
55
- The model class/loader was not patched to make tests pass. Construction changes were configuration reductions and explicit synthetic checkpoint fixture creation. Structured results and configuration provenance are in [validation.json](validation.json); [artifact-manifest.json](artifact-manifest.json) records checkpoint file hashes.
56
-
57
- ## Backbone loading
58
-
59
- With the tested Transformers environment (and compressed-tensors for FP8), this loads the backbone. MTP is opt-in; ordinary Transformers backbone generation does not execute it.
60
 
61
  ```python
62
- import torch
63
- from transformers import AutoModelForCausalLM, AutoTokenizer
64
-
65
- model_id = "inference-optimization/GLM-5-0.88B-MTP-PR3225"
66
- tokenizer = AutoTokenizer.from_pretrained(model_id)
67
- model = AutoModelForCausalLM.from_pretrained(
68
- model_id, dtype=torch.bfloat16, attn_implementation="eager",
 
 
 
 
 
 
 
 
 
 
 
69
  )
70
- inputs = tokenizer("The capital of France is", return_tensors="pt")
71
- output = model.generate(**inputs, max_new_tokens=16, do_sample=False)
72
- print(tokenizer.decode(output[0], skip_special_tokens=True))
73
  ```
74
-
75
- ## Training
76
-
77
- Random seed 3225; AdamW with learning rate 0.0004 and weight decay 0.01; batch size 2; text truncated to 160 tokens. Training stopped after three consecutive checks at toy perplexity <=3. The corpus follows the [repository tiny-model workflow](https://github.com/vllm-project/llm-compressor/tree/2d5242056a8a00028686a303771ffc8e2fe27d07/.agents/skills/create-tiny-model), with one additional short saying. These are the trained/reloaded artifacts used in testing.
78
-
79
- ## License and attribution
80
-
81
- Upstream architecture/tokenizer provenance and license: [zai-org/GLM-5](https://huggingface.co/zai-org/GLM-5/tree/c183ef8c61faee82855eca1ed9bb3a9a7ce3b0b2).
 
9
  - test-fixture
10
  ---
11
 
12
+ # GLM-5-0.88B-MTP
13
 
14
+ Small BF16 test model using [zai-org/GLM-5](https://huggingface.co/zai-org/GLM-5), with a toy-trained backbone and synthetic MTP weights.
15
 
16
+ ## Quantization recipe
17
 
18
+ Uses [LLM Compressor](https://github.com/vllm-project/llm-compressor/pull/3225) model-free quantization. MTP inference has not been verified for this fixture.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  ```python
21
+ from llmcompressor import model_free_ptq
22
+
23
+ MODEL_ID = "inference-optimization/GLM-5-0.88B-MTP"
24
+ SAVE_DIR = "GLM-5-0.88B-MTP-FP8-Dynamic-MFPTQ"
25
+
26
+ model_free_ptq(
27
+ model_stub=MODEL_ID,
28
+ save_directory=SAVE_DIR,
29
+ scheme="FP8_DYNAMIC",
30
+ ignore=[
31
+ "lm_head",
32
+ "model.embed_tokens",
33
+ r"re:.*\.mlp\.gate$",
34
+ r"re:.*\.eh_proj$",
35
+ r"re:.*\.indexer\..*",
36
+ ],
37
+ max_workers=2,
38
+ device="cuda",
39
  )
 
 
 
40
  ```