NVIDIA's GPU-optimized library for training transformer models at scale
open sourceBSD-3-Clausefree
Megatron-LM is NVIDIA's repository for training transformer models at scale on GPUs. It has two parts: Megatron Core, a composable library of GPU-optimized building blocks (transformer layers, tensor, pipeline, data, expert and context parallelism, mixed precision down to FP8) for building your own training framework, and Megatron-LM itself, a reference with Megatron Core and ready-made training scripts for research and learning distributed training. Megatron Core is published on PyPI as megatron-core, and Megatron Bridge converts checkpoints between Hugging Face and Megatron formats.
Problems it solves
- pretrain a large language model across hundreds of GPUs
- split a model too big for one GPU across many with tensor and pipeline parallelism
- train a mixture-of-experts model efficiently on NVIDIA GPUs
Features
- tensor, pipeline, data, expert and context parallelism
- mixed precision training with FP16, BF16 and FP8
- composable transformer building blocks in Megatron Core
- ready-made training scripts in Megatron-LM
Alternatives
The same job
These do what Megatron-LM does.
- Colossal-AI PyTorch library for distributed training, fine-tuning and inference of large AI models
- DeepSpeed Deep learning optimization library for training and serving very large models
- torchtitan A PyTorch-native platform for training generative AI models at scale
- nanochat The best ChatGPT that $100 can buy
- MiniMind Train a 64M-parameter language model from scratch in about two hours
