ContiguousKV: Accelerating LLM Prefill with Granularity-Aligned KV Cache Management
Jing Zou, Shangyu Wu, Hancong Duan, Qiao Li, Chun Jason Xue
TL;DR
ContiguousKV tackles the Re-Prefill bottleneck in shared-prefix LLM serving by co-designing data granularity with pruning semantics via ContiguousChunk, enabling zero read amplification. It introduces two-level asynchronous prefetching across Periods to pipeline I/O with computation and an attention-guided cache policy to keep semantically important chunks in fast memory. Empirical results on Qwen2.5 models demonstrate up to a 3.85x speedup in Re-Prefill over state-of-the-art systems while preserving accuracy, with notable I/O reductions and tail-latency improvements. This work provides a scalable path for memory-efficient, low-latency shared-prefix inference applicable to conversational search, RAG, and long-context tasks.
Abstract
Efficiently serving Large Language Models (LLMs) with persistent Prefix Key-Value (KV) Cache is critical for applications like conversational search and multi-turn dialogue. Serving a request requires loading the pre-computed prefix KV cache and generating the first token, defined as the Re-Prefill Phase. Offloading this shared prefix cache to secondary storage is essential for memory scalability. Re-Prefill with offloading suffers from severe I/O bottlenecks in two aspects. First, semantic-aware KV cache pruning algorithms select important tokens in fine granularity, while systems manage I/O in coarse, fixed-size blocks, causing severe read amplification. Second, the sequential dependency between identifying important tokens and loading KV cache creates idle I/O and compute bubbles, under-utilizing system resources. This paper proposes \textit{ContiguousKV}, a high-performance prefix KV cache offloading system that bridges algorithmic semantics with I/O efficiency to accelerate the Re-Prefill phase. We first introduce \textit{ContiguousChunk}, a unified data management granularity that aligns KV cache pruning with I/O operations. All the mechanisms critical for I/O performance are performed at the granularity of ContiguousChunk, thereby eliminating read amplification. By exploiting the high similarity in important ContiguousChunk indices across layers, we propose intra- and inter-period asynchronous prefetching to break the sequential dependency between I/O and compute, effectively eliminating idle bubbles. Finally, we propose attention-guided cache management to retain semantically critical prefix data in memory. Evaluations on Qwen2.5 series models show that ContiguousKV achieves a 3.85x speedup in the Re-Prefill phase over the state-of-the-art offloading system IMPRESS, while maintaining high output quality.
