nemo-automodel-recipe-development
Skill1k starsChanged 20 days agoApache-2.0View on GitHub
Create and modify NeMo AutoModel training and evaluation recipes, including YAML structure, builders, and execution flow. Use when creating or modifying training, SFT, or eval recipes, adding new YAML config fields, debugging recipe construction or trainer issues, or understanding the recipe execution flow.
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
Use these compact answer patterns for common questions:
- Very specific: line 57
Use this skill for recipe construction and execution-flow questions: YAML structure, _target_ callables, builder functions, validation …
- Very specific: line 61
Do not use this skill for standalone distributed strategy selection, cluster launcher configuration, or model architecture onboarding …
- Distinctive: line 86
All components are constructed through dedicated builder functions:
- Distinctive: line 250
Only supports DDP and FSDP2 strategies (no Megatron-FSDP).
- Very specific: line 303
When cp_size > 1, batches are split across the context-parallel group using make_cp_batch_and_ctx().
- Distinctive: line 328
Default format: consolidated safetensors for easy deployment on HF ecosystem (always prefer this over DCP).
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
NeMo AutoModel Recipe Development
<!-- NVSkills signature refresh requested for AM-519. -->Instructions
For recipe questions, answer with the smallest complete path to action:
- Name the relevant recipe file or YAML section.
- List the builder functions or config keys involved.
- Include a minimal YAML or command example when the question asks how to configure something.
- End with a local validation command or tiny CPU-compatible test.
For conceptual recipe questions, answer from this skill without inspecting the repository or loading other AutoModel skills unless the user asks you to edit files. Keep the response focused on recipe YAML, builders, CLI routing, tests, and local validation.
Use these compact answer patterns for common questions:
- New finetuning recipe variant: start from the closest file under
nemo_automodel/recipes/, update the model, dataset or dataloader, optimizer, loss, LR scheduler, step scheduler, and checkpoint builders, register a recipe alias only if adding a new recipe class, add example YAML underexamples/, then add a tiny CPU-compatible unit test and runautomodel <config.yaml>. _target_fields: describe_target_as the fully qualified Python callable, explain that sibling keys become keyword arguments, show optimizer and dataset examples, and mention nested CLI overrides such as--optimizer.lr.- Validation and checkpointing: name
step_scheduler.val_check_interval,step_scheduler.checkpoint_interval,validation_dataset,restore_from.path, and consolidated safetensors; include the minimal YAML snippet from this skill.
For validation and checkpointing, always name:
step_scheduler.val_check_intervalfor validation cadence.step_scheduler.checkpoint_intervalfor save cadence.validation_datasetas the validation dataloader source.restore_from.pathfor resume.- Consolidated safetensors as the default checkpoint format for HF ecosystem compatibility.
Routing Boundary
Use this skill for recipe construction and execution-flow questions: YAML
structure, _target_ callables, builder functions, validation datasets,
checkpoint configuration, CLI route registration, and recipe-specific tests.
Do not use this skill for standalone distributed strategy selection, cluster launcher configuration, or model architecture onboarding unless the user is asking how those choices appear inside an AutoModel recipe YAML.
Recipe Architecture
Execution Flow
CLI (automodel config.yaml)
-> app.py resolves the config's recipe target
-> recipe script (e.g. train_ft.py) main(config_path)
-> Recipe class .setup() builds all components
-> .run_train_validation_loop() executes trainingRecipe Class
Recipes inherit from BaseRecipe and implement two methods:
setup()-- builds model, optimizer, dataloader, loss, LR scheduler, step scheduler, and checkpoint config via builder functions.run_train_validation_loop()-- executes the training and validation loop.
Builder Pattern
All components are constructed through dedicated builder functions:
build_model()-- instantiates the model from configbuild_optimizer()-- creates optimizer (AdamW, etc.)build_dataloader()-- sets up train and validation dataloadersbuild_loss_module()-- creates the loss functionbuild_lr_scheduler()-- creates the learning rate schedulerbuild_step_scheduler()-- creates the step scheduler controlling training progressionCheckpointingConfig-- configures checkpointing (built directly from the YAMLcheckpoint:block viaRecipeConfig.checkpoint)
Infrastructure Application Order
Components are applied in this strict order after building:
- PEFT (LoRA, etc.)
- FP8 quantization
- QAT (quantization-aware training)
- Checkpoint load / restore
- Parameter freezing
- Sharding (FSDP2, Megatron-FSDP, DDP)
- Device placement
torch.compile- Context parallelism hooks
YAML Config Anatomy
A complete recipe config follows this structure:
step_scheduler:
max_steps: 1000
num_epochs: 1
grad_accumulation_steps: 4
val_check_interval: 100
checkpoint_interval: 500
log_interval: 10
dist_env:
master_addr: localhost
master_port: 29500
rng:
seed: 42
model:
_target_: nemo_automodel.NeMoAutoModelForCausalLM.from_pretrained
pretrained_model_name_or_path: meta-llama/Llama-3.2-1B
dtype: float32
# additional model kwargs passed to the constructor
compile:
enabled: false
backend: inductor
clip_grad_norm:
max_norm: 1.0
distributed:
strategy: fsdp2 # fsdp2 | megatron_fsdp | ddp
dp_size: auto
tp_size: 1
cp_size: 1
loss_fn:
_target_: torch.nn.CrossEntropyLoss
dataset:
_target_: nemo_automodel.datasets.squad.SquadDataset
tokenizer_name_or_path: meta-llama/Llama-3.2-1B
max_seq_length: 2048
validation_dataset:
_target_: nemo_automodel.datasets.squad.SquadDataset
split: validation
packed_sequence:
enabled: false
dataloader:
batch_size: 4
num_workers: 4
pin_memory: true
optimizer:
_target_: torch.optim.AdamW
lr: 2.0e-5
weight_decay: 0.01
lr_scheduler:
_target_: nemo_automodel.schedulers.CosineAnnealingWarmup
warmup_steps: 50
min_lr: 1.0e-6Full-Parameter Training Precision
For new full-parameter training with torch.optim.Adam/AdamW, explicitly set
model.dtype: float32 on NeMoAutoModel loaders for fp32 master weights and
Adam moments. Configure compute precision separately (FSDP2: distributed.mp_policy).
PEFT, TE FusedAdam, and diffusion need separate precision choices; see the mixed-precision guide. Validate memory, training behavior, and checkpoint/resume when migrating existing configs.
The _target_ Pattern
The _target_ key specifies a fully qualified Python callable. All remaining keys in that section are passed as keyword arguments:
optimizer:
_target_: torch.optim.AdamW # callable
lr: 2.0e-5 # kwarg
weight_decay: 0.01 # kwargThis is equivalent to: torch.optim.AdamW(lr=2e-5, weight_decay=0.01).
CLI Overrides
Any config value can be overridden from the command line:
automodel config.yaml \
--optimizer.lr 1e-4 \
--step_scheduler.max_steps 500 \
--distributed.tp_size 2Examples
Validation and checkpointing:
step_scheduler:
val_check_interval: 100
checkpoint_interval: 500
validation_dataset:
_target_: nemo_automodel.datasets.squad.SquadDataset
split: validation
restore_from:
path: /checkpoints/step-500Domain-Specific Notes
LLM
nemo_automodel/recipes/llm/train_ft.pyhandles both finetuning and pretraining. The distinction is in the config (dataset, learning rate, etc.).nemo_automodel/recipes/llm/kd.pyimplements knowledge distillation with a teacher and student model.nemo_automodel/recipes/llm/benchmark.pyruns throughput and latency benchmarks.
VLM
- Uses
NeMoAutoModelForImageTextToTextinstead of causal LM classes. - Config includes a
processorsection instead of a standalone tokenizer. - Recipe lives in
nemo_automodel/recipes/vlm/finetune.py.
Diffusion
- Uses
NeMoAutoDiffusionPipeline. - Requires a
parallel_schemedict in config to define parallelism. - Only supports DDP and FSDP2 strategies (no Megatron-FSDP).
- Recipe lives in
nemo_automodel/recipes/diffusion/train.py.
Retrieval
- Two encoder patterns:
- Bi-encoder (
nemo_automodel/recipes/retrieval/train_bi_encoder.py): separate query and document encoders, contrastive loss. - Cross-encoder (
nemo_automodel/recipes/retrieval/train_cross_encoder.py): joint encoding, classification head.
- Bi-encoder (
- Hard negative mining:
nemo_automodel/recipes/retrieval/mine_hard_negatives.py.
Training Loop Details
The training loop follows this structure per epoch:
for epoch in range(num_epochs):
for batch_idx in range(batches_per_epoch):
# --- gradient accumulation inner loop ---
for micro_batch in micro_batches:
if pipeline_parallel:
schedule.step(micro_batch) # PP schedule
else:
loss = model(micro_batch) # direct forward
loss.backward()
# --- optimizer step ---
scale_grads_and_clip_grad_norm(model, max_norm)
optimizer.step()
lr_scheduler.step()
optimizer.zero_grad()
# --- logging ---
MetricsSample(step, epoch, loss, grad_norm, lr, mem, tps, mfu)
# --- validation (at configured intervals) ---
if step % val_check_interval == 0:
run_validation()
# --- checkpoint (at configured intervals) ---
if step % checkpoint_interval == 0:
save_checkpoint()StepScheduler
Controls all training progression: total epochs, total steps, gradient accumulation steps, validation interval, checkpoint interval, and logging interval.
Gradient Clipping
Applied via scale_grads_and_clip_grad_norm() after the backward pass and before the optimizer step. Controlled by clip_grad_norm.max_norm in config.
Context Parallelism
When cp_size > 1, batches are split across the context-parallel group using make_cp_batch_and_ctx(). This must happen before the forward pass.
MetricsSample
Each training step produces a MetricsSample with fields:
step-- global step countepoch-- current epochloss-- training lossgrad_norm-- gradient norm after clippinglr-- current learning ratemem-- GPU memory usagetps-- tokens per secondmfu-- model FLOPS utilization
Validation & Checkpointing
Validation
- Runs at intervals defined by
step_scheduler.val_check_interval. - Uses the validation dataloader built from
validation_datasetconfig. - Model is set to eval mode; gradients are disabled.
Checkpointing
- Default format: consolidated safetensors for easy deployment on HF ecosystem (always prefer this over DCP).
- Checkpoint interval controlled by
step_scheduler.checkpoint_interval. - Resume training via the
restore_fromconfig key pointing to a checkpoint directory.
restore_from:
path: /checkpoints/step-500Pitfalls
| Problem | Cause | Fix |
| Silent config errors | Typo in _target_ value | The class path must be a valid, importable Python callable. Double-check the module path and class name. |
| Training crashes at first step | global_batch_size not divisible by local_batch_size * dp_size * grad_accumulation_steps | Ensure the batch size math is consistent across all dimensions. |
| New recipe not accessible via CLI | Config is missing a resolvable recipe target | Set the config's recipe key to a discoverable recipe class name or a full dotted _target_ path. |
| Shape mismatch at forward pass | Dataset collate function output does not match model input signature | Verify that the collate function returns tensors with the keys and shapes the model expects. |
| OOM during validation | Validation batch size too large or gradients not disabled | Wrap validation in torch.no_grad() and consider a smaller validation batch size. |
| Checkpoint restore fails | Mismatched model architecture between checkpoint and config | Ensure the model config matches the checkpoint exactly (layer count, hidden dim, vocab size). |
Trending
More talk lately.about the whole repository
Who's talking about NVIDIA-NeMo/Automodel
- NVIDIA/Megatron-LM“DeepSeek-V4 training support”GitHub · Apr 24, 2026 · 27 reactions
- THUDM/slime“[Roadmap][Megatron, VLM] Support VLM”GitHub · Dec 12, 2025 · 6 reactions
- NVIDIA-NeMo/RL“Automodel bump up + Refactor to use the generic CP interface to be provided by Automodel”GitHub · Jul 23, 2026 · 1 reactions
- NVIDIA-NeMo/Megatron-Bridge“[model] Add verified Nemotron 3 Nano 4B CPT support”GitHub · Jul 20, 2026 · 1 reactions
- NVIDIA-NeMo/RL“chore: major version bump (torch 2.8, vllm 0.11, ray 2.49) & SP fixes”GitHub · Oct 10, 2025 · 1 reactions
The biggest 5 of 43 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 43
Talked about on GitHub (43 times).
On GitHub · 43
- Apr 24, 2026DeepSeek-V4 training support — NVIDIA/Megatron-LM27 reactions · 5 comments
- Dec 12, 2025[Roadmap][Megatron, VLM] Support VLM — THUDM/slime6 reactions · 2 comments
- Jul 23, 2026Automodel bump up + Refactor to use the generic CP interface to be provided by Automodel — NVIDIA-NeMo/RL1 reaction · 1 comment
- Jul 20, 2026[model] Add verified Nemotron 3 Nano 4B CPT support — NVIDIA-NeMo/Megatron-Bridge1 reaction · 1 comment
- Oct 10, 2025chore: major version bump (torch 2.8, vllm 0.11, ray 2.49) & SP fixes — NVIDIA-NeMo/RL1 reaction · 41 comments
38 more on GitHub
- Oct 16, 2026fix(automodel): release MoE dispatcher state before colocated offload — NVIDIA-NeMo/RL0 reactions · 4 comments
- Oct 15, 2026feat(speechlm): add native Automodel GSPO ASR recipe — NVIDIA-NeMo/RL0 reactions · 13 comments
- Oct 15, 2026feat(speechlm): support native RL checkpoints and frozen CTC export — NVIDIA-NeMo/Speech0 reactions · 20 comments
- Oct 15, 2026feat(audio): align ASR scoring and support explicit Ray launches — NVIDIA-NeMo/Skills0 reactions · 1 comment
- Oct 14, 2026fix(cutedsl): support CUTLASS DSL 4.4.2 and 4.6.2 — SandAI-org/MagiAttention0 reactions · 2 comments
- Oct 13, 2026An old, unused torchao install makes every LoRA/OFT injection fail with ImportError (e.g. on Colab and Kaggle) — huggingface/peft0 reactions · 6 comments
- Sep 28, 2026fix(build): use C++20 for PyTorch extensions — SandAI-org/MagiAttention0 reactions · 3 comments
- Sep 28, 2026Fix SpeechLM Automodel precision and vLLM audio handling — NVIDIA-NeMo/Speech0 reactions · 8 comments
- Sep 23, 2026chore(customizer): add magi_attention dependency in automodel — NVIDIA-NeMo/nemo-helix0 reactions · 2 comments
- Sep 16, 2026docs: reference NeMo AutoModel and bring the recipe notes up to date — mraad/feln-lora0 reactions · 5 comments
- Sep 16, 2026fix(customizer): install seed deps in grpo env + dtensor v2 ckpt crash — NVIDIA-NeMo/nemo-helix0 reactions · 2 comments
- Sep 16, 2026feat(speechlm2): add DFlash and DFlash2 training for SALM — NVIDIA-NeMo/Speech0 reactions · 9 comments
- Sep 9, 2026build(deps-dev): bump nvidia-modelopt from 0.44.0 to 0.46.0 — HuipengHuang/verl-baseline0 reactions
- Sep 1, 2026[Feature Request] Add text-only GRPO support for Qwen3.8-Flash-Next (qwen4_exp) — verl-project/verl0 reactions
- Aug 4, 2026Add training submodules for RunPod environment — witchking999/muramasaIII0 reactions
- Aug 1, 2026[feature] Support DSpark speculative decoding draft training — NVIDIA-NeMo/Megatron-Bridge0 reactions · 5 comments
- Jul 31, 2026[feature] DeepSeekV4 + FP8 RL — NVIDIA-NeMo/labs-molt0 reactions
- Jul 30, 2026Integrate NeMo Automodel Qwen3.5-35B-A3B recipe with MFSDP v2 — NVIDIA/Megatron-LM0 reactions
- Jul 17, 2026cuDNN fused-MHA SDPA backend intermittently fails with "mha_graph.execute(...).is_good() == false" during Qwen3-VL image+text inference on H200 / cuDNN 9.20 — pytorch/pytorch0 reactions · 5 comments
- Jul 16, 2026[DSpark] Add dspark dense draft model — sgl-project/sglang0 reactions · 2 comments
- Jun 11, 2026feat(speechlm2): add Multi-Token Prediction (MTP) training support to SALMAutomodel — NVIDIA-NeMo/Speech0 reactions · 2 comments
- May 14, 2026CUDA codegen LogFatals on `boolx8` from sparse-MLA bwd kernel on B300/sm_103 (TileLang 0.1.9) — tile-ai/tilelang0 reactions · 1 comment
- May 10, 2026fix(automodel): support combined projection tensor sync — NVIDIA-NeMo/RL0 reactions · 1 comment
- Apr 24, 2026Track DeepSeek V4 upstream dependency blockers — zpqiu/RL0 reactions · 3 comments
- Apr 24, 2026Support DSV4 Flash — NVIDIA-NeMo/RL0 reactions · 1 comment
- Apr 23, 2026Qwen3.5 Automodel path is slower than MCore because flash-linear-attention (FLA) is not installed by default — NVIDIA-NeMo/RL0 reactions · 5 comments
- Apr 23, 2026Qwen3.5 MoE Automodel path does not use FP32 master weights by default, causing slower convergence — NVIDIA-NeMo/RL0 reactions
- Apr 20, 2026fix(pre-commit): preserve matched filenames in `no-underscore-md` hook — NVIDIA-NeMo/FW-CI-templates0 reactions
- Apr 17, 2026Track Qwen3.5-related issues — NVIDIA-NeMo/RL0 reactions
- Feb 10, 2026Support transformers v5 — ByteDance-Seed/VeOmni0 reactions · 1 comment
- Jan 11, 2026feat: Add NVIDIA Embed Nemotron embedding model support — paiml/trueno-rag0 reactions · 1 comment
- Dec 25, 2025ImportError: cannot import name 'TransformersKwargs' from 'transformers.utils' — iqiancheng/llms-cookbook0 reactions · 1 comment
- Dec 25, 2025ImportError: /opt/hpcx/ucc/lib/libucc.so.1: undefined symbol: ucs_config_doc_nop — iqiancheng/llms-cookbook0 reactions · 1 comment
- Nov 12, 2025layer-by-layer comparison tool between policy/generation — NVIDIA-NeMo/RL0 reactions
- Sep 25, 2025Use scale and clip grads utilties from Automodel for DTensor v2 — NVIDIA-NeMo/RL0 reactions
- Sep 8, 2025gemma 27b slow on v2 — NVIDIA-NeMo/RL0 reactions · 1 comment
- Sep 5, 2025Gemma3 27B crashes on 8 nodes with Sequence Parallel — NVIDIA-NeMo/RL0 reactions
- Sep 5, 2025Gemma3 27B crashes on 16 nodes w/ FSDP — NVIDIA-NeMo/RL0 reactions · 1 comment
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- NVIDIA/skills★ 3.8k100% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- build-and-dependencySkill
- cicdSkill
- fern-docsSkill
- linting-and-formattingSkill
- parity-testingSkill
- testingSkill
- nemo-automodel-distributed-trainingSkill
- nemo-automodel-launcher-configSkill
- nemo-automodel-model-onboardingSkill
- pr-reviewSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

