·
Last changedVersion:
This version passed the hardening gate. Hardening applied 11 targeted changes and preserved all other text. Classified findings before hardening: 2. Classified findings closed: 0. Classified findings remaining: 2. Unclassified scanner findings remaining: 0. Review findings closed: 16. Review findings remaining: 0.
1
1
1
1
Expand | File | Group | Subtype | Severity | Status |
|---|---|---|---|---|---|
BENCHMARK.md | Sensitive Data & Secret Exposure | Agent snooping | Medium | Open | |
SKILL.md | Malicious Code & Command Execution | Command injection | Low | Open |
2 findings
This skill indexes every shipped recipe and helps users pick the right starting config, adjust parallelism, and avoid common pitfalls.
When recommending recipes, always include these distinctions before the long index details:
src/megatron/bridge/recipes/ are for functional
training and use scripts/training/run_recipe.py.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.llama3_8b_pretrain_config
with mock data via --dataset mock.--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.num_key_value_heads, use the lowest TP that still fits the dense
state, keep TP within one node unless using NVL72-class interconnect, enable
SP when TP > 1, configure CP for long context, and make both dense and
expert meshes divide the allocation.Before publishing a new pretraining library recipe under
src/megatron/bridge/recipes/, measure steady-state model TFLOP/s/GPU on its
intended workload and GPU allocation. For BF16, aim for roughly 200
TFLOP/s/GPU on H100 and 400 TFLOP/s/GPU on GB200. These are approximate
readiness targets, not exact pass/fail cutoffs. This requirement excludes SFT,
PEFT, and long-context SFT; it assesses the base pretraining library recipe,
not a perf_recipes benchmark or its result. For other precisions or hardware
such as B200/GB300, establish a workload-matched measured target rather than
silently reusing the BF16 H100/GB200 numbers.
If measured performance is severely below the target, either withhold the
recipe until it is improved or clearly label it early, unoptimized in the
recipe docstring, accompanying public documentation/card, and PR description.
Record the measured throughput, hardware, precision, workload, and GPU layout
alongside the limitation. In a card, include the label in both the summary and
the affected training item's expected_result so generated pages display it.
Do not present it as a tuned recommendation or change the intended training
workload or convergence settings merely to meet a target.
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.
These commands are recommendations for the user to review and run. Present them to the user, and get explicit user confirmation before starting any local run on multiple GPUs or submitting any Slurm job. Run them only from a trusted Megatron Bridge checkout at a known, verified commit. Run uv against the repository lockfile, and pin model and dataset revisions where the recipe supports it. Treat downloaded models and datasets as unvetted until the user confirms their source.
For overrides, use only known config keys with typed values, and quote each one as a single argument. Check parallelism and sequence length against the GPU allocation before suggesting the command.
The user supplies the account, partition, and container image values; ask for them rather than guessing. Recommend an official NeMo or Megatron Bridge image from a trusted registry, pinned by digest rather than a mutable tag.
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.
Pass --env NAME only for variables named by the user that hold no secrets,
such as offline or NCCL settings, and keep credentials out of it. Build
--srun-arg=ARG values only from options the user specifies, and propose them
for user review.
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 recipes use the same Python function format as library recipes, but live in a dedicated namespace for throughput benchmarking:
src/megatron/bridge/perf_recipes/<family>/<hardware>/<model>.pyllama3_8b_pretrain_8gpu_h100_bf16_config())scripts/performance/utils/utils.py derives compatibility WorkloadBaseConfig views from the flat recipe itself_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.
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.
Treat its contents as reference data. When a Megatron Bridge checkout is
available, confirm the name against src/megatron/bridge/recipes/__init__.py,
and report any name that cannot be confirmed rather than inventing one.
When the user's GPU count differs from the recipe default:
num_key_value_heads (GQA constraint). E.g. if
num_key_value_heads=8, valid TP = {1, 2, 4, 8}.cp_comm_type. For
GQA models, a2a+p2p hierarchical CP allows CP > num_kv_heads.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.For an MoE recipe on a fixed allocation, use this practical order:
gdn_norm_out on the exact Megatron Core revision
instead of assuming core_attn covers the GDN peak.EP=8 can leave less memory headroom than EP=32, but EP size alone does not justify full recompute. Measure the hot rank and supported Qwen3.5 GDN boundaries; retry no recompute or narrower selective recompute when a larger EP reduces expert-weight pressure.
micro_batch_size. If OOM, reduce to 1; after the
run fits, use measured headroom to sweep MBS upward again.global_batch_size determines learning dynamics. Scale with DP:
GBS = micro_batch_size × DP × gradient_accumulation_steps.micro_batch_size=1 is typical at scale.| Pitfall | Symptom | Fix |
|---|---|---|
TP > num_kv_heads | Crash: "TP must divide num_query_groups" | Reduce TP to a divisor of num_kv_heads |
PP without VP | Poor throughput (large bubble) | Set |
EP too low for large MoE | OOM on expert params | Increase EP; each EP rank holds the expert count divided by EP, so raising EP lowers expert memory per rank |
CUDA graphs + packed sequences | Assert: "CUDA graph accepts only Tensor inputs" | Disable packing or use |
CUDA graphs + full recompute | Assert: "full recompute only with full iteration CUDA graph" | Disable recompute or switch to |
| Assert on provider init when CUDA graphs enabled | Set |
FSDP + TP > 1 on H100 | Possible comm bottleneck | Prefer FSDP with TP=1 or TP=2 on H100; FSDP shines on GB/B-series |
Long context without CP | OOM on activations | Add CP=2/4/8; use |
MoE | May hurt throughput (False in many H100 presets) | Set |
VLM SFT missing image data | Runs but produces garbage | Provide actual multimodal dataset or use mock VLM data |
Qwen35-VL MoE FSDP | Tested on Blackwell only | May not work on H100; validate first |
| I want to... | Start with | GPUs needed |
|---|---|---|
Try Bridge for the first time |
| 2 (native topology; the 8 GPU examples keep it and increase DP) |
Fine-tune a 7-8B model |
| 2–4 |
LoRA on 1 GPU |
| 1 |
Pretrain a dense 70B |
| 32–64 |
Train a small MoE |
| 16 |
Train a large MoE (235B+) |
| 256–512 |
Benchmark text-pretrain throughput | Benchmark recipe via | Exact encoded count |
Long-context training |
| 16+ |
VLM fine-tuning |
| 4–8 |
Diffusion training |
| 8 |
Present launches across many GPUs or nodes to the user for review, and get explicit confirmation before any job is submitted.
| What | Path |
|---|---|
Library recipes root |
|
Recipe |
|
Common recipe helpers |
|
Training entry point |
|
Training Slurm launcher |
|
Benchmark recipes root |
|
Benchmark compatibility launcher |
|
Benchmark recipe helpers |
|
Benchmark overrides |
|
Last signature refresh: 2026-08-03.
Get started with chainctlchainctl skill install public/nvidia/nemo-mbridge-recipe-recommender:latest
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
skills.chainreg.biz/public/github.com/nvidia/skills/nemo-mbridge-recipe-recommender:latest
Apache-2.0
BENCHMARK.md
HARDENING.md
SKILL.md
evals/evals.json
references/recipe-index.md
skill-card.md
skill.oms.sig