Machine Learning PapersLandmark papers
← All papers
RESEARCH PAPER / 2023

Efficient Memory Management for Large Language Model Serving with PagedAttention (vLLM)

Woosuk Kwon, Zhuohan Li, Siyuan Zhuang ...Full author list in the original paper.

UC Berkeley +3 · landmark

Affiliations: UC Berkeley, Stanford University, UC San Diego, Independent Researcher

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$\times$ 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

The following analysis is generated by AI and may contain errors. It is separate from the authors’ abstract and is not peer review.

Research summary

The paper presents a significant advancement in memory management for LLM serving, introducing an innovative algorithm that optimizes resource usage and enhances throughput, thereby addressing a critical bottleneck in deploying large-scale language models.

Methodology

The paper introduces PagedAttention, a novel attention algorithm that leverages concepts from virtual memory management to optimize key-value (KV) cache usage in large language model (LLM) serving. This approach allows for non-contiguous storage of KV blocks, significantly reducing memory waste and improving throughput. The methodology is well-structured, with a clear explanation of how the algorithm operates in conjunction with the vLLM serving system. The integration of a centralized scheduler and the KV cache manager is particularly innovative, allowing for dynamic memory allocation and efficient handling of varying request sizes.

Results & evaluation

The authors conduct thorough evaluations comparing vLLM against state-of-the-art systems like FasterTransformer and Orca. The reported improvements in throughput (2-4x) with maintained latency are impressive and suggest that the proposed system can handle larger models and more complex decoding algorithms effectively. The experiments are well-documented, with clear metrics and comparisons that substantiate the claims made regarding efficiency and performance.

Reproducibility

The paper mentions that the source code is publicly available, which is a positive aspect for reproducibility. However, the implementation details could benefit from more explicit instructions or guidelines to facilitate easier replication of results by other researchers.

Limitations

One limitation is that while the system shows significant improvements, the paper does not extensively explore the trade-offs associated with the block size selection, which could affect performance in different scenarios. Additionally, the reliance on specific GPU architectures may limit the generalizability of the results across different hardware setups.

Broader impact

The proposed system has the potential to significantly enhance the efficiency of LLM deployments, making it more feasible to serve large models in real-time applications. This could lead to broader adoption of LLMs in various domains, including chatbots, content generation, and interactive AI applications. The implications for memory management and computational efficiency are relevant for both academia and industry. The paper presents a significant advancement in memory management for LLM serving, introducing an innovative algorithm that optimizes resource usage and enhances throughput, thereby addressing a critical bottleneck in deploying large-scale language models.

Curator note

Kwon et al.; PagedAttention; near-zero KV cache waste; production LLM serving

Talks & videos

Related later work

Author of this paper? Send a correction.