A repack of Google's official QAT checkpoint
google/gemma-4-26B-A4B-it-qat-q4_0-unquantized
into the compressed-tensors pack-quantized W4A16 format (4-bit symmetric weights,
group size 32, bf16 activations) so the checkpoint can be served by vLLM.
Google shipped the QAT quantization of this model as GGUF only, i.e. for llama.cpp.
This repack targets the vLLM/compressed-tensors path and reproduces the q4_0 grid the
QAT training was performed against, rather than the default RTN grid of llm-compressor.
model.safetensors — fits one 24 GB GPU with a 64K context and fp8 KV cache.Tested on vLLM 0.28.0, one RTX 4090 (24 GB):
vllm serve adeepv/gemma-4-26B-A4B-it-W4A16-vLLM \
--max-model-len 65536 \
--kv-cache-dtype fp8 \
--gpu-memory-utilization 0.92 \
--reasoning-parser gemma4 \
--default-chat-template-kwargs '{"enable_thinking": true}' \
--enable-auto-tool-choice \
--tool-call-parser gemma4
Notes:
enable_thinking is passed:
when the variable is undefined the template emits an empty thought channel, and the model
answers immediately. Without --default-chat-template-kwargs '{"enable_thinking": true}'
(or a per-request chat_template_kwargs) the model runs in the non-thinking mode.--reasoning-parser gemma4 is required for thinking mode, otherwise the reasoning text
is emitted into content instead of reasoning_content.This is the substantive difference from a stock llm-compressor W4A16 run of the same checkpoint.
llm-compressor computes the group scale in calculate_qparams as amax / (bit_range / 2),
where bit_range = 7 - (-8) = 15, i.e. scale = amax / 7.5. The GGUF q4_0 format — and
therefore the grid this checkpoint was QAT-trained against — uses scale = amax / 8. The
divisor is hardcoded in the library and is not exposed as a parameter.
With amax/7.5 the reconstruction points sit next to, but not on, the nodes the QAT procedure
pulled the weights onto, and the benefit of the QAT checkpoint is partly thrown away.
Dequantization error against the bf16 source (relative L2, same checkpoint, same group size):
| Tensor group | amax/7.5 (llm-compressor default) |
amax/8 (this repack) |
|---|---|---|
attention q_proj |
6.66% | 3.79% |
MoE experts down_proj |
8.18% | 8.41% |
For the experts, 8.41% is the floor of the q4_0 grid on this geometry (expert intermediate size 704) — Google's own GGUF lands at the same figure. The attention error is where the default formula loses a factor of 1.76.
The QAT source matters just as much as the formula. Share of weights that land exactly on a 4-bit grid node:
| Source checkpoint | attention | experts | q4_0 error, attention |
|---|---|---|---|
QAT (…-qat-q4_0-unquantized) |
67.0% | 31.6% | 3.79% |
| non-QAT instruct checkpoint | 6.9% | 6.9% | 10.29% |
6.9% is chance level. Quantizing the non-QAT checkpoint gives ~2.7x the attention error, and no choice of scale formula recovers it.
200 tasks with mechanically checkable answers, temperature=0, Russian and English, categories:
math, logic, facts, Russian language, code, format following, word counting, character counting.
Every reference answer was pre-validated against its own checker before the runs.
| Run | this W4A16 (vLLM) | bf16 source (vLLM) | official q4_0 GGUF (llama.cpp) |
|---|---|---|---|
| thinking off | 187/200 | 188/200 | 188/200 |
| thinking on | 197/200 | not measured | 195/200 |
The quantization is not the limiting factor: without thinking this repack scores within one task of the unquantized bf16 source and of Google's own GGUF; with thinking it is at least on par with the GGUF.
Character-level counting ("how many letters n in this word") is the weakest category. This is
not specific to this repack — the official q4_0 GGUF misses the same items, so it is a property
of 4-bit weights on this model rather than of the repacking procedure. For per-character work,
use the bf16 checkpoint or enable thinking.
One RTX 4090 (24 GB, 300 W power cap), vLLM 0.28.0, fp8 KV cache, 64K context, versus the official q4_0 GGUF on llama.cpp (server-cuda) on identical hardware:
| Workload | this W4A16 (vLLM) | official q4_0 GGUF (llama.cpp) |
|---|---|---|
| 200-task suite, thinking on, single stream | 194 tok/s | 165 tok/s |
| chat, concurrency 4, 400 tokens per answer | 559 tok/s | not measured |
What is quantized, what is not:
| Component | Treatment |
|---|---|
text attention q/k/v/o_proj |
W4A16, group 32, symmetric |
text dense mlp.{gate,up,down}_proj |
W4A16, group 32, symmetric |
| MoE experts (128 per layer, all 30 layers) | W4A16, group 32, symmetric |
MoE router router.proj.weight, router.scale, router.per_expert_scale |
bf16, untouched |
token embeddings, all norms, layer_scalar |
bf16, untouched |
vision tower and embed_vision projection |
bf16, untouched |
11,725 linear modules quantized, 655 tensors kept in full precision; 35,923 tensors total.
Two structural points that make a manual repack non-obvious:
…experts.gate_up_proj as [128, 2H, C] and …experts.down_proj as [128, R, C].
They have to be unfolded into per-expert modules; gate_proj is the first half of
gate_up_proj and up_proj the second (verified numerically against the reference layout).v_proj — nothing was dropped or renamed during the repack.Config, tokenizer, chat template and processor config are byte-identical copies of the source
checkpoint; config.json differs only by the added quantization_config block.
| File | Size | Note |
|---|---|---|
model.safetensors |
16.4 GB | single file, W4A16 packed |
config.json |
20 KB | source config + quantization_config |
generation_config.json |
204 B | from source |
tokenizer.json |
32 MB | from source, unmodified |
tokenizer_config.json |
3.7 KB | from source, unmodified |
processor_config.json |
1.7 KB | from source, unmodified |
chat_template.jinja |
18 KB | from source, unmodified |
recipe.yaml |
813 B | quantization recipe |
Derived from google/gemma-4-26B-A4B-it-qat-q4_0-unquantized. Use is governed by the
Gemma Terms of Use and Google's
Gemma Prohibited Use Policy; the terms
apply to this derivative as well. All model weights originate from Google's checkpoint; this
repository only changes the numeric storage format.