LLM Fine-Tuning VRAM Calculator (QLoRA, LoRA & Full BF16)
Fine-tuning consumes vastly more VRAM than inference because backpropagation must store gradients, optimizer momentum/variance states, and sequence activation checkpoints. Size your GPU accurately before launching Unsloth, Axolotl, LLaMA-Factory, or Apple MLX.
Fine-Tuning & Training Memory Calculator (PyTorch / Unsloth / Axolotl)
Calculate exact training VRAM across model weights, backpropagation gradients, AdamW optimizer states, and sequence activations before renting H100s or launching a local run.
python train_unsloth.py --model deepseek-r1-32b --load_in_4bit --lora_r 32 --max_seq_length 4096 --batch_size 2 --use_gradient_checkpointing unslothNeed multi-GPU FSDP/DeepSpeed scaling for 70B+ full fine-tuning? Try our Cluster Planner.
Why QLoRA Saves 70%+ Training VRAM
QLoRA freezes base weights in 4-bit NF4 and attaches tiny low-rank BF16 adapter matrices (typically 0.5%–2% of total parameters), shrinking optimizer and gradient memory dramatically so even 32B models fine-tune on a single 24GB–32GB GPU.
Gradient Checkpointing Trade-Off
Recomputing intermediate layer activations during the backward pass adds ~20–25% wall time while slashing activation memory by ~75% — essential for 4K–16K sequence lengths.
Master the Underlying Memory Math
Read our pure engineering reference guides covering transformer weights, KV caches, quantization trade-offs, and multi-GPU parallelism.
Read LLM VRAM Math Guide