Efficient Memory Management for Large Language Model Serving with PagedAttention
Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng,, Cody Hao Yu, Joseph E. Gonzalez, Hao Zhang, Ion Stoica

TL;DR
This paper introduces PagedAttention and vLLM, a memory-efficient system for large language model serving that significantly reduces memory waste and doubles throughput without increasing latency.
Contribution
It presents a novel attention algorithm inspired by OS paging and a system that minimizes KV cache memory waste, enabling higher throughput for LLM serving.
Findings
vLLM improves throughput by 2-4x over existing systems.
Near-zero KV cache memory waste achieved.
Performance gains are greater with longer sequences and larger models.
Abstract
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 with the same level of latency compared to the state-of-the-art…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsTopic Modeling · Caching and Content Delivery · Software System Performance and Reliability
MethodsFragmentation
