Skip to content

VRAM Math: Sizing Your GPU Before You Buy

VRAM is the binding constraint, not FLOPS — a model either fits or it doesn't. The KV cache grows linearly with context and can exceed weight size.

Every local-inference sizing question reduces to three added terms (codingprotocols.com):

total VRAM = weights + KV cache + overhead
weights (GB)  = parameters (B) × bytes-per-parameter
KV cache (GB) ≈ 2 × num_layers × num_kv_heads × head_dim × context_len × bytes_per_elem / 1e9
overhead      ≈ 0.5–1.5 GB  (CUDA context, activations, framework allocs)

An equivalent single-line form used in practice: weights = P × bits / 8 × 1.05 (the 1.05 covers GGUF metadata); a 70B at Q4 → 70 × 4 ÷ 8 × 1.05 ≈ 36.8 GB (flaviocopes.com).

Precision bits/param bytes/param 9B model needs
FP32 32 4.0 ~36 GB
FP16 / BF16 16 2.0 ~18 GB
Q8 / INT8 / FP8 8 ~1.0 ~9 GB
Q4_K_M (common default) ~4.8 ~0.60 ~5.4 GB
Q3 ~3.5 ~0.44 ~4 GB
Q2 ~2.6 ~0.33 ~3 GB

Source: codingprotocols.com; matching bytes/param table at dev.to/maxvyaznikov.

Use 0.6 GB/billion, not 0.5. K-quants keep some tensors at higher precision because degrading them hurts disproportionately, so the effective rate is always above nominal. Q4_K_M lands at 0.57–0.61 GB per billion in every real file: 7B → ~4.1 GB, 13B → ~7.9 GB, 70B → ~40 GB (codingprotocols.com). Corroborated: ~2 GB/B at FP16 and ~0.6 GB/B at INT4 (spheron.network).

Worked examples (codingprotocols.com):

Setup Weights KV Overhead Total Fits?
8 GB card, 9B @ Q4, 4k ctx 5.4 ~0.5 ~1.0 6.9 GB ✅ tight
8 GB card, 20B @ Q4 12.0 — — >13 GB ❌
24 GB card, 27B @ Q4, 16k ctx 16.2 ~2.0 ~1.0 19.2 GB ✅ sweet spot

A shortcut when you don't want the arithmetic: the model's download size is a good proxy for weight memory; add a couple of GB.

Sources

Date: 2026-10-09