A PyTorch-native platform for training generative AI models at scale
open sourceBSD-3-Clausefree
torchtitan is a clean-room, PyTorch-native implementation of large-scale training from the PyTorch project. One readable codebase takes a model from pretraining through supervised fine-tuning to reinforcement learning, composing FSDP2, tensor, pipeline, context and expert parallelism into N-D layouts through DeviceMesh and DTensor without rewriting the model. Runs are Python recipes you can read and modify. It ships model definitions for DeepSeek, Qwen, Kimi, gpt-oss, Llama and FLUX, MXFP8 and NVFP4 low precision and CUDA graphs, and TitanRL reuses the same models and kernels for training and vLLM generation.
Problems it solves
- pretrain a large language model across many GPUs in plain PyTorch without a heavy framework
- combine FSDP, tensor and pipeline parallelism for a big model without rewriting it
- a hackable reference codebase for large-scale training and RL experiments
Features
- composable FSDP2, tensor, pipeline, context and expert parallelism
- pretraining, fine-tuning and RL in one codebase
- readable Python recipes
- DeepSeek, Qwen, Kimi, gpt-oss, Llama and FLUX models
- MXFP8 and NVFP4 low precision
- TitanRL with vLLM generation
Limitations
- Under active development: the latest features need a recent PyTorch nightly1
Alternatives
The same job
These do what torchtitan does.
- Colossal-AI PyTorch library for distributed training, fine-tuning and inference of large AI models
- MiniMind Train a 64M-parameter language model from scratch in about two hours
- Megatron-LM NVIDIA's GPU-optimized library for training transformer models at scale
- PyTorch Lightning Organises PyTorch code and handles the training engineering, from one CPU to thousands of GPUs
- PaddlePaddle Baidu's open source deep learning framework for training and deploying models at scale
- Accelerate Hugging Face's library to run the same PyTorch code on any distributed setup
