Repository navigation
Description
Summary
Every qwen3.5-MoE / qwen3.6-MoE checkpoint fails to load with Missing weight: model.layers.0.mlp.switch_mlp.gate_proj. Found by the 2026-07-06 full benchmark sweep: qwen3.5-35b-a3b-4bit and qwen3.6-35b-a3b-4bit benched fine on 2026-06-12 (70 and 67 tok/s decode) and are FAIL:bench now.
Root cause
- PR fix(qwen3-next): make real checkpoints load and run (MoE naming, gated-delta slice, mask, stateful decode) #588 (2026-06-16, "make real checkpoints load and run") renamed the shared
qwen3_nextSwitchGLU/SparseMoeBlockexpert projections fromw1/w2/w3togate_proj/up_proj/down_proj(src/models/qwen3_next.rs,SwitchGLU::from_weightsnow requests{prefix}.gate_projetc.). src/models/qwen3_5.rsreuses thatSparseMoeBlock, but itssanitize_weightsstill normalizes toward the OLD naming: step 6 stacksexperts.{e}.{w1,w2,w3}intoswitch_mlp.{w1,w2,w3}, and step 8 renames pre-stackedswitch_mlp.{gate_proj,up_proj,down_proj}intoswitch_mlp.{w1,w3,w2}. The block then asks forswitch_mlp.gate_projand finds nothing.- PR fix(qwen3.5-moe): stack per-expert gate_proj/up_proj/down_proj weight names #587 (2026-07-01) added a per-expert
gate_proj/up_proj/down_projstacking pass, but it also targets the stalew1/w3/w2slot names. Its unit tests assert sanitize OUTPUT keys only and never runQwen35Model::from_weights, so they pass against the wrong convention: the same "synthetic passes, real checkpoint fails" class as fix(qwen3-next): make real checkpoints load and run (MoE naming, gated-delta slice, mask, stateful decode) #588 itself.
Fix
Align qwen3_5::sanitize_weights with the post-#588 block naming: stack experts.{e}.w1/w2/w3 into switch_mlp.gate_proj/down_proj/up_proj (w1 to gate, w2 to down, w3 to up), keep pre-stacked switch_mlp.{gate,up,down}_proj untouched, REVERSE step 8 to rename legacy stacked w1/w2/w3 into the gate/up/down names, and retarget the #587 per-expert pass at the gate/up/down slots. Update the #587 tests to the new expected keys, and add the missing gate: a test that runs sanitize + Qwen35Model::from_weights end to end on tiny synthetic MoE weights in each naming convention (pre-stacked gate/up/down, pre-stacked w1/w2/w3, per-expert w1/w2/w3, per-expert gate/up/down).
Acceptance Criteria
-
qwen3_5::sanitize_weightsproducesswitch_mlp.gate_proj/up_proj/down_projfor all four input naming conventions (pre-stacked gate/up/down, pre-stacked w1/w2/w3, per-expert w1/w2/w3, per-expert gate/up/down). - New end-to-end test runs sanitize +
Qwen35Model::from_weightson tiny synthetic MoE weights for each convention; fix(qwen3.5-moe): stack per-expert gate_proj/up_proj/down_proj weight names #587 unit tests updated to the new expected keys. - Real-checkpoint load + generate succeeds on
models/qwen3.5-35b-a3b-4bitandmodels/qwen3.6-35b-a3b-4bit(both are VLM exports withlanguage_model.*nesting, routed throughload_qwen3_5_moe_vlm). - Dense qwen3.5 regression check passes (e.g. qwen3.5-4b-4bit).
- Both MoE models re-added to the 2026-07-06 benchmark CSV.
Activity
fix(qwen3.5-moe): sanitize toward the gate/up/down expert names Spars…
bench: 2026-07-06 M1 Ultra full refresh (post VLM-port and fix batche…
fix(qwen3.5-moe): sanitize toward the gate/up/down expert names Spars…
bench: 2026-07-06 M1 Ultra full refresh (post VLM-port and fix batche…