arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.24022cs.ARcs.DC
收藏

自适应KV缓存重用用于快速长上下文LLM服务

Adaptive KV Cache Reuse for Fast Long-Context LLM Serving

School of Computer Science and Technology, Xi’an Jiaotong University(西安交通大学计算机科学与技术学院);School of Computer Science and Technology, Huazhong University of Science and Technology(华中科技大学计算机科学与技术学院)

Fei li, Song Liu, Yan Liu, Jinhua Cui, Shiqiang Nie, Jinyu Wang, Weiguo Wu

AI总结:

针对长上下文LLM推理中预填充阶段TTFT延迟瓶颈,提出CacheTune系统,通过频域分析识别关键KV对并选择性重计算,结合稀疏传输、异步重叠和硬件感知自适应重计算比调优,实现3.72x-4.86x TTFT加速和接近全重计算的生成质量。

摘要:

在长上下文大语言模型(LLM)推理中,预填充阶段产生的首令牌延迟(TTFT)已成为限制交互性能和部署成本的首要瓶颈。KV缓存重用提供了一条减少冗余预填充的直接途径,但传统前缀缓存仅适用于严格前缀场景;在非前缀设置中直接重用KV缓存会破坏跨块全局注意力关系,导致生成质量显著下降。当可重用KV缓存被卸载到GPU外部缓存池时,跨异构硬件层的I/O开销进一步成为新的TTFT瓶颈。因此,高效的非前缀KV缓存重用需要同时实现语义一致性恢复和计算-I/O协同优化。本文提出CacheTune,一个面向长上下文LLM服务的频率引导且硬件感知的KV缓存重用系统。CacheTune首先通过频域分析离线识别对交叉注意力恢复最关键的KV对,然后在线仅选择性重计算这些语义关键令牌,同时重用其余KV。为了将这种语义选择转化为端到端延迟降低,CacheTune进一步结合稀疏KV传输、多流异步重叠、延迟位置编码恢复和硬件感知自适应重计算比调优,以平衡跨异构缓存池的计算和数据移动。在主流LLM和长上下文任务上的评估表明,CacheTune实现了3.72倍至4.86倍的TTFT加速和3.93倍至6.21倍的吞吐量提升,同时保持生成质量接近完全重计算。即使缓存被卸载到I/O受限的SSD/HDD存储,CacheTune通过自适应重计算仍能维持2.34倍至2.36倍的TTFT加速。

英文摘要:

In long-context Large Language Model (LLM) inference, the Time-To-First-Token (TTFT) latency incurred by the prefill stage has become the foremost bottleneck limiting interactive performance and deployment cost. KV Cache reuse offers a direct path to reduce redundant prefill, yet traditional prefix caching applies only to strict-prefix scenarios; directly reusing KV Cache in non-prefix settings breaks the cross-chunk global attention relationships and causes significant degradation in generation quality. When reusable KV Cache is offloaded to GPU-external cache pools, I/O overheads across heterogeneous hardware tiers further emerge as a new TTFT bottleneck. Efficient non-prefix KV Cache reuse therefore requires both semantic-consistency recovery and compute-I/O co-optimization. This paper presents CacheTune, a frequency-guided and hardware-aware KV Cache reuse system for long-context LLM serving. CacheTune first identifies, offline, the KV pairs most critical to cross-attention recovery through frequency-domain analysis, and then selectively recomputes only these semantic-critical tokens online while reusing the remaining KVs. To turn this semantic selection into end-to-end latency reduction, CacheTune further combines sparse KV transfer, multi-stream asynchronous overlap, deferred positional-encoding recovery, and hardware-aware adaptive recomputation-ratio tuning to balance computation and data movement across heterogeneous cache pools. Evaluations on mainstream LLMs and long-context tasks show that CacheTune achieves 3.72x-4.86x TTFT speedup and 3.93x-6.21x higher throughput while maintaining generation quality close to full recompute. Even when caches are offloaded to I/O-bound SSD/HDD storage, CacheTune sustains 2.34x-2.36x TTFT speedup through adaptive recomputation.

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

↑