How much VRAM does Llama 3.1 8B need to fine-tune at FP16? Adam optimizer math

By TechCompare · Updated · How we check

Full fine-tuning at FP16 is the worst-case memory configuration. Use it only if you must. LoRA reduces memory to roughly inference + a few GB, and QLoRA reduces it further by quantizing the base model weights. For most fine-tuning use cases, QLoRA on a single 24 GB GPU gets results close to full fine-tuning.

Calculator

Estimated VRAM required

41.1 GB

8B params at FP16, 131,072 token context, batch 1, training (Adam).

Weights
17.3 GB
KV cache
17.2 GB
Overhead
6.7 GB
Doesn't fit in 40 GB of VRAM at FP16 with 128K of context. Switch to Q8_0 (32.1 GB) to fit a single A100 40GB. Or keep FP16 and lower the context to 64K (30.8 GB).

Estimate accuracy: Weights within ~3% of most GGUF files from Q4_K_M up, ~7% for Q3_K_M and Q2_K. KV cache within ~5% for standard GQA models, ~10% for MLA or hybrid state estimates. Real VRAM may vary with framework (vLLM vs llama.cpp vs Transformers), Flash Attention, and driver overhead.

LoRA fine-tune sizing: Forward weights at FP16, only ~1% of params get optimizer state (FP32 master + grad + AdamW m + v). Real LoRA peak depends on rank and target modules; this is the typical r=16 ceiling.

Hardware that fits

Unified memory machines show a model budget, not their installed memory. We hold back 8 GB for the system, or use the vendor's GPU limit when that's lower. It's a planning estimate, not a hard limit.

RTX PRO 5000 48GB
Pro
48 GB
86% used
Apple M5 Pro 64GB
Unified
~56 GB
74% of estimate
RTX PRO 5000 72GB
Pro
72 GB
58% used

Multi-GPU setups

2× RTX 3090
Consumer · 21.1 GB per card
48 GB
88% used

Pooled cards show up once a model outgrows the biggest single card of that kind. Each card past the first keeps about 1 GB for its own buffers, and that's counted here. Your inference engine has to support the split, and speed also depends on how the cards connect.

Just barely too small

A100 40GB
Datacenter
40 GB
short by 1.1 GB

Full fine-tuning Llama 3.1 8B at FP16 with native 128K context needs about 167.9 GB of VRAM. Training weights, gradients and Adam states alone take 144 GB, against 4.9 GB for Q4 inference weights.

How this is calculated

Training weights + gradients + Adam optimizer buffers take 144 GB. The 128K KV cache takes 17.2 GB, and activation overhead adds roughly 6.7 GB, totaling 167.9 GB.

Verdict

A single 24 GB consumer card cannot host this configuration. At FP16 plus an FP32 master copy plus the two FP32 Adam buffers, the weight side is roughly 4x the inference weight cost: Adam's two FP32 buffers per parameter triple or quadruple the memory per parameter, then activations saved for backprop add another chunk.

LoRA drops the optimizer and gradient memory to a few GB by training only adapter weights, and QLoRA goes further by quantizing the base model to 4-bit before training the adapters, fitting a single 24 GB card comfortably with results that match full fine-tuning for most use cases.

More Training scenarios

Kimi K3.1 Pro at Q4_K_M
A 2.78T expert pool with 24 latent attention layers and fixed state in the other 69.
View details
Mistral Large 4 at Q4_K_M
A 1T expert pool with 63 latent cache owners and 44 layers that also store an index key.
View details
Muse Spark Open at Q4_K_M
Only 16 of its 62 layers grow with context, and the other 46 hold a 2,048 token window.
View details

Frequently asked questions

Why does training need so much more memory than inference?
Adam's optimizer states (two FP32 buffers per parameter) plus gradients triple or quadruple the per-parameter cost vs inference. Activations needed for backprop add another large chunk.
Can I fine-tune Llama 3.1 8B on a single 24 GB GPU?
Not with full fine-tuning at native context. Use LoRA (low-rank adapters) or QLoRA, both of which fit comfortably on 24 GB and produce comparable results for most use cases.
What does QLoRA actually store during fine-tuning?
The frozen base model at 4-bit plus a small set of trainable adapter matrices at full precision, with gradients and optimizer states applying only to the adapters. For an 8B model that turns roughly 48 GB of full fine-tuning memory into something that runs on a single 24 GB card. Output quality on standard fine-tuning tasks is statistically indistinguishable from full-parameter training.