[论文解读] ContiguousKV: Accelerating LLM Prefill with Granularity-Aligned KV Cache Management
ContiguousKV 引入 ContiguousChunk,一种与粒度对齐的 KV 缓存下放系统,联合数据管理剪枝、两级异步预取与注意力引导缓存管理以加速 Re-Prefill 阶段。
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.
研究动机与目标
- 通过解决共享前缀 LLM 服务中的读放大和资源利用率不足的问题,推动高效的 Re-Prefill。
- 提出 ContiguousChunk 作为统一粒度,协调 KV 缓存剪枝、存储与 I/O。
- 开发期内与期间的异步预取,以流水线化 I/O 和计算。
- 引入注意力引导缓存管理,优先处理语义重要的前缀数据。
- 在 Qwen2.5 系列模型上,结合多种 KV 缓存预算,评估性能提升。
提出的方法
- 将 ContiguousChunk 定义为用于存储、替换与预取的连续 tokens 单元。
- 开发两级预取引擎:期内(Intra-period)与期间(Inter-period),实现 I/O 与计算的流水线。
- 利用重要 ContiguousChunk 索引在跨层与跨期的相似性来隐藏 I/O 延迟。
- 实现注意力引导的缓存策略,使用缓存分数 S_j = I_j × F_j 在 GPU/CPU 内存中对 ContiguousChunk 进行优先级排序。
- 将实现整合到 FlexGen 框架,并与 IMPRESS 和 AttentionStore 基线进行对比。
实验结果
研究问题
- RQ1粒度对齐的 ContiguousChunk 如何影响 Re-Prefill 过程中的读放大?
- RQ2期内与期间的异步预取是否能减少 Re-Prefill 阶段的空闲计算/ I/O 气泡?
- RQ3注意力引导的缓存管理是否能提升语义重要前缀数据的命中率?
- RQ4在 Qwen2.5 模型上,ContiguousKV 相较于最先进的下放系统的性能提升有多大?
- RQ5在不同 KV 预算比例下,性能提升的鲁棒性如何?
主要发现
- ContiguousKV 在 Re-Prefill 阶段相对于 IMPRESS 实现了 3.85×的加速。
- 使用 ContiguousChunk 通过将 I/O 与剪枝粒度对齐,消除了读放大。
- 期内与期间的预取将 I/O 与计算并行化,降低空闲气泡。
- 注意力引导的缓存管理提升了对语义重要数据的缓存命中率。
- 在 Qwen2.5 模型上的评估显示,在维持输出质量的同时实现了加速。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。