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

CacheClip: 通过有效的KV缓存重用加速RAG

CacheClip: Accelerating RAG with Effective KV Cache Reuse

Intel Corporation(英特尔公司)

Bin Yang, Qiuyu Leng, Jun Zeng, Zhenhua Wu

AI总结:

本文提出CacheClip框架,通过有效利用KV缓存重用,解决了RAG系统中TTFT瓶颈问题,同时保持高质量生成。

摘要:

检索增强生成(RAG)系统由于长输入序列而面临严重的首次令牌时间(TTFT)瓶颈。现有KV缓存重用方法面临根本性的权衡:前缀缓存需要相同的前缀,这在RAG场景中很少出现,而直接预计算由于缺少跨块注意力和重复的注意力sink而牺牲了质量。最近的方法如APE和CacheBlend部分解决了这些问题,但不足以满足鲁棒的RAG应用。本文提出了CacheClip,一种新的框架,实现了快速的TTFT和高质量的生成。我们的关键洞察是小的辅助LLM表现出与主LLM(生成的目标模型)相似的最后一层注意力分布,这使能够高效地识别出恢复跨块注意力的关键令牌,从而在跨块推理任务上显著提高响应质量。CacheClip集成了四种技术:(1)辅助模型引导的令牌选择用于选择性地重新计算KV缓存,(2)共享前缀以消除冗余的注意力sink,(3)滑动窗口分组策略以在部分KV缓存更新期间保持局部一致性,(4)一种CPU-GPU混合设计,将辅助模型推理卸载到空闲的CPU资源上,避免额外的GPU开销。重新计算比率是可调节的,允许用户根据不同的部署需求灵活地平衡效率和质量。实验表明,CacheClip在NIAH和LongBench上保留了高达85.2%和91.1%的全注意力性能,优于CacheBlend和APE在NIAH上分别高出16.1和12.8点,在LongBench上分别高出4.5和4.2点(重新计算比率为20%)。同时,CacheClip在预填时间上将LLM推理加速了高达3.33倍(重新计算比率为20%),为RAG系统中的效率-质量权衡提供了实用的解决方案。

英文摘要:

Retrieval-Augmented Generation (RAG) systems suffer from severe time-to-first-token (TTFT) bottlenecks due to long input sequences. Existing KV cache reuse methods face a fundamental trade-off: prefix caching requires identical prefixes that rarely occur in RAG scenarios, while direct precomputation sacrifices quality due to missing inter-chunk attention and repeated attention sinks. Recent methods like APE and CacheBlend partially address these issues but remain inadequate for robust RAG applications. This paper presents CacheClip, a novel framework that achieves both fast TTFT and high generation quality. Our key insight is that small auxiliary LLMs exhibit similar last-layer attention distributions to primary LLMs (the target model for generation), enabling efficient identification of tokens critical for restoring inter-chunk attention, thereby significantly improving response quality on cross-chunk reasoning tasks. CacheClip integrates four techniques: (1) auxiliary-model-guided token selection for selective KV cache recomputation, (2) shared prefixes to eliminate redundant attention sinks, (3) a sliding-window grouping strategy to maintain local coherence during partial KV cache updates, and (4) a CPU-GPU hybrid design that offloads auxiliary model inference to idle CPU resources, avoiding additional GPU overhead. The recomputation ratio is adjustable, allowing users to flexibly balance efficiency and quality for different deployment requirements. Experiments show CacheClip retains up to 85.2% and 91.1% of full-attention performance on NIAH and LongBench, outperforming CacheBlend and APE by 16.1 and 12.8 points on NIAH, and by 4.5 and 4.2 points on LongBench (with recomp% = 20%). Meanwhile, CacheClip accelerates LLM inference by up to 3.33$\times$ in prefill time (with recomp% = 20%), providing a practical solution to the efficiency-quality trade-off in RAG systems.

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

↑