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

CompressKV: 面向资源高效长上下文LLM推理的语义检索引导KV缓存压缩

CompressKV: Semantic-Retrieval-Guided KV-Cache Compression for Resource-Efficient Long-Context LLM Inference

Technical University of Darmstadt(达姆施塔特工业大学);University of Notre Dame(圣母大学);Technical University of Ilmenau(伊尔梅瑙工业大学)

Xiaolin Lin, Jingcun Wang, Olga Kondrateva, Yiyu Shi, Bing Li, Grace Li Zhang

AI总结:

提出CompressKV框架,通过识别语义检索头(SRH)选择关键token并分层分配缓存预算,在仅用3% KV缓存时保留97%以上性能。

摘要:

长上下文大语言模型(LLM)推理日益受到键值(KV)缓存的内存占用和解码成本的限制,阻碍了在资源受限硬件上的可持续部署。现有的KV缓存驱逐方法通常对基于GQA的LLM中所有头应用启发式token评分。这些方法忽略了注意力头的不同功能,导致关键token被驱逐,从而降低LLM性能。为解决此问题,我们提出CompressKV,一种面向基于GQA的LLM的资源高效KV缓存压缩框架。CompressKV不聚合所有头的注意力分数,而是识别语义检索头(SRH),这些头捕获提示的初始和最终token以及语义重要的中间上下文证据,并利用它们选择应保留KV对的token。此外,CompressKV根据离线估计的逐层驱逐误差在各层间分配缓存预算。在LongBench和Needle-in-a-Haystack上的实验表明,CompressKV在各种内存预算下始终优于现有KV缓存驱逐方法。值得注意的是,在LongBench问答任务中,仅使用3%的KV缓存即可保留超过97%的全缓存性能,在Needle-in-a-Haystack中仅用0.7%的KV存储即可达到90%的准确率。这些结果展示了长上下文LLM推理中改进的资源-性能权衡。我们的代码公开于:this https URL

英文摘要:

Long-context large language model (LLM) inference is increasingly constrained by the memory footprint and decoding cost of key-value (KV) caches, limiting sustainable deployment on resource-constrained hardware. Existing KV cache eviction methods typically apply heuristic token scoring over all heads in GQA-based LLMs. These methods ignore the different functionalities of attention heads, leading to the eviction of critical tokens and thus degrading the performance of LLMs. To address this issue, we propose CompressKV, a resource-efficient KV-cache compression framework for GQA-based LLMs. Instead of aggregating attention scores from all heads, CompressKV identifies Semantic Retrieval Heads (SRHs) that capture both the initial and final tokens of a prompt and semantically important mid-context evidence, and uses them to select tokens whose KV pairs should be retained. Furthermore, CompressKV allocates cache budgets across layers according to offline estimates of layer-wise eviction error. Experiments on LongBench and Needle-in-a-Haystack show that CompressKV consistently outperforms existing KV-cache eviction methods across memory budgets. Notably, it preserves over 97\% of full-cache performance using only 3\% of the KV cache on LongBench question-answering tasks and achieves 90\% accuracy with just 0.7\% KV storage on Needle-in-a-Haystack. These results demonstrate an improved resource--performance trade-off for long-context LLM inference. Our code is publicly available at: https://github.com/TUDa-HWAI/CompressKV

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

↑