Inference Engineering

VII. KV Cache & Attention

The KV cache is the central memory object of LLM serving. This section covers storing, moving, compressing, and reusing it, plus attention variants designed to shrink it.

32 entries · 4 subsections

Editor’s pick

VII.1 KV Cache Management & Offloading 8

  1. PagedAttention Paper

    Stores the KV cache in fixed-size blocks mapped through a block table, nearly removing fragmentation and allowing copy-on-write sharing between sequences.

    SOSP 2023 · Code

  2. LMCache Library

    KV cache layer that stores, moves, and reuses KV data across GPU, CPU, disk, and remote tiers, attached to vLLM and SGLang through connectors.

    Apache-2.0 · 12k stars · Updated 2026-11

  3. Mooncake Library

    Moonshot AI's KV-centric infrastructure, an RDMA transfer engine plus a distributed KV store, used as a backend by vLLM, SGLang, and TensorRT-LLM.

    Apache-2.0 · 7.1k stars · Updated 2026-11

  4. LMCache: An Efficient KV Cache Layer for Enterprise-Scale LLM Inference Paper

    Design paper behind LMCache, covering the engine connector interface, batched KV movement between tiers, and support for both prefix reuse and P/D transfer.

    2025 · Code

  5. vLLM KV Offloading Connector Docs

    Configures vLLM's built-in connector that copies finished KV blocks to pinned CPU memory and optional secondary tiers with asynchronous DMA.

  6. SGLang HiCache Docs

    Design of SGLang's hierarchical cache, which extends the radix-tree prefix cache from GPU memory to host memory and storage backends like Mooncake and 3FS.

  7. kvcached Library

    Elastic KV cache allocator built on GPU virtual memory, so several vLLM or SGLang models can share one GPU and resize their caches with load.

    Apache-2.0 · 2.1k stars · Updated 2026-11

  8. FlexKV Library

    Tencent Cloud's tiered KV cache manager for CPU, SSD, and remote storage, integrated with vLLM, SGLang, TensorRT-LLM, and Dynamo.

    390 stars · Updated 2026-11

VII.2 KV Compression & Eviction 9

  1. KVPress Library

    Library of pluggable KV cache pruning methods, called presses, for Hugging Face transformers, with benchmarks to compare them on long-context tasks.

    Apache-2.0 · 1.3k stars · Updated 2026-11

  2. KIVI Paper

    Tuning-free 2-bit KV quantization that quantizes keys per channel and values per token, keeping a small full-precision window of recent tokens.

    ICML 2024 · Code

  3. StreamingLLM (Attention Sinks) Paper

    Shows that the first tokens act as attention sinks; keeping them plus a sliding window lets models stream past their training length without retraining.

    ICLR 2024 · Code

  4. H2O (Heavy-Hitter Oracle) Paper

    Evicts KV entries except recent tokens and heavy hitters, the tokens with the largest accumulated attention scores, to cap cache size during generation.

    NeurIPS 2023 · Code

  5. SnapKV Paper

    Chooses which prompt positions each attention head keeps by looking at attention from a window at the end of the prompt, compressing the cache before decoding.

    NeurIPS 2024 · Code

  6. KVQuant Paper

    Sub-4-bit KV quantization using per-channel keys taken before RoPE, non-uniform datatypes, and a sparse side matrix for outliers.

    NeurIPS 2024 · Code

  7. TurboQuant Paper

    Data-oblivious online vector quantizer, a random rotation plus scalar quantizers and a 1-bit residual sketch, applied to low-bit KV caches.

    ICLR 2026

  8. CacheGen Paper

    Encodes KV caches into compact bitstreams and adapts their quality to available bandwidth, cutting the time to load long contexts over the network.

    SIGCOMM 2024 · Code

  9. vLLM Quantized KV Cache Docs

    Explains FP8 KV cache in vLLM, including per-tensor and per-head scales and how to calibrate them with llm-compressor.

VII.3 Prefix & Prompt Caching 5

  1. SGLang: Efficient Execution of Structured Language Model Programs Paper

    Introduces RadixAttention, which keeps KV caches in a radix tree for automatic prefix reuse across requests, with LRU eviction and cache-aware scheduling.

    NeurIPS 2024 · Code

  2. vLLM Automatic Prefix Caching Docs

    Design notes on vLLM's hash-based prefix cache, where each block's key chains its own tokens with its prefix and free blocks are evicted in LRU order.

  3. CacheBlend Paper

    Reuses precomputed KV caches for non-prefix chunks such as RAG documents, recomputing a small set of tokens to restore cross-chunk attention.

    EuroSys 2025 · Code

  4. Prompt Cache Paper

    Precomputes attention states for prompt modules declared in a schema and reuses them across prompts, even when the modules are not a shared prefix.

    MLSys 2024 · Code

  5. Marconi Paper

    Prefix caching for hybrid attention and state-space models, with admission and eviction policies that weigh recurrent-state reuse against memory cost.

    MLSys 2025 · Code

VII.4 Sparse, Linear & Hybrid Attention 10

  1. Grouped-Query Attention (GQA) Paper

    Lets groups of query heads share key-value heads, sitting between multi-head and multi-query attention, and uptrains existing checkpoints to use it.

    EMNLP 2023

  2. DeepSeek-V2 (Multi-head Latent Attention) Paper

    Introduced multi-head latent attention, which caches one compressed latent vector per token instead of separate keys and values for every head.

    2024

  3. flash-linear-attention Library

    Triton kernels and layers for linear attention, state-space, and sparse attention variants such as Gated DeltaNet, KDA, and Mamba2.

    MIT · 6.1k stars · Updated 2026-11

  4. Multi-Query Attention (MQA) Paper

    Shares a single key and value head across all query heads, shrinking the KV cache and the memory traffic of incremental decoding.

    2019

  5. Native Sparse Attention (NSA) Paper

    Trainable sparse attention with compressed, selected, and sliding-window branches whose block layout is designed for efficient GPU kernels.

    ACL 2025

  6. DeepSeek-V3.2 (DeepSeek Sparse Attention) Paper

    Adds DeepSeek Sparse Attention on top of MLA, where a cheap indexer ranks past tokens and attention runs only over the selected subset.

    2025

  7. DeepSeek-V4 (Compressed Sparse Attention) Paper

    Preview report on interleaving Compressed Sparse Attention and Heavily Compressed Attention layers to make million-token contexts affordable to serve.

    2026

  8. Gated DeltaNet Paper

    Linear-attention layer combining Mamba2-style gating with the delta rule, used for the linear layers of hybrid models from Qwen3-Next onward.

    ICLR 2025 · Code

  9. Kimi Linear Paper

    Hybrid architecture that interleaves Kimi Delta Attention, a gated linear attention, with MLA layers to cut KV cache size for long contexts.

    2025 · Code

  10. Jenga Paper

    Two-level allocator, built on vLLM, that sizes pages by the LCM of layer embedding sizes and lets each layer type set its own caching and eviction.

    SOSP 2025