Skip to content

Commit 4d7ce79

Browse files
authored
refactor(recipes): add h100 recipe namespace (#4622)
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
1 parent 605c816 commit 4d7ce79

182 files changed

Lines changed: 29813 additions & 25252 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
## 📣 News
1414
- [06/22/2026] **Megatron Bridge 0.5.0 released!** Highlights include expanded LLM and multimodal support (Qwen3.5, DeepSeek V4, Ernie 4.5, GLM-5/4.7, StepFun Step-3.5/3.7, MiMo-V2, Gemma 4, Falcon H1, Ling MoE V2, Nemotron-3 Nano Omni, Qwen3-Omni, Qwen3-ASR, and Nemotron Diffusion), MegatronMIMO and Energon v7 training updates, evaluator backend integration, eval-time context parallelism, deterministic recipes, quantized FP8/MXFP4 export, CUDA graph/performance improvements, and Megatron Inference/tokenizer unification with Megatron-LM. Huge thanks to our community contributors: [@HowardZorn](https://github.com/HowardZorn), [@hy2826](https://github.com/hy2826), [@bo-ke](https://github.com/bo-ke), [@beccohov](https://github.com/beccohov), [@dhiaEddineRhaiem](https://github.com/dhiaEddineRhaiem), [@pavelgein](https://github.com/pavelgein), [@ccclyu](https://github.com/ccclyu), [@hbhflw2000](https://github.com/hbhflw2000), and [@HollowMan6](https://github.com/HollowMan6)! See the [full release notes](https://github.com/NVIDIA-NeMo/Megatron-Bridge/releases/tag/v0.5.0).
1515

16-
- [06/16/2026] NVIDIA topped [MLPerf Training v6.0](https://developer.nvidia.com/blog/nvidia-blackwell-tops-mlperf-training-6-0-with-industry-leading-scale-and-performance/) across every benchmark, including the new DeepSeek-V3 and GPT-OSS MoE training workloads. Megatron Bridge serves as the packaging layer for the NeMo 26.06 training stack that integrates full-iteration CUDA graphs, HybridEP/router optimizations, all-to-all overlap, MXFP8 attention, and pipeline-layout balancing; the blog highlights [DeepSeek-V3 training](https://github.com/NVIDIA-NeMo/Megatron-Bridge/tree/main/scripts/performance/configs/deepseek) at **1,648 TFLOPS/GPU** (**6,338 tokens/sec/GPU**) on GB300. To try related runs, start from the [performance recipes](https://github.com/NVIDIA-NeMo/Megatron-Bridge/tree/main/scripts/performance); the corresponding container is expected with the NeMo 26.06 release soon.
16+
- [06/16/2026] NVIDIA topped [MLPerf Training v6.0](https://developer.nvidia.com/blog/nvidia-blackwell-tops-mlperf-training-6-0-with-industry-leading-scale-and-performance/) across every benchmark, including the new DeepSeek-V3 and GPT-OSS MoE training workloads. Megatron Bridge serves as the packaging layer for the NeMo 26.06 training stack that integrates full-iteration CUDA graphs, HybridEP/router optimizations, all-to-all overlap, MXFP8 attention, and pipeline-layout balancing; the blog highlights [DeepSeek-V3 training](https://github.com/NVIDIA-NeMo/Megatron-Bridge/tree/main/src/megatron/bridge/perf_recipes/deepseek) at **1,648 TFLOPS/GPU** (**6,338 tokens/sec/GPU**) on GB300. To try related runs, start from the [performance recipes](https://github.com/NVIDIA-NeMo/Megatron-Bridge/tree/main/scripts/performance); the corresponding container is expected with the NeMo 26.06 release soon.
1717

1818
- [06/04/2026] [**NVIDIA Nemotron 3 Ultra**](https://huggingface.co/nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16) is now public! Day-0 support for the 550B-A55B hybrid Mamba-Transformer MoE model is available on the [`nemotron_3_ultra`](https://github.com/NVIDIA-NeMo/Megatron-Bridge/tree/nemotron_3_ultra) branch, including checkpoint conversion, inference, SFT, PEFT (LoRA), and pretraining examples. Read the [NVIDIA Technical Blog](https://developer.nvidia.com/blog/nvidia-nemotron-3-ultra-powers-faster-more-efficient-reasoning-for-long-running-agents/) and see the [examples README](https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/nemotron_3_ultra/examples/models/nemotron/nemotron_3/ultra/README.md) for the full walkthrough.
1919

@@ -141,14 +141,14 @@ Training quickstart using pre-configured recipes:
141141

142142
```python
143143
from megatron.bridge import AutoBridge
144-
from megatron.bridge.recipes.llama import llama32_1b_pretrain_config
144+
from megatron.bridge.recipes.llama.h100 import llama32_1b_pretrain_1gpu_h100_bf16_config
145145
from megatron.bridge.training.gpt_step import forward_step
146146
from megatron.bridge.training.pretrain import pretrain
147147

148148
if __name__ == "__main__":
149149
# The recipe uses the Llama 3.2 1B architecture from Hugging Face.
150150
# This is random-init pretraining and does not require a converted Megatron checkpoint.
151-
cfg = llama32_1b_pretrain_config()
151+
cfg = llama32_1b_pretrain_1gpu_h100_bf16_config()
152152

153153
# The recipe already sets cfg.model internally using this pattern.
154154
# Override cfg.model to choose a different Hugging Face model ID as the architecture source.

‎docs/fern/versions/nightly/pages/megatron-lm-to-megatron-bridge.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ uv run python scripts/translate_mlm_to_bridge.py \
3030
```bash
3131
# From a Bridge recipe name (defaults exported as MLM args)
3232
uv run python scripts/translate_mlm_to_bridge.py --reverse \
33-
--recipe llama32_1b_pretrain_config
33+
--recipe llama32_1b_pretrain_1gpu_h100_bf16_config
3434

3535
# From a recipe plus inline overrides
3636
uv run python scripts/translate_mlm_to_bridge.py --reverse \
37-
--recipe llama32_1b_pretrain_config \
37+
--recipe llama32_1b_pretrain_1gpu_h100_bf16_config \
3838
--args "train.train_iters=1000 model.tensor_model_parallel_size=2"
3939

4040
# From Bridge overrides only (no recipe)
@@ -99,7 +99,7 @@ Run the generic recipe launcher and override config keys directly:
9999

100100
```bash
101101
uv run python scripts/training/run_recipe.py \
102-
--recipe llama3_8b_pretrain_config \
102+
--recipe llama3_8b_pretrain_2gpu_h100_bf16_config \
103103
--dataset llm-pretrain \
104104
train.micro_batch_size=2 \
105105
train.global_batch_size=128 \

‎docs/fern/versions/nightly/pages/models/gemma/gemma2.mdx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ config = gemma2_27b_pretrain_config(
166166

167167
#### Gemma 2 2B
168168
```bash
169-
uv run python -m torch.distributed.run --nproc-per-node=8 run/run_recipe.py \
169+
uv run python -m torch.distributed.run --nproc-per-node=8 scripts/training/run_recipe.py \
170170
--pretrained-checkpoint /models/gemma-2-2b \
171171
--recipe gemma2_2b_sft_config \
172172
train.global_batch_size=64 \
@@ -188,7 +188,7 @@ config = gemma2_2b_sft_config(
188188

189189
#### Gemma 2 9B
190190
```bash
191-
uv run python -m torch.distributed.run --nproc-per-node=8 run/run_recipe.py \
191+
uv run python -m torch.distributed.run --nproc-per-node=8 scripts/training/run_recipe.py \
192192
--pretrained-checkpoint /models/gemma-2-9b \
193193
--recipe gemma2_9b_sft_config \
194194
train.global_batch_size=64 \
@@ -198,7 +198,7 @@ checkpoint.save=$SAVE_DIR/gemma2_9b_finetune
198198

199199
#### Gemma 2 27B
200200
```bash
201-
uv run python -m torch.distributed.run --nproc-per-node=16 run/run_recipe.py \
201+
uv run python -m torch.distributed.run --nproc-per-node=16 scripts/training/run_recipe.py \
202202
--pretrained-checkpoint /models/gemma-2-27b \
203203
--recipe gemma2_27b_sft_config \
204204
train.global_batch_size=64 \
@@ -210,7 +210,7 @@ checkpoint.save=$SAVE_DIR/gemma2_27b_finetune
210210

211211
#### Gemma 2 2B
212212
```bash
213-
uv run python -m torch.distributed.run --nproc-per-node=8 run/run_recipe.py \
213+
uv run python -m torch.distributed.run --nproc-per-node=8 scripts/training/run_recipe.py \
214214
--pretrained-checkpoint /models/gemma-2-2b \
215215
--recipe gemma2_2b_peft_config \
216216
--peft_scheme lora \

‎docs/fern/versions/nightly/pages/models/gemma/gemma3.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ config = gemma3_1b_peft_config(
155155

156156
**Full Finetuning:**
157157
```bash
158-
uv run python -m torch.distributed.run --nproc-per-node=8 run/run_recipe.py \
158+
uv run python -m torch.distributed.run --nproc-per-node=8 scripts/training/run_recipe.py \
159159
--pretrained-checkpoint /models/gemma-3-1b-it \
160160
--recipe gemma3_1b_sft_config \
161161
train.global_batch_size=64 \
@@ -165,7 +165,7 @@ uv run python -m torch.distributed.run --nproc-per-node=8 run/run_recipe.py \
165165

166166
**LoRA Finetuning:**
167167
```bash
168-
uv run python -m torch.distributed.run --nproc-per-node=8 run/run_recipe.py \
168+
uv run python -m torch.distributed.run --nproc-per-node=8 scripts/training/run_recipe.py \
169169
--pretrained-checkpoint /models/gemma-3-1b-it \
170170
--recipe gemma3_1b_peft_config \
171171
--peft_scheme lora \

‎docs/fern/versions/nightly/pages/models/glm/glm45.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ config = glm45_355b_peft_config(
214214

215215
```bash
216216
# GLM 4.5 Air - LoRA finetuning on single node (8 GPUs)
217-
uv run python -m torch.distributed.run --nproc-per-node=8 run/run_recipe.py \
217+
uv run python -m torch.distributed.run --nproc-per-node=8 scripts/training/run_recipe.py \
218218
--pretrained-checkpoint /models/glm45-air-106b \
219219
--recipe glm45_air_106b_peft_config \
220220
--peft_scheme lora \
@@ -223,7 +223,7 @@ train.train_iters=1000 \
223223
checkpoint.save=$SAVE_DIR/glm45_air_lora
224224

225225
# GLM 4.5 355B - Full finetuning (256 GPUs)
226-
uv run python -m torch.distributed.run --nnodes=32 --nproc-per-node=8 run/run_recipe.py \
226+
uv run python -m torch.distributed.run --nnodes=32 --nproc-per-node=8 scripts/training/run_recipe.py \
227227
--pretrained-checkpoint /models/glm45-355b \
228228
--recipe glm45_355b_sft_config \
229229
train.global_batch_size=256 \

‎docs/fern/versions/nightly/pages/models/llama/llama3.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ See: [bridge.recipes.llama.llama3](../../apidocs/bridge/bridge.recipes.llama.lla
8686
- `llama32_1b_pretrain_config`, `llama32_3b_pretrain_config`: Llama 3.2 (1B, 3B)
8787
- `llama3_8b_pretrain_config`: Llama 3 8B with 8K context
8888
- `llama3_8b_16k_pretrain_config`, `llama3_8b_64k_pretrain_config`, `llama3_8b_128k_pretrain_config`: Llama 3 8B with extended context (16K/64K/128K)
89-
- `llama3_8b_low_precision_pretrain_config`: Llama 3 8B with low precision (FP8/MXFP8/NVFP4)
89+
- `llama3_8b_pretrain_2gpu_h100_fp8cs_config`, `llama3_8b_pretrain_2gpu_h100_fp8mx_config`, `llama3_8b_pretrain_2gpu_h100_nvfp4_config`: Llama 3 8B H100 low precision (FP8/MXFP8/NVFP4)
9090
- `llama3_70b_pretrain_config`, `llama3_70b_16k_pretrain_config`, `llama3_70b_64k_pretrain_config`: Llama 3 70B (8K/16K/64K context)
9191
- `llama31_8b_pretrain_config`, `llama31_70b_pretrain_config`, `llama31_405b_pretrain_config`: Llama 3.1 (8B/70B/405B, 128K context)
9292

‎docs/fern/versions/nightly/pages/recipe-usage.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This guide will cover the next steps to make use of a training recipe, including
1212

1313
## Choosing a recipe or a new config
1414

15-
Start from an exported recipe when the model family and workflow already exist in `megatron.bridge.recipes`. Recipe functions such as `llama3_8b_pretrain_config`, `llama32_1b_sft_config`, and `qwen3_8b_peft_config` provide model, optimizer, scheduler, precision, dataset, logger, and checkpoint defaults in one `ConfigContainer`. Override those defaults for your dataset, checkpoint paths, run length, parallelism, or precision before creating a new recipe.
15+
Start from an exported recipe when the model family and workflow already exist in `megatron.bridge.recipes`. Hardware-specific H100 recipes such as `llama3_8b_pretrain_2gpu_h100_bf16_config`, `llama32_1b_sft_1gpu_h100_bf16_config`, and `qwen3_8b_peft_1gpu_h100_bf16_config` are the canonical recipe names and share the same `<model>_<task>_<num>gpu_<gpu>_<dtype>[_<variant>]_config` naming strategy as performance recipes. Other hardware-specific recipe namespaces will follow the same pattern as they are added. The older recipe names remain available as compatibility aliases. Override those defaults for your dataset, checkpoint paths, run length, parallelism, or precision before creating a new recipe.
1616

1717
Create a new recipe or config when the base model architecture is not represented by an existing model provider, the checkpoint conversion needs a new bridge, the forward step or dataset provider is model-specific, or you need a reusable configuration that will be shared across jobs. If the Hugging Face model is already supported by `AutoBridge`, you usually only need to start from the closest recipe and override the model provider or `hf_path`.
1818

‎docs/fern/versions/nightly/pages/training/data-preparation.mdx‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ dataset = GPTDatasetConfig(
4141
The CLI-friendly `data_path` field is converted to Megatron Core's `blend` field during config finalization. For weighted multi-dataset training, use either a flattened `data_path` list with weights and prefixes or set `blend`/`blend_per_split` directly.
4242

4343
```bash
44-
uv run python -m torch.distributed.run --nproc_per_node=8 scripts/training/run_recipe.py \
45-
--recipe llama32_1b_pretrain_config \
44+
uv run python -m torch.distributed.run --nproc_per_node=1 scripts/training/run_recipe.py \
45+
--recipe llama32_1b_pretrain_1gpu_h100_bf16_config \
4646
--dataset llm-pretrain \
4747
dataset.data_path=/data/dclm/preprocessed_text_document \
4848
dataset.seq_length=8192
@@ -81,8 +81,8 @@ dataset = FinetuningDatasetConfig(
8181
Launch the generic recipe runner with the preloaded local JSONL dataset type:
8282

8383
```bash
84-
uv run python -m torch.distributed.run --nproc_per_node=8 scripts/training/run_recipe.py \
85-
--recipe llama32_1b_sft_config \
84+
uv run python -m torch.distributed.run --nproc_per_node=1 scripts/training/run_recipe.py \
85+
--recipe llama32_1b_sft_1gpu_h100_bf16_config \
8686
--dataset llm-finetune-preloaded \
8787
dataset.dataset_root=/data/sft_jsonl \
8888
dataset.seq_length=4096 \
@@ -114,8 +114,8 @@ If `dataset_root` is omitted, the processed JSONL is cached under the NeMo datas
114114
The generic launcher provides preset Hugging Face text datasets through `--dataset llm-finetune`:
115115

116116
```bash
117-
uv run python -m torch.distributed.run --nproc_per_node=8 scripts/training/run_recipe.py \
118-
--recipe llama32_1b_peft_config \
117+
uv run python -m torch.distributed.run --nproc_per_node=1 scripts/training/run_recipe.py \
118+
--recipe llama32_1b_peft_1gpu_h100_bf16_config \
119119
--dataset llm-finetune \
120120
dataset.dataset_name=gsm8k \
121121
checkpoint.pretrained_checkpoint=/checkpoints/base_model
@@ -128,8 +128,8 @@ VLM recipes usually use a dataset provider instead of `FinetuningDatasetConfig`.
128128
For Energon/WebDataset data, create tar shards plus `.nv-meta` metadata and pass the dataset root to the recipe provider:
129129

130130
```bash
131-
uv run python -m torch.distributed.run --nproc_per_node=8 scripts/training/run_recipe.py \
132-
--recipe qwen3_vl_8b_peft_energon_config \
131+
uv run python -m torch.distributed.run --nproc_per_node=1 scripts/training/run_recipe.py \
132+
--recipe qwen3_vl_8b_peft_1gpu_h100_bf16_energon_config \
133133
--dataset vlm-energon \
134134
--step_func qwen3_vl_step \
135135
dataset.path=/data/vlm_energon \
@@ -143,8 +143,8 @@ For preloaded VLM JSON or JSONL, use records with `messages` or `conversations`
143143
```
144144

145145
```bash
146-
uv run python -m torch.distributed.run --nproc_per_node=8 scripts/training/run_recipe.py \
147-
--recipe qwen3_vl_8b_peft_config \
146+
uv run python -m torch.distributed.run --nproc_per_node=1 scripts/training/run_recipe.py \
147+
--recipe qwen3_vl_8b_peft_1gpu_h100_bf16_config \
148148
--dataset vlm-preloaded \
149149
--step_func qwen3_vl_step \
150150
dataset.train_data_path=/data/vlm/train.jsonl \

‎docs/fern/versions/nightly/pages/training/mixed-precision.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ cfg.mixed_precision = "bf16_with_nvfp4_mixed"
129129
cfg.checkpoint.pretrained_checkpoint = "/checkpoints/base_model"
130130
```
131131

132-
Some model families expose tuned NVFP4 recipes. For example, Llama 3 8B has a low-precision pretraining helper:
132+
Some model families expose tuned NVFP4 recipes. For example, Llama 3 8B has a hardware-specific low-precision pretraining recipe:
133133

134134
```python
135-
from megatron.bridge.recipes.llama import llama3_8b_low_precision_pretrain_config
135+
from megatron.bridge.recipes.llama.h100 import llama3_8b_pretrain_2gpu_h100_nvfp4_config
136136

137-
cfg = llama3_8b_low_precision_pretrain_config("bf16_with_nvfp4_mixed")
137+
cfg = llama3_8b_pretrain_2gpu_h100_nvfp4_config()
138138
```
139139

140140
NVFP4 is related to FP8 in that both use Transformer Engine low-precision kernels and BF16 fallback for non-quantized state, but the configuration knobs are separate. Use FP8 recipes on Hopper or Blackwell when FP8 is the target precision; use NVFP4 recipes on Blackwell when the model and hardware have been validated for 4-bit training.

‎docs/megatron-lm-to-megatron-bridge.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ uv run python scripts/translate_mlm_to_bridge.py \
3030
```bash
3131
# From a Bridge recipe name (defaults exported as MLM args)
3232
uv run python scripts/translate_mlm_to_bridge.py --reverse \
33-
--recipe llama32_1b_pretrain_config
33+
--recipe llama32_1b_pretrain_1gpu_h100_bf16_config
3434

3535
# From a recipe plus inline overrides
3636
uv run python scripts/translate_mlm_to_bridge.py --reverse \
37-
--recipe llama32_1b_pretrain_config \
37+
--recipe llama32_1b_pretrain_1gpu_h100_bf16_config \
3838
--args "train.train_iters=1000 model.tensor_model_parallel_size=2"
3939

4040
# From Bridge overrides only (no recipe)
@@ -99,7 +99,7 @@ Run the generic recipe launcher and override config keys directly:
9999

100100
```bash
101101
uv run python scripts/training/run_recipe.py \
102-
--recipe llama3_8b_pretrain_config \
102+
--recipe llama3_8b_pretrain_2gpu_h100_bf16_config \
103103
--dataset llm-pretrain \
104104
train.micro_batch_size=2 \
105105
train.global_batch_size=128 \

0 commit comments

Comments
 (0)