npx skills add ...
npx skills add firecrawl/ai-research-skills --skill distributed-llm-pretraining-torchtitan
Provides PyTorch-native distributed LLM pretraining using torchtitan with 4D parallelism (FSDP2, TP, PP, CP). Use when pretraining Llama 3.1, DeepSeek V3, or custom models at scale from 8 to 512+ GPUs with Float8, torch.compile, and distributed checkpointing.
npx skills add firecrawl/ai-research-skills --skill distributed-llm-pretraining-torchtitan
TorchTitan is PyTorch's official platform for large-scale LLM pretraining with composable 4D parallelism (FSDP2, TP, PP, CP), achieving 65%+ speedups over baselines on H100 GPUs.
Installation:
Download tokenizer:
Start training on 8 GPUs:
Copy this checklist:
Step 1: Download tokenizer
Step 2: Configure training
Edit or create a TOML config file:
Step 3: Launch training
Step 4: Monitor and checkpoint
TensorBoard logs are saved to ./outputs/tb/:
Step 1: Configure parallelism for scale
For 70B model on 256 GPUs (32 nodes):
Step 2: Set up SLURM script
Step 3: Submit job
Step 4: Resume from checkpoint
Training auto-resumes if checkpoint exists in configured folder.
Float8 provides 30-50% speedup on H100 GPUs.
Step 1: Install torchao
Step 2: Configure Float8
Add to your TOML config:
Step 3: Launch with compile
Step 1: Create seed checkpoint
Required for consistent initialization across PP stages:
Step 2: Configure 4D parallelism
Step 3: Launch on 512 GPUs
Use TorchTitan when:
Use alternatives instead:
Issue: Out of memory on large models
Enable activation checkpointing and reduce batch size:
Or use gradient accumulation:
Issue: TP causes high memory with async collectives
Set environment variable:
Issue: Float8 training not faster
Float8 only benefits large GEMMs. Filter small layers:
Issue: Checkpoint loading fails after parallelism change
Use DCP's resharding capability:
Issue: Pipeline parallelism initialization
Create seed checkpoint first (see Workflow 4, Step 1).
| Model | Sizes | Status |
|---|---|---|
| Llama 3.1 | 8B, 70B, 405B | Production |
| Llama 4 | Various | Experimental |
| DeepSeek V3 | 16B, 236B, 671B (MoE) | Experimental |
| GPT-OSS | 20B, 120B (MoE) | Experimental |
| Qwen 3 | Various | Experimental |
| Flux | Diffusion | Experimental |
| Model | GPUs | Parallelism | TPS/GPU | Techniques |
|---|---|---|---|---|
| Llama 8B | 8 | FSDP | 5,762 | Baseline |
| Llama 8B | 8 | FSDP+compile+FP8 | 8,532 | +48% |
| Llama 70B | 256 | FSDP+TP+AsyncTP | 876 | 2D parallel |
| Llama 405B | 512 | FSDP+TP+PP | 128 | 3D parallel |
FSDP2 configuration: See references/fsdp.md for detailed FSDP2 vs FSDP1 comparison and ZeRO equivalents.
Float8 training: See references/float8.md for tensorwise vs rowwise scaling recipes.
Checkpointing: See references/checkpoint.md for HuggingFace conversion and async checkpointing.
Adding custom models: See references/custom-models.md for TrainSpec protocol.