VRAM calculator
Pick a model, a card and a context length. You'll see whether it fits, and where the memory goes.
Will it fit on your GPU?
Ollama's
num_ctx. Longer context = bigger cache.
Set with
OLLAMA_KV_CACHE_TYPE.Model sizes are real Ollama downloads. Memory is in GiB, as ollama ps and nvidia-smi report it. Estimates land within about 6% of what we measured; leave some headroom.
How it works
A loaded model needs memory for three things: its weights, the context cache (the KV cache), and a little working space. The weights are fixed by the model and quantization. The cache grows with every token of context you allow.
KV cache (bytes) = 2 × layers × KV heads × head size × context tokens × bytes per value
Read the full explanation, with measurements from my own GPUs, in Why an 8B model can need 21 GB of VRAM.