Training Examples
Get started with Megatron Core training using these practical examples.
Basic Training Example
Use the basic training loop with mock data to get started:
This example:
- Runs on two GPUs
- Uses generated mock data (no data preparation needed)
- Demonstrates basic distributed training setup
- Provides a quick way to verify your installation
LLaMA-3 Training Examples
LLaMA-3 8B with FP8
Train the LLaMA-3 8B model with FP8 mixed precision on eight GPUs:
Configuration
- Eight GPUs
- FP8 mixed precision (requires Hopper/Ada/Blackwell GPUs)
- Mock data for quick testing
Custom LLaMA Training
For training with your own data:
GPT-3 Training Example
Train a GPT-3 style model:
Key Training Arguments
The following tables group common training arguments by category.
Model Architecture
Training Configuration
Learning Rate
Mixed Precision
Data and Checkpointing
Next Steps
- Optimize Performance: Refer to Advanced Features for FSDP, the distributed optimizer, and other optimizations
- Scale Up: Refer to Parallelism Strategies to train larger models across more GPUs
- Prepare Data: Follow the Data Preparation guide to process your own datasets