Gemma 4 31B-it · EXL3 · for radiance
google/gemma-4-31B-it in four EXL3-V3 files of 16.8 to 26.2 GiB for the radiance inference engine on AMD RDNA4. The linear layers of the transformer blocks are EXL3-V3 trellis weights with 3.25 to 6.0 bits per weight on average.
| File | gemma4-31b-exl3-3.25bpw.rad 16.77 GiB · gemma4-31b-exl3-4.07bpw.rad 19.57 GiB · gemma4-31b-exl3-4.89bpw.rad 22.36 GiB · gemma4-31b-exl3-6.0bpw.rad 26.15 GiB |
| Needs | radiance with PR #401 and PR #537, not in a release yet; 1, 2 or 4 cards with 32 GB (tested on one, two and four Radeon AI PRO R9700). The 6.0 bpw file does not fit one card at 262,144 tokens of context |
| Format | linear layers of the transformer blocks: EXL3-V3 trellis, codebook mad; 2.75 to 6.0 bits per layer in the three mixes, 6.0 bits in all layers of the 6.0 bpw file; activations int8 (a8g128) in prefill steps of 512 rows or more; lm_head int8, one bf16 scale per 128 weights; token embedding bf16 |
| Speculation | Google's Gemma 4 assistant head (its lm_head int8), 6 draft tokens with draft-window: adaptive |
| Inputs | text · image · video |
| Context | 262,144 tokens |
| Version | 1.0 (2026-11-19) |
Speed
Radeon AI PRO R9700 at 300 W, radiance 2.1.0 with PR #401 and PR #537 (state of 2026-11-19). Settings: i8 KV, 6 adaptive draft tokens, tp-wire: wht6 on 2 and 4 cards, 262,144 tokens of context, 8 sequences, thinking off.
BetterBench 0.6.1, full run, temperature 0.7. Tokens per second (median):
| decode, one stream | 1 card | 2 cards | 4 cards |
|---|---|---|---|
| 3.25 bpw | 102.9 | 170.8 | 255.1 |
| 4.07 bpw | 94.1 | 163.9 | 245.7 |
| 4.89 bpw | 85.0 | 145.7 | 231.9 |
| 6.0 bpw | does not fit | 136.1 | 210.6 |
| prefill at 24k tokens | 1 card | 2 cards | 4 cards |
|---|---|---|---|
| 3.25 bpw | 1,728 | 3,051 | 4,098 |
| 4.07 bpw | 1,726 | 3,045 | 4,094 |
| 4.89 bpw | 1,722 | 3,042 | 4,093 |
| 6.0 bpw | does not fit | 3,042 | 4,079 |
| 4 streams, total | 1 card | 2 cards | 4 cards |
|---|---|---|---|
| 3.25 bpw | 194 | 316 | 457 |
| 4.07 bpw | 183 | 308 | 441 |
| 4.89 bpw | 173 | 291 | 436 |
| 6.0 bpw | does not fit | 282 | 413 |
Quality
Distance to the bf16 original on the 80 MT-Bench questions, both turns. The text is the GPT-4 answers from lmsys/mt_bench_human_judgments, with the model's chat template and thinking off. The reference is the bf16 original in HF transformers, with fp32 arithmetic and the full vocabulary. radiance scores the answer tokens only (42,283 tokens), with --kld-ref on one card and i8 KV. The EXL3 rows are measured on the same weights without the int8 activations (a8g128) of these files.
| file | size | mean KL | top token the same |
|---|---|---|---|
| EXL3 3.25 bpw | 16.77 GiB | 0.0181 | 96.7% |
| EXL3 4.07 bpw | 19.57 GiB | 0.00598 | 98.0% |
| EXL3 4.89 bpw | 22.36 GiB | 0.00314 | 98.6% |
| EXL3 6.0 bpw | 26.15 GiB | 0.00226 | 98.7% |
| keptn/gemma4-31b-a4 | 19.95 GiB | 0.0246 | 96.1% |
| keptn/gemma4-31b-w5 | 23.36 GiB | 0.00792 | 97.8% |
| keptn/gemma4-31b-i8g (radiance 1.13, fp8 KV) | 33.37 GiB | 0.00236 | 98.8% |
Quick start
Download the file:
hf download keptn/gemma4-31b-exl3 gemma4-31b-exl3-4.07bpw.rad config.json --local-dir ~/modelsSave this as
radiance.yaml. The entry name is the model id in requests.models: gemma4-31b-exl3: model: /models/gemma4-31b-exl3-4.07bpw.rad tp: 2 p2p: on kv-cache-dtype: i8 max-model-len: 262144 max-num-seqs: 8 max-num-batched-tokens: 2048 num-speculative-tokens: 6 draft-window: adaptive vision-tower-placement: ram temp: 1.0 top-p: 0.95 top-k: 64change another file model: /models/gemma4-31b-exl3-<3.25, 4.89 or 6.0>bpw.radone card tp: 1, removep2p: on(not the 6.0 bpw file)four cards tp: 4thinking per request: "chat_template_kwargs": {"enable_thinking": true}three cards do not work: 32 attention heads do not split into three The sampling values are Google's: temperature 1.0, top_p 0.95 and top_k 64.
This file needs radiance with PR #401 and PR #537, not in a release yet. Build the image from the branch of PR #537 (it contains PR #401), as radiance's guide shows: Build the image. Then start it as the guide shows: Run it. The YAML expects the model folder at
/models, as in the guide.
Memory and context
KV pool at max-model-len: 262144 and 8 sequences with i8 KV. Source: the startup report of the speed runs, radiance 2.1.0 with PR #401 and PR #537 (state of 2026-11-19). Tokens of context in total, shared by all sequences, and in brackets radiance's full-length sessions:
| 1 card | 2 cards | 4 cards | |
|---|---|---|---|
| 3.25 bpw | 348,304 (1.6) | 1,142,720 (4.5) | 2,097,248 (8.0) |
| 4.07 bpw | 275,344 (1.4) | 1,069,728 (4.3) | 2,097,248 (8.0) |
| 4.89 bpw | 202,384 (1.1) | 996,800 (4.0) | 2,097,248 (8.0) |
| 6.0 bpw | does not fit | 897,648 (3.6) | 2,097,248 (8.0) |
How it was made
- Started from the bf16 checkpoint
google/gemma-4-31B-it(revision842da379) and Google's assistant headgoogle/gemma-4-31B-it-assistant(revision627c5ec1). - Measured a Hessian for every linear layer of the transformer blocks, one layer at a time. This used the bf16 model in HF transformers and the calibration set named below.
- Quantised these layers with EXL3-V3 (Hero422's rad-exl3-mix, exllamav3 1.6.3 with Hero422's patches), codebook
mad, at 16 uniform levels from 2.0 to 6.0 bits per weight. - Packed each level with
rad-convert. Both lm_heads (the model's and the assistant head's) are int8, one bf16 scale per 128 weights. The token embedding and the vision tower stay bf16. - For the 3.25, 4.07 and 4.89 bpw files, each of the 350 linear layers got one of the levels. A multiple-choice knapsack at a byte limit chose them. Its model is fitted to the measured MT-Bench KL of the uniform levels and five test mixes.
radmixcopied the chosen layers from the level files, without new quantisation. The 6.0 bpw file is the 6.0 level. - Set every linear layer of the transformer blocks to int8 activations (
a8g128) withradmix. This changes only metadata, not the weights.
rad-convert --recipe gemma4-31b-exl3-K<rate>.recipe gemma-4-31B-it --draft-model gemma-4-31B-it-assistant \
--set quantization_config.quant_method=exl3 --max-ctx 262144 -o gemma4-31b-exl3-K<rate>.rad
The recipe sets attn_q, attn_k, attn_v, attn_o, ffn_gate_up and ffn_down of every block to exl3i codebook=mad rate=<rate>. It sets output.weight and mtp.output.weight to rtn codes=i8 group=128 scale=bf16 clamp=sym.
Calibration: 1,213 rows and 1,275,569 tokens of keptn/quant-calibration-v1, rendered with the model's chat template. Each row was cut at 4,096 tokens.
Limits
- radiance runs on AMD RDNA4 cards.
- Speed on two and four cards is measured with
tp-wire: wht6. The Quick start uses radiance's default wire. - Images and video are not compared with HF transformers for these files. The vision tower of the 4.07 bpw file is byte-identical to the one in keptn/gemma4-31b-a4.
- The quality table of keptn/gemma4-31b-i8g comes from radiance 1.13 with fp8 KV; the other rows from radiance 2.1.0 with i8 KV.
- The KL of the files with int8 activations is not measured. For two older EXL3 files (codebook
mul1i8, 3 and 4 bits), the int8 activations changed the mean KL by 0.3 % or less.
Credits
- EXL3: exllamav3 by turboderp. EXL3-V3 in radiance: Hero422, PR #401.
- Gemma 4 support in radiance: based on the initial work of sfjes (sfjes@vmdaemon.org) in PR #75.
- radiance: StillDeadcode (codeberg.org/StillDeadcode/radiance).
- Base model, assistant head and vision tower: Google.
- Test and calibration sets: MT-Bench, keptn/quant-calibration-v1.
License
Apache 2.0, the license of the base model. See LICENSE.
- Downloads last month
- 24