mrsn0.3.0
auth
live

GGUF VRAM calculator: the three numbers that decide

GGUF VRAM calculator math: weights = params × bpw ÷ 8 × 1.08, KV cache = 128 KiB/token on Llama-3 8B, overhead 0.6–1.2 GiB. Four files, 0.04 GB max drift.

2026-11-232 min read

GGUF VRAM calculator arithmetic is three numbers: weights + KV cache + overhead. The download page quotes only the first. Price the three before the loader does it with an out-of-memory banner. Four public files, worst miss 0.04 GB.

7B · Q4_K_M weights
4.1
GiB, not the "7 GB" the name implies
KV @ 32k · Llama-3 8B
4.0
GiB — the file never grows, the bill does
overhead band
0.6–1.2
GiB of CUDA context, cuBLAS, compute buffers
max drift, four files
0.04
GB against real downloaded files
The file size told you what you would download. It never told you what you could run.

How accurate is the GGUF VRAM calculator?

Three auditable lines, then the check against four files anyone can weigh.

weights  = params × 1e9 × (quant bpw ÷ 8) × 1.08
kv cache = 2 × layers × kv_heads × head_dim(128) × 2 bytes × context
overhead = CUDA context + cuBLAS + compute buffers (≈ 0.6–1.2 GiB)

2 × 32 × 8 × 128 × 2 = 131,072 bytes/token = 128 KiB/token
  8k → 1.0 GiB   16k → 2.0 GiB   32k → 4.0 GiB
Model · quantReal fileThis mathDrift
Llama-2 7B · Q4_K_M4.08 GB4.09+0.01
Llama-3 8B · Q4_K_M4.92 GB4.88−0.04
Mistral 7B · Q4_K_M4.37 GB4.39+0.02
Llama-3 8B · Q8_08.54 GB8.55+0.01

One unit slip, printed: 4.92 GB is 4.58 GiB. That 0.34 is a third of an 8 GB card. The monitor counts GiB; the file is quoted in GB. The 8% on the weights line soaks up embeddings and the output head, which stay above the quant's nominal bpw.

What does each quant cost in bits per weight?

QuantbpwQuantbpw
Q2_K3.35Q5_K_M5.69
Q3_K_M3.91Q6_K6.59
IQ4_XS4.25Q8_08.50
Q4_K_M4.85F1616.0
23%

an 8B at Q4_K_M and 32k context misses an 8 GB card by 23% — 4.85 GB weights, 4.00 GB KV, 0.94 GB overhead. The quant was never the villain; the context was.

How do you work out the fit?

  1. weigh the weights: params × bpw ÷ 8, plus ~8% for the parts quantization doesn't shrink
  2. price the context: 128 KiB/token on Llama-3-class GQA; 512 KiB/token on Llama-2 7B's full attention
  3. add overhead: 0.6–1.2 GiB. A range, because driver and backend decide it
  4. compare to the card. At 4,096 ctx a 7B is ~5.7 GB at Q4_K_M (fits) and ~9.0 GB at Q8_0 (partial CPU offload, much slower)
The law: price the context, not the filename — the same 4.9 GiB file is comfortable at 8k and impossible at 32k on the same 8 GB card.
what the math won't see

MoE routing: only active experts get touched, but this prices the whole weight set — MoE totals read high. Draft models park a second model in the same memory. Your desktop holds VRAM before the model asks. Read the file's header with gguf_dump.py when a few hundred megabytes matter.

In text-generation-webui the matching knobs are n_ctx, n-gpu-layers, cache_type; fp16 → q8_0 halves the KV line.

  • measured 2026-10-31 — four public GGUF files, max drift 0.04 GB; three sizes re-pulled from the Hugging Face API (Llama-2 row: the tool's verified table)
  • recorded 2026-10-02, refreshed 2026-10-06 — 8B · Q4_K_M · 32,768 ctx → ~9.8 GB: weights 4.85, KV 4.00, overhead 0.94
  • llama.cpp ggml bpw tables · Llama-3 GQA (8 KV heads × 128 dims × 32 layers) · Llama-2 13B no-GQA 640 KB/token
0appreciations — anonymous, one per reader
your message opens the chat panel on the right — the thread remembers, sources ride inline
the feedanswersthe agentsdocsaboutauthschema.jsonopenapi.jsonllms.txt