Gemma 4 12B-it 路 EXL3 路 for radiance
google/gemma-4-12B-it in four EXL3-V3 files of 6.2 to 9.7 GiB for the radiance inference engine on AMD RDNA4. The trunk linears have 3.25 to 6.0 bits per weight on average. The token embedding is 4-bit.
| File | gemma4-12b-exl3-3.25bpw.rad 6.23 GiB 路 gemma4-12b-exl3-4.07bpw.rad 7.27 GiB 路 gemma4-12b-exl3-4.89bpw.rad 8.31 GiB 路 gemma4-12b-exl3-6.0bpw.rad 9.72 GiB |
| Needs | radiance with PR #401 and PR #537, not in a release yet; 1 or 2 cards with 32 GB (tested on one and two Radeon AI PRO R9700) |
| Format | linear layers of the transformer blocks: EXL3-V3 trellis, codebook mad; 2.5 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 4-bit (a table of 16 values, one bf16 scale per 128 weights, 128-point Hadamard transform), kept in host memory |
| Speculation | Google's Gemma 4 assistant head (its lm_head int8), 6 draft tokens with draft-window: adaptive |
| Inputs | text 路 image |
| Context | 262,144 tokens |
| Version | 1.0 (2026-11-22) |
Which file:
- 3.25 bpw: the smallest file, with the fewest bytes to read per token.
- 4.07 bpw: the middle in size and in quality.
- 4.89 bpw: the default for cards with 16 GB.
- 6.0 bpw: the best quality, for cards with 32 GB.
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 the files as shipped.
| file | size | mean KL | top token the same |
|---|---|---|---|
| EXL3 3.25 bpw | 6.23 GiB | 0.0318 | 95.2% |
| EXL3 4.07 bpw | 7.27 GiB | 0.0118 | 97.1% |
| EXL3 4.89 bpw | 8.31 GiB | 0.00465 | 98.3% |
| EXL3 6.0 bpw | 9.72 GiB | 0.00277 | 98.7% |
| keptn/gemma4-12b-a4 | 8.79 GiB | 0.0518 | 93.9% |
| keptn/gemma4-12b-i8g | 13.79 GiB | 0.00542 | 97.9% |
| keptn/gemma4-12b-bf16 | 24.95 GiB | 0.00177 | 98.9% |
The 3.25, 4.07 and 4.89 bpw files are mixes: every linear layer has its own width. At the same size, the mixes have 22 to 29 % less KL than uniform EXL3 files (interpolated between the two uniform files next to each mix). Both were measured with the bf16 token embedding and without int8 activations. The int8 activations add 0.3 to 5.6 % to the KL. The 4-bit token embedding adds 0.00023 or less.
Quick start
Download the file:
hf download keptn/gemma4-12b-exl3 gemma4-12b-exl3-4.89bpw.rad config.json --local-dir ~/modelsSave this as
radiance.yaml. The entry name is the model id in requests.models: gemma4-12b-exl3: model: /models/gemma4-12b-exl3-4.89bpw.rad tp: 1 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-12b-exl3-<3.25, 4.07 or 6.0>bpw.radtwo cards tp: 2, addp2p: onthinking per request: "chat_template_kwargs": {"enable_thinking": true}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
At max-model-len: 262144 and 8 sequences with i8 KV, the KV pool holds 2,097,168 tokens on one card (2,097,216 on two). That is all 8 sequences at full length, for every file. Source: the startup report of radiance 2.2.0 with PR #401 and PR #537.
How it was made
- Started from the bf16 checkpoint
google/gemma-4-12B-it(revision707f0a3b) and Google's assistant headgoogle/gemma-4-12B-it-assistant(revision3b0b0a4a). - 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 13 uniform levels from 2.5 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 vision tower stays bf16. - For the three mixes, a multiple-choice knapsack gave each of the 280 linear layers one of the levels, at a byte limit. 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, with no new quantisation. The 6.0 bpw file is the 6.0 level (at its size, the knapsack chooses 6.0 for every layer). - Quantised the token embedding to 4 bits with
rad-convertand put it in withradmix. - Set every linear layer of the transformer blocks to int8 activations (
a8g128) withradmix. This changes only metadata, not the weights.
rad-convert --recipe gemma4-12b-exl3-K<rate>.recipe gemma-4-12B-it --draft-model gemma-4-12B-it-assistant \
--set quantization_config.quant_method=exl3 --max-ctx 262144 -o gemma4-12b-exl3-K<rate>.rad
Each .recipe file in this repository lists every weight of its file with its level, and the lines for the token embedding and the lm_heads. rad-info --recipe on a file shows the recipe of the level the mix started from.
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 is not measured yet for these files.
- Four cards are not tested with these files. Cards with 16 GB are not tested.
- Images are not compared with HF transformers. In a test with a picture of ten lines of text, the files read the text back at one and two cards. The 3.25 bpw file at two cards read 99.7 % of the text, after 2,900 tokens of text.
- The checkpoint also has an audio encoder. Audio input is not tested with these files.
- The EXL3 rows of the quality table come from radiance 2.2.0 with PR #537; the other rows from radiance 2.1.0. Both use i8 KV.
- Greedy text at one card and at two cards can differ in single tokens. Two cards round the sums of the split layers in a different order.
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
- -