[Paper Review] ContiguousKV: Accelerating LLM Prefill with Granularity-Aligned KV Cache Management
ContiguousKV introduces ContiguousChunk, a granularity-aligned KV cache offloading system that co-designs data management with pruning, plus two-level asynchronous prefetching and attention-guided cache management to accelerate the Re-Prefill phase.
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 extit{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 extit{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.
Motivation & Objective
- Motivate efficient Re-Prefill by addressing read amplification and resource under-utilization in shared-prefix LLM serving.
- Propose ContiguousChunk as a unified granularity to align KV cache pruning, storage, and I/O.
- Develop intra- and inter-period asynchronous prefetching to pipeline I/O with computation.
- Introduce attention-guided cache management to prioritize semantically important prefix data.
- Evaluate performance gains on Qwen2.5 series models across multiple KV cache budgets.
Proposed method
- Define ContiguousChunk as a unit of consecutive tokens for storage, eviction, and prefetching.
- Develop a two-level prefetching engine: intra-period (within a Period) and inter-period (across Periods) to pipeline I/O with computation.
- Exploit cross-layer and cross-period similarity of important ContiguousChunk indices to hide I/O latency.
- Implement attention-guided cache policy using a cache score S_j = I_j × F_j to prioritize ContiguousChunks in GPU/CPU memories.
- Integrate implementation into FlexGen framework and compare against IMPRESS and AttentionStore baselines.
Experimental results
Research questions
- RQ1How does granularity-aligned ContiguousChunk affect read amplification during Re-Prefill?
- RQ2Can intra- and inter-period asynchronous prefetching reduce idle compute/I/O bubbles in the Re-Prefill phase?
- RQ3Does attention-guided cache management improve hit rates for semantically important prefix data?
- RQ4What is the performance gain of ContiguousKV over state-of-the-art offloading systems on Qwen2.5 models?
- RQ5How robust are the gains across different KV budget ratios?
Key findings
- ContiguousKV achieves a 3.85x speedup in the Re-Prefill phase over IMPRESS.
- Using ContiguousChunk eliminates read amplification by aligning I/O with pruning granularity.
- Intra-period and inter-period prefetching pipeline I/O with compute, reducing idle bubbles.
- Attention-guided cache management improves caching of semantically important data.
- Evaluations on Qwen2.5 models show maintained output quality while delivering speedups.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.