用近似杠杆分数压缩注意力键值缓存,省内存还更稳定。
Compactor: Calibrated Query-Agnostic KV Cache Compression with Approximate Leverage Scores
- 基于近似杠杆分数判断令牌重要性,无需训练
- 真实与合成任务中减少20%缓存令牌,性能不变
- 可自适应校准压缩程度,适合长文本部署
现代大语言模型正日益支持超长上下文窗口。我们提出Compactor,一种无需训练、查询无关的键值(KV)缓存压缩策略,利用近似杠杆分数确定令牌重要性。实验表明,Compactor在合成和真实场景的任务中,仅保留20%更少的令牌即可达到与现有方法相当的性能,且更具任务鲁棒性。我们进一步引入上下文校准压缩机制:在性能显著下降前推断当前上下文可承受的最大压缩率。采用此机制,Compactor在Longbench上实现完整KV性能的同时,平均降低68%的KV内存负担。为验证方法的有效性与通用性,我们在来自RULER和Longbench的27个合成与真实任务上测试了Qwen 2.5与Llama 3.1系列模型。最后,我们发布了compactor-vllm,一个支持压缩KV缓存稀疏非连续访问模式的推理引擎及优化Triton内核套件。本工作证明,Compactor为缓解现代LLM部署中的内存瓶颈提供了高效实用的解决方案。
原文摘要 · Abstract (English)
Modern Large Language Models (LLMs) are increasingly trained to support very large context windows. We present Compactor, a training-free, query-agnostic KV compression strategy that uses approximate leverage scores to determine token importance. We show that Compactor can achieve the same performance as competing methods while retaining 20% fewer tokens in both synthetic and real-world context tasks, while being more task-robust. We further introduce a procedure for context-calibrated compression: inferring the maximum compression a given context supports before significant performance loss. Using context-calibrated compression, we show that Compactor achieves full KV performance on Longbench while reducing the KV memory burden by 68%, on average. To demonstrate the efficacy and generalizability of our approach, we apply Compactor to 27 synthetic and real-world tasks from RULER and Longbench, with models from both the Qwen 2.5 and Llama 3.1 families. Finally, we release compactor-vllm, an inference engine and suite of optimized Triton kernels designed to efficiently support the sparse, non-contiguous memory access patterns inherent to compressed KV caches. This work demonstrates that Compactor offers a practical, high-performance solution for alleviating the memory bottleneck in modern LLM deployment.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。