
MoE Communication Overlap
OfficialFreeOptimize expert-parallel communication in Megatron Bridge.
Free · Opens the source repo
What MoE Communication Overlap does
MoE Communication Overlap is a specialized skill designed for optimizing the communication overhead in expert-parallel training setups using the Megatron Bridge framework. This skill is particularly beneficial when the number of experts is greater than one and when the dispatch or combine time is significant in the profiling results. By enabling this skill, users can enhance the throughput of their training runs, provided that the initial run configuration is already functioning correctly. The skill is not intended for early-stage setups but rather for tuning established configurations to improve performance.
To enable MoE Communication Overlap, users must adjust specific configuration settings in their training scripts. This includes enabling the overlap_moe_expert_parallel_comm flag and potentially using delayed weight gradient computation for further optimization. It is crucial to ensure that shared expert overlap is disabled when using dispatch overlap to avoid conflicts. The skill is designed for users who are familiar with the intricacies of Megatron and have experience in managing model parallelism configurations.
The skill's effectiveness can vary based on workload characteristics. It is most advantageous when the communication time associated with token dispatch is a noticeable factor in the overall step time. Users should be aware that performance gains are not guaranteed across all scenarios, especially in lightly loaded runs. Therefore, careful profiling and validation are necessary to ensure that the skill is beneficial for a given training setup.
For those looking to implement this skill, it is advisable to follow the provided prerequisites and guidelines closely. Users can validate the activation of the skill by checking for specific log messages during initialization and ensuring that the configuration settings align with the required parameters. This skill is particularly suited for advanced users who are looking to fine-tune their models for optimal performance in large-scale training tasks.
When to use it
Use this skill when you have a multi-expert model and need to optimize communication during training for better throughput.
When not to use it
Avoid using this skill during initial setup phases or when the model configuration is not yet stable; it is intended for performance tuning of established runs.
What you can build with it
Optimizing Large-Scale Training
When training large models with multiple experts, enabling MoE Communication Overlap can significantly reduce communication overhead, leading to faster training times.
Fine-Tuning Established Models
If your model is already running correctly, you can use this skill to tune and enhance throughput by optimizing communication paths.
Validating Performance Improvements
After enabling the skill, monitor the training logs for overlap-related messages to confirm that the optimization is active and effective.
How to install MoE Communication Overlap
View source1. Install with the skills CLI
npx skills add nvidia/skills/nemo-mbridge-perf-moe-comm-overlap --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by nvidiaMoE Communication Overlap
For the higher-level overview, see:
- @docs/training/communication-overlap.md
- @skills/nemo-mbridge-perf-moe-comm-overlap/card.yaml
Quick Decision
Use MoE communication overlap when:
EP > 1- token dispatch or combine time is visible in the profile
- the run is already correct and you are now tuning throughput
Avoid turning it on as an early bring-up step. It is easier to validate after the dispatcher, routing mode, and recompute plan are already stable.
Enablement
cfg.comm_overlap.overlap_moe_expert_parallel_comm = True
# Optional: delayed wgrad for additional overlap
cfg.comm_overlap.delay_wgrad_compute = True
# IMPORTANT: disable shared expert overlap when using dispatch overlap
cfg.model.moe_shared_expert_overlap = False
Prerequisites
expert_model_parallel_size > 1num_moe_experts > 1moe_token_dispatcher_typemust be"alltoall"or"flex"- Precision: BF16 or FP16
- If PP is used, VPP (
virtual_pipeline_model_parallel_size) must be set (non-None)
Flex dispatcher activation
Setting moe_flex_dispatcher_backend alone does not activate flex dispatch.
You must also set moe_token_dispatcher_type = "flex".
Recompute And CUDA Graph Interaction
- Full recompute is not a good companion for the overlap path.
delay_wgrad_computeadds further constraints if CUDA-graph scopes include attention or MoE-router work.- In practice, selective recompute is the safer pairing when overlap is enabled.
Measured Short-Run Caveat
A 2026-05-18 current-main H100 x16 smoke on Qwen3 30B-A3B mock pretraining
used EP=16, alltoall, global batch size 1024, CUDA graphs disabled, and
moe_permute_fusion=false because the PyTorch 25.11 / TE / Triton stack failed
in Transformer Engine fused permutation in prior bring-up.
Results were directional rather than release-grade:
- no EP overlap: 41.25s steady-state mean over iterations 3-8
- EP overlap: 31.31s steady-state mean over iterations 3-8
- EP overlap plus
delay_wgrad_compute: 31.20s steady-state mean over iterations 3-8
Treat this as evidence that EP overlap can help an inter-node alltoall MoE
shape when communication is exposed. It is not proof that delayed wgrad is a
separate win, and it does not validate the fused permutation path. An earlier
2026-05-16 short smoke on the same shape showed the same pattern.
Code Anchors
- Overlap validation:
src/megatron/bridge/training/comm_overlap.py - Flex dispatcher backend:
src/megatron/bridge/training/flex_dispatcher_backend.py - Config:
src/megatron/bridge/training/config.py - Unit tests:
tests/unit_tests/training/test_comm_overlap.py - DeepEP tests:
tests/unit_tests/training/test_deepep.py
Pitfalls
-
Shared expert overlap conflict:
moe_shared_expert_overlapandoverlap_moe_expert_parallel_commcan conflict. Disable shared expert overlap when using the dispatch overlap path. -
PP without VPP: MoE overlap requires VPP when pipeline parallelism is active. Without it, the overlap scheduling cannot interleave correctly.
-
Flex != backend flag:
moe_flex_dispatcher_backend="deepep"alone does nothing ifmoe_token_dispatcher_typeis still"alltoall". -
Conservative recipe defaults: Most public recipes leave MoE overlap disabled. You need to explicitly enable it via overrides.
-
Performance gains are workload-dependent: overlap helps most when dispatch communication is already a visible slice of step time. It is not guaranteed to help every small or lightly loaded EP run.
Verification
Look for overlap-related log messages during initialization. The comm overlap
validation in comm_overlap.py will raise if prerequisites are not met, so a
clean startup confirms the feature is active.
For a short performance-harness smoke, keep the command shape explicit and vary only one overlap knob at a time:
uv run python scripts/performance/run_script.py \
-m qwen \
-mr qwen3_30b_a3b \
--task pretrain \
-g h100 \
-c bf16 \
-ng 16 \
-gn 8 \
--max_steps 8 \
--cuda_graph_impl none \
--moe_flex_dispatcher_backend None \
--moe_a2a_overlap false \
--tokenizer_type NullTokenizer \
comm_overlap.overlap_moe_expert_parallel_comm=true \
comm_overlap.delay_wgrad_compute=false \
model.moe_shared_expert_overlap=false
If fused MoE permutation fails during bring-up, add
model.moe_permute_fusion=false to separate overlap timing from runtime-stack
validation, then retest with the matched production container.
Frequently asked questions about MoE Communication Overlap
Similar skills
Heap Snapshot Analysis
Investigate V8 heap snapshots for memory issues.
VS Code Performance Workflow
Automate performance investigations in VS Code.
Memory Leak Audit
Prevent memory leaks with effective coding patterns.
CPU Profile Analysis
Analyze V8 and Chrome performance profiles for optimization.
Chat Performance Testing
Benchmark and validate chat UI performance in VS Code.
Vercel React Best Practices
Optimize your React and Next.js applications for performance.
