arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.11292cs.LGcs.AI
收藏

LouisKV:面向长输入-输出序列的高效KV Cache检索

LouisKV: Efficient KV Cache Retrieval for Long Input-Output Sequences

Peking University(北京大学);Huawei Technologies Ltd.(华为技术有限公司);Chongqing University of Post and Telecommunications(重庆邮电大学)

Wenbo Wu, Qingyi Si, Xiurui Pan, Ye Wang, Jie Zhang

AI总结:

针对长序列场景中KV缓存的内存与效率瓶颈,提出LouisKV框架,通过语义感知检索和解耦细粒度管理策略,在保持近无损精度的同时实现最高4.7倍加速。

摘要:

虽然键值(KV)缓存成功减少了自回归模型中的冗余计算,但它引入了显著的内存开销,限制了其在长序列场景中的实际部署。现有的KV检索方法通过在GPU上仅动态保留一部分KV条目来缓解这一问题。然而,由于逐token检索和粗粒度的页级KV管理,它们仍然存在显著的效率和准确性瓶颈,特别是在长输出推理场景中。随着大型推理模型的出现,高效处理此类场景变得日益重要。为了解决这个问题,我们提出了两个关键观察:(1)关键KV在解码期间表现出强时间局部性,(2)这些KV在输入提示和生成输出中表现出不同的分布模式。基于这些观察,我们提出了LouisKV,一个专为各种长序列场景设计的高效KV缓存检索框架。具体而言,LouisKV引入了一种语义感知检索策略,利用时间局部性仅在语义边界处触发检索,从而大幅减少计算和数据传输开销。LouisKV还设计了一种解耦的、细粒度的管理方案,为输入和输出序列量身定制差异化策略,以创建更好地匹配模型注意力模式的检索单元,从而实现关键KV的精确识别。此外,为了提升效率,LouisKV结合了多项内核级优化,包括定制的Triton和CUDA内核以加速KV聚类和检索。评估表明,LouisKV在最先进的KV检索方法上实现了高达4.7倍的加速,同时在包括长输入短输出、短输入长输出和长输入长输出场景在内的各种长序列任务中保持了近乎无损的准确性。

英文摘要:

While Key-Value (KV) cache succeeds in reducing redundant computations in auto-regressive models, it introduces significant memory overhead, limiting its practical deployment in long-sequence scenarios. Existing KV retrieval methods mitigate this by dynamically retaining only a subset of KV entries on the GPU. However, they still suffer from notable efficiency and accuracy bottlenecks due to per-token retrieval and coarse-grained page-level KV management, especially in long-output reasoning scenarios. With the emergence of large reasoning models, efficiently handling such scenarios has become increasingly important. To address this issue, we present two key observations: (1) critical KVs exhibit strong temporal locality during decoding, and (2) these KVs exhibit distinct distribution patterns across the input prompt and generated output. Building on these observations, we propose LouisKV, an efficient KV cache retrieval framework designed for various long-sequence scenarios. Specifically, LouisKV introduces a semantic-aware retrieval strategy leveraging temporal locality to trigger retrieval only at semantic boundaries, drastically reducing computation and data transfer overhead. LouisKV also designs a decoupled, fine-grained management scheme that tailors differentiated strategies for input and output sequences to create retrieval units that better match the model's attention patterns, enabling precise identification of critical KVs. Furthermore, to boost efficiency, LouisKV incorporates several kernel-level optimizations, including custom Triton and CUDA kernels to accelerate the KV clustering and retrieval. Evaluations show that LouisKV achieves up to 4.7$\times$ speedup over state-of-the-art KV retrieval methods while maintaining near-lossless accuracy across diverse long-sequence tasks, including long-input short-output, short-input long-output, and long-input long-output scenarios.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑