nvlabs/skill2env/nemo-automodel-model-onboarding
Claude Code and agent skill by nvlabs/skill2env
- community
- ext:[{"type":"config","description":"Configuration overrides"}]
Checking that the SKILL.md file is still in the repository.
Guide for onboarding new model architectures into NeMo AutoModel, including architecture discovery, implementation patterns, registration, and validation.
Install
npx vskill@latest install nvlabs/skill2env/nemo-automodel-model-onboardingSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as nvidia/skills/nemo-automodel-model-onboarding.
Adding Model Support to NeMo AutoModel
Purpose
This skill guides implementation of new model architectures in NeMo AutoModel. Follow the five phases in order.
Instructions
When answering an onboarding question, keep the response in this order:
- Classify the architecture from
config.json. - Name the exact implementation files under
components/models/<name>/. - Identify registry and optional custom-config updates.
- State the validation tests that must be added before full checkpoint use.
For conceptual onboarding questions, answer from this skill without opening the pattern files unless the user asks you to edit code. Mention pattern filenames as references, then give the direct checklist.
Use direct action verbs: classify the model, name the files, map the weights, register the class, and add tests. Do not discuss distributed strategy, launcher configuration, or general recipe authoring unless the user explicitly connects it to onboarding a new architecture.
Examples
Use these compact answer patterns for common questions:
- Dense causal LM: classify as dense only when
architecturescontains a
ForCausalLM class and expert fields such as num_local_experts, n_routed_experts, or num_experts_per_tok are absent. Create components/models/<name>/model.py, state_dict_adapter.py, __init__.py, and optional config.py, register MODEL_ARCH_MAPPING in _transformers/registry.py, add example YAML, and add tiny-config unit tests plus layer-equivalence tests for rewritten layers.
- MoE state dict: identify expert fields in
config.json, reference
moe-patterns.md, map router tensors separately, preserve routed-expert index order, map routed experts, shared experts, and gate/up/down projections, add adapter key-map tests and tiny-config numerical equivalence tests, and do not rely only on from_pretrained() or silent tensor reshapes.
- VLM onboarding: classify as VLM only when
vision_config,text_config, and
a ForConditionalGeneration architecture are present. Reference vlm-patterns.md and existing VLM implementations such as mistral4, kimivl, or kimi_k25_vl; check text backbone, vision tower, projector, processor assumptions, text and vision state_dict_adapter.py mappings, registry registration, and tiny image-text tests before full checkpoints. Do not treat VLM onboarding as a pure causal-LM path or skip processor/image tests.
For MoE state-dict questions, always include the safety checklist:
- Map router tensors separately from expert tensors.
- Preserve routed-expert index order; never sort, drop, merge, or silently
reshape expert weights to make loading pass.
- Map gate, up, and down projections explicitly, including combined projection
layouts and shared experts when present.
- Add adapter key-map tests and tiny-config numerical equivalence tests before
relying on full checkpoint loading.
For VLM questions, explicitly check vision_config, text_config, the conditional-generation architecture, text backbone, vision tower, projector, processor assumptions, registry entry, and tiny image-text tests.
Routing Boundary
Use this skill only when the user is adding or modifying model architecture support: model files, custom layers, state-dict adapters, Hugging Face config mapping, registry entries, or model capability flags.
Do not use this skill for standalone training recipe YAML questions about optimizers, datasets, schedulers, validation datasets, or trainer wiring unless they are explicitly part of onboarding a new model architecture. Those recipe questions belong to the nemo-automodel-recipe-development skill.
In-scope examples:
- "Add support for a new Hugging Face causal LM architecture."
- "Map MoE router and expert weights from a Hugging Face checkpoint."
- "Register a new model class in NeMo AutoModel."
Out-of-scope examples:
- "Write a finetuning recipe YAML with optimizer and dataset sections."
- "Choose FSDP2, DDP, tensor parallel, or context parallel settings."
- "Configure Slurm, SkyPilot, containers, mounts, or launch dispatch."
Phase 1: Discovery
Before writing code, gather information about the target model.
1.1 Fetch HuggingFace config.json
Download the model's config.json from the HuggingFace Hub (or use AutoConfig.from_pretrained). Key fields to extract:
architectures-- determines the class name and registration key (e.g.,"LlamaForCausalLM","Qwen3MoeForCausalLM","Mistral3ForConditionalGeneration")model_type-- used for custom config registration in_CUSTOM_CONFIG_REGISTRATIONSif HF does not have a built-in config classhidden_size,intermediate_size,num_hidden_layers,num_attention_heads,num_key_value_heads-- sizingvocab_size-- needed for tiny test configstie_word_embeddings-- whether lm_head shares weights with embed_tokenshidden_act-- activation function (e.g.,"silu"for SwiGLU)
1.2 Determine model type
| Type | Indicators | Pattern file | |
|---|---|---|---|
| Dense LLM | ForCausalLM in architectures, no expert fields | llm-patterns.md | |
| MoE LLM | n_routed_experts, num_local_experts, num_experts_per_tok in config | moe-patterns.md | |
| VLM | ForConditionalGeneration in architectures, has vision_config + text_config | vlm-patterns.md |
1.3 Check for existing similar architectures
Look in components/models/ for architectures with similar attention or MLP patterns:
1.4 Identify custom components
Check whether the model needs:
- Custom attention: GQA (standard), MLA (DeepSeek/Mistral4), sliding window, bidirectional
- Custom RoPE: Standard (Llama), YaRN scaling, NTK-aware, complex-number (DeepSeek)
- Custom normalization: RMSNorm (standard), LayerNorm, different eps values
- Custom MLP: SwiGLU (standard), GeGLU, ReLU-squared, MoE routing
- Custom config class: Needed only if HF
AutoConfigcannot parse the model'sconfig.json(checkauto_mapfield)
1.5 Note dimensions for test config
For unit tests, create a tiny config. Target: ~1M parameters or less.
Phase 2: Implementation
2.1 Create directory structure
2.2 Implementation order
Implement files in dependency order:
- config.py (if needed) -- Custom
PretrainedConfigsubclass - rope_utils.py (if needed) -- RoPE implementation
- layers.py (if needed) -- Attention, MLP, decoder block classes
- model.py -- The main
ForCausalLM(orForConditionalGeneration) class - state_dict_adapter.py -- HF weight conversion
- __init__.py -- Re-export the main model class
See the pattern files for detailed implementation guidance:
- Dense LLM: llm-patterns.md
- MoE: moe-patterns.md
- VLM: vlm-patterns.md
2.3 MoE state-dict adapter checklist
For MoE models, do not stop at generic loading. The adapter must explicitly map:
- Router weights, including gate bias or correction-bias tensors when the Hugging Face model has them.
- Expert weights, preserving expert index order across local and routed experts.
- Gate/up/down projections, including combined or split projection layouts.
- Shared experts separately from routed experts when the architecture has both.
Add tests that assert expected key mappings and run numerical equivalence with tiny configs before trying full checkpoints.
Do not use these shortcuts:
- Do not validate the adapter only by calling
from_pretrained(). - Do not accept missing or extra expert keys without an explicit mapping reason.
- Do not change dtype, transpose dimensions, or reshape tensors unless the HF
and NeMo layouts require it and a test proves the conversion is reversible.
- Do not skip router or shared-expert tests because dense-layer tests pass.
2.4 VLM onboarding checklist
For VLMs, confirm the Hugging Face config has vision_config and text_config and that architectures points to a conditional-generation class. Start from the closest VLM pattern file, usually vlm-patterns.md, and compare existing implementations such as mistral4, kimivl, or kimi_k25_vl.
The implementation should explicitly cover:
- Text backbone, vision tower, projector, and processor or image preprocessing assumptions.
- Weight mapping for both text and vision modules in
state_dict_adapter.py. - Registration of the
ForConditionalGenerationclass in_transformers/registry.py. - Tiny tests that exercise image-text inputs and verify the adapter round-trip.
2.5 Register in registry
Add the model to MODEL_ARCH_MAPPING in _transformers/registry.py:
If the model has a custom config class with auto_map in its config.json, also register in _CUSTOM_CONFIG_REGISTRATIONS:
Phase 3: Onboarding Example Config
This phase is only for adding a minimal example config that proves the newly onboarded architecture can load and run. Use nemo-automodel-recipe-development for general recipe authoring or existing recipe modifications.
3.1 Create example YAML config
Create an example config under examples/llm_finetune/<name>/ (or examples/vlm_finetune/<name>/):
3.2 Verify model loads
Test that the model loads from a HuggingFace checkpoint:
3.3 Test with tiny config first
Before using full-size models, verify with a tiny config (1-2 layers, small hidden dim) to catch shape mismatches early.
Phase 4: Tests
Create tests/unit_tests/models/<name>/ and cover the checks below before loading full checkpoints:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingSkillHub/skills/nvidia/nemo-automodel-model-onboarding/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Extension points
configConfiguration overrides
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nvlabs/skill2env/nemo-automodel-model-onboarding)