Language Models
Megatron Core supports the following language model architectures for large-scale training.
Converting HuggingFace Models
Use Megatron Bridge to convert HuggingFace models to Megatron format. Megatron Bridge is the official standalone converter with support for an extensive list of models including LLaMA, Mistral, Mixtral, Qwen, DeepSeek, Gemma, Phi, Nemotron, and many more.
See the Megatron Bridge supported models list for the complete and up-to-date list.
Decoder-Only Models
Encoder-Only Models
Encoder-Decoder Models
Example Scripts
Training examples for these models can be found in the examples/ directory:
examples/gpt3/- GPT-3 training scriptsexamples/llama/- LLaMA training scriptsexamples/mixtral/- Mixtral MoE trainingexamples/mamba/- Mamba training scriptsexamples/bert/- BERT training scriptsexamples/t5/- T5 training scripts
Model Implementation
All language models are built using Megatron Core’s composable transformer blocks, enabling:
- Flexible parallelism strategies (TP, PP, DP, EP, CP)
- Mixed precision training (FP16, BF16, FP8)
- Distributed checkpointing
- Efficient memory management