Skip to content

[Fix] bailing: Renormalize top-k routing weights by default for Ling-2.5/2.6 - #45662

Merged
ch-wan merged 1 commit into
mainfrom
fix/bailing-linear-renormalize-default
Oct 21, 2026
Merged

ch-wan merged 1 commit into
mainfrom
fix/bailing-linear-renormalize-default

Conversation

@em-dreyer

@em-dreyer em-dreyer commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

The nightly test_ling_2_6_flash.py (8-GPU H200 and B200) has failed GSM8K since #44904. On 10/21 (8e3e2980d) it scored 0.39 on H200 and 0.35 on B200, against a 0.825 threshold. The 10/17 nightly scored 0.87.

Root cause:

  1. The BailingMoeV2_5ForCausalLM checkpoints (Ling-2.6-flash, Ling-2.5-1T, Ling-2.6-1T, Ring-2.5-1T) have no norm_topk_prob key. bailing_moe_linear.py reads getattr(config, "norm_topk_prob", False), so the router gets renormalize=False.
  2. The reference modeling_bailing_moe_v2_5.py always renormalizes the top-k weights, then multiplies by routed_scaling_factor (2.5):
    topk_weight = scores / (scores.sum(dim=-1, keepdim=True) + 1e-20) if self.top_k > 1 else scores
    topk_weight = topk_weight * self.routed_scaling_factor
  3. Ling-2.6-flash (256 experts, top-8) used to take the FlashInfer fused_topk_deepseek path, which always renormalizes regardless of the flag. That hid the wrong default.
  4. [Fix] moe: Renormalize per-rank shared-slot routing over routed experts only #44904 correctly gated that path on renormalize, so Ling moved to a path that respects renormalize=False. The top-k weights no longer sum to 1, the MoE output is mis-scaled at every layer, and GSM8K collapsed.

#44904 is correct and should stay; the bug is the model's default.

Modifications

bailing_moe_linear.py: norm_topk_prob now defaults to True, matching the reference modeling. Configs that set the key explicitly are unaffected.

Accuracy Tests

The CI test file was run unchanged (test_ling_2_6_flash.py: TP=4, NEXTN MTP, extra_buffer, 200-question 5-shot GSM8K) on 4×B200:

Commit GSM8K Mean accept len
4eb606b2ae (10/17 nightly, last green) 0.87 3.40
3a059de94c (parent of #44904) 0.86 —
48ea486928 (#44904) 0.355 2.38
8e3e2980db (10/21 nightly) 0.43 2.68
8e3e2980db + this change 0.87 3.40

The first bad commit was found by bisecting 62cee1b15c..8e3e2980db. The fixed run applied this same one-line change on top of 8e3e2980db; this branch is based on a newer main.

Not covered here: bailing_moe_v3.py has the same getattr(config, "norm_topk_prob", False) default. I haven't checked whether its reference modeling also always renormalizes.

Checklist

cc @ch-wan (#44904)

🤖 Generated with Claude Code


CI States

Latest PR Test (Base): ❌ Run #39671654604
Latest PR Test (Extra): ❌ Run #39671654736
Latest PR Test (AMD ROCm 10): ❌ Run #39671655084

…2.5/2.6

BailingMoeV2_5 checkpoints (Ling-2.6-flash) have no norm_topk_prob key,
so the model read renormalize=False. The reference modeling always
renormalizes before applying routed_scaling_factor. The FlashInfer
fused_topk_deepseek path renormalized regardless of the flag, which hid
the mismatch until #44904 gated that path on renormalize; since then
Ling-2.6-flash GSM8K fell from 0.87 to ~0.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ch-wan ch-wan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ch-wan
ch-wan marked this pull request as ready for review October 21, 2026 21:53
@ch-wan
ch-wan merged commit aa5880e into main Oct 21, 2026
111 of 127 checks passed
@ch-wan
ch-wan deleted the fix/bailing-linear-renormalize-default branch October 21, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants