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.
The top 3
- Paged KV Cache: Top Throughput Gains Quantified: Paged KV Cache can increase throughput by up to 4x for long context windows and significantly reduce memory usage by up to 2-3x compared to contiguous KV cache allocations, especially with varying sequence lengths.
- Memory Efficiency: Paged KV Cache vs. Contiguous Allocation: Unlike traditional contiguous KV cache, Paged KV Cache's non-contiguous memory management, inspired by operating system paging, drastically reduces fragmentation and allows for sharing of KV cache blocks across different requests, leading to superior memory utilization.
- Paged KV Cache's Core Innovation: OS Paging Analogy: The fundamental innovation of Paged KV Cache lies in applying operating system virtual memory concepts, specifically paging, to LLM KV cache management, allowing flexible allocation and deallocation of fixed-size 'pages' of key-value states.
Sources
Open the full topic