hugging-yiii commited on
Commit
3f4c141
Β·
verified Β·
1 Parent(s): cf11e7b

Model card: align layout with GLM-5.3-Flash-MLX template

Browse files
Files changed (1) hide show
  1. README.md +75 -62
README.md CHANGED
@@ -75,11 +75,12 @@ tags:
75
  > tensors more bits (shared experts `+2`, `down_proj` `+1`) while **attention stays at 8-bit and
76
  > the DSA indexer stays in BF16** in every build. Browse all models in the
77
  > [OrcaRouter Model Catalog](https://www.orcarouter.ai/models); deployed as API
78
- > [here](https://www.orcarouter.ai/models/z-ai/glm-5.3).
 
79
 
80
  ---
81
 
82
- ## Available Quantizations
83
 
84
  | Folder | Expert base bits | Group size | Size | Min RAM | Quality vs FP8 |
85
  |---|---|---|---:|---:|---|
@@ -117,7 +118,7 @@ Two properties of this checkpoint drive the whole recipe:
117
 
118
  Everything that was *not* FP8 in the base release β€” the indexer, router `gate` weights, the FP32 `e_score_correction_bias`, every norm, `embed_tokens` and `lm_head` β€” is carried through at its **original dtype**, never a lossy cast.
119
 
120
- ### Bit Allocation for GLM-5.3
121
 
122
  | Component | Tensors | Params | 2-bit | 3-bit | 4-bit | 6-bit | Policy |
123
  |---|---:|---:|---|---|---|---|---|
@@ -150,43 +151,11 @@ The **MTP (multi-token prediction) layer β€” layer 78 β€” is dropped**, and `num
150
 
151
  ## Quality vs FP8
152
 
153
- ### Weight-Space Fidelity
 
 
154
 
155
- Measured on **every quantized tensor** at pack time (58,224 per build), against the FP8 source block-dequantized to BF16 β€” so the only variable is the quantization.
156
-
157
- | Build | Size | Cosine sim | SNR (dB) | Rel. error |
158
- |---|---:|---:|---:|---:|
159
- | `6-bit` | 671 GB | **0.9998** | **37.2** | **1.7 %** |
160
- | `4-bit` | 459 GB | **0.9968** | **22.9** | **7.6 %** |
161
- | `3-bit` | 368 GB | **0.9865** | **16.7** | **15.7 %** |
162
- | `2-bit` | 322 GB | **0.9517** | **11.2** | **29.7 %** |
163
-
164
- Worst-case per build (`cos_min` / `snr_min`): `6-bit` 0.99972 / 32.5 dB Β· `4-bit` 0.99509 / 20.1 dB Β· `3-bit` 0.97869 / 13.7 dB Β· `2-bit` 0.92718 / 8.3 dB.
165
-
166
- > Relative error is the mean of the **per-tensor** relative error `10^(-SNR/20)` over all 58,224 quantized tensors β€” not a value back-derived from the mean SNR, which would understate it (1.4 / 7.1 / 14.7 / 27.5 %).
167
-
168
- Per role β€” this is where the OrcaSAQ policy shows up:
169
-
170
- | Role | bits/gs | 2-bit cos | 3-bit cos | 4-bit cos | 6-bit cos |
171
- |---|---|---:|---:|---:|---:|
172
- | Expert `gate_proj`/`up_proj` | base | 0.93417 | 0.98169 | 0.99570 | 0.99975 |
173
- | Expert `down_proj` | base +1 | 0.98510 | 0.99568 | 0.99898 | 0.99998 |
174
- | Shared expert | base +2 | 0.99561 | 0.99896 | 0.99974 | 0.99998 |
175
- | MLA attention | 8/64 | 0.99998 | 0.99998 | 0.99998 | 0.99998 |
176
- | Dense MLP | 6/64 | 0.99975 | 0.99975 | 0.99975 | 0.99975 |
177
-
178
- Cosine distribution across all quantized tensors (tight percentiles = no outlier tensors hiding behind a good mean):
179
-
180
- | Build | min | p1 | p5 | median | p95 | max |
181
- |---|---:|---:|---:|---:|---:|---:|
182
- | `2-bit` | 0.92718 | 0.93133 | 0.93390 | 0.93437 | 0.98515 | 0.99999 |
183
- | `3-bit` | 0.97869 | 0.98047 | 0.98157 | 0.98178 | 0.99571 | 0.99999 |
184
- | `4-bit` | 0.99509 | 0.99546 | 0.99566 | 0.99571 | 0.99899 | 0.99999 |
185
- | `6-bit` | 0.99972 | 0.99974 | 0.99975 | 0.99975 | 0.99999 | 0.99999 |
186
-
187
- The worst tensors in every build are the same ones β€” early-layer routed experts (`layers.3–5`, e.g. `layers.4.mlp.experts.168.gate_proj`) β€” and `6-bit` still holds them above 0.9997.
188
-
189
- ### Perplexity
190
 
191
  Measured against the **FP8 reference** on wikitext-2 test, 4 chunks Γ— 1024 tokens
192
  (4,092 predicted tokens). Both sides run the identical `glm_moe_dsa` forward on the
@@ -203,7 +172,7 @@ transformers model β€” so quantization is the only variable.
203
 
204
  `6-bit` lands within noise of the FP8 reference β€” read it as indistinguishable.
205
 
206
- ### KL Divergence & Top-1 Token Agreement
207
 
208
  KLD is `KL(ref β€– quant)` per token against the FP8 reference distribution, Top-1 is how
209
  often the build's argmax matches the reference's. Lower KLD and higher Top-1 = closer to
@@ -223,9 +192,41 @@ less memory** and is the recommended default, and `3-bit` holds up well at 40 %
223
  FP8. `2-bit` is the memory-first option β€” reach for it when the hardware cannot hold
224
  anything larger.
225
 
226
- ### Build Verification
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
 
228
- Independent of quality, every build passed a structural release gate before upload:
229
 
230
  - **accounting** β€” 175,242 tensors on disk, 58,224 quantized modules, `weight`/`scales`/`biases` triplets all paired
231
  - **dtype preservation** β€” kept tensors byte-identical in their source dtype (FP32 router bias stays FP32; FP8 `keep` goes through a proper block dequant, never a raw cast)
@@ -236,9 +237,11 @@ Independent of quality, every build passed a structural release gate before uplo
236
 
237
  ---
238
 
 
 
239
  ## Usage
240
 
241
- ### Hosted API β€” No Download
242
 
243
  The full-precision model is live on OrcaRouter as **`z-ai/glm-5.3`** β€” 1M context, 128K max output, $1.26 / $3.96 per 1M input / output tokens:
244
 
@@ -260,7 +263,7 @@ print(response.choices[0].message.content)
260
 
261
  **https://www.orcarouter.ai/models/z-ai/glm-5.3**
262
 
263
- ### Run it Locally (mlx-vlm)
264
 
265
  > **Use `mlx-vlm`, not `mlx-lm`.** GLM-5.3 is a text-only model, but as of **mlx-lm 0.31.3** the `glm_moe_dsa` implementation builds an indexer for *every* layer, while this checkpoint shares one indexer across four layers (`indexer_types`) β€” 285 tensors come up missing. **mlx-vlm 0.6.17** implements the shared-indexer layout and loads these builds as-is. Check for mlx-lm support before switching back.
266
 
@@ -335,11 +338,29 @@ Tool calling is in the template too (`<tool_call>` / `<arg_key>` blocks, `tools=
335
 
336
  ---
337
 
338
- ## GLM-5.3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
 
340
  > Available full-precision on the OrcaRouter API as **`z-ai/glm-5.3`** β€”
341
  > **https://www.orcarouter.ai/models/z-ai/glm-5.3**
342
 
 
 
 
 
343
  GLM-5.3 uses the same base model as GLM-5.2 β€” every gain comes from post-training. Compared with GLM-5.2, it is much better at complex coding and long-horizon tasks:
344
 
345
  - **Stronger coding:** the most capable open-weights model for coding, with a **50 % improvement over GLM-5.2** on Z.AI's in-house Code Bench, and open-source SOTA on public benchmarks including Terminal Bench 3.0 and Agents' Last Exam.
@@ -349,7 +370,9 @@ GLM-5.3 uses the same base model as GLM-5.2 β€” every gain comes from post-train
349
  <img src="https://raw.githubusercontent.com/zai-org/GLM-5/refs/heads/main/resources/logo.svg" width="30%" alt="GLM-5" />
350
  </div>
351
 
352
- ### Official Benchmarks
 
 
353
 
354
  Reported by Z.AI for the full-precision model. These are the upstream model's numbers, not measurements of these MLX builds β€” see [Quality vs FP8](#quality-vs-fp8) above for how each quantization tracks the FP8 release.
355
 
@@ -376,7 +399,9 @@ Reported by Z.AI for the full-precision model. These are the upstream model's nu
376
 
377
  Full evaluation protocols and footnotes are in the [official model card](https://huggingface.co/zai-org/GLM-5.3).
378
 
379
- ### Model Overview
 
 
380
 
381
  - **Type:** Mixture-of-Experts Causal LM (`glm_moe_dsa`, `GlmMoeDsaForCausalLM`)
382
  - **Parameters:** **753B total** Β· **~39B active** per token (22.6B routed + 16.7B always-on; 743B after the MTP layer is dropped)
@@ -387,7 +412,9 @@ Full evaluation protocols and footnotes are in the [official model card](https:/
387
  - **Context:** 1,048,576 tokens Β· vocab 154,880
388
  - **Modality:** text
389
 
390
- ### Best Practices
 
 
391
 
392
  - **Pick a precision:** `6-bit` for near-lossless, `4-bit` (repo root) as the everyday default, `3-bit` when memory is the binding constraint, `2-bit` when nothing else fits β€” the tables above quantify the trade at each step.
393
  - **Sampling:** follow the official GLM-5.3 guidance. The shipped `generation_config.json` is `temperature` 1.0, `top_p` 0.95; long-horizon agentic and coding tasks want generous `max-tokens` headroom.
@@ -397,20 +424,6 @@ Full evaluation protocols and footnotes are in the [official model card](https:/
397
 
398
  ---
399
 
400
- ## Build Provenance
401
-
402
- | | |
403
- |---|---|
404
- | Source | `zai-org/GLM-5.3` (FP8, 141 shards, 756 GB) |
405
- | Quantized | 2026-08-28 |
406
- | Toolchain | MLX 0.32.2, safetensors 0.8.0, NumPy 2.5.2 |
407
- | Method | OrcaSAQ β€” calibration-free, role-based mixed precision |
408
- | Per-build files | 140 shards + `config.json`, `quantization_map.json`, `build_manifest.json`, `fidelity_summary.json`, tokenizer, chat template |
409
-
410
- Each folder carries its own `build_manifest.json` (exact recipe, source path, dropped-tensor count, toolchain versions) and `fidelity_summary.json` (per-role cosine/SNR with the five worst tensors named), so any claim in this card can be checked against the build itself.
411
-
412
- ---
413
-
414
  ## Citation
415
 
416
  ```bibtex
 
75
  > tensors more bits (shared experts `+2`, `down_proj` `+1`) while **attention stays at 8-bit and
76
  > the DSA indexer stays in BF16** in every build. Browse all models in the
77
  > [OrcaRouter Model Catalog](https://www.orcarouter.ai/models); deployed as API
78
+ > [here](https://www.orcarouter.ai/models/z-ai/glm-5.3). Put this model to work reviewing your
79
+ > pull requests with **[OrcaCode Review](https://github.com/Continuum-AI-Corp/Orca-Code-Review)**.
80
 
81
  ---
82
 
83
+ ## Available quantizations
84
 
85
  | Folder | Expert base bits | Group size | Size | Min RAM | Quality vs FP8 |
86
  |---|---|---|---:|---:|---|
 
118
 
119
  Everything that was *not* FP8 in the base release β€” the indexer, router `gate` weights, the FP32 `e_score_correction_bias`, every norm, `embed_tokens` and `lm_head` β€” is carried through at its **original dtype**, never a lossy cast.
120
 
121
+ ### Bit allocation for GLM-5.3
122
 
123
  | Component | Tensors | Params | 2-bit | 3-bit | 4-bit | 6-bit | Policy |
124
  |---|---:|---:|---|---|---|---|---|
 
151
 
152
  ## Quality vs FP8
153
 
154
+ All three tables compare each build against the full **FP8** reference (dequantized to BF16 and run
155
+ through the identical `glm_moe_dsa` forward, so the only variable is the quantization). Sizes are
156
+ decimal GB, matching the file sizes in this repo.
157
 
158
+ **Perplexity**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
 
160
  Measured against the **FP8 reference** on wikitext-2 test, 4 chunks Γ— 1024 tokens
161
  (4,092 predicted tokens). Both sides run the identical `glm_moe_dsa` forward on the
 
172
 
173
  `6-bit` lands within noise of the FP8 reference β€” read it as indistinguishable.
174
 
175
+ **KL divergence & Top-1 token agreement**
176
 
177
  KLD is `KL(ref β€– quant)` per token against the FP8 reference distribution, Top-1 is how
178
  often the build's argmax matches the reference's. Lower KLD and higher Top-1 = closer to
 
192
  FP8. `2-bit` is the memory-first option β€” reach for it when the hardware cannot hold
193
  anything larger.
194
 
195
+ **Weight-space fidelity** β€” measured on every quantized tensor at pack time (58,224 per build):
196
+
197
+ | Build | Size | Cosine sim | SNR (dB) | Rel. error |
198
+ |---|---:|---:|---:|---:|
199
+ | `6-bit` | 671 GB | **0.9998** | **37.2** | **1.7 %** |
200
+ | `4-bit` | 459 GB | **0.9968** | **22.9** | **7.6 %** |
201
+ | `3-bit` | 368 GB | **0.9865** | **16.7** | **15.7 %** |
202
+ | `2-bit` | 322 GB | **0.9517** | **11.2** | **29.7 %** |
203
+
204
+ Worst-case per build (`cos_min` / `snr_min`): `6-bit` 0.99972 / 32.5 dB Β· `4-bit` 0.99509 / 20.1 dB Β· `3-bit` 0.97869 / 13.7 dB Β· `2-bit` 0.92718 / 8.3 dB.
205
+
206
+ > Relative error is the mean of the **per-tensor** relative error `10^(-SNR/20)` over all 58,224 quantized tensors β€” not a value back-derived from the mean SNR, which would understate it (1.4 / 7.1 / 14.7 / 27.5 %).
207
+
208
+ Per role β€” this is where the OrcaSAQ policy shows up:
209
+
210
+ | Role | bits/gs | 2-bit cos | 3-bit cos | 4-bit cos | 6-bit cos |
211
+ |---|---|---:|---:|---:|---:|
212
+ | Expert `gate_proj`/`up_proj` | base | 0.93417 | 0.98169 | 0.99570 | 0.99975 |
213
+ | Expert `down_proj` | base +1 | 0.98510 | 0.99568 | 0.99898 | 0.99998 |
214
+ | Shared expert | base +2 | 0.99561 | 0.99896 | 0.99974 | 0.99998 |
215
+ | MLA attention | 8/64 | 0.99998 | 0.99998 | 0.99998 | 0.99998 |
216
+ | Dense MLP | 6/64 | 0.99975 | 0.99975 | 0.99975 | 0.99975 |
217
+
218
+ Cosine distribution across all quantized tensors (tight percentiles = no outlier tensors hiding behind a good mean):
219
+
220
+ | Build | min | p1 | p5 | median | p95 | max |
221
+ |---|---:|---:|---:|---:|---:|---:|
222
+ | `2-bit` | 0.92718 | 0.93133 | 0.93390 | 0.93437 | 0.98515 | 0.99999 |
223
+ | `3-bit` | 0.97869 | 0.98047 | 0.98157 | 0.98178 | 0.99571 | 0.99999 |
224
+ | `4-bit` | 0.99509 | 0.99546 | 0.99566 | 0.99571 | 0.99899 | 0.99999 |
225
+ | `6-bit` | 0.99972 | 0.99974 | 0.99975 | 0.99975 | 0.99999 | 0.99999 |
226
+
227
+ The worst tensors in every build are the same ones β€” early-layer routed experts (`layers.3–5`, e.g. `layers.4.mlp.experts.168.gate_proj`) β€” and `6-bit` still holds them above 0.9997.
228
 
229
+ **Build verification** β€” every build passed a structural release gate before upload:
230
 
231
  - **accounting** β€” 175,242 tensors on disk, 58,224 quantized modules, `weight`/`scales`/`biases` triplets all paired
232
  - **dtype preservation** β€” kept tensors byte-identical in their source dtype (FP32 router bias stays FP32; FP8 `keep` goes through a proper block dequant, never a raw cast)
 
237
 
238
  ---
239
 
240
+ ---
241
+
242
  ## Usage
243
 
244
+ ### Hosted API β€” no download
245
 
246
  The full-precision model is live on OrcaRouter as **`z-ai/glm-5.3`** β€” 1M context, 128K max output, $1.26 / $3.96 per 1M input / output tokens:
247
 
 
263
 
264
  **https://www.orcarouter.ai/models/z-ai/glm-5.3**
265
 
266
+ ### Run it locally (mlx-vlm)
267
 
268
  > **Use `mlx-vlm`, not `mlx-lm`.** GLM-5.3 is a text-only model, but as of **mlx-lm 0.31.3** the `glm_moe_dsa` implementation builds an indexer for *every* layer, while this checkpoint shares one indexer across four layers (`indexer_types`) β€” 285 tensors come up missing. **mlx-vlm 0.6.17** implements the shared-indexer layout and loads these builds as-is. Check for mlx-lm support before switching back.
269
 
 
338
 
339
  ---
340
 
341
+ ## Build Provenance
342
+
343
+ | | |
344
+ |---|---|
345
+ | Source | `zai-org/GLM-5.3` (FP8, 141 shards, 756 GB) |
346
+ | Quantized | 2026-08-28 |
347
+ | Toolchain | MLX 0.32.2, safetensors 0.8.0, NumPy 2.5.2 |
348
+ | Method | OrcaSAQ β€” calibration-free, role-based mixed precision |
349
+ | Per-build files | 140 shards + `config.json`, `quantization_map.json`, `build_manifest.json`, `fidelity_summary.json`, tokenizer, chat template |
350
+
351
+ Each folder carries its own `build_manifest.json` (exact recipe, source path, dropped-tensor count, toolchain versions) and `fidelity_summary.json` (per-role cosine/SNR with the five worst tensors named), so any claim in this card can be checked against the build itself.
352
+
353
+ ---
354
+
355
+ # GLM-5.3
356
 
357
  > Available full-precision on the OrcaRouter API as **`z-ai/glm-5.3`** β€”
358
  > **https://www.orcarouter.ai/models/z-ai/glm-5.3**
359
 
360
+ ---
361
+
362
+ ## GLM-5.3 Highlights
363
+
364
  GLM-5.3 uses the same base model as GLM-5.2 β€” every gain comes from post-training. Compared with GLM-5.2, it is much better at complex coding and long-horizon tasks:
365
 
366
  - **Stronger coding:** the most capable open-weights model for coding, with a **50 % improvement over GLM-5.2** on Z.AI's in-house Code Bench, and open-source SOTA on public benchmarks including Terminal Bench 3.0 and Agents' Last Exam.
 
370
  <img src="https://raw.githubusercontent.com/zai-org/GLM-5/refs/heads/main/resources/logo.svg" width="30%" alt="GLM-5" />
371
  </div>
372
 
373
+ ---
374
+
375
+ ## Official benchmarks
376
 
377
  Reported by Z.AI for the full-precision model. These are the upstream model's numbers, not measurements of these MLX builds β€” see [Quality vs FP8](#quality-vs-fp8) above for how each quantization tracks the FP8 release.
378
 
 
399
 
400
  Full evaluation protocols and footnotes are in the [official model card](https://huggingface.co/zai-org/GLM-5.3).
401
 
402
+ ---
403
+
404
+ ## Model Overview
405
 
406
  - **Type:** Mixture-of-Experts Causal LM (`glm_moe_dsa`, `GlmMoeDsaForCausalLM`)
407
  - **Parameters:** **753B total** Β· **~39B active** per token (22.6B routed + 16.7B always-on; 743B after the MTP layer is dropped)
 
412
  - **Context:** 1,048,576 tokens Β· vocab 154,880
413
  - **Modality:** text
414
 
415
+ ---
416
+
417
+ ## Best Practices
418
 
419
  - **Pick a precision:** `6-bit` for near-lossless, `4-bit` (repo root) as the everyday default, `3-bit` when memory is the binding constraint, `2-bit` when nothing else fits β€” the tables above quantify the trade at each step.
420
  - **Sampling:** follow the official GLM-5.3 guidance. The shipped `generation_config.json` is `temperature` 1.0, `top_p` 0.95; long-horizon agentic and coding tasks want generous `max-tokens` headroom.
 
424
 
425
  ---
426
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
427
  ## Citation
428
 
429
  ```bibtex