LoRA & QLoRA Fine-Tuning VRAM Calculator
Compare training VRAM requirements across Full BF16, LoRA BF16, and 4-bit QLoRA with 8-bit AdamW and gradient checkpointing.
Input Parameters
Calculated Output
Primary Result
—
Adjust inputs to recalculate immediately.
Need More VRAM for Training Runs?
Compare hourly pricing on RunPod for A100 80GB and H100 nodes.
Compare RunPod Training GPUs ↗Training VRAM Breakdown: 8B Model (Seq=2048, Micro-Batch=2)
Demonstrates why QLoRA + gradient checkpointing enables 8B training on consumer 12GB–16GB GPUs.
| Method | Weights | Gradients + Optimizer | Activations (Ckpt ON) | Total VRAM (+1.2 GiB CUDA) |
|---|---|---|---|---|
| QLoRA (4-bit NF4, 8-bit AdamW) | 4.10 GiB | 0.36 GiB | 1.00 GiB | ~6.66 GiB (Fits 12GB GPU) |
| LoRA (BF16 Base, 8-bit AdamW) | 14.90 GiB | 0.36 GiB | 1.00 GiB | ~17.46 GiB (Fits 24GB GPU) |
| Full Fine-Tune (BF16, FP32 AdamW) | 14.90 GiB | 74.51 GiB | 1.00 GiB | ~91.61 GiB (Multi-A100/H100) |
Formula & Engineering Methodology
Total training VRAM sums static base weights (0.55 B/param for NF4 double-quant vs 2 B/param for BF16), trainable adapter gradients (BF16 = 2 B/param), AdamW momentum/variance states (4 B or 8 B per trainable parameter), activations scaled by gradient checkpointing (0.25x), and 1.2 GiB PyTorch workspace.
weights_gib = (base_params_b * 1e9 * base_bytes) / 1073741824
trainable_params = base_params_b * 1e9 * (1 if full else trainable_pct/100)
gradients_gib = (trainable_params * 2) / 1073741824
optimizer_gib = (trainable_params * optimizer_bytes) / 1073741824
activations_gib = ((batch_size * seq_len * layers * hidden_dim * 8) / 1073741824) * (0.25 if grad_ckpt else 1.0)
total_vram_gib = weights_gib + gradients_gib + optimizer_gib + activations_gib + 1.2
Variable Definitions
0.55 B/param: 4-bit NormalFloat (NF4) base weights plus double-quantization scaling constants.optimizer_bytes: AdamW tracks two state tensors (8 B/param in FP32, 4 B/param in 8-bit paged AdamW).0.25: Activation memory reduction factor when gradient checkpointing is active.
Practical Note: Using micro-batch=1 with gradient accumulation steps achieves equivalent effective batch size while minimizing activation VRAM spikes.
Frequently Asked Questions
Why do activations often dominate QLoRA VRAM at long sequence lengths?
Because NF4 base weights and tiny LoRA adapters stay small (~4–5 GiB), bumping sequence length from 2K to 16K inflates stored intermediate tensors by 8x unless gradient checkpointing is enabled.
Can an 8B model be fine-tuned on a 12GB RTX 3060?
Yes. With QLoRA (4-bit NF4), 8-bit paged AdamW, gradient checkpointing, and micro-batch 1–2 at 2048 context, total VRAM sits comfortably around 7–9 GiB.
How much extra memory does Unsloth save?
Optimized Triton kernels and chunked cross-entropy loss in libraries like Unsloth reduce peak logit materialization spikes by another 30–50% during long-context steps.