Generated banner for Nemo Mbridge Recipe Recommender
Generated logo for Nemo Mbridge Recipe Recommender

Nemo Mbridge Recipe Recommender

NVIDIAOfficialPublished by NVIDIA

  • Skill
  • Tool integration
  • Software development
  • Apache-2.0
  • Medium risk

From the author

Recommend and customize Megatron Bridge library and benchmark recipes for a user's model, GPU count, hardware, sequence length, and pretrain/SFT/PEFT goal. Use when selecting a starting recipe, comparing library and benchmark configs, resizing parallelism for a GPU allocation, or distinguishing convergence changes, semantics-preserving execution tuning, and benchmark-only shortcuts.
— the description by NVIDIA

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The nemo-mbridge-recipe-recommender provides a structured approach to selecting and configuring training recipes for the Megatron Bridge library. It distinguishes between functional library recipes for training and specialized benchmark recipes for throughput analysis. The skill guides users through selecting the correct recipe function based on model architecture, training mode (Pretrain, SFT, PEFT), and hardware constraints, while providing essential rules for parallelism resizing, batch tuning, and common configuration pitfalls.

What it does

  • Matches user requirements to specific library or benchmark recipe functions.
  • Provides guidance on resizing parallelism (TP, PP, CP, EP) based on available GPU counts.
  • Distinguishes between convergence-preserving configuration changes and performance-only tuning.
  • Offers troubleshooting advice for common OOM errors and configuration pitfalls.
  • Supports CLI-based overrides for model parameters, batch sizes, and hardware settings.
  • Maintains a clear separation between functional training workflows and throughput benchmarking.

When to use it

  • When selecting an initial configuration for a new model training run.
  • When adapting an existing recipe to a different number of GPUs or hardware topology.
  • When troubleshooting OOM errors or performance bottlenecks in a training job.
  • When preparing to run throughput benchmarks for model verification.
  • When adjusting sequence lengths or enabling long-context features like CP.

Advantages

  • Ensures consistent configuration by using explicit Python-based recipe functions.
  • Prevents common errors by enforcing parallelism constraints like GQA head divisibility.
  • Clearly separates convergence-critical settings from execution-performance knobs.
  • Provides a standardized workflow for both functional training and performance benchmarking.

Usage examples

“I want to fine-tune a Llama 3 8B model on 4 GPUs. Which recipe should I use?”
The agent will recommend the llama3_8b_sft_config and provide the command to run it with the appropriate dataset, noting that TP should be adjusted if necessary.
“How do I enable long context training for my Llama 3 8B model?”
The agent will suggest using a 16k or 64k variant recipe or provide the specific CLI overrides for model.seq_length and model.context_parallel_size.
“I am getting an OOM error on my MoE model. What should I change?”
The agent will advise increasing the Expert Parallelism (EP) size rather than Tensor Parallelism (TP) and suggest reducing the micro_batch_size.
“How can I run a throughput benchmark for Qwen3 30B?”
The agent will point to the benchmark recipes in src/megatron/bridge/perf_recipes/ and explain how to use the training launcher with the specific benchmark function name.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/nvidia/nemo-mbridge-recipe-recommender/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip nemo-mbridge-recipe-recommender.zip -d .agents/skills

Documentation by NVIDIA

Auto Recipe — Recipe Index & Recommendation

This skill indexes every shipped recipe and helps users pick the right starting config, adjust parallelism, and avoid common pitfalls.

How to Use This Skill

  1. Ask the user for: model name/size, GPU count & type, training goal (pretrain / SFT / PEFT), and sequence length (if non-default).

  2. Look up the best-match recipe in the index below.

  3. Recommend the recipe function name + entry-point command.

  4. Provide adjustment advice (parallelism resizing, batch tuning, pitfalls).

First Answer Checklist

When recommending recipes, always include these distinctions before the long index details:

  1. Library recipes under src/megatron/bridge/recipes/ are for functional training and use scripts/training/run_recipe.py.

  2. Benchmark recipes under src/megatron/bridge/perf_recipes/ are for upper-bound throughput benchmarks. They own their canonical benchmark data and settings and should not be presented as production training recipes.

  3. For a first-time Bridge smoke test, recommend llama3_8b_pretrain_config with mock data via --dataset mock.

  4. For normal SFT recommendations, select a finetuning preset such as --dataset squad or --dataset tulu3; for pretrain and mock validation recommendations, use --dataset mock. Do not pair the pretraining-only mock preset with an SFT or PEFT mode.

  5. After the recipe and dataset, give the required resizing rules: TP must divide num_key_value_heads, keep TP within one node unless using NVL72-class interconnect, enable SP when TP > 1, configure CP for long context, DP is implicit, and reduce micro_batch_size first on OOM.

  6. State whether each proposed override changes the convergence contract or only the execution/performance mapping. Do not trade convergence semantics for throughput without calling it a new experiment.

Configuration Layers and Change Control

Separate training semantics from their hardware mapping before recommending or tuning a recipe.

Convergence configuration includes the starting checkpoint and trainable parameters; dataset/revision/split/order/seeds; tokenizer, masking, truncation, and packing; sequence length; global batch and token budget; objective and loss coefficients; natural or forced MoE routing and token-dropping policy; optimizer, LR, schedule, warmup, betas, epsilon, weight decay, clipping, and dropout; arithmetic and optimizer-state precision; and PEFT adapter settings. Changing one of these creates a new convergence experiment.

Execution/performance configuration includes hardware count and topology; TP/PP/VP/CP/EP/ETP/DP/SP; recompute and offload; distributed optimizer/FSDP; communication overlap; fusions and attention backends; CUDA graphs and compilation; checkpoint I/O; and MoE transport through all-to-all, DeepEP, or HybridEP when the routing policy is unchanged. These settings should preserve the objective and effective updates, although floating-point reduction order can produce small numerical drift that still needs validation.

Treat micro batch size and gradient accumulation as execution fingerprints. Tune them only with fixed global batch size, global batch membership/order, normalization, optimizer boundaries, and token budget, and validate fresh loss sentinels for each layout. Packing, precision, forced MoE load balancing, token dropping/capacity, and router/auxiliary loss changes are never performance-only knobs.

Treat mock data, forced balancing, disabled correctness checks, and timing-only schedules as benchmark-only shortcuts. They may be appropriate in perf_recipes, but their losses and checkpoints are not convergence evidence.

For comparable model-verification recipes, choose a cohort-wide convergence contract before tuning performance. Keep the same bounded data selection, preprocessing, sequence length, global batch, optimizer/schedule, precision, seeds, routing policy, optimizer-step horizon, and processed-token checkpoints where the architectures permit. Record any necessary model-specific deviation and do not present that result as apples-to-apples convergence evidence. Absolute losses from different architectures or tokenizers are not directly rankable; compare stability and trend at equal token counts.

When a recipe's batch disagrees with the chosen convergence contract, modify and validate the library recipe separately. A declared bounded-verification protocol may explicitly apply the same LR, schedule, sequence, and data overrides across a cohort, but do not make one-off convergence changes merely to improve throughput. Conversely, first try TP/PP/CP/EP, recompute/offload, dispatcher transport, overlap, fusion, and CUDA graphs when optimizing fit or throughput.


Entry Points

Library recipes (functional training)
# Pretrain with mock data
uv run python -m torch.distributed.run --nproc_per_node=8 scripts/training/run_recipe.py \
    --recipe <recipe_function_name> \
    --dataset mock

# SFT with SQuAD
uv run python -m torch.distributed.run --nproc_per_node=8 scripts/training/run_recipe.py \
    --recipe <recipe_function_name> \
    --dataset squad

# Override any field via CLI
uv run python -m torch.distributed.run --nproc_per_node=8 scripts/training/run_recipe.py \
    --recipe llama3_8b_pretrain_config \
    --dataset mock \
    'model.tensor_model_parallel_size=2' \
    'train.global_batch_size=64'
Benchmark recipes (throughput benchmarks)
./scripts/training/train.sh \
    --nodes 2 --gpus-per-node 8 \
    --account ACCOUNT --partition PARTITION --container-image IMAGE \
    --recipe qwen3_30b_a3b_pretrain_16gpu_h100_bf16_config \
    --mode pretrain

The total GPU allocation must match the count encoded in the recipe name. The user selects the node shape, and the selected partition must provide the requested hardware. The launcher does not inject benchmark offline defaults or cluster-specific launch policy. Use --env NAME for exported offline or NCCL fabric settings and repeated --srun-arg=ARG options for srun. Configure CPU/NUMA wrappers and Slurm segment sizing through the target cluster integration, or use scripts/performance/setup_experiment.py when its compatibility policies are required. The unified launcher supports exact exported text pretraining, text SFT/PEFT, Qwen-VL pretraining, and Wan pretraining recipes and infers their forward step. Text SFT/PEFT text benchmark recipes retain the flat runner's mock-data default; Qwen-VL and Wan retain their model-specific datasets. Exported benchmark PEFT recipes are fixed LoRA configs; use a configurable library recipe for DoRA. Trailing KEY=VALUE overrides are accepted, but an overridden benchmark recipe no longer represents its canonical benchmark configuration. Use scripts/performance/setup_experiment.py for selector-based invocation, dataset replacement, topology resizing, and specialized benchmark controls.

See the Benchmark Recipe Index for important caveats before using these for anything beyond throughput benchmarking.


Benchmark Recipe Layout

Benchmark recipes use the same Python function format as library recipes, but live in a dedicated namespace for throughput benchmarking:

  • Benchmark recipes live in src/megatron/bridge/perf_recipes/<family>/<hardware>/<model>.py

  • Each benchmark recipe is a self-contained Python function (e.g. llama3_8b_pretrain_8gpu_h100_bf16_config())

  • Recipe names encode model, task, GPU count, hardware, precision, and optional variant

  • scripts/performance/utils/utils.py derives compatibility WorkloadBaseConfig views from the flat recipe itself

  • Shared helpers: _benchmark_common() (50 iters, timing, TE RNG), _perf_precision() (bf16 / fp8_cs / fp8_mx / nvfp4)

Why Python, not YAML? Previous YAML-based approaches had problems: recipe logic was split across multiple indirection layers, configs were not self-contained, and the two-level pipeline made maintenance and debugging difficult. Python functions are explicit, greppable, and composable.

The training launcher discovers library and benchmark recipes from the complete exported function name. Five legacy duplicate names select the benchmark definition; use the corresponding generic alias for those functional workloads. New recipe names should be unique across both packages.


Recipe Index (Library & Benchmark)

The full per-family recipe tables — every shipped library recipe (src/megatron/bridge/recipes/) and benchmark recipe (src/megatron/bridge/perf_recipes/), with parallelism degrees, minimum GPU counts, and hardware coverage — are kept in a dedicated reference file so this skill stays concise:

→ See references/recipe-index.md — Library Recipe Index (Llama, Qwen2/2.5/3, Qwen3-MoE, Qwen3-Next, DeepSeek, GLM-4.5, Gemma, Nemotron, VLM, Diffusion) and Benchmark Recipe Index (per-hardware throughput configs).

Load that file to pull an exact recipe function name or its default parallelism; the guidance below tells you which entry to look up.


Recommendation Decision Tree

User wants to train a model
│
├─ Know the model name?
│   ├─ Yes → Look up in references/recipe-index.md
│   │   ├─ Has a recipe for their size + mode? → Use it directly
│   │   └─ No exact match? → Use closest size, adjust parallelism
│   └─ No → Ask for model name, size, and HF model ID
│
├─ What's the training goal?
│   ├─ Pretrain → Use *_pretrain_config
│   ├─ SFT (full fine-tune) → Use *_sft_config
│   └─ PEFT (LoRA/DoRA) → Use *_peft_config (lowest GPU requirement)
│
├─ How many GPUs?
│   ├─ 1 GPU → Only PEFT recipes work (TP=1, PP=1)
│   ├─ 8 GPUs (1 node) → Most 8B–16B models, small MoE (EP=8)
│   ├─ 16–64 GPUs → 70B dense, medium MoE
│   └─ 128+ GPUs → 405B+, large MoE (DeepSeek V3, Kimi K2)
│
├─ Want throughput benchmarks?
│   ├─ Yes → Use benchmark recipes (src/megatron/bridge/perf_recipes/)
│   │   ├─ Exact exported recipe → scripts/training/train.sh --recipe <exact function name>
│   │   └─ Selector/specialized workflow → scripts/performance/setup_experiment.py
│   └─ No → Use library recipes (scripts/training/run_recipe.py)
│
└─ Long context?
    ├─ > 8K → Need CP (context parallelism), check *_16k / *_64k / *_128k variants
    └─ ≤ 8K → Default recipes work

Adjustment Advice (When Recommending)

Parallelism Resizing Rules

When the user's GPU count differs from the recipe default:

  1. TP must divide num_key_value_heads (GQA constraint). E.g. if num_key_value_heads=8, valid TP = {1, 2, 4, 8}.

  2. TP should stay within a single node (NVLink). TP > 8 requires inter-node NVLink (e.g., GB200 NVL72).

  3. PP adds pipeline bubbles. Minimize PP; only increase when TP alone can't fit the model. Use VP (virtual pipeline) to mitigate bubble overhead.

  4. EP doesn't reduce dense-layer memory. Only expert parameters shard with EP. Shared attention/embeddings are replicated. For "OOM with MoE", increase EP first, not TP.

  5. SP should be True whenever TP > 1. It eliminates redundant activation copies and is essentially free.

  6. CP requires all-to-all or ring attention. Check cp_comm_type. For GQA models, a2a+p2p hierarchical CP allows CP > num_kv_heads.

  7. Dense and expert meshes overlap. Do not multiply TP and EP together. The minimum MoE world size is PP × max(TP × CP, EP × ETP). Dense DP is world_size / (TP × PP × CP) and expert EDP is world_size / (PP × EP × ETP); both quotients must be integral, and the expert count must be divisible by EP.

Batch Size Tuning
  • Start with the recipe's micro_batch_size. If OOM, reduce to 1.

  • global_batch_size determines learning dynamics. Scale with DP: GBS = micro_batch_size × DP × gradient_accumulation_steps.

  • For MoE, micro_batch_size=1 is typical at scale.

Common Pitfalls to Warn About
PitfallSymptomFix
TP > num_kv_headsCrash: "TP must divide num_query_groups"Reduce TP to a divisor of num_kv_heads
PP without VPPoor throughput (large bubble)Set virtual_pipeline_model_parallel_size
EP too low for large MoEOOM on expert paramsIncrease EP; each expert lives on EP/num_experts ranks
CUDA graphs + packed sequencesAssert: "CUDA graph accepts only Tensor inputs"Disable packing or use local full-iteration graphs
CUDA graphs + full recomputeAssert: "full recompute only with full iteration CUDA graph"Disable recompute or switch to local impl
use_te_rng_tracker not setAssert on provider init when CUDA graphs enabledSet cfg.model.use_te_rng_tracker = True and cfg.rng.te_rng_tracker = True
FSDP + TP > 1 on H100Possible comm bottleneckPrefer FSDP with TP=1 or TP=2 on H100; FSDP shines on GB/B-series
Long context without CPOOM on activationsAdd CP=2/4/8; use *_16k, *_64k, or *_128k recipe variants
MoE overlap_grad_reduce on H100May hurt throughput (False in many H100 presets)Set overlap_grad_reduce=False for MoE on H100
VLM SFT missing image dataRuns but produces garbageProvide actual multimodal dataset or use mock VLM data
Qwen35-VL MoE FSDPTested on Blackwell onlyMay not work on H100; validate first
Recipe Override Examples
# Scale Llama3 8B from 2 GPUs to 8 GPUs (increase DP)
uv run python -m torch.distributed.run --nproc_per_node=8 scripts/training/run_recipe.py \
    --recipe llama3_8b_pretrain_config \
    --dataset mock

# Run the native 4-GPU Qwen3-MoE 30B PEFT topology
uv run python -m torch.distributed.run --nproc_per_node=4 scripts/training/run_recipe.py \
    --recipe qwen3_30b_a3b_peft_config \
    --dataset tulu3

# Add long context to an existing recipe
uv run python -m torch.distributed.run --nproc_per_node=8 scripts/training/run_recipe.py \
    --recipe llama3_8b_pretrain_config \
    --dataset mock \
    'model.seq_length=32768' \
    'model.context_parallel_size=4'

# Enable CUDA graphs on any recipe
uv run python -m torch.distributed.run --nproc_per_node=8 scripts/training/run_recipe.py \
    --recipe qwen3_30b_a3b_pretrain_config \
    --dataset mock \
    'model.cuda_graph_impl=transformer_engine' \
    'model.cuda_graph_scope=[attn,moe_router,moe_preprocess]' \
    'model.use_te_rng_tracker=True' \
    'rng.te_rng_tracker=True'

Quick Reference: Which Recipe for My Situation?

I want to...Start withGPUs needed
Try Bridge for the first timellama3_8b_pretrain_config + mock data2
Fine-tune a 7-8B modelllama3_8b_sft_config or qwen3_8b_sft_config2–4
LoRA on 1 GPUllama3_8b_peft_config or qwen3_8b_peft_config1
Pretrain a dense 70Bllama3_70b_pretrain_config32–64
Train a small MoEqwen3_30b_a3b_pretrain_config16
Train a large MoE (235B+)qwen3_235b_a22b_pretrain_config256–512
Benchmark text-pretrain throughputBenchmark recipe via train.sh --recipe <exact name>Exact encoded count
Long-context trainingllama3_8b_128k_pretrain_config or add CP override16+
VLM fine-tuningqwen3_vl_8b_sft_config or gemma3_vl_*_sft_config4–8
Diffusion trainingwan_1_3B_pretrain_config or flux_12b_pretrain_config8

Code Anchors

WhatPath
Library recipes rootsrc/megatron/bridge/recipes/
Recipe __init__.py (all exports)src/megatron/bridge/recipes/__init__.py
Common recipe helperssrc/megatron/bridge/recipes/common.py
Training entry pointscripts/training/run_recipe.py
Training Slurm launcherscripts/training/train.sh
Benchmark recipes rootsrc/megatron/bridge/perf_recipes/
Benchmark compatibility launcherscripts/performance/setup_experiment.py
Benchmark recipe helpersscripts/performance/utils/utils.py
Benchmark overridesscripts/performance/utils/overrides.py

Last signature refresh: 2026-08-03.

Files

evals/evals.json

[
  {
    "id": "recipe-recommender-positive-sft-peft-smoke",
    "question": "Use the nemo-mbridge-recipe-recommender skill. Recommend recipes for these exact Megatron Bridge cases: Qwen3 30B-A3B SFT on 16 GPUs, Qwen3 235B-A22B PEFT on 16 GPUs, Llama3 8B 128K pretrain, and first-time Bridge tryout. Include the entry point, datasets, library-vs-benchmark recipe distinction, key adjustment rules, and change-control classification.",
    "expected_skill": "nemo-mbridge-recipe-recommender",
    "expected_script": null,
    "ground_truth": "The answer should use the recipe recommender skill. It should recommend qwen3_30b_a3b_sft_config with the tulu3 dataset for Qwen3 30B-A3B SFT on 16 GPUs, qwen3_235b_a22b_peft_config with a finetuning dataset such as squad or tulu3 for Qwen3 235B-A22B PEFT on 16 GPUs, llama3_8b_128k_pretrain_config with the mock dataset for Llama3 8B 128K pretrain, and llama3_8b_pretrain_config with the mock dataset as the first-time Bridge tryout. It should name scripts/training/run_recipe.py with uv run python -m torch.distributed.run for library recipes and distinguish benchmark recipes under src/megatron/bridge/perf_recipes from production training recipes. It should explain that exact benchmark recipes can run through scripts/training/train.sh, use their canonical dataset and total GPU count, and may use scripts/performance/setup_experiment.py for compatibility workflows. It should include adjustment rules: TP must divide num_key_value_heads, TP should stay within a node unless using NVL72-style interconnect, SP should be true whenever TP>1, CP needs cp_comm_type and long-context variants or overrides, dense and expert parallel meshes must both divide the world size, and micro_batch_size should be reduced first on OOM. It should classify proposed overrides as convergence changes, semantics-preserving execution changes, or benchmark-only shortcuts.",
    "expected_behavior": [
      "Read the nemo-mbridge-recipe-recommender skill before answering.",
      "Identify the task as recipe selection or customization.",
      "Recommend the exact Qwen3, Llama3, and first-time recipes requested.",
      "Name scripts/training/run_recipe.py and valid named dataset presets such as mock, squad, and tulu3.",
      "Include recipe resizing rules for TP, SP, CP, DP, and micro batch size.",
      "Distinguish library recipes from benchmark recipes and name the benchmark launcher paths.",
      "Distinguish convergence-contract changes from semantics-preserving execution changes and benchmark-only shortcuts."
    ]
  }
]

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, 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-recipe-recommender · 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-recipe-recommender.zip