arch/common, data/recipes: an M2XFP4 DFlash2 drafter -- DenseFP8 declares and issues an m2xfp4 weight, and q38-27b-m2xfp4-df2.recipe converts one

DenseFP8, the drafter's linear, reads a plain m2xfp4 encoding as LinearFP8 does: the weight view
takes the codes and meta planes together, the E8M0 plane is b_scale and b_ref, and gemm() issues
gemm_nt_q at dtype m2xfp4 over the same E4M3 pair. declare_slice stays block fp8 and clears the
flag. The DFlash2 block keeps an M2XFP4 gate_up off the fp8a8 gated fold, as it does an MXFP4 one.
The recipe is q38-27b-mxfp4-df2.recipe with its 4-bit trunk and drafter rules at m2xfp4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hugypufyandClaude Opus 5.5 authored and StillDeadcode committed 2026-10-26 09:24:01 +01:00
1 parent 1c6acaf84b
commit 22df1c7264
3 files changed
+82 -6

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
# q38-27b-m2xfp4-df2.recipe -- a bf16 Qwen3.8-27B (or a finetune of it) at M2XFP4 with the DFlash2
# drafter.
#
# rad-convert <bf16 Qwen3.8-27B checkpoint> --draft-model <z-lab/Qwen3.8-27B-DFlash2> \
# --recipe q38-27b-m2xfp4-df2.recipe \
# --set quantization_config.quant_method=fp8 --set quantization_config.fmt=e4m3 \
# -o q38-27b-m2xfp4-df2.rad
#
# The --set keys give the container the family's fp8 descriptor, so qwen35_fp8 serves it as it
# serves the Quark, ParoQuant and NVFP4 releases; without them a bf16 checkpoint selects
# qwen35_bf16, which has no 4-bit GEMM.
#
# q38-27b-mxfp4-df2.recipe with its 4-bit rules at M2XFP4 (`m2xfp4`, docs/TOOLS.md): the MXFP4
# codes and e8m0 exponent per 32 of K plus one metadata byte a group, whose four 2-bit extra
# mantissas refine the exponent per 8 columns, chosen by least squared error from the bf16 source,
# once. The delta net's a/b projections, the norms, the embedding and the vision tower stay bf16;
# the head goes block fp8 as in the other 27B recipes. The checkpoint's MTP head is not read: the
# DFlash2 drafter displaces it.
#
# The drafter's linears go to M2XFP4 as well, beside the same 2-bit copy of the target's head (u2
# with a u8 zero, least-squares clip search) whose top 32 the engine rescores against the target's
# fp8 head.
blk.*.ffn_gate_up.weight m2xfp4
blk.*.ffn_down.weight m2xfp4
blk.*.attn_qg.weight m2xfp4
blk.*.attn_k.weight m2xfp4
blk.*.attn_v.weight m2xfp4
blk.*.attn_output.weight m2xfp4
blk.*.ssm_inz.weight m2xfp4
blk.*.ssm_out.weight m2xfp4
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
dflash.fc.weight m2xfp4
dflash.blk.*.attn_q.weight m2xfp4
dflash.blk.*.attn_k.weight m2xfp4
dflash.blk.*.attn_v.weight m2xfp4
dflash.blk.*.attn_output.weight m2xfp4
dflash.blk.*.ffn_gate_up.weight m2xfp4
dflash.blk.*.ffn_down.weight m2xfp4