Paged KV Cache: OS Paging's LLM Evolution
Introduced by the vLLM team in early 2023, PagedAttention applies operating system virtual memory paging concepts to efficiently manage the dynamic and unpredictable Key-Value (KV) cache in large language models (LLMs).
The top 3
- LLM KV Cache: The Memory Problem Paged Caching Solved: Before Paged KV Cache, LLM inference systems commonly wasted 60-80% of GPU memory allocated for KV caches due to severe fragmentation and pre-allocating contiguous blocks for maximum sequence lengths, severely limiting throughput and context windows.
- Paged KV Cache: OS Virtual Memory's LLM Parallel: Paged KV Cache directly borrows from operating system virtual memory concepts, using fixed-size 'pages' to manage non-contiguous GPU memory for LLM KV caches. This allows dynamic allocation and block-wise eviction, much like how an OS manages physical RAM.
- Paged KV Cache: Dramatic Throughput & Memory Gains: This optimization drastically reduces memory wastage from 60-80% to under 5% and can boost LLM inference throughput by 2-4x, and in some cases up to 5.18x or even 24x. It enables significantly larger batch sizes and longer context windows on existing hardware.
Sources
Open the full topic