Skip to content

fix(moe): preserve DeepEP autograd for empty expert ranks - #3680

Draft
Slyne wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
Slyne:slyne/fix/deepep-empty-rank-autograd
Draft

fix(moe): preserve DeepEP autograd for empty expert ranks#3680
Slyne wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
Slyne:slyne/fix/deepep-empty-rank-autograd

Conversation

@Slyne

@Slyne Slyne commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep the zero-local-token GroupedExpertsDeepEP path connected to the tensors returned by DeepEP dispatch
  • attach zero-valued dependencies for all local expert parameters so empty EP ranks still enter reverse dispatch and materialize optimizer gradients
  • stabilize the empty routing-probability dtype across activation-checkpoint recomputation
  • add CPU coverage and a scheduled two-GPU DeepEP regression with deliberately imbalanced routing

Motivation

When one EP rank receives no local expert tokens, the previous fallback built its dummy computation from the original input. That bypassed FusedDispatch autograd on that rank while peers entered the reverse-dispatch collective, causing either a no-grad error or a distributed timeout during backward.

Verification

  • ruff format --check and ruff check on the changed Python files
  • 3 focused GroupedExpertsDeepEP CPU regression cases passed
  • shell syntax check for the new L2 launcher
  • end-to-end Hero5c CP=1/EP=8 head-only MTP training completed five 12,288-token optimizer steps on eight H100s (Slurm 6351147)

The new standalone two-GPU L2 guard is included for CI execution. A CP=2/EP=4 end-to-end smoke remains a draft-PR gate.

Related

Signed-off-by: SlyneD <slyned@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 25, 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.

@HuiyingLi

Copy link
Copy Markdown
Contributor

Hi @Slyne, what failure did you see? Hang?

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