Ongoing research training transformer models at scale
Ongoing research training transformer models at scale
This repository contains two components: Megatron-LM and Megatron Core.
Megatron-LM is a reference example that includes Megatron Core plus pre-configured training scripts, ideal for research teams, learning distributed training, and quick experimentation.
Megatron Core is a composable library with GPU-optimized building blocks for custom training frameworks. It provides transformer building blocks, advanced parallelism strategies (TP, PP, DP, EP, and CP), mixed precision support (FP16, BF16, FP8, and FP4), and model architectures, ideal for framework developers and ML engineers building custom training pipelines.
Megatron Bridge provides bidirectional Hugging Face ↔ Megatron checkpoint conversion with production-ready recipes.
Install from PyPI:
uv pip install megatron-coreOr clone and install from source:
git clone https://github.com/NVIDIA/Megatron-LM.git
cd Megatron-LM
uv pip install -e .Note: Building from source can use a lot of memory. If the build runs out of memory, limit parallel compilation jobs by setting
MAX_JOBS(for example,MAX_JOBS=4 uv pip install -e .).
For NVIDIA GPU Cloud (NGC) container setup and all installation options, review the Installation Guide.
dev branch includes the initial DeepSeek-V4 implementation; Megatron Bridge provides conversion, inference, and pretraining recipes.…For the latest performance benchmarking results, refer to NVIDIA Megatron Bridge Performance Summary.
The codebase efficiently trains models from 2B to 462B parameters across thousands of GPUs, achieving up to 47% Model FLOP Utilization (MFU) on H100 clusters.
Benchmark Configuration:
--overlap-grad-reduce, --overlap-param-gather), TP (--tp-comm-overlap), and PP (enabled by default)Key Results:
The weak scaled results show superlinear scaling (MFU increases from 41% for the smallest model considered to 47–48% for the largest models); this is because larger GEMMs have higher arithmetic intensity and are consequently more efficient to execute.
This test strong scales the standard GPT-3 model (slightly more than 175 billion parameters due to larger vocabulary size) from 96 H100 GPUs to 4,608 GPUs, using the same batch size of 1,152 sequences throughout. Communication becomes more exposed at larger scale, leading to a reduction in MFU from 47% to 42%.
dev branch first developments]Contributions are welcome. Ways to contribute:
If you use Megatron in your research or project, use the following citation:
@article{megatron-lm,
title={Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism},
author={Shoeybi, Mohammad and Patwary, Mostofa and Puri, Raul and LeGresley, Patrick and Casper, Jared and Catanzaro, Bryan},
journal={arXiv preprint arXiv:1909.08053},
year={2019}
}triton KV append kernel hard-asserts CUDA, blocking non-CUDA Triton backends
[QUESTION] Will this repo accept contributions for other vendor devices
GRPO crashes with --transformer-impl local when RL training CUDA graphs are disabled
[BUG] Packed THD MLA value padding may affect attention backend availability on Blackwell
Persistent async checkpoint worker failures are not propagated to training ranks
[QUESTION]NVFP4 Post SFT Training & Model Accuracy
Megatron-LM Monthly Activity Report — September 2026 (Final, through September 30, 2026)
MFSDP v2: cross-unit checkpoint replay reads sharded child weights
[BUG] Expert RNG seed depends on pp_rank + ep_rank only, so experts in different pipeline stages get identical initial weights
Batch-invariant weighted SwiGLU reads invalid memory at large input offsets