LitGPT
Lightning AI library of 20+ from-scratch LLM implementations with recipes to pretrain, fine-tune, and deploy.
About
Recipes rather than abstractions drive LitGPT, the Lightning AI library that reimplements more than 20 language models from scratch, including Llama 3, Qwen 2.5, Phi 4, Gemma 2, Mistral, Falcon 3, and Code Llama, each kept readable with no abstraction layers on top of PyTorch. The command line covers the full lifecycle, litgpt pretrain, finetune, evaluate, and serve, with parameter-efficient LoRA, QLoRA, and Adapter methods alongside full fine-tuning, 4-bit and 8-bit quantization, Flash Attention 2, and multi-GPU scaling through FSDP. Configs ship as validated YAML files with tested hyperparameters, so a fine-tune can start with a single command after pip install litgpt[extra]. Serious training needs an NVIDIA GPU, while quantized runs of small models fit on modest hardware. Everything is Apache-2.0 licensed, and the project has about 13,600 GitHub stars. Several open pretraining efforts have used it as their base implementation, and it comes from the team that maintains PyTorch Lightning, which shows in the emphasis on reproducible, debuggable single-file model code.
Should you use LitGPT?
Pick it when
Pick it when you want readable, from-scratch implementations of Llama, Qwen, Phi, or Gemma with tested YAML recipes and one CLI for pretraining, LoRA or QLoRA fine-tuning, evaluation, and serving, especially if you debug model code directly.
Look elsewhere when
Only the 20-plus architectures it reimplements are supported, so a brand-new Hugging Face model may be missing. For broader coverage and DPO-style preference tuning use LLaMA-Factory or Axolotl; for cluster-scale pretraining use torchtitan.
Alternatives to LitGPT
- LLaMA-Factory
Supports 100+ models with a web UI and RLHF, much wider coverage, but wraps Transformers instead of giving you readable model files.
- Axolotl
YAML-driven fine-tuning on Transformers models with DPO, ORPO, and KTO; not a from-scratch codebase you can read end to end.
- nanoGPT
Even smaller for learning GPT pretraining, but GPT-2 style only, with no LoRA, evaluation, or serving commands.
- torchtitan
4D parallelism and float8 for pretraining at 70B to 405B scale, well beyond LitGPT's FSDP, at much higher complexity.
Reviews (0)
Leave a Review
No reviews yet. Be the first to review!
Details
- Category
- Model Training & Fine-Tuning
- Price
- Free
- Platform
- Local/Desktop
- Difficulty
- Easy (2/5)
- License
- Apache-2.0
- Added
- Jul 29, 2026