MoE Pipeline Stage Asymmetry Hang
When using a custom `--pipeline-model-parallel-layout`, users may configure a pipeline stage to have zero MoE layers (e.g., placing all MoE layers in the middle stages). However, the logging/loss aggregation function `reduce_aux_losses_tracker_across_ranks` implicitly assumes all ranks in the pipeline group possess MoE layers and invokes an AllReduce across the entire pipeline group. The stage with 0 MoE layers bypasses the MoE loss logic and never joins the AllReduce, causing the other stages to hang forever waiting for it.
When using a custom `--pipeline-model-parallel-layout`, users may configure a pipeline stage to have zero MoE layers (e.
- Root cause
- When using a custom `--pipeline-model-parallel-layout`, users may configure a pipeline stage to have zero MoE layers (e.g., placing all MoE layers in the middle stages).
- Recommended fix
- Balance MoE Layers or Patch Reduction Group Ensure each PP stage has at least 1 MoE layer in your layout. If all stages participate in the MoE logic, the AllReduce will succeed. Alternatively, patch the Megatron code to use a custom NCCL communicator that only includes ranks containing MoE layers.
- How Denpex helps
- Denpex matches MoE Pipeline Stage Asymmetry Hang across every rank in a distributed run and reports which rank failed first, so you act on the initiating node instead of the loudest one.
What this failure is
MoE Pipeline Stage Asymmetry Hang is a Model failure seen during ML training runs. When using a custom `--pipeline-model-parallel-layout`, users may configure a pipeline stage to have zero MoE layers (e.g., placing all MoE layers in the middle stages). However, the logging/loss aggregation function `reduce_aux_losses_tracker_across_ranks` implicitly assumes all ranks in the pipeline group possess MoE layers and invokes an AllReduce across the entire pipeline group. The stage with 0 MoE layers bypasses the MoE loss logic and never joins the AllReduce, causing the other stages to hang forever waiting for it. Common tags: Pipeline Configuration.
Is this what broke your run? Paste your log.
You're reading about MoE Pipeline Stage Asymmetry Hang. Paste your own crash log or traceback below and get the real root cause for YOUR run, not this generic entry. No account, no card. Logs are masked at ingress and never saved to account history.
Want 14 days on the Scale plan?
Request an evaluation code. A verified workplace organization activates up to 50 diagnoses a day, alerts, history, and follow-up questions. No credit card or automatic subscription.
Why it happens (the mechanism)
Users assume the layout is valid because the model builds and allocates memory without errors. The failure only hits during the specific synchronization point for auxiliary losses.
What you'll observe
- Process stuck in reduce_aux_losses_tracker_across_ranks
- NCCL timeout waiting on rank in pipeline group
Common symptoms and what they mean
| Symptom | Why it happens |
|---|---|
| Training initialization succeeds, but hangs indefinitely upon completing the first forward pass or when logging auxiliary losses. | When using a custom `--pipeline-model-parallel-layout`, users may configure a pipeline stage to have zero MoE layers (e.g., placing all MoE layers in the middle stages). However, the logging/loss aggregation function `reduce_aux_losses_tracker_across_ranks` implicitly assumes all ranks in the pipeline group possess MoE layers and invokes an AllReduce across the entire pipeline group. The stage with 0 MoE layers bypasses the MoE loss logic and never joins the AllReduce, causing the other stages to hang forever waiting for it. |
| Occurs specifically when using custom pipeline layouts with MoE models. | When using a custom `--pipeline-model-parallel-layout`, users may configure a pipeline stage to have zero MoE layers (e.g., placing all MoE layers in the middle stages). However, the logging/loss aggregation function `reduce_aux_losses_tracker_across_ranks` implicitly assumes all ranks in the pipeline group possess MoE layers and invokes an AllReduce across the entire pipeline group. The stage with 0 MoE layers bypasses the MoE loss logic and never joins the AllReduce, causing the other stages to hang forever waiting for it. |
Which systems are affected
- Megatron-LM
- Pipeline Parallelism
How to confirm this is the problem
Use this checklist to test the hypothesis against a small reproduction. No single line proves the root cause, so preserve the preceding events and compare one variable at a time.
- ✓Inspect the `--pipeline-model-parallel-layout` argument and cross-reference with where MoE layers are injected.
- ✓Use `py-spy` and check if ranks are blocked inside `reduce_aux_losses_tracker_across_ranks`.
- ✓Check if `--moe-router-load-balancing-type` implies aux loss calculation.
The fix and the prevention pattern
The root cause is on this page and stays free. A free account adds the exact remediation steps, saved history, and the fix on every entry in the encyclopedia.
Sign up free. Unlock the full analysisNo credit card. Daily allowance follows verified trust tier. Instant access.
Diagnose this failure in VS Code
Select the traceback or open the failed terminal, then run Denpex locally to see the initiating rank, collateral failures, exact fix, and verification command without uploading the log.
Install the free VS Code extensionRoot cause
- When using a custom `--pipeline-model-parallel-layout`, users may configure a pipeline stage to have zero MoE layers (e.g., placing all MoE layers in the middle stages). However, the logging/loss aggregation function `reduce_aux_losses_tracker_across_ranks` implicitly assumes all ranks in the pipeline group possess MoE layers and invokes an AllReduce across the entire pipeline group. The stage with 0 MoE layers bypasses the MoE loss logic and never joins the AllReduce, causing the other stages to hang forever waiting for it.
The fix and how to prevent it
Evaluate Denpex on your own logs
Request a Scale evaluation code. A verified workplace organization activates 14 days with up to 50 diagnoses a day. Every account keeps its current diagnosis allowance and gets a verification path. No card or automatic subscription.
Don't just read the fix, diagnose your run
The encyclopedia tells you what went wrong. Denpex tells you what went wrong in YOUR training run. With your logs, your config, and your stack.