VRAM math without magic
A practical way to estimate whether a model fits before you download 40 GB of weights.
Most “will it run?” answers are either a guess or a screenshot of someone else’s task manager. The arithmetic is not that hard. You need three numbers: the size of the weights, the size of the KV cache, and the overhead your runtime refuses to talk about.
1. Weights
A quantized model is roughly:
weights_GB ≈ parameters_in_billions × bytes_per_parameter
The tricky part is bytes_per_parameter. A “4-bit” quantization is not exactly 4 bits per weight: there are scales, zero points, and block metadata. For GGUF files, these are realistic planning numbers:
| Quant | Bits per weight (approx.) | Bytes per parameter | 8B model, GB |
|---|---|---|---|
| Q4_K_M | 4.8 | 0.60 | 4.8 |
| Q5_K_M | 5.7 | 0.71 | 5.7 |
| Q6_K | 6.6 | 0.82 | 6.6 |
| Q8_0 | 8.5 | 1.06 | 8.5 |
| FP16 | 16 | 2.00 | 16.0 |
So a 7B model in Q4 is not 7 GB. It is closer to 4.2 GB, plus everything else.
2. KV cache
Every token you keep in context needs keys and values for every layer. With grouped-query attention (GQA), the formula is:
kv_bytes = 2 × layers × kv_heads × head_dim × tokens × bytes_per_element
The 2 is for keys and values. For a typical 8B model with 32 layers, 8 KV heads, head dimension 128, and FP16 cache:
2 × 32 × 8 × 128 × 8192 × 2 bytes ≈ 1.07 GB
At 32k tokens, the same model needs about 4.3 GB of KV cache. This is why a model that “fits” at 4k context suddenly does not fit at 32k. Some runtimes quantize the cache; some do not. Check before you plan around it.
3. Overhead
CUDA context, activations, graph buffers, fragmentation, the operating system, and the browser you forgot to close. On a small GPU, reserve 0.8–1.5 GB before you start. For long context or large batches, reserve more.
A worked example
An 8B model, Q4_K_M, 8k context, FP16 KV cache:
weights 4.8 GB
KV cache 1.1 GB
overhead 1.0 GB
----------------
total 6.9 GB
On a 6 GB card this does not fit. On an 8 GB card it fits, but with very little room for a larger context or a second process. That is the kind of answer you can get in two minutes, before downloading anything.
What the calculator cannot tell you
Whether it will be fast. Whether the quantization hurts the languages you care about. Whether the runtime silently offloads half the layers to the CPU and turns generation into a slideshow. Those require an actual test, on your machine, with your build.
Use the math to reject impossible configurations. Use a measurement to choose between the possible ones.