Capacity planning tool

LLM GPU memory and KV cache calculator

Estimate dense model weight storage and standard attention KV-cache tensors. Load a published model preset or enter custom architecture, precision, context, and concurrency values to plan GPU sizing.

Model and workload

Estimated total15.401 GiB
Model weights (16-bit)14.901 GiB
KV cache (1 seq)0.5 GiB
Weights 97%KV cache 3%Allowance 0% (0 GiB)

GPU capacity and concurrency comparison

Planning estimate assuming 90% usable GPU memory minus your additional runtime allowance. Verify actual startup block counts in your serving engine logs.

GPUAdvertised VRAMMemory bandwidthMax 4,096-token sequences (1 GPU)Min GPUs for 1 sequence
NVIDIA RTX 409024 GB1,008 GB/s10 seq1 GPU
NVIDIA L40S48 GB864 GB/s50 seq1 GPU
NVIDIA A100 80GB80 GB2,039 GB/s104 seq1 GPU
NVIDIA H100 SXM80 GB3,350 GB/s104 seq1 GPU
NVIDIA H200141 GB4,800 GB/s206 seq1 GPU
AMD Instinct MI300X192 GB5,300 GB/s292 seq1 GPU

Formulas and worked example

Weight bytes = parameters × bits per weight ÷ 8
KV bytes = 2 × layers × KV heads × head dimension
           × cached tokens × concurrent sequences × bytes per value
GiB = bytes ÷ 1,073,741,824

With 8 billion parameters at 16 bits, weights occupy about 14.901 GiB. At 32 layers, 8 KV heads, head dimension 128, 4,096 cached tokens, one sequence, and two bytes per KV value, the cache needs 0.5 GiB. The combined tensor estimate is 15.401 GiB before overhead.

Use KV heads, not query heads, for grouped-query attention (GQA). Cached tokens include both the prompt and generated continuation. Multi-head latent attention (MLA) models compress the cache; read MLA vs. GQA for their exact latent storage math.

What this estimate leaves out

Quantization scales, runtime allocations, CUDA graphs, temporary prefill activations, paged block fragmentation, and non-model processes require extra memory. Set a realistic additional allowance (typically 1.5–4 GiB per GPU) before choosing hardware. Mixture-of-Experts (MoE) weights depend on total resident parameters, not active parameters per token.

Next, estimate latency and tokens/s in the roofline latency calculator, price replicas in the cost per million tokens calculator, or generate flags in the vLLM & SGLang command builder.

Understand, practice, and verify the estimate

Frequently asked questions

How do you calculate LLM KV cache memory per token?

Standard GQA and MHA caches store two tensors per attention layer (Key and Value): 2 × layers × KV heads × head dimension × bytes per KV value. Use KV heads rather than query heads when sizing grouped-query attention models like Llama 3.1 or Qwen3.

Why do quantized weights still need extra VRAM headroom?

Group-wise INT4 formats like AWQ and GPTQ store per-group scales and zero points alongside packed weights, and engines allocate workspace buffers for dequantization kernels, activations, and CUDA graphs.

How should I estimate memory for Mixture-of-Experts (MoE) models?

Enter total resident parameters across all routed and shared experts, not active parameters per token. All expert weights must stay in GPU VRAM unless you offload inactive experts.

Does Multi-Head Latent Attention (MLA) use the same KV formula?

No. MLA architectures such as DeepSeek-V3 and DeepSeek-R1 compress keys and values into a single shared low-rank latent vector plus a small decoupled RoPE key per token, reducing per-token KV storage sharply.