Archived
gemma4: a GPTQ calibration tap and recipe for the 31B's w4a8 container, whose tool calls then close their strings
Rounded to nearest, the 31B's w4a8 trunk leaves streamed tool calls inside their string arguments: after `sku:<|"|>MS-110` it prefers `**,` (58%) to the string's close (41%; bf16 ~1.0), and BetterBench's order request stalled in 10 of 20 tries. This adds what it takes to make the same container (same grid, kernels and size) with the trunk's int4 codes chosen by GPTQ against the bf16 model's own activations. - arch/gemma4: with RADIANCE_CALIB_DIR set, the plugin serving the 31B's bf16 checkpoint sums the Gram of every dense linear's bf16 input over the corpus a server is fed (gram_accum into a PERSIST [K, K] f32 buffer a tap) and writes the files at RADIANCE_CALIB_TOKENS, as arch/gemma3's tap does: q|k|v's and gate|up's input whole from rank 0, o_proj's and down's this rank's columns as `<stem>.part`, which libquant places on the diagonal. The files carry the names the w4a8 container gives the weights (gemma4_bf16's attn_qkv, attn_o, ffn_gate_up, ffn_down), so a GPTQ recipe converting that container reads them with calib=DIR. RADIANCE_G4_CALIB_LAYERS=lo:hi records a slice of layers (the 31B's taps are ~364 MiB a layer a rank at --tp 4, and 60 layers of them do not fit beside the bf16 weights). Under the tap a step runs whole and on one lane; without RADIANCE_CALIB_DIR nothing changes. - data/recipes/gemma4-31b-dense-bf16-w4a8g-df2.recipe: the -df2 recipe with `gptq codes=i4 group=128 scale=f16 rule=search calib=$CALIB` on the trunk's four linears. - docs/GEMMA4-31B-GPTQ.md: the route, the corpus, how to run it, and the measurements. Measured (1.11.0, the same tap and recipe): by GPTQ the close is 99.8% and no try stalls; KL against bf16 on the model's own turns falls from 0.341 to 0.251 (the w8a8 container 0.226), at the same speed. The convert takes 75 minutes with OpenBLAS in the image (#220; an estimated days without). A container made this way is on Hugging Face as Ashlyn4202025/gemma4-31b-w4a8-gptq-dflash2, and with the block-16 drafter as Ashlyn4202025/gemma4-31b-w4a8-gptq-dflash2-b16. Tests: engine_e2e takes the tiny Gemma 4 (shaped like the 31B) through the whole route at --tp 2: the tap's files, by name and width on each rank; rad-convert with the two shipped recipes, every trunk linear fitted and none rounded to nearest; and the GPTQ container's KL against the bf16 model on held-out documents more than three times below the round-to-nearest one's (0.0018 against 0.0105). With rank 0's and rank 1's .part blocks swapped the margin is 2.2 times, which fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
66c86b9f89
commit
d8b9ce3a32
7 files changed
+404
-3
No files matched your search
@@ -1026,6 +1026,17 @@ the whole 128-row scale blocks that cover its share of the columns and an `all_g
|
||||
them, with `gemm_nt_q`'s `split_n` keeping every output the unsplit fc's to the bit. The recipe is
|
||||
`gemma4-31b-dense-bf16-w4a8-df2.recipe`.
|
||||
|
||||
**The 31B by GPTQ.** `arch/gemma4_bf16`'s linears read int8 activations, which the Gram tap
|
||||
(`gram_accum`) does not take, so the 31B's Hessians come from this plugin serving the bf16
|
||||
checkpoint. With `RADIANCE_CALIB_DIR` set it taps each layer's dense linears, the routed arm aside:
|
||||
rank 0 writes q|k|v's and gate|up's inputs whole, and each rank writes its columns of o's and
|
||||
down's inputs as `<stem>.part`, all under the names `gemma4_bf16`'s container gives those weights
|
||||
(`blk.N.attn_qkv`, `ffn_gate_up`, `attn_o`, `ffn_down`), so
|
||||
`data/recipes/gemma4-31b-dense-bf16-w4a8g-df2.recipe` reads them as written. The prefill overlap
|
||||
and the fused arms are off while it runs. `RADIANCE_G4_CALIB_LAYERS=lo:hi` takes a slice of layers:
|
||||
the 31B's four taps a layer are ~364 MiB a rank at four ranks, and its 60 layers do not fit beside
|
||||
the weights in one pass. docs/GEMMA4-31B-GPTQ.md has the corpus, the run and what it changes.
|
||||
|
||||
**The 31B's junctions at four ranks.** At two ranks every junction carries the all-reduce in front
|
||||
of it (`ar_rmsnorm_quant_i8`). At four it does too, in steps of up to 16 rows (decode, and a DFlash
|
||||
or DFlash2 verify), on libr4d's `ar_rmsnorm_quant_i8_4rank`, in a form chosen by height. Every form
|
||||
|
||||
Reference in new issue
Block a user