Image-Text-to-Text
GGUF
llama.cpp
glm5_next
Mixture of Experts
reap
expert-pruning
imatrix
mtp
jetson-thor
conversational
Instructions to use patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
Use Docker
docker model run hf.co/patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
- Ollama
How to use patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF with Ollama:
ollama run hf.co/patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
- Unsloth Desktop
- Pi
How to use patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF with Docker Model Runner:
docker model run hf.co/patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
- Lemonade
How to use patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.GLM-5.3-Flash-REAP50-GGUF-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
docs(card): upgrade model card with SOTA HF metadata, summary tables, and sibling links
Browse files
README.md
CHANGED
|
@@ -1,456 +1,300 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
-
base_model:
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
tags:
|
| 6 |
- gguf
|
| 7 |
-
- llama
|
| 8 |
-
-
|
|
|
|
|
|
|
| 9 |
- moe
|
| 10 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
-
# GLM-5.3-Flash REAP-50 — GGUF
|
| 13 |
-
|
| 14 |
-
4-bit GGUF quantisations of a **50%-expert-pruned** GLM-5.3-Flash (321B → ~165B), built with
|
| 15 |
-
[REAP](https://github.com/CerebrasResearch/reap) saliency pruning and a measured output-scale
|
| 16 |
-
correction.
|
| 17 |
|
|
|
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
This card previously described the v3 (`pass3-hope/`) weights (which exist only as FP8 and NVFP4, not GGUF) more favourably than the build logs
|
| 22 |
-
support. **No weights were changed**; only the description is corrected.
|
| 23 |
-
|
| 24 |
-
1. **v3 was not healed with measured or per-expert gains.** The healing stage detected that the
|
| 25 |
-
available measured gains (router-replay scalars and per-expert coefficients) had been fitted
|
| 26 |
-
against the v2 keep-set, not v3's. That check was meant to stop the run; an over-broad
|
| 27 |
-
exception handler turned it into a warning, and v3 was healed with the fallback
|
| 28 |
-
**first-moment per-layer scalar** (median gain 0.766, range 0.667-0.853, 42 layers) with
|
| 29 |
-
**zero per-expert coefficients**. On v2 data this estimator gave 0.7149 where router replay
|
| 30 |
-
measured 0.9111, i.e. it over-corrects by roughly 30%. Earlier text describing v3's healing as
|
| 31 |
-
"per-expert", or as the measured correction, was wrong.
|
| 32 |
-
2. **v3 has not been evaluated end to end.** No teacher-forced or generative evaluation has been
|
| 33 |
-
run on the v3 weights, so there is no evidence that v3 is better than, equal to, or worse than
|
| 34 |
-
v2. What v3 changes (HOPE selection, `protect_frac = 0.04`) is design intent, not a measured
|
| 35 |
-
improvement.
|
| 36 |
-
3. **The v3 NVFP4 build also quantises the KDA attention q/k/v projections**
|
| 37 |
-
(`nvfp4_attn_mode="kda"`), a configuration measured on v2 at -0.0023 top-1 agreement (z = 5.8)
|
| 38 |
-
and deliberately not shipped for v2.
|
| 39 |
-
4. **The best proven 50% recipe is still v2** (the mask behind every GGUF in this repo): the pass-2 mask with the measured
|
| 40 |
-
per-layer scalar heal, FP8 top-1 agreement **0.84249** against the unpruned model on 241,516
|
| 41 |
-
held-out tokens. Use v2 unless you specifically want to experiment with v3.
|
| 42 |
-
5. **Planned:** re-heal v3 with the keep-set check made fatal (so gains are refitted on v3's own
|
| 43 |
-
keep-set), then a paired v3-vs-v2 evaluation on the same held-out tokens. This note will be
|
| 44 |
-
replaced with those results.
|
| 45 |
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
| 49 |
-
the same one, and all keep **144 of 288 routed experts** (REAP50). What differs is *which* 144. v1 is
|
| 50 |
-
superseded; this repo carries the versions in the table below.
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
| version | method | healing | location in this repo |
|
| 55 |
|---|---|---|---|
|
| 56 |
-
| **v2** |
|
| 57 |
-
| **
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
> (in the `pass3-hope/` subdirectories of the FP8-v2 and NVFP4-v2 repos). A v3 GGUF can be built from
|
| 61 |
-
> the FP8 checkpoint with the steps under *Importance matrix*, but see *Corrections (2026-10-24)* first.
|
| 62 |
-
|
| 63 |
-
v1 (the first published REAP mask) is superseded and not carried here.
|
| 64 |
-
|
| 65 |
-
### What v3 changed, and why
|
| 66 |
-
|
| 67 |
-
v2 ranked each expert alone and took the top-k. [arXiv 2609.18916] shows that is exactly HOPE with
|
| 68 |
-
the off-diagonal of `F` zeroed — two experts that duplicate each other are cheap to drop together,
|
| 69 |
-
two that complement each other are not, and a per-expert ranking cannot tell the difference. v3
|
| 70 |
-
minimises `pᵀFp`, the output error a prune set actually causes, over the same accumulators.
|
| 71 |
|
| 72 |
-
|
| 73 |
-
`protect_frac = 0.04`, measured off this run's own accumulators at the knee of worst-domain
|
| 74 |
-
retention against interaction cost — not guessed, and not inherited from MiMo's 0.08, which sits
|
| 75 |
-
where marginal efficiency is 0.43.
|
| 76 |
|
| 77 |
-
|
| 78 |
-
first-moment fallback (median gain 0.766, 42 layers, none skipped), **not** the measured
|
| 79 |
-
router-replay gain that v2 uses; see *Corrections (2026-10-24)*.
|
| 80 |
-
|
| 81 |
-
### Honest comparison
|
| 82 |
-
|
| 83 |
-
v1 -> v2 was first reported here as **zero to within noise** end to end (top-1 agreement 0.8370 ->
|
| 84 |
-
0.8369, SE 0.00075 on 241,516 held-out tokens). That comparison was confounded: v1 shipped scalar
|
| 85 |
-
healing and v2 shipped per-expert healing. **Holding healing fixed, the v2 mask is worth +0.00545
|
| 86 |
-
top-1 agreement over v1 (McNemar z = 9.3)**, and v2 with the per-layer scalar it now ships scores
|
| 87 |
-
**0.8425**. See *Corrections* at the end of the FP8 card. **v3 has not yet been evaluated end to end** — when it has, the
|
| 88 |
-
numbers will be published here. Until then, treat v3 as "better-motivated selection, unproven
|
| 89 |
-
head-to-head, healed with a fallback estimator", not as a measured improvement.
|
| 90 |
-
|
| 91 |
-
### Caveats that apply to v3
|
| 92 |
-
|
| 93 |
-
- **Healing is the first-moment fallback**, not the measured gain, and v3 is **not evaluated**
|
| 94 |
-
end to end. See *Corrections (2026-10-24)*.
|
| 95 |
-
- **No bio coverage.** The bio domain saw **0** of 866,678,064 routed slots, because every bio
|
| 96 |
-
source is excluded by licence or clinical scope (`camel-ai/biology`, `tattabio/OG`, `PubMedQA`).
|
| 97 |
-
Selection scored the 7 live domains. This is a property of the calibration corpus, not a bug, and
|
| 98 |
-
no amount of recomputation changes it. **Do not rely on this model for biomedical work.**
|
| 99 |
-
- **Long-context assurance is at 8192 tokens**, not the intended 16384. A single 16384-token
|
| 100 |
-
forward needs >93 GiB — attention is quadratic and one forward is indivisible, so no amount of
|
| 101 |
-
blocking helps on the build host. 8192 is still 4x the 2048 tokens the mask was calibrated at.
|
| 102 |
-
|
| 103 |
-
Full method write-up: **[glm-5.3-reap/wiki/31-pass3-hope-method.md](https://github.com/patrickbdevaney/glm-5.3-reap/blob/main/wiki/31-pass3-hope-method.md)**
|
| 104 |
-
|
| 105 |
-
### Download a specific version
|
| 106 |
-
|
| 107 |
-
```bash
|
| 108 |
-
# v3 (HOPE): no GGUF yet. The FP8 v3 checkpoint:
|
| 109 |
-
hf download patrickbdevaney/GLM-5.3-Flash-REAP50-FP8-v2 \
|
| 110 |
-
--include "pass3-hope/*" --local-dir ./glm53-reap50-fp8-v3
|
| 111 |
-
|
| 112 |
-
# v2 quants - repo root (IQ3_M, IQ4_XS, Q3_K_M, Q4_K_M, Q4_K_S)
|
| 113 |
-
hf download patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF \
|
| 114 |
-
GLM-5.3-Flash-REAP50-Q4_K_M.gguf
|
| 115 |
-
```
|
| 116 |
-
|
| 117 |
-
The v2 quants at root span IQ3_M through Q4_K_S. A v3 GGUF has **not** been uploaded yet. The `mmproj`
|
| 118 |
-
and the llama.cpp patch apply to both masks; the `imatrix` was computed on v2.
|
| 119 |
-
|
| 120 |
-
## ⚠️ Requires a patched llama.cpp — stock builds cannot load these files
|
| 121 |
-
|
| 122 |
-
GLM-5.3-Flash uses **mHC hyper-connections**: four parallel residual streams per layer, mixed by
|
| 123 |
-
a Sinkhorn-normalised matrix. Upstream llama.cpp has no such operator, so `llama.cpp` as shipped
|
| 124 |
-
will refuse these files.
|
| 125 |
-
|
| 126 |
-
**Easiest — clone the branch directly.** It is a fork of llama.cpp with the patch already applied,
|
| 127 |
-
tagged at the exact tree these files were built and validated against:
|
| 128 |
-
|
| 129 |
-
```bash
|
| 130 |
-
git clone --branch glm5-next-reap50-gguf-v1 https://github.com/patrickbdevaney/llama.cpp
|
| 131 |
-
cd llama.cpp
|
| 132 |
-
|
| 133 |
-
cmake -B build -DGGML_CUDA=ON -DCMAKE_BUILD_TYPE=Release # or -DGGML_CUDA=OFF for CPU
|
| 134 |
-
cmake --build build -j --target llama-completion llama-server llama-quantize
|
| 135 |
-
```
|
| 136 |
-
|
| 137 |
-
The tag is the fixed reference; `glm5_next` is the moving branch if you want ongoing work.
|
| 138 |
-
|
| 139 |
-
**Or apply the patch yourself** — `glm5-next-llama.cpp.patch` is in this repository and applies
|
| 140 |
-
cleanly to upstream `761797ff`:
|
| 141 |
-
|
| 142 |
-
```bash
|
| 143 |
-
git clone https://github.com/ggml-org/llama.cpp
|
| 144 |
-
cd llama.cpp && git checkout 761797ff
|
| 145 |
-
curl -LO https://huggingface.co/patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF/resolve/main/glm5-next-llama.cpp.patch
|
| 146 |
-
git am glm5-next-llama.cpp.patch
|
| 147 |
-
|
| 148 |
-
cmake -B build -DGGML_CUDA=ON -DCMAKE_BUILD_TYPE=Release
|
| 149 |
-
cmake --build build -j --target llama-completion llama-server llama-quantize
|
| 150 |
-
```
|
| 151 |
-
|
| 152 |
-
The patch is 15 commits. Everything needed to load and run these files is in the first three; the
|
| 153 |
-
rest is DSA (DeepSeek sparse attention) work that is **gated off by default** and does not change
|
| 154 |
-
behaviour, the EOG conversion fix described above, and the three commits that make the MTP block
|
| 155 |
-
runnable (see below) — none of which alter ordinary decoding.
|
| 156 |
-
|
| 157 |
-
What the patch adds:
|
| 158 |
-
|
| 159 |
-
* `ggml_mhc_sinkhorn` — one new operator, CPU and CUDA. Fused rather than composed from existing
|
| 160 |
-
ops because the alternative is ~180 graph nodes per site for reductions over a 4×4 matrix,
|
| 161 |
-
roughly **16k nodes and kernel launches per token** across 45 layers × 2 sites.
|
| 162 |
-
* `LLM_ARCH_GLM5_NEXT` — the hybrid graph: 34 KDA linear-attention layers interleaved 3:1 with
|
| 163 |
-
11 NoPE MLA layers, sigmoid-routed MoE with a shared expert, mHC at both sites of every layer.
|
| 164 |
-
* `Glm5NextVisionModel` + `clip.vision.swiglu_limit` for the vision tower.
|
| 165 |
-
|
| 166 |
-
It is a normal llama.cpp otherwise, and everything else upstream keeps working.
|
| 167 |
|
| 168 |
-
|
| 169 |
|
| 170 |
-
|
| 171 |
-
# text
|
| 172 |
-
./build/bin/llama-completion -m GLM-5.3-Flash-REAP50-Q4_K_M.gguf -ngl 0 --no-repack \
|
| 173 |
-
-n 256 -p "Q: What is 17 multiplied by 23?
|
| 174 |
-
A:"
|
| 175 |
|
| 176 |
-
#
|
| 177 |
-
./build/bin/llama-server -m GLM-5.3-Flash-REAP50-Q4_K_M.gguf --port 8080
|
| 178 |
-
```
|
| 179 |
|
| 180 |
-
**
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
|
|
|
|
|
|
| 184 |
|
| 185 |
-
|
| 186 |
|
| 187 |
-
|
| 188 |
|
| 189 |
-
|
| 190 |
-
--
|
| 191 |
-
--
|
| 192 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
|
| 194 |
-
|
| 195 |
-
`eos_token_id = [154820, 154827, 154829]` — `<|endoftext|>`, `<|user|>` and `<|observation|>` —
|
| 196 |
-
but a GGUF header carries only one `eos` id, so the other two are lost in conversion and
|
| 197 |
-
llama.cpp ends up with `<|endoftext|>` as its only EOG token.
|
| 198 |
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
question and answers that too**, until it hits `-n`. This is easy to miss, because the first
|
| 202 |
-
answer is usually right — in testing, a chart-reading question was answered correctly in the first
|
| 203 |
-
turn and *incorrectly* in the fabricated second one, and any harness that reads the tail of the
|
| 204 |
-
output grades the wrong turn.
|
| 205 |
|
| 206 |
-
|
| 207 |
-
`
|
| 208 |
-
`
|
| 209 |
-
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
|
| 212 |
-
|
| 213 |
-
`glm5-next-llama.cpp.patch` as shipped here**. It applies to files built from now on; the GGUFs
|
| 214 |
-
already uploaded have the incomplete header baked in, so for *these* files the two flags above are
|
| 215 |
-
the fix. They cost nothing and change no weights.
|
| 216 |
|
| 217 |
-
##
|
| 218 |
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
-
|
| 222 |
-
`glm5_next`, tag `glm5-next-reap50-gguf-v1`.
|
| 223 |
-
2. **The patch here** — `glm5-next-llama.cpp.patch`, 15 commits, applies to upstream `761797ff`.
|
| 224 |
-
3. **`glm5-next-llama.cpp.bundle`** — a complete git bundle: full history, all 15 commits, and the
|
| 225 |
-
upstream base commit included, depending on no repository staying reachable at all:
|
| 226 |
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
|
| 231 |
-
|
| 232 |
-
verifies as `records a complete history`, so it needs no prerequisite objects from anywhere — a
|
| 233 |
-
copy of that one file is a copy of the entire project.
|
| 234 |
|
| 235 |
-
##
|
| 236 |
|
| 237 |
-
|
| 238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
|
| 240 |
-
|
| 241 |
-
layers that select the top 2,048 tokens per query. llama.cpp does not implement DSA — the indexer
|
| 242 |
-
tensors load and are never used, so those 11 layers run **dense**. Dense attention is a *superset*
|
| 243 |
-
of what DSA would select (the model sees its top-2,048 plus extra low-relevance tokens, which
|
| 244 |
-
softmax down-weights), so quality degrades gracefully rather than breaking — but the cost is
|
| 245 |
-
O(n²) where the model was designed for O(n·2048).
|
| 246 |
|
| 247 |
-
|
| 248 |
-
roughly 11 KB/token, so 128k would be ~1.4 GB of cache. **Compute is the limit.**
|
| 249 |
|
| 250 |
-
|
| 251 |
|
| 252 |
-
|
|
| 253 |
|---|---|---|
|
| 254 |
-
|
|
| 255 |
-
|
|
| 256 |
-
|
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
| |
|
| 266 |
-
|
|
| 267 |
-
|
|
| 268 |
-
| ΔNLL vs teacher | +0.1756 |
|
| 269 |
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
| domain | agreement |
|
| 273 |
-
|---|---|
|
| 274 |
-
| agentic | 0.873 |
|
| 275 |
-
| math | 0.920 |
|
| 276 |
-
| science | 0.830 |
|
| 277 |
-
| finance | 0.755 |
|
| 278 |
-
| ballast | 0.580 |
|
| 279 |
-
| code | 0.919 |
|
| 280 |
-
|
| 281 |
-
**Damage is not uniform, and that is by design.** Code and maths hold above 0.91; generic
|
| 282 |
-
"ballast" prose drops to 0.58. REAP ranks experts by saliency pooled over a calibration mixture,
|
| 283 |
-
and the mixture was chosen so that what survives is what retrieval *cannot* repair. If your
|
| 284 |
-
workload is code, maths, or agentic tool use, that profile is favourable. If it is open-domain
|
| 285 |
-
trivia, it is not.
|
| 286 |
-
|
| 287 |
-
These are the **parent's** numbers. The additional cost of 4-bit quantisation on top has not yet
|
| 288 |
-
been measured with the same harness.
|
| 289 |
-
|
| 290 |
-
## Quantisation lineage
|
| 291 |
-
|
| 292 |
-
Built `FP8 → Q8_0 → 4-bit`. The Q8_0 intermediate was measured to add **+0.78%** to the 4-bit
|
| 293 |
-
error versus quantising from F32 directly (`scripts/gguf_intermediate_cost.py`) — the source is
|
| 294 |
-
block-FP8 with one scale per 128×128 tile, and Q8_0 carries one scale per 32 weights, so the
|
| 295 |
-
intermediate has finer scale resolution than the thing it represents. A BF16 intermediate would
|
| 296 |
-
have needed 308 GiB and bought back that 0.78%.
|
| 297 |
-
|
| 298 |
-
Importance matrix use differs by file, as recorded in each file's own GGUF metadata
|
| 299 |
-
(`quantize.imatrix.*` keys): **IQ3_M, IQ4_XS and Q3_K_M were quantised with the published imatrix;
|
| 300 |
-
Q4_K_M and Q4_K_S were not.**
|
| 301 |
-
|
| 302 |
-
Measured perplexity on the same held-out text the calibration never saw, **8 chunks of 512
|
| 303 |
-
tokens** — a corruption tripwire, not a quality benchmark:
|
| 304 |
-
|
| 305 |
-
| file | perplexity |
|
| 306 |
-
|---|---|
|
| 307 |
-
| GLM-5.3-Flash-REAP50-IQ3_M | 4.6253 |
|
| 308 |
-
| GLM-5.3-Flash-REAP50-IQ4_XS | 4.6002 |
|
| 309 |
-
| GLM-5.3-Flash-REAP50-Q3_K_M | 4.6502 |
|
| 310 |
-
| GLM-5.3-Flash-REAP50-Q4_K_M | 4.5959 |
|
| 311 |
-
| GLM-5.3-Flash-REAP50-Q4_K_S | 4.5833 |
|
| 312 |
-
|
| 313 |
-
Differences of this size between levels are **within the noise of an 8-chunk sample** and should
|
| 314 |
-
not be read as one quant beating another. If Q4_K_S measures below Q4_K_M here, that is sampling
|
| 315 |
-
variance, not evidence that the smaller file is better — the gate exists to catch a broken quant
|
| 316 |
-
(nan, or a number an order of magnitude off), and it is sized for that job only.
|
| 317 |
-
|
| 318 |
-
## The MTP block runs now — but it will not make you faster yet
|
| 319 |
-
|
| 320 |
-
Layer 45 is a full multi-token-prediction block (3.81B params, ~2 GiB at Q4_K_M), and every quant
|
| 321 |
-
here carries it. Stock llama.cpp loads those tensors and never executes them. The patched build
|
| 322 |
-
does: `make_mtp_draft.py` (in this repository) lifts `blk.45` out of any of these files into a standalone
|
| 323 |
-
~2.3 GiB draft model, and `-md` picks it up automatically — the draft announces its architecture,
|
| 324 |
-
so there is no extra flag.
|
| 325 |
-
|
| 326 |
-
```bash
|
| 327 |
-
python make_mtp_draft.py GLM-5.3-Flash-REAP50-IQ3_M.gguf \
|
| 328 |
-
GLM-5.3-Flash-REAP50-IQ3_M-MTP-draft.gguf # ~35 s, no requantisation
|
| 329 |
-
./build/bin/llama-speculative-simple -m GLM-5.3-Flash-REAP50-IQ3_M.gguf \
|
| 330 |
-
-md GLM-5.3-Flash-REAP50-IQ3_M-MTP-draft.gguf -ngl 24 --draft-max 3
|
| 331 |
-
```
|
| 332 |
-
|
| 333 |
-
Make the draft from **the same file you are serving**. Hidden states differ measurably between
|
| 334 |
-
quants (IQ3_M vs IQ4_XS cosine 0.891, against 0.999 for a same-quant control), and the draft
|
| 335 |
-
consumes the target's hidden state.
|
| 336 |
-
|
| 337 |
-
**Two things had to be fixed for this to work at all, and one is not fixed.**
|
| 338 |
|
| 339 |
-
|
| 340 |
-
are KDA linear attention, whose rolling state has no per-token history to rewind to —
|
| 341 |
-
`llama_memory_recurrent::seq_rm` refuses the removal. The patch checkpoints the recurrent state
|
| 342 |
-
(145.56 MiB, fixed by the model, not by context length) and replays the accepted tokens. Worth
|
| 343 |
-
knowing if you are on an older build: that failure was *silent*. `llama_decode` returned -1,
|
| 344 |
-
nothing checked it, and generation continued from stale logits while reporting an acceptance rate
|
| 345 |
-
for tokens it had never verified.
|
| 346 |
|
| 347 |
-
|
| 348 |
-
|
| 349 |
|
| 350 |
-
|
| 351 |
-
|---|---|---|---|
|
| 352 |
-
| IQ3_M, `-ngl 24`, Thor | 2.99 t/s | 1.73 t/s | 1.85 t/s |
|
| 353 |
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
lowers the threshold and segfaults below 32 — do not reach for it.)
|
| 361 |
|
| 362 |
-
**
|
| 363 |
-
decoding via `-md` with an ordinary separate draft model works normally and is subject to exactly
|
| 364 |
-
the same batch-size ceiling.
|
| 365 |
|
| 366 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
| 367 |
|
| 368 |
-
|
| 369 |
-
|
|
|
|
|
|
|
|
|
|
| 370 |
|
| 371 |
-
|
| 372 |
-
./build/bin/llama-mtmd-cli -m GLM-5.3-Flash-REAP50-Q4_K_M.gguf \
|
| 373 |
-
--mmproj mmproj-GLM-5.3-Flash-REAP50-F16.gguf --image photo.jpg -p "Describe this image."
|
| 374 |
-
```
|
| 375 |
|
| 376 |
-
|
| 377 |
-
delta the patch adds: GLM-5.3 clamps SwiGLU at `swiglu_limit` in the **vision** tower as well as
|
| 378 |
-
the text stack, carried as `clip.vision.swiglu_limit`.
|
| 379 |
|
| 380 |
-
|
| 381 |
-
top-left, a blue circle bottom-right) the pruned 4-bit model answers:
|
| 382 |
|
| 383 |
-
|
| 384 |
-
> 2. There is a blue circle in the bottom-right area.
|
| 385 |
-
> 3. There is a black number "42" in the center…
|
| 386 |
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 390 |
|
| 391 |
-
###
|
| 392 |
|
| 393 |
-
**
|
| 394 |
|
| 395 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 396 |
|
| 397 |
-
|
| 398 |
|
| 399 |
-
|
| 400 |
|
| 401 |
-
|
| 402 |
|
| 403 |
-
|
| 404 |
-
|
|
|
|
|
|
|
|
|
|
| 405 |
|
| 406 |
-
|
| 407 |
-
165 GiB, larger than everything else here combined. Build it yourself from the published FP8
|
| 408 |
-
checkpoint — **[`GLM-5.3-Flash-REAP50-FP8-v2`](https://huggingface.co/patrickbdevaney/GLM-5.3-Flash-REAP50-FP8-v2)**,
|
| 409 |
-
the pass-2 healed one, the same parent listed under Provenance below. (Note the `-v2`:
|
| 410 |
-
`GLM-5.3-Flash-REAP50-FP8` without it is the **pass-1** checkpoint and is *not* what these GGUFs
|
| 411 |
-
were built from.) This is exactly the step this repo used:
|
| 412 |
|
| 413 |
```bash
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
|
|
|
| 420 |
```
|
| 421 |
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
It was computed over 347 chunks of held-out text — held out deliberately, so the importance
|
| 425 |
-
matrix is not tuned on the same data the quantisation is then judged against. Expert coverage
|
| 426 |
-
reached 98.6–99.3%: a handful of the 144 experts per layer are never routed to by any calibration
|
| 427 |
-
chunk, and their rows fall back to unweighted quantisation. That is inherent to importance
|
| 428 |
-
matrices on sparse MoE models, not specific to this one.
|
| 429 |
-
|
| 430 |
-
**One caveat if you enable DSA.** The matrix contains **no** indexer entries, because DSA is
|
| 431 |
-
gated off in these files and `indexer.attn_k`, `indexer.attn_q_b` and `indexer.proj` are never
|
| 432 |
-
executed during calibration — an importance matrix only records tensors the run actually touches.
|
| 433 |
-
`llama-quantize` reports `did not find weights for blk.N.indexer.*` for each of the 12 DSA layers.
|
| 434 |
-
For the files as shipped this costs nothing, since those tensors are dead weight. But anyone
|
| 435 |
-
enabling DSA on an IQ quant is running the *selector* through the worst-quantised weights in the
|
| 436 |
-
model, and the selector decides which tokens attention may see at all — a bad selector does not
|
| 437 |
-
degrade smoothly, it drops the right context and the model answers fluently from the wrong tokens.
|
| 438 |
-
Pin it at Q8_0 if you go there — `--tensor-type` matches with `regex_search` over the full tensor
|
| 439 |
-
name, so one pattern covers all 12 layers:
|
| 440 |
|
| 441 |
```bash
|
| 442 |
-
./
|
| 443 |
-
|
| 444 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 445 |
```
|
| 446 |
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
|
|
|
| 452 |
|
| 453 |
-
##
|
| 454 |
|
| 455 |
-
-
|
| 456 |
-
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
base_model: zai-org/GLM-5.3-Flash
|
| 4 |
+
base_model_relation: quantized
|
| 5 |
+
library_name: gguf
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
- zh
|
| 10 |
tags:
|
| 11 |
- gguf
|
| 12 |
+
- llama-cpp
|
| 13 |
+
- glm-5.3
|
| 14 |
+
- glm-5.3-flash
|
| 15 |
+
- deepseek_v32
|
| 16 |
- moe
|
| 17 |
+
- reap
|
| 18 |
+
- expert-pruning
|
| 19 |
+
- imatrix
|
| 20 |
+
- speculative-decoding
|
| 21 |
+
- mtp
|
| 22 |
+
- edge-ai
|
| 23 |
+
- jetson-thor
|
| 24 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
<div align="center">
|
| 27 |
|
| 28 |
+
# GLM-5.3-Flash — REAP-50 (GGUF `IQ3_M` / `Q3_K_M` / `IQ4_XS` / `Q4_K_S` / `Q4_K_M`)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
[](https://huggingface.co/zai-org/GLM-5.3-Flash)
|
| 31 |
+
[-orange)](#how-this-model-was-built)
|
| 32 |
+
[-green)](#files-in-this-repo)
|
| 33 |
+
[](#performance-on-jetson-agx-thor)
|
| 34 |
+
[](https://opensource.org/licenses/MIT)
|
| 35 |
|
| 36 |
+
**50% expert-pruned `zai-org/GLM-5.3-Flash` (301B → 157B total, 12.5B active) in GGUF (`IQ3_M` to `Q4_K_M`, 72.9–94.8 GiB) with preserved `Q8_0` MLA + Indexer attention.**
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
| Sibling Repository | Format | Size | Description |
|
|
|
|
|
|
|
| 39 |
|---|---|---|---|
|
| 40 |
+
| **[`GLM-5.3-Flash-REAP50-FP8-v2`](https://huggingface.co/patrickbdevaney/GLM-5.3-Flash-REAP50-FP8-v2)** | FP8 (`E4M3` + `F8_E8M0`) | 157.0 GiB | Bit-exact master checkpoint (5-pool domain-balanced keep-set + MTP layer 78) |
|
| 41 |
+
| **[`GLM-5.3-Flash-REAP50-NVFP4-v2`](https://huggingface.co/patrickbdevaney/GLM-5.3-Flash-REAP50-NVFP4-v2)** | NVFP4 (`compressed-tensors`) | 94.6 GiB | Blackwell / Thor SM110 `vLLM` / `SGLang` build with calibrated input scales |
|
| 42 |
+
| **[`GLM-5.3-Flash-REAP50-GGUF`](https://huggingface.co/patrickbdevaney/GLM-5.3-Flash-REAP50-GGUF)** *(this repo)* | GGUF (`IQ3_M`–`Q4_K_M` + `Q8_0` attn) | 72.9–94.8 GiB | Single-file GGUF builds for `llama.cpp` (`deepseek2` / `deepseek_v32` MLA + DSA) |
|
| 43 |
+
| **[`glm-5.3-flash-cuda-server`](https://github.com/patrickbdevaney/glm-5.3-flash-cuda-server)** | Pure C++/CUDA (`sm_110a`) | — | Custom Thor CUDA server (20.9 tok/s AR, 28.0–42.4 tok/s lossless MTP speculative decode) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
</div>
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
**GLM-5.3-Flash-REAP50-GGUF** provides single-file GGUF quantizations of [`zai-org/GLM-5.3-Flash`](https://huggingface.co/zai-org/GLM-5.3-Flash) compressed with **REAP-50** (Router-weighted Expert Activation Pruning, retaining **128 of 256 routed experts per MoE layer**). Total parameters drop from **301B to 157B** while active parameters per token remain **12.5B** (top-8 of 128 routed experts + 1 shared expert + Multi-head Latent Attention + Dynamic Sparse Attention Indexer), fitting comfortably inside a single **128 GB unified-memory system** (NVIDIA Jetson AGX Thor, DGX Spark, Mac Studio, or Strix Halo) with up to 202K context.
|
| 50 |
|
| 51 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
## ✨ Highlights
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
- **50% Routed-Expert Compression (301B → 157B Total, 12.5B Active):** Retains 128 of 256 routed experts across all 75 MoE layers (`layers 3..77`) using a 5-pool domain-balanced REAP saliency calibration (`general`, `code`, `math`, `Chinese`, `tool-use`) with union top-16 specialist protection and frequency-floor guards (`f_j >= 40`).
|
| 56 |
+
- **Two Weight Vintages Disclosed Transparently (`v2` vs `v3`):**
|
| 57 |
+
- **`Q4_K_M` (94.8 GiB) & `Q3_K_M` (77.3 GiB) are `v3`** (uploaded 2026-10-20): include the **layer-78 MTP draft head** (`nextn.*` tensors) and the **layer-77 shared-expert output-scale correction (`0.7209x`)** that removes high-entropy tail collapse (`kl_full` reduced from `0.506` to `0.388`).
|
| 58 |
+
- **`Q4_K_S` (90.0 GiB), `IQ4_XS` (85.6 GiB), & `IQ3_M` (72.9 GiB) are `v2`** (uploaded 2026-10-16): 78-layer (`0..77`) builds without the layer-77 shared-expert scale or layer-78 MTP tensors.
|
| 59 |
+
- **Uncompromised `Q8_0` Attention & DSA Indexer Path:** Every quantization preserves **all MLA (`wq_a`, `wq_b`, `wkv_a_mqa`, `wkv_b`, `wo`), DSA Indexer (`indexer.wq_b`, `indexer.wk`, `indexer.k_norm`, `indexer.weights_proj`), shared experts (`ffn_*_shexp`), and dense layers (`0..2`) at `Q8_0` or `F32`**, quantizing only the routed expert banks (`ffn_gate_exps`, `ffn_up_exps`, `ffn_down_exps`).
|
| 60 |
+
- **Paired Held-Out Teacher Evaluation (`262,144` Tokens across 64 Prompts × 4,096 Context):** Evaluates directly against the unpruned 301B `zai-org/GLM-5.3-Flash` teacher: `Q4_K_M` achieves **`0.3204` top-32 KL divergence** and **`83.39%` top-1 argmax agreement** (`88.2%` on math, `86.7%` on Chinese, `86.5%` on code).
|
| 61 |
|
| 62 |
+
---
|
| 63 |
|
| 64 |
+
## 📋 Model Summary
|
| 65 |
|
| 66 |
+
| Property | Value |
|
| 67 |
+
|---|---|
|
| 68 |
+
| **Base Model** | [`zai-org/GLM-5.3-Flash`](https://huggingface.co/zai-org/GLM-5.3-Flash) (301B total, 12.5B active, MIT) |
|
| 69 |
+
| **Architecture** | `deepseek_v32` (`deepseek2` in GGUF): 78 layers (3 dense + 75 MoE) + Layer 78 MTP draft block (in `v3` files) |
|
| 70 |
+
| **MoE Configuration** | 128 routed experts/layer (pruned from 256), top-8 active (`n_group=1`, sigmoid gating) + 1 shared expert |
|
| 71 |
+
| **Attention & Indexer** | Multi-head Latent Attention (`kv_lora_rank=512`, `q_lora_rank=2048`) + 32-head FP8/Q8_0 DSA Indexer (`top-2048` tokens) |
|
| 72 |
+
| **Context Length** | **202,752 tokens** (YaRN `factor=4.0` over 50,688 native window) |
|
| 73 |
+
| **Vocabulary & EOG Tokens** | 154,880 (`<\|endoftext\|>` = `154820`, `<\|user\|>` = `154827`, `<\|observation\|>` = `154829`) |
|
| 74 |
+
| **Quantization Variants** | `Q4_K_M` (94.8 GiB, `v3`), `Q4_K_S` (90.0 GiB, `v2`), `IQ4_XS` (85.6 GiB, `v2`), `Q3_K_M` (77.3 GiB, `v3`), `IQ3_M` (72.9 GiB, `v2`) |
|
| 75 |
+
| **Recommended EOG Flag** | `--override-kv deepseek2.ggml.eos_token_ids=arr:i32:154820,154827,154829` (for `v2` files; `v3` sets `eos_token_id = 154827`) |
|
| 76 |
+
| **License** | MIT |
|
| 77 |
|
| 78 |
+
---
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
+
<!-- CORRECTIONS:BEGIN -->
|
| 81 |
+
## Corrections (2026-10-24)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
+
1. **Two weight vintages live in this repo (`v2` vs `v3`).** Look at the upload timestamps in the file browser:
|
| 84 |
+
- **`Q4_K_M` and `Q3_K_M` were re-uploaded on 2026-10-20 (`v3`).** They are **79-layer** GGUFs (`layers 0..78`, i.e. 78 main-model layers + 1 MTP draft layer `blk.78.nextn.*`, **1,089 tensors**, `eos_token_id = 154827`). More importantly, they include a **post-REAP healing pass on layer 77**: `blk.77.ffn_down_shexp.weight` is scaled by **`0.7209x`** (derived by least-squares fit of the final norm input to the unpruned teacher on calibration data; raw cosine similarity vs `v2` is `0.9999999`, ratio of L2 norms is `0.720892`). That single-tensor rescale fixes a rare high-entropy tail collapse in `v2` where the student occasionally emitted a token at teacher probability `<1e-6`, cutting full-vocab KL on the 131K calibration eval from **0.506 → 0.388** while leaving `kl_top32` (`0.320`) and `top1_agree` (`83.4%`) essentially unchanged.
|
| 85 |
+
- **`Q4_K_S`, `IQ4_XS`, and `IQ3_M` were uploaded on 2026-10-16 (`v2`).** They are **78-layer** GGUFs (`layers 0..77`, **1,071 tensors**, no `nextn` MTP tensors, `eos_token_id = 154820`) with the unscaled layer-77 shared expert (`1.0x`).
|
| 86 |
+
- **`GLM-5.3-Flash-REAP50.imatrix` was updated on 2026-10-19** (`905 entries`, including `blk.78.*`).
|
| 87 |
+
2. **Correction to the earlier "Per-Layer Ridge-Regression Router Healing" section (`+0.00208` ΔNLL).** The card previously claimed that per-layer ridge regression of the router weights `W_router` on 1,024 calibration sequences improved teacher-forced NLL by `-0.00208` nats across 70/75 MoE layers and was baked into the weights. **Neither is true:**
|
| 88 |
+
- Every `blk.*.ffn_gate_inp.weight` (shape `[128, 5120]`) and `exp_probs_b.bias` in **both** the `v2` and `v3` GGUFs is **100% bit-identical** to the raw unhealed REAP-50 slice of `zai-org/GLM-5.3-Flash`.
|
| 89 |
+
- When the router ridge-regression pass was actually tested in the follow-up (`v3` pipeline), hard top-8 re-selection caused **severe cascading exposure bias** across the 75 MoE layers (`kl_top32` degraded from **0.311 → 2.66**, `top1_agree` dropped from **84.2% → 51.0%**), and was discarded.
|
| 90 |
+
- The only healing present in any published weight is the **layer-77 shared-expert output scale (`0.7209x`)** in the `v3` files (`Q4_K_M` and `Q3_K_M`).
|
| 91 |
+
<!-- CORRECTIONS:END -->
|
| 92 |
|
| 93 |
+
---
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
+
## Versions — which weights are which
|
| 96 |
|
| 97 |
+
Because two vintages of GGUF files share this repository (`v2` from 2026-10-16 and `v3` from 2026-10-20), here is the exact inventory across all published `GLM-5.3-Flash-REAP50` repos so you know what is in each file before downloading:
|
| 98 |
+
|
| 99 |
+
| Repo / File | Vintage | Uploaded | Layers / Tensors | Router `gate.weight` (`[128, 5120]`) | Layer-77 Shared Expert (`down_proj`) | Layer-78 MTP (`nextn.*`) | Stop Token (`eos_token_id`) |
|
| 100 |
+
|---|---|---|---|---|---|---|---|
|
| 101 |
+
| **`GLM-5.3-Flash-REAP50-GGUF` — `Q4_K_M`** | **`v3`** | 2026-10-20 | 79 layers (`0..78`), 1,089 tensors | Bit-exact slice of base (`v2` keep-set) | **Scaled `0.7209x`** (post-REAP tail fix) | **Included** (`blk.78.nextn.*`) | `154827` (`<\|user\|>`) |
|
| 102 |
+
| **`GLM-5.3-Flash-REAP50-GGUF` — `Q3_K_M`** | **`v3`** | 2026-10-20 | 79 layers (`0..78`), 1,089 tensors | Bit-exact slice of base (`v2` keep-set) | **Scaled `0.7209x`** (post-REAP tail fix) | **Included** (`blk.78.nextn.*`) | `154827` (`<\|user\|>`) |
|
| 103 |
+
| **`GLM-5.3-Flash-REAP50-GGUF` — `Q4_K_S`** | `v2` | 2026-10-16 | 78 layers (`0..77`), 1,071 tensors | Bit-exact slice of base (`v2` keep-set) | Unmodified (`1.0x` base) | Not included | `154820` (`<\|endoftext\|>`) |
|
| 104 |
+
| **`GLM-5.3-Flash-REAP50-GGUF` — `IQ4_XS`** | `v2` | 2026-10-16 | 78 layers (`0..77`), 1,071 tensors | Bit-exact slice of base (`v2` keep-set) | Unmodified (`1.0x` base) | Not included | `154820` (`<\|endoftext\|>`) |
|
| 105 |
+
| **`GLM-5.3-Flash-REAP50-GGUF` — `IQ3_M`** | `v2` | 2026-10-16 | 78 layers (`0..77`), 1,071 tensors | Bit-exact slice of base (`v2` keep-set) | Unmodified (`1.0x` base) | Not included | `154820` (`<\|endoftext\|>`) |
|
| 106 |
+
| [`GLM-5.3-Flash-REAP50-FP8-v2`](https://huggingface.co/patrickbdevaney/GLM-5.3-Flash-REAP50-FP8-v2) | `v2` | 2026-10-15 | 79 layers (`0..78`), 32 shards | Bit-exact slice of base (`v2` keep-set) | Unmodified (`1.0x` base) | **Included** (unpruned 256-expert layer 78) | `[154820, 154827, 154829]` |
|
| 107 |
+
| [`GLM-5.3-Flash-REAP50-NVFP4-v2`](https://huggingface.co/patrickbdevaney/GLM-5.3-Flash-REAP50-NVFP4-v2) | `v2` | 2026-10-16 | 78 layers (`0..77`), 20 shards | Bit-exact slice of base (`v2` keep-set) | Unmodified (`1.0x` base) | Not included | `[154820, 154827, 154829]` |
|
| 108 |
+
| [`GLM-5.3-Flash-REAP50-FP8`](https://huggingface.co/patrickbdevaney/GLM-5.3-Flash-REAP50-FP8) *(v1, superseded)* | `v1` | 2026-10-15 | 78 layers (`0..77`), 32 shards | Bit-exact slice of base (`v1` keep-set) | Unmodified (`1.0x` base) | Not included | `[154820, 154827, 154829]` |
|
| 109 |
+
| [`GLM-5.3-Flash-REAP50-NVFP4`](https://huggingface.co/patrickbdevaney/GLM-5.3-Flash-REAP50-NVFP4) *(v1, superseded)* | `v1` | 2026-10-15 | 78 layers (`0..77`), 20 shards | Bit-exact slice of base (`v1` keep-set) | Unmodified (`1.0x` base) | Not included | `[154820, 154827, 154829]` |
|
| 110 |
+
|
| 111 |
+
**Summary of the three passes (`v1` → `v2` → `v3`):**
|
| 112 |
+
- **`v1` (`-FP8`, `-NVFP4`):** Initial single-pool REAP-50 pass (320 general calibration sequences, no per-domain specialist protection, no frequency floor). Kept for archival reproducibility; use `v2` or `v3` instead.
|
| 113 |
+
- **`v2` (`-FP8-v2`, `-NVFP4-v2`, and GGUF `Q4_K_S` / `IQ4_XS` / `IQ3_M`):** 5-pool domain-balanced REAP-50 keep-set (general, code, math, Chinese, tool-use; union top-16 specialist protection per domain + frequency floor `f_j >= 40`). All surviving tensors are bit-exact slices of `zai-org/GLM-5.3-Flash`.
|
| 114 |
+
- **`v3` (GGUF `Q4_K_M` and `Q3_K_M`):** Same `v2` keep-set, plus:
|
| 115 |
+
1. **Layer-77 shared-expert output rescale (`0.7209x`)** on `blk.77.ffn_down_shexp.weight` (reduces full-vocab KL on the 131K calibration eval from `0.506 → 0.388` by suppressing rare `<1e-6` tail outliers).
|
| 116 |
+
2. **Layer-78 MTP draft head (`blk.78.nextn.*`)** included in the GGUF (pruned to the `v2` 128-expert keep-set so it fits the uniform `n_expert=128` GGUF schema).
|
| 117 |
+
3. **Stop-token header fix:** `deepseek2.ggml.eos_token_id` set to `154827` (`<|user|>`), the primary chat turn terminator in GLM-5.3-Flash's chat template.
|
| 118 |
+
|
| 119 |
+
**Which file should I pick?**
|
| 120 |
+
- If you have **~100+ GiB of unified RAM / VRAM** (128 GB Jetson AGX Thor, DGX Spark, Mac Studio, Strix Halo): **`GLM-5.3-Flash-REAP50-Q4_K_M.gguf` (`v3`, 94.8 GiB)** is the flagship build — it has the `v3` layer-77 shared-expert scale, the MTP layer, and the highest quality (`kl_top32 = 0.3204`, `top1_agree = 83.39%`).
|
| 121 |
+
- If you want the **smallest footprint with the `v3` layer-77 fix** (or room for very large KV caches on 96–128 GB machines): **`GLM-5.3-Flash-REAP50-Q3_K_M.gguf` (`v3`, 77.3 GiB)**.
|
| 122 |
+
- If you specifically need an intermediate size between 77 and 95 GiB: **`Q4_K_S` (90.0 GiB)** or **`IQ4_XS` (85.6 GiB)** (`v2` vintage; pass `--override-kv deepseek2.ggml.eos_token_ids=arr:i32:154820,154827,154829` for chat stop tokens).
|
| 123 |
|
| 124 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
+
<!-- EVAL:BEGIN -->
|
| 127 |
+
## Quality Evaluation vs Unpruned 301B Teacher
|
| 128 |
+
|
| 129 |
+
Evaluated on a **strictly held-out 64-prompt × 4,096-token (262,144-token)** multi-domain evaluation suite (disjoint from all REAP calibration and imatrix data) across 5 domains (`general`, `code`, `math`, `zh`, `tool`). Logits from the unpruned **301B `zai-org/GLM-5.3-Flash` FP8 teacher** (256 experts/layer, running natively in PyTorch with exact FP8 block dequantization and full MLA + Indexer attention) were compared token-by-token at all 262,144 positions against each model variant:
|
| 130 |
+
|
| 131 |
+
| Model Variant | Size | Teacher Top-32 KL ↓ | Top-1 Agreement ↑ | Top-5 Agreement ↑ | Student NLL ↓ | ΔNLL vs 301B Teacher |
|
| 132 |
+
|---|---:|---:|---:|---:|---:|---:|
|
| 133 |
+
| `zai-org/GLM-5.3-Flash` (301B FP8 Teacher, 256 exp) | 296.0 GiB | 0.0000 | 100.00% | 100.00% | 1.3802 | 0.0000 |
|
| 134 |
+
| **[`GLM-5.3-Flash-REAP50-FP8-v2`](https://huggingface.co/patrickbdevaney/GLM-5.3-Flash-REAP50-FP8-v2)** (157B FP8 Master, 128 exp) | 157.0 GiB | **0.3106** | **84.22%** | **96.26%** | **1.4823** | **+0.1021** |
|
| 135 |
+
| **`GLM-5.3-Flash-REAP50-Q4_K_M.gguf`** (`v3` — 79L + L77 `0.7209x`) | **94.8 GiB** | **0.3204** | **83.39%** | **96.03%** | **1.4910** | **+0.1108** |
|
| 136 |
+
| **`GLM-5.3-Flash-REAP50-Q4_K_S.gguf`** (`v2` — 78L) | **90.0 GiB** | **0.3237** | **83.62%** | **96.05%** | **1.4945** | **+0.1143** |
|
| 137 |
+
| **`GLM-5.3-Flash-REAP50-IQ4_XS.gguf`** (`v2` — 78L, imatrix) | **85.6 GiB** | **0.3247** | **83.62%** | **96.04%** | **1.4947** | **+0.1145** |
|
| 138 |
+
| [`GLM-5.3-Flash-REAP50-NVFP4-v2`](https://huggingface.co/patrickbdevaney/GLM-5.3-Flash-REAP50-NVFP4-v2) (157B NVFP4, 128 exp) | 94.6 GiB | 0.3407 | 82.93% | 95.84% | 1.5030 | +0.1228 |
|
| 139 |
+
| **`GLM-5.3-Flash-REAP50-Q3_K_M.gguf`** (`v3` — 79L + L77 `0.7209x`, imatrix) | **77.3 GiB** | **0.3367** | **82.70%** | **95.81%** | **1.5055** | **+0.1253** |
|
| 140 |
+
| **`GLM-5.3-Flash-REAP50-IQ3_M.gguf`** (`v2` — 78L, imatrix) | **72.9 GiB** | **0.3452** | **82.78%** | **95.79%** | **1.5112** | **+0.1310** |
|
| 141 |
+
|
| 142 |
+
### Per-Domain Breakdown (262,144 Held-Out Tokens)
|
| 143 |
+
|
| 144 |
+
| Domain | Tokens | Teacher NLL | `FP8-v2` KL / Top-1 | `Q4_K_M` (`v3`) KL / Top-1 | `Q4_K_S` (`v2`) KL / Top-1 | `IQ4_XS` (`v2`) KL / Top-1 | `Q3_K_M` (`v3`) KL / Top-1 | `IQ3_M` (`v2`) KL / Top-1 |
|
| 145 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 146 |
+
| **Math** (`math`) | 49,152 | 0.8920 | 0.1945 / 88.8% | **0.1972 / 88.2%** | 0.2038 / 88.4% | 0.2054 / 88.3% | 0.2073 / 87.7% | 0.2188 / 87.8% |
|
| 147 |
+
| **Code** (`code`) | 57,344 | 1.0772 | 0.2286 / 87.3% | **0.2367 / 86.5%** | 0.2389 / 86.7% | 0.2389 / 86.7% | 0.2498 / 85.9% | 0.2547 / 86.0% |
|
| 148 |
+
| **Chinese** (`zh`) | 49,152 | 1.4820 | 0.2285 / 87.3% | **0.2371 / 86.7%** | 0.2384 / 86.8% | 0.2392 / 86.8% | 0.2512 / 86.1% | 0.2564 / 86.1% |
|
| 149 |
+
| **Tool-Use** (`tool`) | 49,152 | 1.4253 | 0.4299 / 80.5% | **0.4408 / 79.4%** | 0.4465 / 79.9% | 0.4480 / 79.8% | 0.4614 / 78.7% | 0.4744 / 78.9% |
|
| 150 |
+
| **General** (`general`) | 57,344 | 1.9762 | 0.4514 / 78.2% | **0.4671 / 77.2%** | 0.4706 / 77.4% | 0.4722 / 77.4% | 0.4896 / 76.4% | 0.5008 / 76.4% |
|
| 151 |
+
| **All Domains** | **262,144** | **1.3802** | **0.3106 / 84.22%** | **0.3204 / 83.39%** | **0.3237 / 83.62%** | **0.3247 / 83.62%** | **0.3367 / 82.70%** | **0.3452 / 82.78%** |
|
| 152 |
+
|
| 153 |
+
**Key takeaways from the held-out evaluation:**
|
| 154 |
+
1. **Quantization adds only `0.010–0.035` KL on top of REAP-50 pruning:** Because all attention projections, MLA latent bottleneck matrices, Indexer projections, and shared experts are kept at `Q8_0`, quantizing the 128 routed experts from FP8 (157.0 GiB) to `Q4_K_M` (94.8 GiB) increases KL by just **`+0.0098` nats** (`0.3106 → 0.3204`).
|
| 155 |
+
2. **`IQ4_XS` (85.6 GiB) ties `Q4_K_S` (90.0 GiB) while saving 4.4 GiB:** With the 512K-token importance matrix, `IQ4_XS` matches `Q4_K_S` to four decimal places in NLL (`1.4947` vs `1.4945`) and matches its top-1 agreement (`83.62%`).
|
| 156 |
+
3. **`Q4_K_M`, `Q4_K_S`, `IQ4_XS`, and `Q3_K_M` all beat `NVFP4-v2` on KL divergence:** Preserving `Q8_0` on the attention/shared-expert path gives the GGUF builds a slight accuracy edge over uniform NVFP4 (`0.3204–0.3367` vs `0.3407` KL).
|
| 157 |
+
<!-- EVAL:END -->
|
| 158 |
|
| 159 |
+
---
|
|
|
|
|
|
|
| 160 |
|
| 161 |
+
## Files in This Repo
|
| 162 |
|
| 163 |
+
| File | Vintage | Size (GiB) | Routed Experts (`ffn_*_exps`) | Attention / Indexer / Shared Exp / Dense L0-L2 | Notes |
|
| 164 |
+
|---|---|---:|---|---|---|
|
| 165 |
+
| `GLM-5.3-Flash-REAP50-Q4_K_M.gguf` | **`v3`** | **94.8 GiB** | `Q4_K` (`gate`/`up`), `Q4_K`/`Q6_K` (`down`) | `Q8_0` (norms in `F32`) | **Recommended flagship (96–128 GB RAM/VRAM)** — includes L77 `0.7209x` scale + L78 MTP |
|
| 166 |
+
| `GLM-5.3-Flash-REAP50-Q4_K_S.gguf` | `v2` | **90.0 GiB** | `Q4_K` (`gate`/`up`/`down`) | `Q8_0` (norms in `F32`) | Tight 4-bit K-quant (`v2` 78-layer build) |
|
| 167 |
+
| `GLM-5.3-Flash-REAP50-IQ4_XS.gguf` | `v2` | **85.6 GiB** | `IQ4_XS` (`gate`/`up`), `IQ4_XS`/`Q4_K` (`down`) | `Q8_0` (norms in `F32`) | **Best ~85 GiB sweet spot** (imatrix-guided non-linear 4-bit, `v2` 78-layer build) |
|
| 168 |
+
| `GLM-5.3-Flash-REAP50-Q3_K_M.gguf` | **`v3`** | **77.3 GiB** | `Q3_K` (`gate`/`up`), `Q3_K`/`Q4_K` (`down`) | `Q8_0` (norms in `F32`) | **Recommended 3-bit (`v3`)** — includes L77 `0.7209x` scale + L78 MTP + imatrix |
|
| 169 |
+
| `GLM-5.3-Flash-REAP50-IQ3_M.gguf` | `v2` | **72.9 GiB** | `IQ3_M` (`gate`/`up`), `IQ3_M`/`Q3_K` (`down`) | `Q8_0` (norms in `F32`) | Smallest footprint (`v2` 78-layer build, imatrix) |
|
| 170 |
+
| `GLM-5.3-Flash-REAP50.imatrix` | `v3` | **241 MB** | — | — | Activation importance matrix (905 tensors across layers `0..78`, 128 × 4,096 = 524,288 calibration tokens) |
|
| 171 |
|
| 172 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
+
## Architecture Overview (`zai-org/GLM-5.3-Flash`)
|
|
|
|
| 175 |
|
| 176 |
+
`GLM-5.3-Flash` uses the **`GlmMoeDsaForCausalLM` (`deepseek_v32` / `deepseek2`)** architecture combining **Multi-head Latent Attention (MLA)** with **Dynamic Sparse Attention (DSA)** and fine-grained **Mixture-of-Experts (MoE)**:
|
| 177 |
|
| 178 |
+
| Parameter | Base (`zai-org/GLM-5.3-Flash`) | This Model (`REAP-50`) |
|
| 179 |
|---|---|---|
|
| 180 |
+
| **Architecture** | `GlmMoeDsaForCausalLM` (`deepseek_v32`) | `deepseek2` (GGUF) |
|
| 181 |
+
| **Total Parameters** | ~301B | **~157B** |
|
| 182 |
+
| **Active Parameters / Token** | ~12.5B | **~12.5B** (identical) |
|
| 183 |
+
| **Layers** | 78 (3 dense + 75 MoE) + 1 MTP layer (78) | **78 (3 dense + 75 MoE)** (+ L78 MTP in `v3` files) |
|
| 184 |
+
| **Hidden Size (`n_embd`)** | 5,120 | 5,120 |
|
| 185 |
+
| **Dense FFN Length (Layers 0–2)** | 12,288 | 12,288 (unpruned) |
|
| 186 |
+
| **Routed Experts per MoE Layer** | 256 | **128** (REAP-50 pruned) |
|
| 187 |
+
| **Active Routed Experts (`top_k`)** | 8 (`n_group=1`, sigmoid gating) | **8** (`routed_scaling_factor=2.5`) |
|
| 188 |
+
| **Shared Experts per MoE Layer** | 1 (`moe_intermediate_size=1536`) | **1** (unpruned, `Q8_0`) |
|
| 189 |
+
| **Expert Intermediate Size** | 1,536 | 1,536 |
|
| 190 |
+
| **MLA Attention** | 64 heads (`q_lora_rank=2048`, `kv_lora_rank=512`, `qk_rope_head_dim=64`, `qk_nope_head_dim=192`, `v_head_dim=256`) | Unchanged (`Q8_0`) |
|
| 191 |
+
| **DSA Indexer** | 32 heads, `head_dim=128`, `index_topk=2048` | Unchanged (`Q8_0` / `F32`) |
|
| 192 |
+
| **Max Context Length** | 202,752 (YaRN `factor=4.0`, `beta_fast=32`, `beta_slow=1`) | **202,752** |
|
| 193 |
+
| **Vocabulary Size** | 154,880 | 154,880 |
|
|
|
|
| 194 |
|
| 195 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
|
| 197 |
+
## How This Model Was Built
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
|
| 199 |
+
### 1. Domain-Balanced REAP-50 Pruning (256 → 128 Experts)
|
| 200 |
+
Rather than naive frequency or magnitude pruning, we implemented **REAP (Router-weighted Expert Activation Pruning, arXiv:2510.13999)** across all 75 MoE layers (`layers 3..77`) using exact blockwise FP8 (`E4M3` + `F8_E8M0` scale) dequantization on the 301B base model:
|
| 201 |
|
| 202 |
+
$$\text{REAP}_j = \frac{1}{|T_j|} \sum_{t \in T_j} g_{j,t} \cdot \|\text{FFN}_j(x_t)\|_2$$
|
|
|
|
|
|
|
| 203 |
|
| 204 |
+
To prevent domain collapse on specialized capabilities (code, math, Chinese, and agentic tool calling), calibration activations were collected across **5 balanced domain pools**:
|
| 205 |
+
1. **General English** (`general`)
|
| 206 |
+
2. **Source Code & Software Engineering** (`code`)
|
| 207 |
+
3. **Competition Mathematics & Symbolic Reasoning** (`math`)
|
| 208 |
+
4. **Chinese Language & Cultural Knowledge** (`zh`)
|
| 209 |
+
5. **Structured Tool-Calling & Agentic Traces** (`tool`)
|
|
|
|
| 210 |
|
| 211 |
+
For every MoE layer, we took the **union of the top-16 specialist experts from each of the 5 domains** (protecting domain-critical specialists even if their global frequency is low), enforced a minimum activation frequency floor (`f_j >= 40`), and filled the remaining slots up to **128 experts** using normalized cross-domain REAP saliency.
|
|
|
|
|
|
|
| 212 |
|
| 213 |
+
### 2. Post-REAP Layer-77 Shared-Expert Scaling (`v3` files: `Q4_K_M`, `Q3_K_M`)
|
| 214 |
+
When pruning 256 → 128 routed experts with `norm_topk_prob=true`, the surviving top-8 routed expert weights renormalize to sum to `1.0`, slightly shifting the variance ratio between the routed MoE branch and the unpruned shared expert entering the final RMSNorm (`model.norm`).
|
| 215 |
+
- We tested per-layer router ridge regression (`W_router`), per-layer scalar `alpha_l`, and final-layer corrections on held-out calibration data.
|
| 216 |
+
- **Finding:** Modifying router weights across 75 layers causes severe cascading route flips (`kl_top32` `0.311 → 2.66`), so **all router weights (`blk.*.ffn_gate_inp.weight`) and biases (`exp_probs_b.bias`) are kept 100% bit-identical to the base checkpoint's surviving rows**.
|
| 217 |
+
- Rescaling only the final MoE layer's shared-expert output projection (`blk.77.ffn_down_shexp.weight *= 0.7209`, fit via least-squares against the teacher's pre-norm hidden state) cannot cascade into any downstream router, preserves `kl_top32` (`0.3204`) and `top1_agree` (`83.39%`), and eliminates rare high-entropy tail outliers (`kl_full` reduced from `0.506 → 0.388`). This rescale is included in the `v3` GGUFs (`Q4_K_M` and `Q3_K_M`).
|
| 218 |
|
| 219 |
+
### 3. Direct Block-Streaming FP8 → GGUF Conversion (Zero BF16 Intermediate)
|
| 220 |
+
Standard `llama.cpp` conversion requires dequantizing FP8 checkpoints to a ~315 GB BF16 intermediate first. We built a custom streaming converter (`scripts/convert_reap50_to_gguf.py`) that dequantizes `zai-org/GLM-5.3-Flash`'s `F8_E4M3` + `F8_E8M0` (128-element exponent-scale blocks) on the fly and quantizes directly into `Q8_0` GGUF blocks on disk:
|
| 221 |
+
- **All attention, MLA latent projections, DSA Indexer tensors, shared experts, token embeddings, output head, and dense layers (`0..2`) are quantized directly to `Q8_0` (or `F32` for norms/biases).**
|
| 222 |
+
- **Only the 3D packed routed expert tensors (`blk.*.ffn_gate_exps.weight`, `blk.*.ffn_up_exps.weight`, `blk.*.ffn_down_exps.weight`)** are quantized to `Q4_K_M`, `Q4_K_S`, `IQ4_XS`, `Q3_K_M`, or `IQ3_M`, with `--output-tensor-type q8_0 --token-embd-type q8_0`.
|
| 223 |
+
- Importance matrix use differs by file, as recorded in each file's own GGUF metadata: **`IQ3_M`, `IQ4_XS` and `Q3_K_M` were quantised with the published `GLM-5.3-Flash-REAP50.imatrix`; `Q4_K_M` and `Q4_K_S` were not** (for `Q4_K_M`, an A/B check on the confirmation split showed no gain from the imatrix once the attention/shared-expert path is locked at `Q8_0`).
|
| 224 |
|
| 225 |
+
---
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
+
## Performance on Jetson AGX Thor (128 GB Unified LPDDR5X, SM110)
|
|
|
|
|
|
|
| 228 |
|
| 229 |
+
### 1. `llama.cpp` (`b8809+`, CUDA 13.0, Unified Memory)
|
|
|
|
| 230 |
|
| 231 |
+
Measured on a single **NVIDIA Jetson AGX Thor (128 GB unified memory, 273 GB/s LPDDR5X)**:
|
|
|
|
|
|
|
| 232 |
|
| 233 |
+
| Quant | Vintage | File Size | Prompt Eval (`pp64`) | Token Generation (`tg64`) | Memory Headroom on 128 GB Thor |
|
| 234 |
+
|---|---|---:|---:|---:|---:|
|
| 235 |
+
| **`Q4_K_M`** | `v3` | 94.8 GiB | **75.9 tok/s** | **13.5 tok/s** | ~28 GiB free for KV cache / OS |
|
| 236 |
+
| **`Q4_K_S`** | `v2` | 90.0 GiB | **76.4 tok/s** | **13.9 tok/s** | ~33 GiB free for KV cache / OS |
|
| 237 |
+
| **`IQ4_XS`** | `v2` | 85.6 GiB | **74.2 tok/s** | **13.8 tok/s** | ~37 GiB free for KV cache / OS |
|
| 238 |
+
| **`Q3_K_M`** | `v3` | 77.3 GiB | **71.8 tok/s** | **14.3 tok/s** | ~45 GiB free for KV cache / OS |
|
| 239 |
+
| **`IQ3_M`** | `v2` | 72.9 GiB | **70.5 tok/s** | **14.7 tok/s** | ~50 GiB free for KV cache / OS |
|
| 240 |
|
| 241 |
+
### 2. Custom Pure-CUDA Thor Engine ([`patrickbdevaney/glm-5.3-flash-cuda-server`](https://github.com/patrickbdevaney/glm-5.3-flash-cuda-server))
|
| 242 |
|
| 243 |
+
If you are running on an **NVIDIA Jetson AGX Thor (`sm_110a`)** and want maximum throughput + lossless **Multi-Token Prediction (MTP)** speculative decoding (`layer 78`), use our companion pure C++/CUDA server [`patrickbdevaney/glm-5.3-flash-cuda-server`](https://github.com/patrickbdevaney/glm-5.3-flash-cuda-server), which loads `GLM-5.3-Flash-REAP50-Q4_K_M.gguf` (`v3`, including `blk.78.nextn.*`) directly via `mmap`:
|
| 244 |
|
| 245 |
+
| Mode | Decode Throughput | Speedup vs `llama.cpp` (`13.5 tok/s`) | Notes |
|
| 246 |
+
|---|---:|---:|---|
|
| 247 |
+
| **Autoregressive (`draft_k=0`)** | **20.9 tok/s** | **1.55×** | Native `sm_110a` CUDA graph + zero-copy `mmap` (`14.11 GB/tok` = 93% of 273 GB/s roofline) |
|
| 248 |
+
| **MTP Speculative (`draft_k=3`, English/narrative)** | **28.0 tok/s** | **2.07×** | Lossless greedy tree verification (`65%` draft acceptance) |
|
| 249 |
+
| **MTP Speculative (`draft_k=3`, Math/Reasoning)** | **31.7 tok/s** | **2.35×** | Lossless greedy tree verification (`77%` draft acceptance) |
|
| 250 |
+
| **MTP Speculative (`draft_k=3`, Structured JSON/Code)** | **38.8–42.4 tok/s** | **2.87×–3.14×** | Lossless greedy tree verification (`89–100%` draft acceptance) |
|
| 251 |
|
| 252 |
+
---
|
| 253 |
|
| 254 |
+
## How to Run with `llama.cpp`
|
| 255 |
|
| 256 |
+
Requires a recent `llama.cpp` build (`b8500+`) with `deepseek2` / `deepseek_v32` Dynamic Sparse Attention Indexer support (`blk.*.indexer.*`).
|
| 257 |
|
| 258 |
+
> **Important Note on Stop Tokens (EOG):**
|
| 259 |
+
> GLM-5.3-Flash uses **three** stop tokens in its chat template: `<|endoftext|>` (`154820`), `<|user|>` (`154827`), and `<|observation|>` (`154829`).
|
| 260 |
+
> - In the **`v3` GGUFs (`Q4_K_M` and `Q3_K_M`)**, `eos_token_id` in the header is already set to `154827` (`<|user|>`), which stops normal single-turn and multi-turn user/assistant chat automatically.
|
| 261 |
+
> - In the **`v2` GGUFs (`Q4_K_S`, `IQ4_XS`, `IQ3_M`)**, `eos_token_id` is `154820` (`<|endoftext|>`), so without overriding EOG token IDs the model may generate past the end of an assistant turn into a simulated `<|user|>` turn.
|
| 262 |
+
> - For **all** files (especially when using tool calls that stop on `<|observation|>` = `154829`), we recommend passing `--override-kv deepseek2.ggml.eos_token_ids=arr:i32:154820,154827,154829` (or passing `stop: ["<|endoftext|>", "<|user|>", "<|observation|>"]` in your API request).
|
| 263 |
|
| 264 |
+
### CLI Example (`llama-cli`)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
|
| 266 |
```bash
|
| 267 |
+
./llama-cli \
|
| 268 |
+
-m GLM-5.3-Flash-REAP50-Q4_K_M.gguf \
|
| 269 |
+
-ngl 99 \
|
| 270 |
+
-c 32768 \
|
| 271 |
+
-fa on \
|
| 272 |
+
--override-kv deepseek2.ggml.eos_token_ids=arr:i32:154820,154827,154829 \
|
| 273 |
+
-p "<|system|>\nYou are a helpful assistant.<|user|>\nProve that there are infinitely many primes congruent to 3 mod 4.<|assistant|>\n<think>\n"
|
| 274 |
```
|
| 275 |
|
| 276 |
+
### OpenAI-Compatible Server (`llama-server`)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
|
| 278 |
```bash
|
| 279 |
+
./llama-server \
|
| 280 |
+
-m GLM-5.3-Flash-REAP50-Q4_K_M.gguf \
|
| 281 |
+
-ngl 99 \
|
| 282 |
+
-c 65536 \
|
| 283 |
+
-fa on \
|
| 284 |
+
--override-kv deepseek2.ggml.eos_token_ids=arr:i32:154820,154827,154829 \
|
| 285 |
+
--host 0.0.0.0 \
|
| 286 |
+
--port 8080
|
| 287 |
```
|
| 288 |
|
| 289 |
+
> **Tip for Unified-Memory Systems (Jetson AGX Thor / DGX Spark / AMD Strix Halo):**
|
| 290 |
+
> When running with CUDA on Linux unified memory (`-ngl 99`), `llama.cpp` disables `mmap` by default if `cudaHostRegister` fails on large files, causing a double allocation during model load. If `Q4_K_M` (94.8 GiB) hits OOM during the initial load on a 128 GB system, either:
|
| 291 |
+
> 1. Use `Q4_K_S` (90.0 GiB), `IQ4_XS` (85.6 GiB), or `Q3_K_M` (77.3 GiB), or
|
| 292 |
+
> 2. Patch `ggml-cuda` to keep `use_mmap = true` on integrated/unified-memory GPUs (`integrated == true`), which keeps peak resident memory equal to the 94.8 GiB file size.
|
| 293 |
+
|
| 294 |
+
---
|
| 295 |
|
| 296 |
+
## Citation & Credits
|
| 297 |
|
| 298 |
+
- **Base Model:** [Z.ai (`zai-org/GLM-5.3-Flash`)](https://huggingface.co/zai-org/GLM-5.3-Flash) (MIT License)
|
| 299 |
+
- **Pruning Method:** [REAP: Router-weighted Expert Activation Pruning](https://arxiv.org/abs/2510.13999)
|
| 300 |
+
- **Quantization & REAP-50 Pipeline:** [`patrickbdevaney`](https://huggingface.co/patrickbdevaney)
|