Skip to content

Commit e87d715

Browse files
kmbandyclaude
andcommitted
fix(calib): include down_proj as its own sub-group in the dense block walk
down_proj was omitted from the qwen35 dense sub-group enumeration, so under default tiering it never became a real ml8 target. Add it as a trailing sub-group (reads the quantized FFN intermediate -> quantized LAST). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e01f1f5 commit e87d715

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

scripts/calibration/block_arch_adapter.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,31 @@ class Qwen35BlockAdapter(DefaultBlockAdapter):
3636
# LINEARS ['linear_attn.out_proj', 'linear_attn.in_proj_qkv', 'linear_attn.in_proj_z',
3737
# 'linear_attn.in_proj_b', 'linear_attn.in_proj_a',
3838
# 'mlp.gate_proj', 'mlp.up_proj', 'mlp.down_proj']
39-
# FP8-tier (not ML8 targets, excluded from groups):
40-
# linear_attn.out_proj, linear_attn.in_proj_a, linear_attn.in_proj_b, mlp.down_proj
41-
# ML8-tier targets (confirmed by probe):
42-
# linear_attn.in_proj_qkv, linear_attn.in_proj_z -- read block input together
43-
# mlp.gate_proj, mlp.up_proj -- read FFN input together
39+
# Which leaves are ML8 targets is decided PER-RUN by the tier map (is_ml8),
40+
# NOT hardcoded here — ml8_targets filters every sub-group by is_ml8(), so a leaf
41+
# tiered fp8/native (linear_attn.out_proj / in_proj_a / in_proj_b by default, or
42+
# mlp.down_proj under ML8_TIER_OVERRIDE=ffn_down=fp8) drops out cleanly, and a leaf
43+
# tiered ml8 (mlp.down_proj by default) is included. The sub-group SHAPE below only
44+
# encodes causal DEPENDENCY ORDER (which leaves share an input / must be quantized
45+
# before which), so it is safe to list every quantizable leaf — the tier map gates
46+
# membership. (Bugfix: down_proj was previously omitted here, so under default
47+
# tiering it was silently dropped — neither ml8 nor fp8 — leaving the highest-slack
48+
# FFN tensor unquantized unless an override forced it to fp8.)
49+
# in_proj_qkv, in_proj_z -- read block input together
50+
# gate_proj, up_proj -- read FFN input together
51+
# down_proj -- reads the (quantized) FFN intermediate -> own sub-group, LAST
4452
_SSM_GROUPS = [
4553
["linear_attn.in_proj_qkv", "linear_attn.in_proj_z"],
4654
["mlp.gate_proj", "mlp.up_proj"],
55+
["mlp.down_proj"],
4756
]
4857
# Full-attention block kind (best-effort; 0.8B is all delta-net, validated
4958
# later by the run_block equivalence gate):
5059
_ATTN_GROUPS = [
5160
["self_attn.q_proj", "self_attn.k_proj", "self_attn.v_proj"],
5261
["self_attn.o_proj"],
5362
["mlp.gate_proj", "mlp.up_proj"],
63+
["mlp.down_proj"],
5464
]
5565

5666
def ml8_targets(self, block, block_idx, is_ml8):

0 commit comments

Comments
 (0)