Executive TL;DR
The KV-cache is the silent budget killer in LLM inference. At 128K context, a single Llama 3.3 70B request consumes ~32GB of VRAM for KV-cache alone โ consuming 40% of an H100 SXM5's 80GB total memory budget. This forces tensor parallelism across 2 GPUs, doubling infrastructure cost for what appears to be a single request.
The KV-Cache Formula
KV-cache memory = 2 ร num_layers ร num_kv_heads ร head_dim ร seq_len ร bytes_per_element
= 2 ร 32 ร 8 ร 128 ร seq_len ร 1 byte
= 65,536 ร seq_len bytes = 0.0625 MB per token
Context Length Scaling Table
| Context | KV-Cache (FP8) | Total (Model + KV) | H100 (80GB) | H200 (141GB) |
|---|
| 4K | 256 MB | 72.3 GB | โ Single GPU | โ Single GPU |
| 32K | 2 GB | 74 GB | โ Single GPU | โ Single GPU |
| 128K | 32 GB | 104 GB | โ TP=2 | โ Single GPU |
The MLA Escape Hatch
DeepSeek-R1 and DeepSeek-V3 use Multi-head Latent Attention (MLA), which compresses the KV-cache by a factor of ~4-8x compared to standard GQA. This reduces the 128K KV-cache from 32GB to approximately 4-8GB, allowing single-GPU serving on H100-class hardware.