[Paper Review] Efficient Memory Management for Large Language Model Serving with PagedAttention
The paper introduces PagedAttention and vLLM to dramatically reduce KV cache memory waste and boost LLM serving throughput by 2–4x versus state-of-the-art systems, with better sharing across requests and decoding scenarios.
High throughput serving of large language models (LLMs) requires batching sufficiently many requests at a time. However, existing systems struggle because the key-value cache (KV cache) memory for each request is huge and grows and shrinks dynamically. When managed inefficiently, this memory can be significantly wasted by fragmentation and redundant duplication, limiting the batch size. To address this problem, we propose PagedAttention, an attention algorithm inspired by the classical virtual memory and paging techniques in operating systems. On top of it, we build vLLM, an LLM serving system that achieves (1) near-zero waste in KV cache memory and (2) flexible sharing of KV cache within and across requests to further reduce memory usage. Our evaluations show that vLLM improves the throughput of popular LLMs by 2-4$ imes$ with the same level of latency compared to the state-of-the-art systems, such as FasterTransformer and Orca. The improvement is more pronounced with longer sequences, larger models, and more complex decoding algorithms. vLLM's source code is publicly available at https://github.com/vllm-project/vllm
Motivation & Objective
- Identify memory allocation challenges in LLM serving that limit throughput.
- Propose a new attention algorithm that enables non-contiguous KV cache storage to reduce waste.
- Design a distributed LLM serving engine that co-optimizes memory management and decoding.
- Demonstrate throughput improvements over FasterTransformer and Orca across models and decoding scenarios.
Proposed method
- Introduce PagedAttention which partitions KV cache into fixed-size blocks and allows non-contiguous memory storage.
- Develop a KV cache manager inspired by OS virtual memory that maps logical KV blocks to physical blocks and enables on-demand allocation.
- Co-design vLLM with PagedAttention to support prompt phase and autoregressive generation efficiently.
- Apply block-level sharing and copy-on-write to enable memory sharing across sequences and beams.
- Describe handling of variable input/output lengths and diverse decoding methods (greedy, sampling, beam search) within the paged memory framework.
- Explain the distributed architecture with a centralized scheduler coordinating GPU workers.

Experimental results
Research questions
- RQ1How does non-contiguous KV cache storage impact memory waste and batch throughput in LLM serving?
- RQ2Can paged KV cache management enable effective memory sharing across tokens, prompts, samples, and beams while preserving accuracy?
- RQ3What throughput gains and memory savings does vLLM achieve compared with FasterTransformer and Orca across models and decoding strategies?
- RQ4How does the system handle variable sequence lengths and complex decoding (beam search, parallel sampling) in a paged memory model?
Key findings
- vLLM improves LLM serving throughput by 2-4x over state-of-the-art systems with similar latency.
- PagedAttention reduces KV cache memory waste by enabling fixed-size KV blocks and non-contiguous storage.
- Memory sharing across sequences and decoding candidates is enabled by block-level management and copy-on-write, reducing redundant KV cache copies.
- Sharing of prompts and prefixes is supported, enabling substantial memory savings for common prefixes.
- The approach scales to longer sequences, larger models, and more complex decoding algorithms, with accuracy preserved.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.