Archived on 2026-11-26. This repo gets no more updates, and its files stay here. Use keptn/gemma4-31b-exl3 instead: its files are smaller for the same quality, and they run on radiance 2.3.0 or newer.
google/gemma-4-31B-it in one 20 GiB file for the radiance inference engine on AMD RDNA4. The file reads text, images and video and includes Google's assistant head for speculative decoding.
| File | gemma4-31b-a4.rad, 19.95 GiB |
| Needs | radiance 2.0.0 or newer; 1, 2 or 4 cards with 32 GB (tested on one, two and four Radeon AI PRO R9700). |
| Format | weights int4 with a zero point, one f16 scale per 128 weights (all linear layers of the trunk, GPTQ); activations int8, one scale per token and 128 values; at decode an f16 copy of the int4 layers; lm_head int8, one bf16 scale per 128 weights; the assistant head's lm_head also int8 |
| Speculation | Google's Gemma 4 assistant head, bf16, 3 draft tokens |
| Inputs | text · image · video |
| Context | 262,144 tokens |
| Version | 2.0 (2026-11-04) |
Radeon AI PRO R9700 at 215 W, radiance 1.16.0, fp8 KV, 3 draft tokens, thinking off. BetterBench 0.6.1, full run, temperature 0.7. Tokens per second (median):
| 1 card | 2 cards | 4 cards | |
|---|---|---|---|
| decode, one stream | 78.4 | 132.3 | 202.0 |
| prefill at 24k tokens | 1,463 | 2,657 | 4,318 |
| 4 streams, total | 130 | 349 | 516 |
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 this file with --kld-ref, on the answer tokens only (42,283 tokens).
| mean KL | 99th percentile KL | top token the same | perplexity ratio | |
|---|---|---|---|---|
| this file | 0.0251 | 0.331 | 96.1% | ×0.993 |
| keptn/gemma4-31b-a4 version 1.0 (w4a8) | 0.0517 | 0.721 | 94.6% | ×1.056 |
| keptn/gemma4-31b-i8g | 0.00236 | 0.0311 | 98.8% | ×1.004 |
| keptn/gemma4-31b-w5 | 0.00803 | 0.107 | 97.8% | ×1.010 |
Download the file:
hf download keptn/gemma4-31b-a4 gemma4-31b-a4.rad config.json --local-dir ~/models
Save this as radiance.yaml. The entry name is the model id in requests.
models:
gemma4-31b-a4:
model: /models/gemma4-31b-a4.rad
tp: 2
p2p: on
kv-cache-dtype: i8
max-model-len: 65536
max-num-seqs: 8
max-num-batched-tokens: 2048
num-speculative-tokens: 3
vision-tower-placement: ram
temp: 1.0
top-p: 0.95
top-k: 64
| change | |
|---|---|
| one card | tp: 1, remove p2p: on, max-num-seqs: 2 |
| four cards | tp: 4 |
| full context | max-model-len: 262144, max-num-seqs: 2 |
| thinking | 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.
Start radiance as its Docker guide shows: Run it.
Use the image stilldeadcode/radiance:2.0.0 or newer. The YAML expects the model folder at /models, as in
the guide.
KV pool at --max-model-len 262144, fp8 KV, radiance 1.16.0, from radiance's startup report. Tokens of context in total, shared by all sequences:
| 2 sequences | 4 sequences | 8 sequences | |
|---|---|---|---|
| 1 card | 298,848 | 277,648 | 234,672 |
| 2 cards | 524,304 | 1,048,624 | 1,017,136 |
| 4 cards | 524,352 | 1,048,624 | 2,097,248 |
On one card each sequence also keeps its own sliding-window state. So more sequences leave less for the shared pool.
The same inputs go to radiance and to the bf16 original in HF transformers. Greedy, thinking off, 2 cards, radiance 1.16.0. There is one measurement for each vision or audio encoder, made with gemma4-31b-a4.rad.
| input | cases | same answer | mean KL | top token the same |
|---|---|---|---|---|
| images (DocVQA and AI2D, fixed selection) | 20 | 16/20 | 0.268 | 66/70 |
| video (MVBench, 5 clips, 4 frames each) | 5 | 4/5 | 0.0556 | 31/32 |
radiance.yaml.| version | date | change |
|---|---|---|
| 2.0 | 2026-11-04 | a4: int4 with a zero point, GPTQ on keptn/quant-calibration. Mean KL about half of 1.0; decode 1.6 % slower on one card, 7.5 % on two |
| 1.0 | 2026-10-13 | w4a8: int4 without a zero point, int8 activations per row. The repository was keptn/gemma4-31b-w4a8 (the name redirects here) |
Version 1.0 needs radiance 1.5.0 or newer: hf download keptn/gemma4-31b-a4 gemma4-31b-w4a8.rad --revision v1.0 --local-dir ~/models.
Apache 2.0, the license of the base model. See LICENSE.
google/gemma-4-31B-it