Nemo Mbridge Perf Moe Long Context
NVIDIAOfficialPublished by NVIDIA
- Skill
- Guidelines
- Software development
- Apache-2.0
- Medium risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides architectural patterns and configuration strategies for training MoE models at long sequence lengths. It synthesizes findings from various model experiments to help practitioners manage memory constraints, throughput, and parallelism trade-offs when scaling beyond standard sequence lengths.
What it does
- Provides rules of thumb for context parallelism (CP) sizing based on sequence length.
- Outlines strategies for selective activation recomputation to manage memory.
- Offers configuration templates for different hardware and model scales.
- Details considerations for dispatcher choices and pipeline layouts.
- Identifies common pitfalls in long-context training, such as CUDA graph limitations.
- Suggests methods for balancing parallelism dimensions like TP, EP, and PP.
When to use it
- When training MoE models at long sequence lengths.
- When troubleshooting out-of-memory (OOM) errors in long-context MoE runs.
- When investigating throughput degradation during long-context scaling.
- When determining appropriate parallelism layouts for large-scale model training.
Advantages
- Provides empirically derived scaling patterns for complex MoE architectures.
- Helps balance memory usage against GPU-count feasibility.
- Offers actionable advice on recompute strategies to optimize memory footprint.
- Clarifies the interaction between different parallelism dimensions.
Usage examples
- “How should I determine the initial CP size for a 128k sequence length MoE model?”
- The skill suggests starting with a CP value derived from the sequence length divided by 4096, then rounding to a practical power-of-two layout.
- “What recompute strategy is recommended for long-context MoE training?”
- It advises preferring selective recompute of modules like up_proj, norm, moe, or mlp before considering full recompute.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/nvidia/nemo-mbridge-perf-moe-long-context/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip nemo-mbridge-perf-moe-long-context.zip -d .agents/skills
Documentation by NVIDIA
MoE Long-Context Training
Stable docs: @docs/training/moe-optimization.md Card: @skills/nemo-mbridge-perf-moe-long-context/card.yaml
What Changes At Long Context
Once sequence length moves well past the 4K-class regime, attention memory and activation residency become the dominant constraints. For MoE models, that usually means you need some combination of:
context parallelism
selective recompute
lower precision
CPU offload for optimizer state
a dispatcher and PP layout that do not waste the smaller remaining DP budget
Rounded Scaling Patterns
DSV3 on H100
The DSV3 long-context runs show a stable pattern:
selective recompute works better than full recompute once you move past the shortest contexts
throughput stays in a fairly narrow band from mid-length through very long contexts if CP is increased appropriately
the trade shifts from "memory fit" to "GPU-count feasibility" as CP grows
In other words, long context does not immediately collapse utilization if the layout is chosen well, but it does consume the DP budget very quickly.
Qwen3-Next on GB200
Qwen3-Next behaves more like a memory-sensitive medium-scale model:
8K and 32K remain practical with moderate CP
64K is possible, but the throughput drop is noticeable and memory becomes much tighter
pipeline layout and grouped-GEMM improvements matter almost as much as CP
Qwen3 235B on GB200
Qwen3 235B shows that long context can still be efficient on NVL72 systems when TP, CP, and HybridEP are coordinated. The best 128K-class configurations are not just "fit-only" recipes; they can remain highly efficient if routing, parallelism, and recompute are balanced.
CP Sizing Rules Of Thumb
Start from a 4K shard target: a good first guess is
CP ~= seq_len / 4096, then round to a practical power-of-two layout.Keep DP alive if possible: long-context scaling becomes brittle once CP, EP, TP, and PP together squeeze DP down to the floor.
Prefer selective recompute: recompute modules such as
up_proj,norm,moe,moe_act, ormlpbefore reaching for full recompute.Avoid SDPA-heavy recompute at very long context: recomputing attention internals can add a lot of work for less memory benefit than recomputing smaller MoE and MLP-side modules.
Use TP as another lever on NVL72 systems: GB200 and GB300 runs can sometimes trade some CP for TP while still staying efficient.
Assume GBS will need to shrink: as CP rises and DP falls, you may need to reduce global batch size or accept higher GA.
Representative Config Families
DSV3 at 128K on H100
TP=1 CP=32 EP=32 PP=8 VPP=4
Precision: FP8-class
Dispatcher: DeepEP
Recompute: up_proj, norm, moe, mlp
Extra memory help: optimizer CPU offloadDSV3 at 256K on H100
TP=1 CP=64 EP=32 PP=8 EDP=2 VPP=4
Precision: FP8-class
Dispatcher: DeepEP
Recompute: up_proj, norm, moe, mlp
Extra memory help: optimizer CPU offloadQwen3 235B at 128K on GB200
TP=4 CP=4 EP=32 PP=4 VPP=12
Precision: BF16 or MXFP8
Dispatcher: HybridEP
Recompute: moe_act, norm
CUDA Graph: attn + moe_router + moe_preprocessRecompute And CUDA Graph Guidance
For long-context MoE training:
start with selective recompute
add CUDA graphs only after the shapes and routing path are stable
keep sequence length and MBS fixed when using CUDA graphs
if the run depends on highly dynamic batches, prefer eager execution
Useful references:
@docs/training/activation-recomputation.md
@skills/nemo-mbridge-perf-cuda-graphs/SKILL.md
Pitfalls
CP does not replace EP or PP: it adds another dimension; it does not make the others disappear.
A good 4K baseline can still be a bad long-context baseline: routing mode, recompute choice, and offload strategy often need to change.
GPU-count feasibility becomes the real constraint: very long context can look fine in a single recipe, then become impossible once EP and PP are added honestly across the full model.
CUDA graphs need static shapes: variable-length batches and opportunistic padding strategies can silently break the path.
Container and kernel support matters more at 128K+: long-context paths tend to rely on newer kernels and bug fixes than short-context bring-up does.
Files
- ATTRIBUTION.mdAdded by AutoGineer867 B
- BENCHMARK.md4.3 KiB
- LICENSELicence file added by AutoGineer11.2 KiB
- SKILL.md4.8 KiB
- card.yaml3.4 KiB
- evals/evals.json1.6 KiB
- skill-card.md3.8 KiB
- skill.oms.sig4.7 KiB
skill-card.md
Description: <br>
Long-context MoE training guidance for Megatron Bridge covering CP sizing, selective recompute, dispatcher choices, and practical patterns from DSV3, Qwen3, and Qwen3-Next long-context experiments. <br>
This skill is ready for commercial/non-commercial use. <br>
Owner
NVIDIA <br>
License/Terms of Use: <br>
Apache 2.0 <br>
Use Case: <br>
Developers and engineers training MoE models at long sequence lengths (16K–256K tokens) who need guidance on context parallelism sizing, selective recompute strategies, and dispatcher selection to avoid OOM or degraded throughput. <br>
Deployment Geography for Use: <br>
Global <br>
Known Risks and Mitigations: <br>
Risk: Review before execution as proposals could introduce incorrect or misleading guidance into skills. <br> Mitigation: Review and scan skill before deployment. <br>
Reference(s): <br>
Skill Output: <br>
Output Type(s): [Configuration instructions, Analysis] <br> Output Format: [Markdown with inline code blocks] <br> Output Parameters: [1D] <br> Other Properties Related to Output: [None] <br>
Evaluation Agents Used: <br>
Claude Code (
claude-code) <br>Codex (
codex) <br>
Evaluation Tasks: <br>
Evaluated against 1 positive skill-activation task with 2 attempts per task (NVSkills-Eval external profile, local environment). <br>
Evaluation Metrics Used: <br>
Reported benchmark dimensions: <br>
Security: Checks whether skill-assisted execution avoids unsafe behavior such as secret leakage, destructive commands, or unauthorized access. <br>
Correctness: Checks whether the agent follows the expected workflow and produces the correct final output. <br>
Discoverability: Checks whether the agent loads the skill when relevant and avoids using it when irrelevant. <br>
Effectiveness: Checks whether the agent performs measurably better with the skill than without it. <br>
Efficiency: Checks whether the agent uses fewer tokens and avoids redundant work. <br>
Underlying evaluation signals used in this run: <br>
security: Checks for unsafe operations, secret leakage, and unauthorized access. <br>skill_execution: Verifies that the agent loaded the expected skill and workflow. <br>skill_efficiency: Checks routing quality, decoy avoidance, and redundant tool usage. <br>accuracy: Grades final-answer correctness against the reference answer. <br>goal_accuracy: Checks whether the overall user task completed successfully. <br>behavior_check: Verifies expected behavior steps, including safety expectations. <br>token_efficiency: Compares token usage with and without the skill. <br>
Evaluation Results: <br>
| Dimension | Num | claude-code | codex |
|---|---|---|---|
| Security | 2 | 100% (+0%) | 100% (+0%) |
| Correctness | 2 | 100% (+0%) | 97% (+0%) |
| Discoverability | 2 | 100% (+0%) | 72% (-12%) |
| Effectiveness | 2 | 98% (-1%) | 92% (-4%) |
| Efficiency | 2 | 93% (-0%) | 60% (-18%) |
Skill Version(s): <br>
v0.2.0rc6-1529-g97db3553 (source: git tag) <br>
Ethical Considerations: <br>
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal team to ensure this skill meets requirements for the relevant industry and use case and addresses unforeseen product misuse. <br>
(For Release on NVIDIA Platforms Only) <br> Please report quality, risk, security vulnerabilities or NVIDIA AI Concerns here. <br>
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
What our scanner noticed· Medium risk
- Large base64-encoded blobs
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- NVIDIA
- Publisher
- NVIDIA (Official)
- Source
- NVIDIA/skills · skills/nemo-mbridge-perf-moe-long-context · commit fce3cca
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE-APACHE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by NVIDIA.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download nemo-mbridge-perf-moe-long-context.zip