Nemo Mbridge Perf Megatron Fsdp
NVIDIAOfficialPublished by NVIDIA
- Skill
- Tool integration
- 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 a comprehensive reference for enabling and troubleshooting Megatron FSDP (Fully Sharded Data Parallel) in Megatron-Bridge. It covers essential configuration parameters, code migration paths, common pitfalls, and verification procedures to ensure stable training performance.
What it does
- Provides configuration snippets for enabling Megatron FSDP in training recipes.
- Details necessary adjustments for checkpoint formats and sharding strategies.
- Identifies code anchors for migrating legacy distributed configuration settings.
- Highlights common pitfalls regarding mutual exclusivity and hardware-specific settings.
- Outlines functional smoke testing procedures to verify successful implementation.
When to use it
- When transitioning from DDP to FSDP-based data parallelism.
- When debugging Out-of-Memory (OOM) errors related to data parallel configurations.
- When investigating performance regressions linked to FSDP settings.
- When setting up new training runs requiring specific sharding strategies.
Advantages
- Centralizes configuration requirements for Megatron FSDP.
- Reduces integration errors by highlighting mandatory checkpoint format changes.
- Provides clear validation steps to confirm correct deployment.
- Clarifies the relationship between different distributed training wrappers.
Usage examples
- “How do I enable Megatron FSDP in my Megatron-Bridge training config?”
- The agent provides the required configuration block, including setting use_megatron_fsdp to True, selecting the appropriate sharding strategy, and configuring the fsdp_dtensor checkpoint format.
- “I am getting an error when using Megatron FSDP, how do I verify my setup?”
- The agent directs you to run the functional smoke test using the provided pytest command and explains how to interpret the logs for finite loss and successful checkpointing.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/nvidia/nemo-mbridge-perf-megatron-fsdp/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip nemo-mbridge-perf-megatron-fsdp.zip -d .agents/skills
Documentation by NVIDIA
Megatron FSDP Skill
For stable background and recommendation level, see:
@docs/training/megatron-fsdp.md
@skills/nemo-mbridge-perf-megatron-fsdp/card.yaml
Enablement
Minimal Megatron FSDP override in Bridge:
cfg.ddp.use_megatron_fsdp = True
cfg.ddp.data_parallel_sharding_strategy = "optim_grads_params"
cfg.ddp.average_in_collective = False
cfg.checkpoint.ckpt_format = "fsdp_dtensor"Example recipe fixup:
cfg = llama3_8b_pretrain_config()
cfg.ddp.use_megatron_fsdp = True
cfg.ddp.data_parallel_sharding_strategy = "optim_grads_params"
cfg.ddp.average_in_collective = False
cfg.checkpoint.ckpt_format = "fsdp_dtensor"
cfg.checkpoint.save = "/tmp/fsdp_ckpts"
cfg.checkpoint.load = NonePerformance harness note:
python scripts/performance/launch.py --use_megatron_fsdp trueCode Anchors
Megatron-Core DDP configuration (exposed as cfg.ddp in Bridge):
from megatron.core.distributed import DistributedDataParallelConfig
ddp_config = DistributedDataParallelConfig(use_megatron_fsdp=True)DistributedInitConfig no longer accepts use_megatron_fsdp. Migrate existing
cfg.dist.use_megatron_fsdp overrides to cfg.ddp.use_megatron_fsdp.
Bridge validation:
if self.ddp.use_megatron_fsdp and self.dist.use_torch_fsdp2:
raise ValueError(...)
...
assert not self.dist.use_tp_pp_dp_mapping, "use_tp_pp_dp_mapping is not supported with Megatron FSDP"
...
assert self.checkpoint.ckpt_format == "fsdp_dtensor", (
"Megatron FSDP only supports fsdp_dtensor checkpoint format"
)Runtime wrapper selection:
if use_megatron_fsdp:
DP = FullyShardedDataParallel
elif use_torch_fsdp2:
DP = TorchFullyShardedDataParallel
else:
DP = DistributedDataParallel
...
DP(
config=get_model_config(model_chunk),
ddp_config=ddp_config,
module=model_chunk,
...
pg_collection=pg_collection,
)Perf harness overrides:
recipe.ddp.use_megatron_fsdp = True
recipe.ddp.data_parallel_sharding_strategy = "optim_grads_params"
recipe.ddp.keep_fp8_transpose_cache = False
recipe.ddp.average_in_collective = False
...
recipe.checkpoint.load = NonePitfalls
Public recipes often expose
use_megatron_fsdpbut still default tockpt_format="torch_dist". If save/load is enabled, switch tofsdp_dtensor.use_torch_fsdp2exists, but on the validated branch Bridge still fails before training because_ddp_wrappassespg_collection.CPU offloading is only valid when
pipeline_model_parallel_size == 1and activation recomputation is disabled.Upstream warns that FSDP and TP/CP can want different
CUDA_DEVICE_MAX_CONNECTIONSsettings on Hopper and earlier.Megatron FSDP and FSDP2 are mutually exclusive.
Verification
Use the existing 2-GPU functional smoke test:
CUDA_VISIBLE_DEVICES=0,1 uv run python -m torch.distributed.run --nproc_per_node=2 \
-m pytest tests/functional_tests/training/test_megatron_fsdp.py::TestMegatronFSDP::test_fsdp_pretrain_basic -v -sSuccess criteria:
Pytest reports
1 passedThe log shows finite loss at the last iteration
The run finishes without a checkpoint format assertion
Files
- ATTRIBUTION.mdAdded by AutoGineer861 B
- BENCHMARK.md9.3 KiB
- LICENSELicence file added by AutoGineer11.2 KiB
- SKILL.md3.7 KiB
- card.yaml2.0 KiB
- evals/evals.json1.4 KiB
- skill-card.md7.0 KiB
- skill.oms.sig4.7 KiB
skill-card.md
Description: <br>
Operational guide for enabling Megatron FSDP in Megatron-Bridge, including config knobs, code anchors, pitfalls, and verification. <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 models with Megatron-Bridge use this skill to enable FSDP-based data parallelism (Megatron FSDP) instead of DDP, choose the correct sharding strategy and fsdp_dtensor checkpoint format, avoid known pitfalls, and trace OOMs or regressions to FSDP config changes. <br>
Deployment Geography for Use: <br>
Global <br>
Requirements / Dependencies: <br>
Requires API Key or External Credential: [Not Specified] <br> Credential Type(s): [None identified] <br>
Do not include secrets in prompts/logs/output; use least-privilege credentials; rotate keys as appropriate. <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>
Megatron FSDP training guide <br>
Skill Output: <br>
Output Type(s): [Configuration instructions, Code, Shell commands] <br> Output Format: [Markdown with inline Python and bash code blocks] <br> Output Parameters: [1D] <br> Other Properties Related to Output: [None] <br>
Evaluation Agents Used: <br>
Claude Code (
aws/anthropic/bedrock-claude-opus-5-5) <br>Codex (
openai/openai/gpt-6.1-sol) <br>
Evaluation Tasks: <br>
1 evaluation task (1 positive), 1 attempt per task, run in the k8s-sandbox environment with each task attempt in its own isolated sandbox pod; each task was also attempted without the skill as a baseline. Evaluator version 1.6.6, evaluation date 2026-11-04. <br>
Evaluation Metrics Used: <br>
Reported benchmark dimensions: <br>
Security: Is it safe to use? Scored from
security(100%). <br>Correctness: Is the answer correct? Scored from
accuracy(100%). <br>Discoverability: Was the right skill loaded when needed? Scored from
skill_execution(100%). <br>Effectiveness: Did the skill help complete the task? Scored from
goal_accuracy(50%) +behavior_check(50%). <br>Efficiency: Did it avoid wasted tool calls and token usage? Scored from
skill_efficiency(50%) +token_efficiency(50%). <br>
Underlying evaluation signals used in this run: <br>
security: Security: unsafe operations, secret leakage, and unauthorized access. <br>skill_execution: Skill Execution: whether the expected skill was selected, decoys were avoided, and the workflow executed. <br>skill_efficiency: Tool Productivity: tool-call productivity (legacy wire id; routing is scored under Discoverability). <br>accuracy: Accuracy: final-answer correctness against the reference answer. <br>goal_accuracy: Goal Accuracy: whether the user's goal was achieved. <br>behavior_check: Behavior Check: whether the expected workflow behavior was followed. <br>token_efficiency: Token Efficiency: actual uncached prompt plus completion usage (50% of Efficiency). <br>
Evaluation Results: <br>
✅ Overall verdict: PASS — Recommended for publication
Publication Recommendation
Recommended for publication based on the completed evaluation evidence in this report.
Results at a Glance
| Measure | Claude Code (Baseline → Skill Uplift) | Codex (Baseline → Skill Uplift) |
|---|---|---|
| Overall | 98.1% — baseline ran, but no comparable score was available; uplift unavailable | 89.8% — baseline ran, but no comparable score was available; uplift unavailable |
| Security | 100.0% → 100.0% (±0.0 points) | 100.0% → 100.0% (±0.0 points) |
| Correctness | 60.0% → 100.0% (+40.0 points) | 100.0% → 100.0% (±0.0 points) |
| Discoverability | 100.0% — baseline ran, but no comparable score was available; uplift unavailable | 95.0% — baseline ran, but no comparable score was available; uplift unavailable |
| Effectiveness | 16.7% → 91.7% (+75.0 points) | 66.7% → 83.3% (+16.6 points) |
| Efficiency | 98.6% — baseline ran, but no comparable score was available; uplift unavailable | 70.6% — baseline ran, but no comparable score was available; uplift unavailable |
How to read this table: baseline is the same task attempted without the target skill. Scores are rounded to one decimal; threshold-adjacent values use additional precision so their displayed band matches the verdict. Uplift is derived from those displayed scores and shown in percentage points.
Example: 47.0% → 92.0% (+45.0 points) means the skill-assisted run scored 92.0%, 45.0 percentage points above its 47.0% no-skill baseline.
Comparison details
Shared-source comparisons use the same signals and weights on both conditions. They do not replace the full dimension scores above or change the publication verdict.
| Agent | Dimension | Basis | Baseline → With skill (uplift) | Explanation |
|---|---|---|---|---|
| claude-code | Discoverability | Dimension comparison | N/A | Discoverability is not applicable to the no-skill baseline; there is no installed skill to discover. |
| claude-code | Efficiency | Token-only comparison | 84.0% → 97.2% (+13.2 points) | Only Token Efficiency is comparable; the full dimension scores use different evaluator sources. |
| codex | Discoverability | Dimension comparison | N/A | Discoverability is not applicable to the no-skill baseline; there is no installed skill to discover. |
| codex | Efficiency | Token-only comparison | 86.3% → 91.2% (+4.9 points) | Only Token Efficiency is comparable; the full dimension scores use different evaluator sources. |
Tier Status
| Tier | Purpose | Status | Evidence |
|---|---|---|---|
| Tier 1 | Static validation | PASSED WITH OBSERVATIONS | 11 validator(s); 10 finding(s) |
| Tier 2 | Semantic deduplication | PASSED | 2 validator(s); 0 finding(s) |
| Tier 3 | Live agent evaluation | PASS | 2 agent(s); 1 task(s) |
Skill Version(s): <br>
1.0.0+9edee0c (source: pyproject.toml; git SHA b72560f, committed 2026-11-04) <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.
Needs: Needs Python
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-megatron-fsdp · 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 or NVIDIA.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download nemo-mbridge-perf-megatron-fsdp.zip