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
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.
Fast Modeling L2 Cache Reuse Distance Histograms Using Combined Locality Information from Software Traces
为了缓解CPU和主存之间的性能差距,多级缓存体系结构被广泛应用于现代处理器中。因此,在设计空间探索(DSE)的早期阶段,对下游缓存的行为进行建模成为处理器性能评估的一个关键部分。本文提出了一种快速、准确的二级缓存重用距离直方图模型,可用于预测一级缓存使用LRU替换策略、二级缓存使用LRU/随机替换策略的多级缓存架构的行为。我们使用了L1重用距离直方图和两个新提出的度量,即可扩展表和Hit-RDH,描述了更详细的信息的软件跟踪作为输入。对于给定的L1高速缓存配置,分析结果可以重新用于L2高速缓存的不同配置。我们的模型的输出是L2缓存重用距离直方图,在此基础上,L2缓存未命中率可以评估。我们将L2缓存未命中率与从SPEC CPU 2006中选择的15个基准测试和从SPEC CPU 2017中选择的9个基准测试的gem 5周期精确模拟结果进行了比较。平均绝对误差小于5%,而对于四个L2缓存候选者,每个L2配置的评估时间可以加快近30倍。
Reuse Distance-based Copy-backs of Clean Cache Lines to Lower-level Caches
缓存在缩小CPU和主存之间的性能差距方面起着至关重要的作用。现代多核CPU通常采用多级缓存层次结构,通过该结构,最近和频繁使用的数据被维护在每个核的本地私有缓存中,而所有核共享最后一级缓存(LLC)。对于包含性高速缓存,在较高级别高速缓存中替换的干净高速缓存行不一定被复制回较低级别,因为包含性意味着它们存在于较低级别中。对于当今被Intel、AMD和ARM广泛使用的独占和非包含高速缓存,不加区别地将所有或不将替换的干净高速缓存行复制回较低级别不会违反独占性和非包含性定义。我们已经进行了定量研究,并发现,复制回所有或没有干净的高速缓存线,以较低级别的高速缓存的排他缓存需要次优的性能。其原因是,只有一部分缓存线将被重用,而其他人变成死在长期运行。这种观察促使我们选择性地将一些干净的高速缓存行复制回独占或非独占高速缓存架构中的LLC。我们重新讨论了高速缓存线的重用距离的概念。简而言之,具有较短重用距离的干净高速缓存行被复制回较低级别高速缓存,因为它可能在不久的将来被重新引用,而具有长得多的重用距离的高速缓存行将被丢弃或发送到存储器,如果它们是脏的。我们已经实施和评估了我们的建议与非易失性(STT-MRAM)有限责任公司。使用gem 5和SPEC CPU 2017基准测试的实验结果表明,平均而言,我们的建议比最近最少使用(LRU)替换策略(为STT-MRAM LLC复制所有干净的高速缓存行…
HyDRA: Deadline and Reuse-Aware Cacheability for Hardware Accelerators
Amar Nath and Shashi Khosla School of Information Technology, Indian Institute of Technology Delhi(印度德里理工学院阿马尔·纳特和沙希·科斯拉信息技术学院);Department of Computer Science and Engineering, Indian Institute of Technology Delhi(印度德里理工学院计算机科学与工程系)
KV-RM: Regularizing KV-Cache Movement for Static-Graph LLM Serving
Stevens Institute of Technology(史蒂文斯理工学院);The Hong Kong University of Science and Technology (Guangzhou)(香港科学与技术大学(广州));Argonne National Laboratory(阿贡国家实验室);Northwestern University(西北大学)