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.
The top 3
- Top 3 LLM Memory Bottlenecks Paged KV Cache Solved: Before Paged KV Cache, LLM serving systems suffered from significant memory waste due to internal fragmentation (pre-allocating max sequence length) and external fragmentation (scattered, unusable free memory blocks). Traditional methods often wasted 60-80% of GPU memory, limiting throughput and context length.
- Paged KV Cache's Top 3 Performance & Efficiency Gains: Paged KV Cache drastically improves LLM serving by reducing memory wastage from 60-80% to under 5%, leading to throughput improvements of up to 5.18x. It enables scalable concurrent serving and supports longer context windows by allocating memory on-demand and allowing block sharing for common prefixes.
- Core OS Virtual Memory Concepts Adapted by Paged KV Cache: Paged KV Cache directly borrows concepts from operating system virtual memory, primarily 'pages' (fixed-size blocks), 'page tables' (mapping logical token offsets to physical memory), and 'dynamic allocation' to manage the KV cache. This allows LLMs to view a contiguous memory space for the KV cache while the physical storage is non-contiguous, eliminating fragmentation at the page level.
Sources
Open the full topic