[2025/12] 🎉 Megatron Core development has moved to GitHub! All development and CI now happens in the open. We welcome community contributions.
[2025/10]Megatron Dev Branch - early access branch with experimental features.
[2025/10]Megatron Bridge - Bidirectional converter for interoperability between Hugging Face and Megatron checkpoints, featuring production-ready recipes for popular models.
[2025/08]MoE Q3-Q4 2025 Roadmap - Comprehensive roadmap for MoE features including DeepSeek-V3, Qwen3, advanced parallelism strategies, FP8 optimizations, and Blackwell performance enhancements.
[2025/08]GPT-OSS Model - Advanced features including YaRN RoPE scaling, attention sinks, and custom activation functions are being integrated into Megatron Core.
[2025/06]Megatron MoE Model Zoo - Best practices and optimized configurations for training DeepSeek-V3, Mixtral, and Qwen3 MoE models with performance benchmarking and checkpoint conversion tools.
[2025/05] Megatron Core v0.11.0 brings new capabilities for multi-data center LLM training (blog).
Previous News
[2024/07] Megatron Core v0.7 improves scalability and training resiliency and adds support for multimodal training (blog).
[2024/01 Announcement] NVIDIA has released the core capabilities in Megatron-LM into Megatron Core in this repository. Megatron Core expands upon Megatron-LM's GPU-optimized techniques with more cutting-edge innovations on system-level optimizations, featuring composable and modular APIs. Explore the [Megatron Core intro](#Megatron Core) for more details.
Megatron Bridge - Training library with bidirectional Hugging Face ↔ Megatron checkpoint conversion, flexible training loops, and production-ready recipes
NeMo RL - Scalable toolkit for efficient reinforcement learning with RLHF, DPO, and other post-training methods
NeMo Framework - Enterprise framework with cloud-native support and end-to-end examples
We strongly recommend using the previous releases of PyTorch NGC Container rather than the latest one for optimal compatibility with Megatron Core release and testing matrix. Our releases are always based on the previous month's NGC container, so this ensures compatibility and stability.
Note: The NGC PyTorch container constraints the python environment globally via PIP_CONSTRAINT. In the following examples we will unset the variable.
This container comes with all dependencies pre-installed with compatible versions and optimized configurations for NVIDIA GPUs:
PyTorch (latest stable version)
CUDA, cuDNN, NCCL (latest stable versions)
Support for FP8 on NVIDIA Hopper, Ada, and Blackwell GPUs
For best performance, use NVIDIA Turing GPU architecture generations and later
bash
1# Run container with mounted directories2docker run --runtime --nvidia --gpus all -it --rm \3 -v /path/to/megatron:/workspace/megatron \4 -v /path/to/dataset:/workspace/dataset \5 -v /path/to/checkpoints:/workspace/checkpoints \6 -e PIP_CONSTRAINT=\7 nvcr.io/nvidia/pytorch:25.04-py3
Pip Installation
Megatron Core offers support for two NGC PyTorch containers:
dev: Moving head that supports the most recent upstream dependencies
lts: Long-term support of NGC PyTorch 24.01
Both containers can be combined with mlm which adds package dependencies for Megatron-LM on top of Megatron Core.
bash
1# Install the latest release dependencies2pip install"setuptools<80.0.0,>=77.0.0""packaging>=24.2"3pip install --no-build-isolation megatron-core[dev]4# For running an M-LM application:5pip install"setuptools<80.0.0,>=77.0.0""packaging>=24.2"6pip install --no-build-isolation megatron-core[mlm,dev]
bash
1# Install packages for LTS support NGC PyTorch 24.012pip install"setuptools<80.0.0,>=77.0.0""packaging>=24.2"3pip install --no-build-isolation megatron-core[lts]4# For running an M-LM application:5pip install"setuptools<80.0.0,>=77.0.0""packaging>=24.2"6pip install --no-build-isolation megatron-core[mlm,lts]
For a version of Megatron Core with only torch, run:
Our codebase efficiently trains models from 2B to 462B parameters across thousands of GPUs, achieving up to 47% Model FLOP Utilization (MFU) on H100 clusters.
Model table
Benchmark Configuration:
Vocabulary size: 131,072 tokens
Sequence length: 4096 tokens
Model scaling: Varied hidden size, attention heads, and layers to achieve target parameter counts
Communication optimizations: Fine-grained overlapping with DP (--overlap-grad-reduce, --overlap-param-gather), TP (--tp-comm-overlap), and PP (enabled by default)
Key Results:
6144 H100 GPUs: Successfully benchmarked 462B parameter model training
Superlinear scaling: MFU increases from 41% to 47-48% with model size
End-to-end measurement: Throughputs include all operations (data loading, optimizer steps, communication, logging)
Production ready: Full training pipeline with checkpointing and fault tolerance
Note: Performance results measured without training to convergence
Weak Scaling Results
Our 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.
Weak scaling
Strong Scaling Results
We also strong scaled the standard GPT-3 model (our version has slightly more than 175 billion parameters due to larger vocabulary size) from 96 H100 GPUs to 4608 GPUs, using the same batch size of 1152 sequences throughout. Communication becomes more exposed at larger scale, leading to a reduction in MFU from 47% to 42%.
Strong scaling
Training
Getting Started
Simple Training Example
bash
1# Distributed training example (2 GPUs, mock data)2torchrun --nproc_per_node=2 examples/run_simple_mcore_train_loop.py
FlashAttention is a fast and memory-efficient attention algorithm. We recommend the default usage, which uses cuDNN for attention via Transformer Engine and provides up to 50% speedups on forward and 84% on backward propagation with FP8 kernels. The flash-attn package is also supported via --use-flash-attn.
Mixed Precision Training
bash
1--fp16 # Standard FP162--bf16 # BFloat16 (recommended for large models)3--fp8-hybrid # FP8 training (Hopper, Ada, and Blackwell GPUs)
Activation Checkpointing and Recomputation
bash
1# For limited memory2--recompute-activations
34# For extreme memory constraints5--recompute-granularity full \6--recompute-method uniform
Data Parallelism Communication Overlap
bash
1--overlap-grad-reduce
2--overlap-param-gather
Distributed Optimizer
--use-distributed-optimizer
Roadmaps
Stay up-to-date with our development roadmaps and planned features:
MoE Q3-Q4 2025 Roadmap - Comprehensive MoE feature development including DeepSeek-V3, Qwen3, advanced parallelism, FP8 optimizations, and Blackwell enhancements
GPT-OSS Implementation Tracker - Advanced features including YaRN RoPE scaling, attention sinks, and custom activation functions
1@article{megatron-lm,
2 title={Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism},
3 author={Shoeybi, Mohammad and Patwary, Mostofa and Puri, Raul and LeGresley, Patrick and Casper, Jared and Catanzaro, Bryan},
4 journal={arXiv preprint arXiv:1909.08053},
5 year={2019}
6}