Nemo Mbridge Mlm Bridge Training
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 the necessary procedures and configuration patterns for running training jobs using Megatron-LM and Megatron Bridge. It focuses on ensuring consistency between the two frameworks through correlation testing, mapping CLI arguments, and managing multi-GPU environments. It also includes guidance on handling the Megatron-Core submodule and common pitfalls encountered during training setup.
What it does
- Provides commands for running training with Megatron-LM and Megatron Bridge.
- Outlines the procedure for loss-correlation testing between the two frameworks.
- Lists available pre-configured training recipes for various model architectures.
- Details how to manage the Megatron-Core submodule versions.
- Provides multi-GPU training examples with tensor model parallelism.
- Documents common pitfalls and environment requirements for successful training runs.
When to use it
- When you need to run model training using Megatron-LM or Megatron Bridge.
- When comparing loss curves between Megatron-LM and Megatron Bridge.
- When investigating discrepancies in training results after a code commit.
- When setting up multi-GPU training environments for large models.
Advantages
- Ensures consistent results through standardized correlation testing.
- Provides clear mapping between legacy Megatron-LM arguments and Bridge configurations.
- Simplifies environment setup with specific launch wrappers and path requirements.
- Reduces common errors by documenting specific cleanup and scheduler requirements.
Usage examples
- “How do I run a correlation test between Megatron-LM and Bridge?”
- The agent provides the specific CLI commands for both frameworks using the vanilla_gpt_pretrain_config, emphasizing the need to clear experiment directories and match hyperparameters.
- “How can I switch the Megatron-Core version for testing?”
- The agent provides the script commands to switch between main and dev versions, including the necessary synchronization steps for the submodule.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/nvidia/nemo-mbridge-mlm-bridge-training/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip nemo-mbridge-mlm-bridge-training.zip -d .agents/skills
Documentation by NVIDIA
MLM vs Bridge Training
For how they differ, the arg mapping tables, gotchas, and translation script, see:
@docs/megatron-lm-to-megatron-bridge.md
First Answer Checklist
For MLM-vs-Bridge correlation questions, always name these items up front:
Bridge recipe:
vanilla_gpt_pretrain_config.Bridge entry point:
scripts/training/run_recipe.py.MLM entry point:
3rdparty/Megatron-LM/pretrain_gpt.py.Launch wrapper for both:
uv run python -m torch.distributed.run.Fresh-run cleanup:
rm -rf nemo_experimentsbefore the Bridge run.
Also state that MLM needs
PYTHONPATH=3rdparty/Megatron-LM:$PYTHONPATH, matched Bridge and MLM losses
should agree within BF16 rounding, and files under 3rdparty/Megatron-LM/
should not be modified from this repo.
Correlation Testing
Use vanilla_gpt_pretrain_config for loss-correlation testing. This recipe uses
bare GPTModelProvider defaults (LayerNorm, GeLU, learned_absolute position
embeddings, vocab_size inherited from tokenizer) — matching MLM
pretrain_gpt.py defaults with no args.
MLM Correlation Run (2L/256H, 1 GPU)
PYTHONPATH=3rdparty/Megatron-LM:$PYTHONPATH \
uv run python -m torch.distributed.run --nproc_per_node=1 \
3rdparty/Megatron-LM/pretrain_gpt.py \
--num-layers 2 --hidden-size 256 --num-attention-heads 4 \
--ffn-hidden-size 1024 --seq-length 512 --max-position-embeddings 512 \
--micro-batch-size 4 --global-batch-size 32 \
--train-iters 10 --eval-iters 2 --eval-interval 10 \
--mock-data --bf16 --use-mcore-models \
--tokenizer-type NullTokenizer --vocab-size 32000 \
--lr 3e-4 --min-lr 3e-5 --seed 1234 --log-interval 1Bridge Correlation Run (same config, 1 GPU)
rm -rf nemo_experiments && \
uv run python -m torch.distributed.run --nproc_per_node=1 \
scripts/training/run_recipe.py \
--recipe vanilla_gpt_pretrain_config \
model.num_layers=2 model.hidden_size=256 \
model.num_attention_heads=4 model.ffn_hidden_size=1024 \
model.seq_length=512 dataset.seq_length=512 \
train.train_iters=10 train.global_batch_size=32 train.micro_batch_size=4 \
validation.eval_interval=10 validation.eval_iters=2 \
optimizer.lr=3e-4 optimizer.min_lr=3e-5 \
scheduler.lr_warmup_iters=1 scheduler.lr_decay_iters=10 \
rng.seed=1234 logger.log_interval=1Verification
With matched parameters the LM losses should be nearly identical at each
iteration. Compare lm loss values from both logs — they should agree to
within BF16 rounding.
Multi-GPU Examples
MLM 2-GPU with TP=2
PYTHONPATH=3rdparty/Megatron-LM:$PYTHONPATH \
uv run python -m torch.distributed.run --nproc_per_node=2 \
3rdparty/Megatron-LM/pretrain_gpt.py \
--tensor-model-parallel-size 2 --sequence-parallel \
--num-layers 4 --hidden-size 256 --num-attention-heads 4 \
--seq-length 1024 --max-position-embeddings 1024 \
--micro-batch-size 2 --global-batch-size 16 \
--train-iters 10 --eval-iters 2 --eval-interval 10 \
--mock-data --bf16 --use-mcore-models \
--tokenizer-type NullTokenizer --vocab-size 1024 \
--lr 1e-4 --log-interval 1Bridge 2-GPU with TP=2
rm -rf nemo_experiments && \
uv run python -m torch.distributed.run --nproc_per_node=2 \
scripts/training/run_recipe.py \
--recipe vanilla_gpt_pretrain_config \
model.tensor_model_parallel_size=2 model.sequence_parallel=true \
model.num_layers=4 model.hidden_size=256 \
model.num_attention_heads=4 model.ffn_hidden_size=1024 \
model.seq_length=1024 dataset.seq_length=1024 \
train.train_iters=10 train.global_batch_size=16 train.micro_batch_size=2 \
validation.eval_interval=10 validation.eval_iters=2 \
scheduler.lr_warmup_iters=2 scheduler.lr_decay_iters=10 \
logger.log_interval=1Available Recipes
Common recipes (use with --recipe):
vanilla_gpt_pretrain_config— Minimal GPT (bare GPTModelProvider defaults, ideal for correlation testing and custom configs)llama32_1b_pretrain_config— Llama 3.2 1B (16L, 2048H, GBS=512, seq=8192)llama3_8b_pretrain_config— Llama 3 8Bqwen3_8b_pretrain_config— Qwen3 8Bdeepseek_v2_lite_pretrain_config— DeepSeek-V2-Lite 16B MoE
SFT/PEFT variants use _sft_config / _peft_config suffix.
Megatron-Core Submodule
For what the submodule is and why two versions exist, see @docs/megatron-lm-to-megatron-bridge.md.
Check current version
./scripts/switch_mcore.sh statusSwitch to dev for testing newer MCore features
./scripts/switch_mcore.sh dev
# uv sync (without --locked) since lockfile is for main
uv syncSwitch back to main
./scripts/switch_mcore.sh mainAfter pulling latest main
When you pull the latest Bridge main branch, the submodule pointer may have been updated. Re-sync the submodule:
git submodule update --init 3rdparty/Megatron-LMPitfalls
Always
rm -rf nemo_experimentsbefore a fresh correlation run. Bridge auto-resumes from stale checkpoints silently.uv runrequired: Always useuv run python -m torch.distributed.run(not baretorchrunorpython).MLM PYTHONPATH: Must include
3rdparty/Megatron-LMsogpt_builders.pyis importable.Scheduler overrides: When overriding
train.train_itersto a small value, also setscheduler.lr_warmup_itersandscheduler.lr_decay_itersor you get an assertion error.Use
dataset.seq_lengthin CLI overrides for both pretraining and fine-tuning datasets.MoE OOM: Large MoE models require full activation recomputation and typically multi-node EP. TP does NOT reduce per-GPU expert memory.
uv sync --lockedfails after switching to dev: The lockfile is generated against the main MCore commit. Useuv sync(without--locked) when on dev.
Files
- ATTRIBUTION.mdAdded by AutoGineer863 B
- BENCHMARK.md3.9 KiB
- LICENSELicence file added by AutoGineer11.2 KiB
- SKILL.md6.1 KiB
- card.yaml2.0 KiB
- evals/evals.json1.6 KiB
- skill-card.md4.1 KiB
- skill.oms.sig4.7 KiB
BENCHMARK.md
Evaluation Report
Evaluation of the nemo-mbridge-mlm-bridge-training skill before publication through NVSkills-Eval.
This benchmark summarizes 3-Tier Evaluation from NVSkills-Eval results for the skill. The goal is to document whether the skill is safe, discoverable, effective, and useful for agents before it is published for broader workflow use.
Evaluation Summary
Skill:
nemo-mbridge-mlm-bridge-trainingEvaluation date: 2026-07-15
NVSkills-Eval profile:
externalEnvironment:
astra-sandboxDataset: 1 evaluation tasks
Attempts per task: 1
Pass threshold: 50%
Overall verdict: PASS
Agents Used
claude-codecodex
Metrics Used
Reported benchmark dimensions:
Security: checks whether skill-assisted execution avoids unsafe behavior such as secret leakage, destructive commands, or unauthorized access.
Correctness: checks whether the agent follows the expected workflow and produces the correct final output.
Discoverability: checks whether the agent loads the skill when relevant and avoids using it when irrelevant.
Effectiveness: checks whether the agent performs measurably better with the skill than without it.
Efficiency: checks whether the agent uses fewer tokens and avoids redundant work.
Underlying evaluation signals used in this run:
security(Security): checks for unsafe operations, secret leakage, and unauthorized access.skill_execution(Skill Execution): verifies that the agent loaded the expected skill and workflow.skill_efficiency(Efficiency): checks routing quality, decoy avoidance, and redundant tool usage.accuracy(Accuracy): grades final-answer correctness against the reference answer.goal_accuracy(Goal Accuracy): checks whether the overall user task completed successfully.behavior_check(Behavior Check): verifies expected behavior steps, including safety expectations.token_efficiency(Token Efficiency): compares token usage with and without the skill.
Test Tasks
The benchmark dataset contained 1 evaluation tasks:
Positive tasks: 1 tasks where the skill was expected to activate.
Negative tasks: 0 tasks where no skill was expected.
Unlabeled tasks: 0 tasks where positive/negative intent could not be inferred.
Task composition is derived from the evaluation dataset when possible. Entries with expected_skill set are treated as positive skill-activation cases, while entries with expected_skill: null are treated as negative activation cases.
Results
| Dimension | Num | claude-code | codex |
|---|---|---|---|
| Security | 1 | 100% (+0%) | 100% (+0%) |
| Correctness | 1 | 100% (+100%) | 97% (+25%) |
| Discoverability | 1 | 100% (+100%) | 97% (+64%) |
| Effectiveness | 1 | 100% (+95%) | 100% (+0%) |
| Efficiency | 1 | 94% (+67%) | 96% (+59%) |
Score values show skill-assisted performance. Values in parentheses show uplift versus the no-skill baseline when baseline data is available.
Tier 1: Static Validation Summary
Tier 1 validation passed with observations. NVSkills-Eval ran 1 checks and found 4 total findings.
Top findings:
MEDIUM SCHEMA/body_recommended_section: Missing recommended section: '## Instructions' (
skills/nemo-mbridge-mlm-bridge-training/SKILL.md)MEDIUM SCHEMA/body_recommended_section: Missing recommended section: '## Examples' (
skills/nemo-mbridge-mlm-bridge-training/SKILL.md)MEDIUM SCHEMA/author_missing: Author not specified in metadata (
skills/nemo-mbridge-mlm-bridge-training/SKILL.md)LOW SCHEMA/unexpected_file: Unexpected 'card.yaml' in skill root (
skills/nemo-mbridge-mlm-bridge-training/card.yaml)
Tier 2: Deduplication Summary
This tier was not run or did not produce findings in this report.
Publication Recommendation
The skill is suitable to proceed toward NVSkills-Eval publication based on this benchmark. Skill owners should keep this file with the skill and refresh it when the evaluation dataset, skill behavior, or target agents materially change.
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 a command-line tool, Needs Python, Needs Node.js
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-mlm-bridge-training · 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-mlm-bridge-training.zip