witcheer commited on
Commit
6b2cdae
·
verified ·
1 Parent(s): d397729

Upload reports/gemma4-31b-qat-mtp.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. reports/gemma4-31b-qat-mtp.md +70 -0
reports/gemma4-31b-qat-mtp.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # The quality king, quantized: Gemma 4 31B QAT + MTP on a 32GB card
2
+
3
+ **Rig:** RTX 5090 32GB (capsule, llama.cpp b9562) · **Date:** 2026-06-08 · **Task:** local-ai-roadmap t039
4
+ **Arms:** `gemma-4-31B-it-qat-q4_0` (QAT) vs naive Q4_0 vs Q6_K (the prior quality king) · MTP drafter `gemma-4-31B-it-MTP-Q8_0`
5
+
6
+ ## The setup
7
+
8
+ Gemma 4 31B was already this rig's **quality king** — but at Q6_K it **OOM'd at 32K context** on a 32GB card.
9
+ Two June-2026 drops promised to fix both ends: Google's **QAT checkpoints** (near-BF16 quality at Q4) and
10
+ **MTP** merged into llama.cpp (a draft head for ">2x" decode). So: does QAT hold the crown at a third the VRAM,
11
+ does MTP deliver, and does the lighter model finally handle long context? Three things to settle on our own hardware.
12
+
13
+ ## 1. Quality — Q4 barely costs anything, and QAT ≈ naive Q4
14
+
15
+ q_avg (5 tasks, think-off, 50% MMLU/HellaSwag, full ARC/GSM8K/HumanEval):
16
+
17
+ | | MMLU | ARC-C | HellaSwag | HumanEval | GSM8K | **q_avg** |
18
+ |---|---|---|---|---|---|---|
19
+ | **QAT-Q4_0** | 87.25 | 97.61 | 91.60 | 97.56 | 97.27 | **94.26** |
20
+ | naive Q4_0 | 87.46 | 97.18 | 90.94 | 97.56 | 97.19 | **94.07** |
21
+ | Q6_K (king) | 87.82 | 97.61 | 91.95 | 96.34 | 97.50 | **94.24** |
22
+
23
+ All three land within **0.19 q_avg of each other.** QAT-Q4 (94.26) *ties* Q6_K (94.24) and beats a dumb Q4_0 by
24
+ a noise-level +0.19. The honest read: **Gemma 4 31B is remarkably quantization-robust** — Q4 costs essentially
25
+ nothing on standard benchmarks, and QAT's specific edge over naive Q4 doesn't show up here. QAT's value isn't a
26
+ better benchmark number; it's that Q4 *at no quality cost* is what unlocks the next two wins.
27
+
28
+ ## 2. Speed — MTP is real: 1.67x decode (2.3x vs the old king)
29
+
30
+ Decode throughput (tok/s):
31
+
32
+ - Q6_K: **55** · QAT-Q4: **76** (smaller quant alone) · **QAT-Q4 + MTP: 125**
33
+
34
+ MTP (draft head, `--spec-type draft-mtp --spec-draft-n-max 4`, 33% draft acceptance) lifts QAT-Q4 from 76 to
35
+ **125 tok/s — a 1.67x decode speedup.** Short of the headline ">2x" (acceptance-rate bound at our settings), but
36
+ substantial and verified. Stacked against the Q6_K king's 55 tok/s, the QAT-Q4 + MTP combo is **2.3x faster** —
37
+ the quant shrink and the draft head compounding.
38
+
39
+ ## 3. Long context — the king finally clears 128K
40
+
41
+ QAT-Q4 server load at depth, vs Q6_K's prior wall:
42
+
43
+ | context | QAT-Q4 | Q6_K (prior) |
44
+ |---|---|---|
45
+ | 32K | ✅ 23.8 GB | ❌ **OOM** |
46
+ | 64K | ✅ 26.4 GB | — |
47
+ | 128K | ✅ 31.5 GB | — |
48
+
49
+ **QAT-Q4 loads the full 128K context (31.5 of 32GB) where Q6_K couldn't even reach 32K.** This is the real
50
+ payoff of the VRAM cut: not a quality story, a *capability* story. The quality king couldn't do long context on
51
+ this card; quantized, it can.
52
+
53
+ ## The wedge (why QAT matters even though it doesn't win on quality)
54
+
55
+ QAT's benchmark edge over naive Q4 is negligible — but that's not the point. Q4 (either kind) holds Gemma 4 31B's
56
+ quality *and* halves the footprint, and that freed VRAM is exactly what buys the **128K context** and the headroom
57
+ for the **MTP draft head**. Lighter isn't the feature; lighter is what makes faster-and-longer possible on one card.
58
+
59
+ ## Feasibility notes (Blackwell + the MTP gotcha)
60
+
61
+ - **llama.cpp rebuilt 9365 → 9562** to land Gemma4 MTP ([PR #23398](https://github.com/ggml-org/llama.cpp/pull/23398)); Donald (the resident agent) verified
62
+ on the new binary before proceeding. The `mistral4`, gpt-oss, gemma archs all still load.
63
+ - **The drafter gotcha:** the first community MTP GGUF (`...-assistant`, arch `gemma4_assistant`, underscore) is
64
+ **rejected as "unknown architecture."** The working one is unsloth's `MTP/gemma-4-31B-it-MTP-Q8_0.gguf` (arch
65
+ `gemma4-assistant`, hyphen). Post-merge the MTP-head GGUF format is still settling — match the arch the build expects.
66
+ - 31B Q4/Q6 fit 32GB fully (`-ngl 999 -fa on`), no offload.
67
+
68
+ ---
69
+ Harness: the rig's `bench.py` quality+speed + `scripts/mtp_speed.sh` (MTP via `llama-server` `/completion` timings)
70
+ + a long-context load sweep. Raw scores: `results/`. think-off, 50% sample — matches the prior Q6_K methodology.