LLM VRAM Calculator
Estimate how much GPU memory an AI language model needs to run on your own computer, from its parameter count, quantization and context length, and see whether it fits your graphics card.
How to use the VRAM calculator
- Model size in billions of parameters, from the model's name (8B, 70B…).
- Quantization: lower bit widths shrink the model with some quality loss. 4-bit (Q4_K_M) is a popular balance for local use.
- Context length: how many tokens of conversation or documents the model holds at once.
- Layers and KV heads × head dimension from the model card (config.json). The defaults fit many 7–8B models with grouped-query attention.
- Your GPU memory in GB. On Apple Silicon Macs, use about 70–75% of unified memory.
The formula
Total VRAM ≈ weights + KV cache + overhead
- Weights = parameters × bits ÷ 8 (an 8B model at 4.5 bits ≈ 4.5 GB)
- KV cache = 2 × layers × context × KV dimension × 2 bytes (grows with context)
- Overhead for the runtime and activations: about 10% plus 0.5 GB
Example: an 8B model, 4-bit, 8,192 tokens of context: 4.5 GB weights + 1.1 GB KV cache + 1.1 GB overhead ≈ 6.6 GB, comfortable on a 12 GB GPU. A 70B model at 4-bit needs about 47 GB.
Rough guide
| Model size | 4-bit | 8-bit | 16-bit |
|---|---|---|---|
| 3–4B | ~3–4 GB | ~5–6 GB | ~9 GB |
| 7–8B | ~6–7 GB | ~10 GB | ~18 GB |
| 13–14B | ~10 GB | ~17 GB | ~30 GB |
| 32–34B | ~22 GB | ~38 GB | ~70 GB |
| 70B | ~45 GB | ~80 GB | ~150 GB |
At 8K context. Longer context adds more.
If it doesn't fit
Tools like llama.cpp and Ollama can offload some layers to system RAM, at much lower speed. Otherwise, choose a smaller model or lower quantization, or reduce context. To compare with paying for an API, see the LLM API cost calculator.
Frequently asked questions
How much VRAM do I need for a 7B model?
About 5–7 GB at 4-bit quantization with moderate context, or roughly 16–18 GB at full 16-bit precision.
Can I run a 70B model on a 24 GB GPU?
Not fully in VRAM at 4-bit; it needs about 45 GB. Offloading to system RAM works but is slow.
What is quantization?
Storing model weights with fewer bits (such as 4 instead of 16) to cut memory use, with a small loss in quality.