KV cache memory size calculator

Long-context serving fails on KV cache memory long before you run out of FLOPs. Pick a model architecture and KV dtype below to see exact gigabytes per request and how many concurrent users fit before OOM.

Interactive calculator

KV Cache PolicyGB / RequestBatch KV TotalMax ConcurrencyStatus

How to stop KV cache OOM crashes in production

  1. Enable FP8 KV cache before adding another GPU. Moving KV tensors from BF16 to FP8 E4M3 cuts memory footprint by 50% on H100, H200, and Ada GPUs while keeping perplexity nearly unchanged.
  2. Turn on automatic prefix caching for shared system prompts. If 40 concurrent agents share a 6K system prompt and tool schema, prefix caching stores that prefix once instead of 40 times.
  3. Reserve 8% to 10% of VRAM for CUDA graphs and activations. Setting gpu-memory-utilization to 0.98 causes sudden OOM spikes during large prefill chunks. Stick to 0.90 or 0.92 in production.
  4. Cap max-model-len to your real P99 prompt length. Leaving max-model-len at 128K when 99% of requests finish under 16K wastes slot allocation and throttles scheduler throughput.

Common questions

How do you calculate KV cache size for a GQA model?

Multiply 2 (keys and values) by layer count, KV head count, head dimension, sequence length, and bytes per element. Llama 3.3 70B uses 320 KB per token in FP16.

Why does DeepSeek V3 use so much less KV cache?

DeepSeek V3 uses Multi-Head Latent Attention (MLA), compressing keys and values into a single 576-dimension latent vector per layer instead of full KV heads.

Does FP8 KV cache hurt long-context accuracy?

On 70B-class models, FP8 E4M3 KV quantization typically changes benchmark scores by less than 0.3 points while doubling maximum batch size.

What happens when active requests exceed KV VRAM headroom?

PagedAttention engines like vLLM preempt lower-priority sequences, swapping blocks to CPU RAM or recomputing them, which spikes tail latency.

All calculations run 100% locally in your browser with zero external API calls. Hardware specs and hourly rates reflect published 2026 cloud and silicon datasheets.