LLM KV Cache and Concurrent Inference VRAM Calculator
Estimate the storage needed for KV states during LLM inference and how it increases with concurrent requests.
Sequence length includes the retained prompt and generated tokens. If request lengths differ, calculate separately using the total token count.
Results
—GiB
- KV cache per request
- —GiB
- KV cache per token
- —bytes
- Total Key cache
- —GiB
- Total Value cache
- —GiB
- Exact KV cache size for concurrent requests
- —bytes
Results update automatically when the required values are entered.
Method, applicability and sources
Calculation method
KV cache per token [bytes] = 2 (Key/Value) × layers × KV heads × head dimension × storage precision [bytes/element]. Per-request storage = per-token storage × sequence length. Concurrent total = per-request storage × concurrent requests. Key and Value each occupy half. 1 GiB = 1,073,741,824 bytes. If both optional VRAM inputs are supplied, total = KV cache + model weights + other reserved VRAM. Storage is calculated in whole bytes; only the GiB display is rounded to 12 decimal places. GiB inputs for weights and other memory are rounded to the nearest byte.
Worked example (hypothetical values)
Example: 32 layers, 8 KV heads, dimension 128, FP16, 4,096 tokens and 4 concurrent requests give 131,072 bytes per token, 0.5 GiB per request and 2 GiB in total (Key 1 GiB / Value 1 GiB). With model weights of 14 GiB and other reserved memory of 2 GiB, the simple total is 18 GiB.
Applicability and limitations
Inference with decoder-only Transformers using standard full-context attention and independent KV storage for each request. Excludes inference of model specifications, weight precision conversion, sharding across GPUs, paged/block allocation rounding, shared prefixes, sliding-window or hybrid attention, MLA, quantization scales, automatic estimates of runtime activations/workspace, training VRAM and API charges.
Methods used
- Theoretical storage for independent KV caches (NVIDIA 2023 / vLLM 2026-11-13): scope Models with equal K and V dimensions and the same KV head structure in every attention layer. This does not measure total actual GPU allocation.; region Global
Method and sources
Method: NVIDIA Inference Optimization (2023-11-17) / vLLM KVCacheSpec (cross-checked 2026-11-13). Data recorded: 2026-11-13.