PagedAttention is an attention algorithm for LLM serving that stores key–value cache blocks noncontiguously. This avoids wasted reserved space and reduces internal and external memory fragmentation, making memory available for larger batches and higher throughput. section 11.1
PagedAttention addresses several serving constraints:
- Replaces contiguous cache allocation with dynamically managed blocks, allowing unused capacity to be reused across requests. section 11.1
- Avoids preallocating a request’s maximum sequence length when actual input or output lengths are shorter. section 11.1
- Supports centralized scheduling and KV-cache management, similar to virtual memory, while batching autoregressive generation for throughput. section 11.1
- Creates a foundation for more efficient memory sharing in parallel sampling and beam search. section 11.1
vLLM serving
vLLM uses PagedAttention to manage KV-cache blocks noncontiguously, combining memory-efficient serving with offline and online deployment and OpenAI-compatible API endpoints. section 11.5
