The KV Cache Is the New Memory Wall
Organizations: Dell Technologies, Santa Clara, CA 95054, USA
Abstract
Autoregressive LLM inference at long context is bounded by memory bandwidth, not arithmetic throughput, and the binding resource shifts from model weights to the Key-Value (KV) cache as sequence length grows. For Llama-3-70B in BF16, the 140 GB weight footprint exceeds the 80 GB HBM of a single accelerator, and one 128k-token sequence adds 42 GB of KV cache. Techniques that compress, evict, page, share, or offload KV state have proliferated, but reported gains use inconsistent workloads, hardware, and quality metrics, preventing cross-paper comparison. This SoK paper unifies the field analytically, with a protocol that strictly separates derived and reported claims. We derive closed-form arithmetic intensity as a decaying function of context length, parameterized by hardware topology for NVIDIA H100, NVIDIA B200, and AMD MI300X, including per-die bandwidth partitioning and the crossover lengths where KV traffic overtakes weight traffic. We classify the literature into five domains, quantization, token eviction, KV paging, prefix caching, and heterogeneous tiering, evaluating one method per domain at 128k context under a single protocol. The central finding is a three-regime structure: below a hardware-specific crossover, weight traffic dominates and KV compression yields negligible speedup; beyond it, KV traffic dominates and each domain trades quality for bandwidth savings approaching the roofline bound. Paging and prefix sharing are lossless but address capacity, not bandwidth. Quantization and eviction cut bandwidth directly, with degradation that accelerates below 4-bit precision and turns discontinuous for eviction on position-sensitive tasks. Tiering converts the bandwidth wall into an interconnect problem bounded by PCIe or NVLink rather than HBM. We close with design rules for selecting a compression domain given hardware, context length, and quality budget.
Figures & tables
| Model | Attn. | MB/token | ||||
|---|---|---|---|---|---|---|
| Llama-2-13B [ 22 ] | MHA | 40 | 40 | 40 | 128 | 0.82 MB |
| Mixtral 8x7B [ 23 ] | GQA | 32 | 32 | 8 | 128 | 0.13 MB |
| Llama-3-8B [ 2 ] | GQA | 32 | 32 | 8 | 128 | 0.13 MB |
| Llama-3-70B [ 2 ] | GQA | 80 | 64 | 8 | 128 | 0.33 MB |
| Llama-3.1-405B [ 2 ] | GQA | 126 | 128 | 8 | 128 | 0.52 MB |
| DeepSeek-V2 [ 8 ] | MLA | 60 | 128 | 576 † | — | 0.07 MB |
| Domain | Mechanism | Scales | Lossless | Representative methods |
|---|---|---|---|---|
| Quantization | Store keys and values at | No | KIVI [ 9 ] , KVQuant [ 10 ] , QServe [ 24 ] | |
| Token eviction | Retain fraction of positions | No | StreamingLLM [ 11 ] , H2O [ 12 ] , SnapKV [ 13 ] , PyramidKV [ 26 ] | |
| KV paging | Fixed-size block allocation | Yes | PagedAttention [ 14 ] | |
| Prefix caching | Deduplicate shared prefixes | Yes | RadixAttention [ 15 ] , LMCache [ 18 ] | |
| Memory tiering | Migrate blocks across HBM, DRAM, NVMe | Yes ∗ | FlexGen [ 16 ] , CacheGen [ 17 ] |
| Device | Package | HBM | BF16 | FP8 | |||
|---|---|---|---|---|---|---|---|
| H100 SXM | Monolithic | 80 GB | 3.35 TB/s | 3.35 TB/s | 989.5 | 1979 | 295 |
| B200 | 2 dies, NV-HBI 10 TB/s | 192 GB | 8.0 TB/s | 4.0 TB/s | 2250 | 4500 | 281 |
| MI300X | 8 XCDs, Infinity Fabric | 192 GB | 5.3 TB/s | 0.66 TB/s | 1307 | 2615 | 247 |
| Model | |||||
|---|---|---|---|---|---|
| Llama-3-8B | 122.5k | 15.3k | 3.8k | 957 | 479 |
| Llama-3-70B | 427.2k | 53.4k | 13.4k | 3.3k | 1.7k |
| Llama-3.1-405B | 1.57M | 196.2k | 49.0k | 12.3k | 6.1k |
| Configuration | KV (GB) | (ms) | tok/s | Speedup | AI | |
|---|---|---|---|---|---|---|
| Context k, below crossover k. | ||||||
| BF16 baseline | 16 bit | 41.9 | 22.7 | 44.0 | 1.00 | 2.6 |
| INT8 cache | 8 bit | 21.0 | 20.1 | 49.7 | 1.13 | 3.0 |
| INT4 cache | 4 bit | 10.5 | 18.8 | 53.2 | 1.21 | 3.2 |
| 2-bit cache | 2 bit | 5.2 | 18.2 | 55.1 | 1.25 | 3.3 |
| 2-bit plus eviction | 2 bit | 2.6 | 17.8 | 56.1 | 1.28 | 3.3 |
| ID | Pattern | Binding constraint | ||
|---|---|---|---|---|
| W1 | Single-sequence decode | 1 | 128k | Latency, weight-dominated |
| W2 | Batched decode | 32 | 128k | Throughput, KV-dominated |
| W3 | 8 requests, 96k shared prefix plus 32k unique | 8 | 128k | Capacity and TTFT |
| W4 | Reuse after 10-minute gap | 1 | 128k | Recompute versus fetch |
| Method | KV (GB) | W1 | W2 | Lossless | Quality delta (as reported) | |
|---|---|---|---|---|---|---|
| BF16 paged baseline [ 14 ] | 1 | 41.9 | 1.00 | 1.00 | — | reference |
| KIVI, 2-bit [ 9 ] | 8 | 5.2 | 1.25 | 4.82 | No | to ppl. LongBench baseline |
| KVQuant, 3-bit [ 10 ] | 5.3 | 7.9 | 1.23 | 3.78 | No | ppl. LongBench near baseline |
| H2O, [ 12 ] | 2 | 21.0 | 1.13 | 1.83 | No | 97 to 99% task retention reported |
| SnapKV, [ 13 ] | 4 | 10.5 | 1.21 | 3.12 | No | 96 to 98% LongBench retention reported |
| PagedAttention [ 14 ] | 1 | 41.9 | 1.00 | 1.00 | Yes | None. Waste cut from 60 to 80% to % |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Kernel | FLOPs | Bytes moved |
|---|---|---|
| QKV projection | ||
| Scores | ||
| Softmax | (on chip) | |
| Value contraction | ||
| Output projection | ||
| MLP, SwiGLU |
| Model | Embeddings | Reconstructed | used | |||
|---|---|---|---|---|---|---|
| Llama-3-8B | 4096 | 14336 | ||||
| Llama-3-70B | 8192 | 28672 | ||||
| Llama-3.1-405B | 16384 | 53248 |
| Symbol | Meaning | Running value |
|---|---|---|
| Layers | 80 | |
| Hidden size | 8192 | |
| Head dimension, | 128 | |
| Query heads per layer | 64 | |
| Key-value heads per layer | 8 | |
| GQA group factor, | 8 |
| Symbol | Meaning | Running value |
| Context length, decimal tokens | 128,000 | |
| Prefill length | 128,000 | |
| Decode batch size | 1–32 | |
| KV byte factor of a technique | 1–16 | |
| Eviction retention fraction | 0.25–1 | |
| Prefix sharing factor | 1–2.91 |
| ID | Structure | Metrics | Binding equations | |
|---|---|---|---|---|
| W1 | 1 | No sharing | , tok/s | Eqs. ( 6 ), ( 12 ) |
| W2 | 32 | No sharing | tok/s, speedup | Eqs. ( 7 ), ( 14 ) |
| W3 | 8 | 96k shared prefix 32k unique | TTFT, stored bytes | Eqs. ( 4 ), ( 19 ) |
| W4 | 1 | Full reuse after 10-minute gap | fetch versus recompute | Eq. ( 19 ) and link rates of Section 2 |
KV Caching
Key-value (KV) caching reuses Transformer states to speed generation while managing memory and data movement.
See all 281 papers