Eliminating Fragmentation: Paged KV Cache's Block Table
Paged KV Cache partitions the KV cache into fixed-size, non-contiguous blocks (typically 16 tokens) and uses a block table to map logical token positions to physical memory locations, effectively eliminating memory fragmentation and enabling efficient sharing of KV states across requests.
The top 3
- Why LLMs Struggle with KV Cache Fragmentation: Traditional LLM inference systems waste 60-80% of KV cache memory due to fragmentation and over-allocation, as they pre-allocate large, contiguous memory blocks for maximum possible sequence lengths, regardless of actual usage. This inefficiency drastically limits throughput and concurrent request handling.
- Block Table's Blueprint: How Paged KV Cache Maps Memory: Paged KV Cache employs a block table, analogous to an operating system's page table, to map logical KV cache blocks to non-contiguous physical memory pages. This allows dynamic, on-demand allocation and eliminates the need for large, contiguous memory reservations.
- Memory & Speed Wins: Paged KV Cache's Impact: Paged KV Cache, through its block table, dramatically cuts KV cache memory waste from 60-80% to under 5% and boosts LLM inference throughput by up to 5.18x, enabling significantly longer contexts and higher concurrency.
Sources
Open the full topic