Skip to main content
Infrastructure

Paged Attention

Paged attention is a KV-cache memory-management technique that stores attention keys and values in fixed-size blocks, addressed via a page table — analogous to virtual memory in operating systems.

AIDOLS Research Team · Editorial standards

Full definition

Introduced in vLLM (Kwon et al., SOSP 2023), paged attention solves KV-cache fragmentation. Naive serving allocates a contiguous KV-cache buffer sized to the maximum context, wasting 60–80% of KV-cache memory on fragmentation and over-reservation. Paged attention allocates KV-cache in 16-token blocks and uses a page table per sequence, eliminating fragmentation and enabling memory sharing across requests with shared prefixes (system prompts, few-shot examples). Reported gains: 2–4x throughput vs FasterTransformer and Orca at the same latency (Kwon et al., 2023); the vLLM team's June 2023 launch post reported 14–24x vs Hugging Face Transformers.

Why it matters

Paged attention is what made cheap long-context inference economically viable. Its fixed-size blocks also make prefix caching cheap to implement: vLLM's automatic prefix caching hashes each KV-cache block by its tokens and prefix, so requests that share a system prompt reuse the same blocks.

Example

A coding assistant ships a 30k-token system prompt with rules and examples; paged attention shares those KV-cache blocks across 200 concurrent users, freeing 90% of the memory a naive implementation would consume.

Next steps

More infrastructure terms

Source & further reading

Primary source: Kwon et al. — "Efficient Memory Management for Large Language Model Serving with PagedAttention" (SOSP) (2023).

Citation policy: this entry is part of the AIDOLS AI Implementation Glossary and may be quoted for research, journalism, and education with attribution to aidolsgroup.com/en/glossary/paged-attention/.