You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[QUALITY] #4720 incomplete: Ling 2.0 (bailing_moe) AWQ still RTNs all 514 shared+routed expert gate/up per MoE layer when one expert is starved (group search input is the shared expert, so the split is skipped) #4760
Found on main @ 2b7a0b5, RTX 4090 (sm_89, CUDA 13.2, torch 2.15, transformers 5.22.1). Also reproduced at b225a43, and at e2a5ff6fa~1.
What is wrong
#4720 (the fix for #4675) keeps AWQ for the covered experts of a routed-expert gate/up group. It drops only the starved members, and only when the group's search input is not one of its members: shared_search_input = cfg.get("_input_feature_name") not in layer_names (gptqmodel/looper/awq_processor.py, _quantize_layer). Otherwise the old all-or-nothing veto still applies (if not shared_search_input or not starved_names: fallback_names.update(layer_names)).
On Ling 2.0 (bailing_moe), the MoE gate/up group is post_attention_layernorm -> [mlp.shared_experts.gate_proj, mlp.shared_experts.up_proj, mlp.experts.{0..255}.gate_proj/up_proj] (514 members). awq_get_modules_for_scaling gives it _input_feature_name = "mlp.shared_experts.gate_proj", which is a member, instead of the MoE root mlp. This is the root that Qwen1.5-MoE's group uses (_input_feature_name = "mlp"). Both features hold the same post-norm activations ((1, 362, 2048) here), but the name check decides the path. So one starved routed expert still sends all 514 projections to RTN in every MoE layer, which is exactly the #4675 behavior. The likely cause is the root != last_module_root gate around models/base.py:5796-5809: the root input feature is only chosen when module2inspect is resolved for a new root. Ling's tree declares a dense mlp block next to mlp:moe, and the router mlp.gate sets last_module_root = "mlp" before the experts block.
Evidence
Ling-mini-2.0 truncated to 3 layers (layer 0 dense, layers 1-2 MoE with 256 experts + shared experts), default AWQConfig(bits=4, group_size=128), batch_size=1. Groups returned by awq_get_modules_for_scaling ((prev_op, #members, first member, _input_feature_name)):
That is 514 gate/up (all 256 routed experts and the shared expert) plus the 13 starved experts' down_proj. There is no keeps AWQ for N of M members line, so #4720's split never runs. The 64-row result is the same (fallback quant 530 / 531), as is a run with subset early-stop disabled, so this is not #4738.
Suggested fix
Give the routed-expert gate/up group the MoE root feature (mlp) whenever the block is an MoE gate/up block, independent of last_module_root bookkeeping.
Or make shared_search_input check whether the search input is a routed member: a shared expert always executes and its input is the norm output, so it is a valid search input that cannot be starved.
Test that should have caught it
tests/test_awq_moe_starved_expert_group_4675.py uses a tiny Qwen3-MoE with no shared expert. Add a shared-expert MoE with a router bias that starves one expert: a tiny bailing_moe (whose tree also declares a dense mlp), plus qwen2_moe/deepseek_v2 as controls. Assert that the other experts' and the shared expert's gate/up keep AWQ.
Severity
High (silent quality loss). Default AWQ on Ling 2.0 / Ling-flash (256 routed experts) RTNs every routed and shared expert gate/up projection in every MoE layer, as soon as any one expert is below Fallback.threshold. With 256 experts that happens in practice: 13-17 experts per layer at 16-64 rows.
Activity
Qubitium commentedon Nov 17, 2026
Agent claim released:
agent-53ba17eb4d83finished this issue.Pull request: #4790
Ling 2.0 bailing_moe AWQ gate/up group search uses shared-expert input name; worktree /root/work-4760
fix(awq): search the MoE root feature for shared-expert gate/up groups (
Port every supported model onto the Transformers 5.23 ABI; never patc…
refactor(awq): build scaling groups from fold declarations; the tree …