Archived
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>
32 lines
2.1 KiB
Plaintext
32 lines
2.1 KiB
Plaintext
# gemma4-26b-a4b-df-pad768.recipe -- gemma-4-26B-A4B-it with its experts PADDED TO 768 wide, and
|
|
# z-lab's DFlash drafter, as arch/gemma4 serves it.
|
|
#
|
|
# rad-convert <padded gemma-4-26B-A4B-it checkpoint> --draft-model <gemma-4-26B-A4B-it-DFlash checkpoint> \
|
|
# --recipe data/recipes/gemma4-26b-a4b-df-pad768.recipe -o gemma4-26b-a4b-df-pad768.rad
|
|
#
|
|
# The padding happens BEFORE conversion, outside the engine: each expert's gate and up gain 64
|
|
# zero rows (704 -> 768) and its down 64 zero columns, and moe_intermediate_size becomes 768. It is
|
|
# exact -- gelu(0) * 0 = 0 in the added intermediate columns, which meet zero columns of down -- so
|
|
# the padded model computes the original's function. 768 is six whole 128-blocks, which the fp8
|
|
# grouped GEMM needs for down's K, and gate and up each start on a block boundary.
|
|
#
|
|
# Both expert projections block fp8. Everything else as gemma4-26b-a4b-df.recipe says.
|
|
|
|
blk.*.ffn_gate_up_exps.*.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
|
blk.*.ffn_down_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
|