Skip to content

fix: zero router aux loss in Qwen3.5 automodel recipes - #3169

Merged
yuki-97 merged 1 commit into
NVIDIA-NeMo:mainfrom
zpqiu:alexq/qwen35-automodel-router-aux-loss-0
Jul 13, 2026
Merged

yuki-97 merged 1 commit into
NVIDIA-NeMo:mainfrom
zpqiu:alexq/qwen35-automodel-router-aux-loss-0

Conversation

@zpqiu

@zpqiu zpqiu commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds hf_config_overrides.text_config.router_aux_loss_coef: 0.0 to the three Qwen3.5 Automodel recipes:

  • examples/configs/recipes/llm/grpo-qwen3.5-35ba3b-dapo-4n8g-automodel.yaml
  • examples/configs/recipes/llm/grpo-qwen3.5-35ba3b-2n8g-automodel-ep16.yaml
  • examples/configs/recipes/vlm/vlm_grpo-qwen3.5-35ba3b-geo3k-2n8g-automodel-ep16.yaml

Reran the above release test: https://wandb.ai/nvidia/nemorl-pr3196/runs/almaogtl

Why

The Automodel backend reads router_aux_loss_coef from the HF config (Qwen3.5 default: 0.001) and silently injects the MoE load-balancing aux-loss gradient into the router via MoEAuxLossAutoScaler during RL training. The load-balancing objective conflicts with the policy objective and severely degrades accuracy.

Verified on grpo-qwen3.5-35ba3b-dapo-4n8g-automodel with dynamic filtering=True (DAPOMathAIME2024 validation, otherwise identical runs):

  • Red: original run
  • Green: with router_aux_loss_coef=0.0
截屏2026-07-13 09 56 09

Wandb Link: https://wandb.ai/nvidia/nemorl-pr3196

The run with aux loss active also shows ~10x larger grad norm at step 1 (1.88 vs ~0.1) and token_mult_prob_error spikes up to ~2.0.

All other MoE Automodel recipes (nanov3, minimax-m27, gpt-oss) already zero this coefficient; the Qwen3.5 recipes were the only ones missing it. Qwen3.5 nests the field under text_config, and the value must be 0.0 (float) because Hugging Face strict config validation rejects YAML's integer 0.

Issues

N/A

🤖 Generated with Claude Code

@zpqiu
zpqiu requested review from a team as code owners July 12, 2026 06:38
@copy-pr-bot

copy-pr-bot Bot commented Jul 12, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@zpqiu
zpqiu requested review from terrykong and yuki-97 July 13, 2026 02:54
The Automodel backend silently reads router_aux_loss_coef from the HF
config (Qwen3.5 default: 0.001) and injects MoE load-balancing gradients
into the router via MoEAuxLossAutoScaler during GRPO training. The
load-balancing objective conflicts with the policy objective and
severely degrades accuracy: on grpo-qwen3.5-35ba3b-dapo-4n8g-automodel,
DAPOMathAIME2024 validation accuracy stalls at ~0.27-0.35 and decays
after step 30, vs 0.60 at step 30 and 0.68 at step 70 for an otherwise
identical run with the aux loss zeroed (also ~10x larger grad norm at
step 1). The 30-step nightly thresholds (reward > -0.7, accuracy > 0.2)
are too loose to catch this.

All other MoE automodel recipes (nanov3, minimax-m27, gpt-oss) already
zero this coefficient; the Qwen3.5 recipes were the only ones missing
it. Qwen3.5 nests it under text_config.

Signed-off-by: Zhaopeng Qiu <[email protected]>
@zpqiu
zpqiu force-pushed the alexq/qwen35-automodel-router-aux-loss-0 branch from cfe43e0 to 35c1c3b Compare July 13, 2026 08:36
@yuki-97 yuki-97 added CI:docs Run doctest r0.7.0 labels Jul 13, 2026
@yuki-97

yuki-97 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

/ok to test 35c1c3b

@yuki-97
yuki-97 enabled auto-merge (squash) July 13, 2026 15:03
@yuki-97
yuki-97 merged commit a2957f4 into NVIDIA-NeMo:main Jul 13, 2026
43 checks passed
sharonyu-115 added a commit to sharonyu-115/RL that referenced this pull request Jul 15, 2026
sharonyu-115 added a commit to sharonyu-115/RL that referenced this pull request Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants