Fine-Tuning VRAM Calculator (LoRA, QLoRA)
Fine-tuning memory = frozen weights + trained parameters × 16 bytes (Adam, mixed precision) + activations. For Llama 3.1 8B that is about 120 GiB for full fine-tuning, 15.2 GiB for LoRA and 4.1 GiB for QLoRA before activations (ZeRO and QLoRA papers, checked 23 October 2026).
How to use
- Pick a model to fill in parameters, layers and hidden size, or type them from config.json.
- Set the LoRA rank and how many weight matrices per layer get an adapter (4 for q, k, v, o; 7 to add the MLP).
- Set an overhead for activations and buffers, then compare the three methods.
How it works
Each trained parameter needs 16 bytes with mixed-precision Adam: 2 for the FP16 weight, 2 for its gradient and 12 for the FP32 master copy and two Adam moments (ZeRO paper, arXiv 1910.02054). Full fine-tuning trains every parameter.
LoRA keeps the base weights frozen at 16 bits (2 bytes per parameter) and trains small adapters. QLoRA stores the frozen weights in 4-bit NF4 plus 0.127 bits per parameter for the quantization constants (QLoRA paper, arXiv 2305.14314).
Adapter parameters ≈ layers × adapted matrices × 2 × rank × hidden size, treating each matrix as hidden × hidden (LoRA paper, arXiv 2106.09685). This is an approximation: grouped-query k and v and the MLP matrices have other shapes.
Activations depend on batch size, sequence length and gradient checkpointing, so they are an overhead percentage you choose (an assumption, 20 percent by default). Papers checked 23 October 2026. Results in GiB (2^30 bytes).
Sources: ZeRO (arXiv 1910.02054) · QLoRA (arXiv 2305.14314) · LoRA (arXiv 2106.09685)Last reviewed 2026-10-23
FAQ
How much VRAM to fine-tune an 8B model?
For Llama 3.1 8B with rank 16 on 4 matrices and 20 percent overhead: about 144 GiB for full fine-tuning, 18 GiB for LoRA and 5 GiB for QLoRA.
Can I fine-tune a 70B model on one 48 GB GPU?
With QLoRA the weights and adapters come to about 35 GiB, so it is possible with short sequences and gradient checkpointing. LoRA in 16-bit needs about 133 GiB before activations.
Why is full fine-tuning so much bigger?
Every parameter carries a gradient and Adam states, 16 bytes in total, against 2 bytes to just hold the weight for inference.
Does a higher LoRA rank need much more memory?
Adapters grow linearly with rank but stay small: rank 16 on Llama 3.1 8B is about 16.8 million parameters, 0.25 GiB with optimizer states.