This repository has been archived on 2026-11-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
radiance-sycl/data/recipes/gemma4-26b-a4b-df.recipe
T
AshlynandClaude Opus 5.5 743b7e1a6a arch/gemma4: the DFlash head reads a block-fp8 copy of the table where the container holds one
The drafter's head was `gemm_nt` over the target's bf16 table -- 352 MiB a rank at tp 4, every draft
pass, 566 us of a 26B-A4B decode step under --profile-ops on 4x R9700: the widest read on the draft
path, and the "first thing to change once the model runs" its own comment named.

A container may now hold the table a second time as `dflash.draft_head.weight`, block fp8 -- one
checkpoint tensor, two logical weights, as rad_block_dflash2.h does it -- made by the recipe line

    dflash.draft_head.weight  rtn codes=fp8_e4m3 block=128x128 scale=bf16

which the three gemma4-26b-a4b -df recipes now carry. Where the copy is there, the head is
quant_act_fp8 over the gathered rows and gemm_nt_q over the copy at fp8a8: half the bytes, for 176
MiB a rank more. The copy is row-sharded exactly as the table, so a rank's rows are the same
vocabulary slice and row_topk's vocab_off, the all_gather and pair_argmax are unchanged. Drafts are
verified, so the coarser logits change what is proposed and never what is accepted --
draft_n_accepted says whether they propose worse; there is no rerank against the bf16 table yet.

Where the copy is not there -- every container converted before this, or one whose recipe made it
something other than block fp8 -- the head reads the bf16 table exactly as before. The decision is
the stored encoding's (weight_enc on the copy's name), and the copy's name map entry alone writes
nothing: rad-convert walks the declared weights. The startup note names the head in use. The
block-fp8 test moves to one helper, which the routed experts' encoding check now uses too.

arch_test: with the copy's encoding block fp8, the copy is declared and the head is gemm_nt_q over
it from the quantised rows; without, nothing is declared and the head is gemm_nt over the table;
a draft pass issues the head once either way. ARCHITECTURES.md says so.

Not yet run on the cards; it needs a container converted with the new recipe line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 14:40:04 -05:00

34 lines
2.1 KiB
Plaintext

# gemma4-26b-a4b-df.recipe -- gemma-4-26B-A4B-it with z-lab's DFlash drafter, from the bf16
# checkpoint as Google ships it, as arch/gemma4 serves it.
#
# rad-convert <gemma-4-26B-A4B-it checkpoint> --draft-model <gemma-4-26B-A4B-it-DFlash checkpoint> \
# --recipe data/recipes/gemma4-26b-a4b-df.recipe -o gemma4-26b-a4b-df.rad
#
# The routed experts are ~90% of the weight bytes and a decode step reads whichever were routed.
# Their gate_up is block fp8: 2 x 704 = 1408 rows are whole 64-row GEMM tiles and eleven 128-row
# scale blocks, and K = 2816 is 22. A third of the expert bytes a decode step reads.
#
# Their down projection stays bf16: K is the expert width, 704, and the fp8 grouped GEMM reads K
# in whole 128-column blocks. gemma4-26b-a4b-df-pad768.recipe makes it fp8 as well, from a
# checkpoint whose experts were padded to 768 first.
#
# The attention, the dense arm, the router, the norms and the tied embedding stay bf16: together
# under a tenth of the bytes, and the dense arm's 2112 is not whole 128-blocks either.
blk.*.ffn_gate_up_exps.*.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
# The DFlash drafter's six linears: block fp8 (the drafter only proposes; the trunk verifies).
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
# The drafter's head: the target's tied table again under a name of its own, block fp8, which the
# draft head reads instead of the bf16 table -- half the widest read on the draft path, for half
# the table's bytes again (176 MiB a rank at tp 4). Drafts are verified, so this changes what is
# proposed, never what is accepted.
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16