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

LookaheadKV: 通过不生成未来预览实现快速且准确的KV缓存淘汰

LookaheadKV: Fast and Accurate KV Cache Eviction by Glimpsing into the Future without Generation

Samsung Research(三星研究院)

Jinwoo Ahn, Ingyu Seong, Akhil Kedia, Junhan Kim, Hyemi Jang, Kangwook Lee, Yongkweon Jeon

AI总结:

LookaheadKV通过无需显式生成未来响应的轻量级框架,实现高效准确的KV缓存淘汰,减少淘汰成本并提升推理速度。

摘要:

基于变换器的大型语言模型(LLMs)依赖键值(KV)缓存来避免在自回归推理过程中重复计算。尽管这种机制大大提高了效率,但缓存大小与输入序列长度成线性增长,很快成为长上下文任务的瓶颈。现有解决方案通过删除被认为不重要的提示KV来缓解这一问题,通过估计重要性分数进行指导。值得注意的是,最近的一项工作提出通过“预览未来”来提高淘汰质量,其中草稿生成器生成一个近似目标模型真实响应的替代未来响应,然后该替代响应被用来更准确地估计缓存KV的重要性。然而,这些方法依赖于计算成本高昂的草稿生成,这会引入显著的prefill开销,限制了其在实际部署中的实用性。为了解决这一挑战,我们提出了LookaheadKV,一个轻量级的淘汰框架,它利用替代未来响应的优势而无需显式草稿生成。LookaheadKV在变换器层中加入了参数高效的模块,这些模块经过训练以高精度预测真实的重要性分数。我们的设计确保了运行时开销与现有低成本启发式方法相当,同时实现了优于更昂贵近似方法的准确性。在长上下文理解基准上的大量实验,涵盖了广泛模型范围,表明我们的方法不仅在各种长上下文理解任务中优于最近的竞争基线,还通过减少淘汰成本高达14.5倍,显著加快了时间到第一个token的速度。我们的代码可在https://github.com/SamsungLabs/LookaheadKV上获得。

英文摘要:

Transformer-based large language models (LLMs) rely on key-value (KV) caching to avoid redundant computation during autoregressive inference. While this mechanism greatly improves efficiency, the cache size grows linearly with the input sequence length, quickly becoming a bottleneck for long-context tasks. Existing solutions mitigate this problem by evicting prompt KV that are deemed unimportant, guided by estimated importance scores. Notably, a recent line of work proposes to improve eviction quality by "glimpsing into the future", in which a draft generator produces a surrogate future response approximating the target model's true response, and this surrogate is subsequently used to estimate the importance of cached KV more accurately. However, these approaches rely on computationally expensive draft generation, which introduces substantial prefilling overhead and limits their practicality in real-world deployment. To address this challenge, we propose LookaheadKV, a lightweight eviction framework that leverages the strength of surrogate future response without requiring explicit draft generation. LookaheadKV augments transformer layers with parameter-efficient modules trained to predict true importance scores with high accuracy. Our design ensures negligible runtime overhead comparable to existing inexpensive heuristics, while achieving accuracy superior to more costly approximation methods. Extensive experiments on long-context understanding benchmarks, across a wide range of models, demonstrate that our method not only outperforms recent competitive baselines in various long-context understanding tasks, but also reduces the eviction cost by up to 14.5x, leading to significantly faster time-to-first-token. Our code is available at https://github.com/SamsungLabs/LookaheadKV.

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

↑