npx skills add ...
npx skills add firecrawl/ai-research-skills --skill implementing-llms-litgpt
Implements and trains LLMs using Lightning AI's LitGPT with 20+ pretrained architectures (Llama, Gemma, Phi, Qwen, Mistral). Use when need clean model implementations, educational understanding of architectures, or production fine-tuning with LoRA/QLoRA. Single-file implementations, no abstraction layers.
npx skills add firecrawl/ai-research-skills --skill implementing-llms-litgpt
LitGPT provides 20+ pretrained LLM implementations with clean, readable code and production-ready training workflows.
Installation:
Load and use any model:
List available models:
Copy this checklist:
Step 1: Download pretrained model
Models are saved to checkpoints/ directory.
Step 2: Prepare dataset
LitGPT supports multiple formats:
Alpaca format (instruction-response):
Save as data/my_dataset.json.
Step 3: Configure training
Step 4: Run fine-tuning
Training saves checkpoints to out/finetune/ automatically.
Monitor training:
Most memory-efficient option.
Step 1: Choose base model
For limited GPU memory (12-16GB):
Step 2: Configure LoRA parameters
LoRA rank guide:
r=8: Lightweight, 2-4MB adaptersr=16: Standard, good qualityr=32: High capacity, use for complex tasksr=64: Maximum quality, 4× larger adaptersStep 3: Train with LoRA
Step 4: Merge LoRA weights (optional)
Merge LoRA adapters into base model for deployment:
Now use merged model:
Train new model on your domain data.
Step 1: Prepare pretraining dataset
LitGPT expects tokenized data. Use prepare_dataset.py:
Step 2: Configure model architecture
Edit config file or use existing:
Step 3: Set up multi-GPU training
Step 4: Launch pretraining
For large-scale pretraining on cluster:
Export LitGPT models for production.
Step 1: Test inference locally
Step 2: Quantize model (optional)
Reduce model size with minimal quality loss:
Step 3: Convert to GGUF (for llama.cpp)
Step 4: Deploy with API
Use LitGPT when:
Use alternatives instead:
Issue: Out of memory during fine-tuning
Use LoRA instead of full fine-tuning:
Or enable gradient checkpointing:
Issue: Training too slow
Enable Flash Attention (built-in, automatic on compatible hardware):
Use smaller micro-batch and accumulate:
Issue: Model not loading
Check model name:
Verify checkpoints directory:
Issue: LoRA adapters too large
Reduce LoRA rank:
Apply LoRA to fewer layers:
Supported architectures: See references/supported-models.md for complete list of 20+ model families with sizes and capabilities.
Training recipes: See references/training-recipes.md for proven hyperparameter configurations for pretraining and fine-tuning.
FSDP configuration: See references/distributed-training.md for multi-GPU training with Fully Sharded Data Parallel.
Custom architectures: See references/custom-models.md for implementing new model architectures in LitGPT style.