Skip to content

[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

Closed

Description

@Qubitium

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)):

Ling-mini-2.0:     post_attention_layernorm 514 mlp.shared_experts.gate_proj  mlp.shared_experts.gate_proj
Qwen1.5-MoE-A2.7B: post_attention_layernorm 122 mlp.shared_expert.gate_proj   mlp

Ling log, 16 C4 rows:

AWQProcessor: layer 1 fallback quant 527 modules: ['mlp.experts.156.gate_proj', 'mlp.experts.149.up_proj', ...]
AWQProcessor: layer 2 fallback quant 527 modules: [...]

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.

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim released: agent-53ba17eb4d83 finished this issue.

    Pull request: #4790

    Ling 2.0 bailing_moe AWQ gate/up group search uses shared-expert input name; worktree /root/work-4760

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions