Efficient Memory Management for Large Language Model Serving with PagedAttention

要約

大規模言語モデル (LLM) を高スループットで提供するには、一度に十分な数のリクエストをバッチ処理する必要があります。
ただし、各リクエストのキーバリュー キャッシュ (KV キャッシュ) メモリが膨大であり、動的に拡大および縮小するため、既存のシステムは困難を抱えています。
管理が非効率である場合、このメモリは断片化と冗長重複によって大幅に浪費され、バッチ サイズが制限される可能性があります。
この問題に対処するために、オペレーティング システムの古典的な仮想メモリとページング技術にヒントを得たアテンション アルゴリズムである PagedAttendant を提案します。
その上で、(1) KV キャッシュ メモリの無駄がほぼゼロ、(2) リクエスト内およびリクエスト間で KV キャッシュを柔軟に共有してメモリ使用量をさらに削減する、LLM サービング システムである vLLM を構築します。
私たちの評価によると、vLLM は、FasterTransformer や Orca などの最先端のシステムと比較して、同じレベルの遅延で一般的な LLM のスループットを 2 ~ 4 倍 $ 向上させます。
この改善は、シーケンスが長くなり、モデルが大きくなり、復号アルゴリズムが複雑になるにつれてより顕著になります。
vLLM のソース コードは https://github.com/vllm-project/vllm で公開されています。

要約(オリジナル)

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

arxiv情報

著者 Woosuk Kwon,Zhuohan Li,Siyuan Zhuang,Ying Sheng,Lianmin Zheng,Cody Hao Yu,Joseph E. Gonzalez,Hao Zhang,Ion Stoica
発行日 2023-09-12 12:50:04+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.DC, cs.LG パーマリンク