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.

The top 3

  1. Paged KV Cache: 80% Memory Waste Eliminated: Traditional LLM KV cache methods typically wasted 60-80% of GPU memory due to fragmentation and over-allocation, but Paged Caching reduces this inefficiency to under 4%, achieving near-optimal memory utilization.
  2. Traditional KV Cache: Fixed, Contiguous Memory Blocks: Prior to Paged KV Cache, LLM serving systems pre-allocated large, contiguous GPU memory blocks for each sequence, sized for the maximum possible length, leading to significant internal and external fragmentation for variable-length requests.
  3. Paged Cache: OS Paging for Non-Contiguous Memory: Paged KV Cache innovates by adopting operating system virtual memory concepts, partitioning KV states into fixed-size blocks that can be stored non-contiguously in GPU memory and mapped using a block table, enabling dynamic allocation and efficient context sharing across requests.

Sources

Open the full topic