arXiv:2511.14510cs.LG2025-11被引 2

通过查询相似性复用缓存,显著降低大模型推理时的CPU开销和显存压力。

LiteCache: A Query Similarity-Driven, GPU-Centric KVCache Subsystem for Efficient LLM Inference

  • 基于注意力头内查询相似性,实现细粒度缓存复用
  • 在H100/A40上提升解码吞吐10.7-224.2%,支持超长序列
  • 全GPU调度、低延迟数据预取,兼容CUDA图加速

大模型推理中,键值缓存(KVCache)内存随序列长度和批量大小线性增长,常超出GPU容量。现有方法将KV状态卸载至主机内存并利用top-k注意力减少传输,但采用以CPU为中心的缓存管理及跨设备数据移动,导致高开销并破坏CUDA Graph所需的批量执行模式。本文观察到同一注意力头内相邻查询具有强方向相似性,其top-k KV状态高度重叠,据此提出头粒度缓存算法QSAC:当当前查询与前一查询足够相似时,直接复用先前缓存。该机制简化了缓存操作,几乎完全消除CPU参与。我们构建了LiteCache系统,引入基于GPU的同步控制器与推测性稀疏预取,实现计算与数据移动的完全重叠。该设计保持稳定可预测的执行模式,兼容CUDA Graph的批量执行需求。在两个主流LLM上的评估表明,LiteCache在精度与基线相当的前提下,显著降低CPU开销,充分使用PCIe带宽,在H100和A40 GPU上实现10.7%-224.2%的解码吞吐提升,并轻松支持超过100万长度的序列。代码已开源:https://anonymous.4open.science/r/LiteCache-888D。

原文摘要 · Abstract (English)

During LLM inference, KVCache memory usage grows linearly with sequence length and batch size and often exceeds GPU capacity. Recent proposals offload KV states to host memory and reduce transfers using top-k attention. But their CPU-centric management of the on-GPU cache and CPU-GPU data movement incurs high overhead and fragments the bulk GPU execution that CUDA Graph relies on. To close this gap, we observe that adjacent queries within the same attention head exhibit strong directional similarity and retrieve highly overlapping top-k KV states. This insight enables a simple head granularity cache algorithm, QSAC, in which each head reuses its previously cached KV states whenever the current query is sufficiently similar to the prior one. QSAC further simplifies cache management primitives and cuts CPU involvement almost entirely. We develop LiteCache, a KVCache subsystem that incorporates QSAC. LiteCache introduces a GPU-centric synchronization controller and speculative sparse prefetching, enabling fully overlapped data movement and computation. These mechanisms produce a stable and predictable execution pattern that remains compatible with the bulk execution mode required by CUDA Graphs. Evaluation on two widely-used LLMs indicates that LiteCache achieves comparable accuracy to baselines, while sharply minimizing CPU overhead, fully utilizing PCIe bandwidth, thus improving decoding throughput by 10.7-224.2% on both H100 and A40 GPUs and easily supporting sequence lengths beyond 1M. We opensource LiteCache at https://anonymous.4open.science/r/LiteCache-888D.

大模型推理显存优化KV缓存CUDA图

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。