recipe: PARO M2XFP4 with the standard MTP head (graft of mtp.* from bf16; blk.64 rtn ahead of the trunk m2xfp4 imports); container packs 20.03 GB and serves at MTP depth 3

This commit is contained in:
hugypufy committed 2026-10-23 12:25:59 +01:00
1 parent 29869dd70e
commit 6ae8136d3d
1 file changed
+51
@@ -0,0 +1,51 @@
# q38-27b-paro-m2xfp4-mtp.recipe -- a ParoQuant M2XFP4 Qwen3.8-27B (quant_method
# paroquant_m2xfp4) with the base model's STANDARD MTP head instead of a DFlash2 drafter.
# The MTP head ({mtp.layers.0.*, mtp.fc, mtp.norm, mtp.pre_fc_norm_*, mtp.draft_head})
# is grafted from the bf16 release; blk.64 is its transformer block, so its linears take
# the rtn rule ahead of the trunk's m2xfp4 imports (first matching rule decides).
#
# tools/rad_pack_m2xfp4.py <paroqant result dir> --model <donor> --recipe \
# data/recipes/q38-27b-paro-m2xfp4-df2.recipe --draft <DFlash2> -o q38-27b-paro-m2xfp4-df2.rad
#
# The trunk's linears are imported as they ship, and need no rule: e2m1 codes, an E8M0 exponent a 32
# of K and the scheme's metadata byte a group (four 2-bit subgroup multipliers, subgroup s in bits
# [2s, 2s+2)), stored in the ROTATED basis ParoQuant trained them in, with the rotations beside
# them as the encoding's "givens" transform (abi/rad_encoding.h): per projection the Givens pairs
# and angles of krot stages inside groups of 128 columns, and the channel scales. A fused gate|up or
# qkv|z keeps one set of tables a checkpoint tensor (parts). rad-convert writes them as planes of
# the weight; the GEMM is the plain M2XFP4 one, and the activation is rotated in front of it
# (givens_dense_quant) -- nothing is re-quantised, so the weights are the fine-tune's to the bit.
#
# What the checkpoint does NOT ship in a form the architecture declares gets a rule. `convert`
# loads the donor fp16, so everything it does not re-quantise is fp16 where the plugin declares
# bf16 or f32: `cast` rounds once. The head is quantised as in every recipe here; the MTP head is
# not read, since the DFlash2 drafter displaces it. THE DRAFTER is made as small as its acceptance
# allows, as in q38-27b-m2xfp4-df2.recipe.
blk.*.attn_norm.weight cast dtype=f32
blk.*.attn_q_norm.weight cast dtype=f32
blk.*.attn_k_norm.weight cast dtype=f32
blk.*.ffn_norm.weight cast dtype=f32
dflash.blk.*.attn_norm.weight cast dtype=f32
dflash.blk.*.attn_q_norm.weight cast dtype=f32
dflash.blk.*.attn_k_norm.weight cast dtype=f32
dflash.blk.*.ffn_norm.weight cast dtype=f32
blk.64.*.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
mtp.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
blk.*.ssm_ab.weight cast dtype=bf16
blk.*.ssm_conv1d.weight cast dtype=bf16
token_embd.weight cast dtype=bf16
v.* cast dtype=bf16
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