GPU VRAM Calculator for LLMs
Estimate the GPU VRAM an LLM needs from parameter count, quantization (FP16, INT8, INT4), and context, then check if your card fits.
Approximate LLM Weight Memory
The calculator reports binary GiB and these rows cover model weights only. Context, KV cache, runtime overhead, and training states need additional VRAM.
| Quantization | Bytes per parameter | 1B parameters, weights only |
|---|---|---|
| FP16 | 2 | 1.86 GiB |
| INT8 | 1 | 0.93 GiB |
| INT4 | 0.5 | 0.47 GiB |
Frequently Asked Questions about the GPU VRAM Calculator for LLMs
How do you estimate the VRAM an LLM needs?
The calculator sums four consumers of GPU memory: model weights, the KV cache, a working set, and framework overhead. Weights equal the parameter count times the bytes per weight (2 for FP16, 1 for INT8, 0.5 for INT4). For inference it adds a KV cache sized from your layers, hidden size, context length, and batch, plus a small activation buffer. It then adds a CUDA context allowance and a fragmentation margin, and reports the total in GiB.
What VRAM does a 7B model use for inference?
A 7 billion parameter model in FP16 stores about 13.0 GiB of weights. With a 4,096-token context, one sequence, and a 32-layer, 4,096-hidden-size model, the calculator adds about 2.0 GiB of KV cache, 2.6 GiB of working memory, and 2.8 GiB of overhead, for about 20.4 GiB total. In INT4 the same assumptions produce about 7.5 GiB before the calculator's reserved-VRAM margin, so 8 GB can be tight and 12 GB offers more headroom.
Why does quantization change the VRAM so much?
Quantization sets how many bytes each weight occupies. FP16 and BF16 use 2 bytes per weight, INT8 uses 1 byte, and INT4 uses 0.5 bytes, so moving from FP16 to INT4 cuts the weight memory to a quarter. This calculator assumes an FP16 KV cache, so it does not shrink with weight quantization. Long contexts can still dominate memory even on a heavily quantized model.
What is the KV cache and why does context length matter?
The KV cache stores one Key and one Value vector per layer for every token in the context window so the model does not recompute attention each step. Its size is 2 times layers times hidden size times 2 bytes times context length times batch size. Because it scales linearly with context length and batch size, doubling either one doubles the cache, and very long contexts can need more memory than the weights themselves.
Why does full fine-tuning need so much more memory than inference?
Full fine-tuning with mixed-precision Adam keeps far more than the weights in memory. The standard footprint is about 16 bytes per parameter: FP32 master weights, FP32 momentum, FP32 variance, plus FP16 weights and gradients. That is roughly eight times the FP16 weight size, so a 7B model can need well over 100 GB. LoRA and QLoRA freeze the base weights and train small adapters instead, which is why they fit on a single consumer card.
How accurate are these VRAM estimates?
Treat the result as a planning estimate, not an exact figure. Real usage shifts with the runtime (llama.cpp, vLLM, Transformers), the attention kernel, paged or quantized KV caches, and the exact weight format, which the model approximates with fixed allowances. Leave headroom and validate the result with the actual runtime before choosing hardware.
Related Calculators
More calculators in "Tech"
IOPS CalculatorKeyword Density CheckerLUFS Loudness Normalization CalculatorSpeaker Impedance (Series/Parallel) CalculatorTCP Throughput CalculatorWei to ETH Converter
See all 98 calculators in "Tech"