用小模型补偿大模型的键值缓存压缩,提升长文本推理效率。
SmallKV: Small Model Assisted Compensation of KV Cache Compression for Efficient LLM Inference
- 利用小模型与大模型注意力相似性,动态补偿被压缩的关键信息。
- 在多个基准上实现1.75~2.56倍吞吐提升,保持性能不降。
- 适合资源受限环境下需高效长文本生成的场景。
KV缓存淘汰已成为缓解大语言模型在长上下文场景下资源压力的有效方案。然而,现有基于令牌的淘汰方法常忽视两个关键问题:(1) 其不可逆淘汰策略无法适应解码过程中的动态注意力模式(显著性转移问题);(2) 将边际重要性令牌与真正无关令牌同等处理,忽略了边际令牌对模型性能的累积贡献(边际信息过压缩问题)。为此,我们基于不同规模大模型间注意力矩阵的高度相似性,设计了两种补偿机制,提出SmallKV——一种由小模型辅助的KV缓存压缩补偿方法。SmallKV通过保持不同规模模型间的注意力匹配,实现:(1) 帮助大模型感知全局重要注意力信息;(2) 利用小模型的注意力得分近似大模型中边际令牌的得分。在GSM8K、BBH、MT-Bench和LongBench等基准上的实验表明其有效性。效率评估显示,SmallKV相较基线方法提升1.75至2.56倍吞吐量,凸显其在资源受限环境下的高效高能推理潜力。
原文摘要 · Abstract (English)
KV cache eviction has emerged as an effective solution to alleviate resource constraints faced by LLMs in long-context scenarios. However, existing token-level eviction methods often overlook two critical aspects: (1) their irreversible eviction strategy fails to adapt to dynamic attention patterns during decoding (the saliency shift problem), and (2) they treat both marginally important tokens and truly unimportant tokens equally, despite the collective significance of marginal tokens to model performance (the marginal information over-compression problem). To address these issues, we design two compensation mechanisms based on the high similarity of attention matrices between LLMs of different scales. We propose SmallKV, a small model assisted compensation method for KV cache compression. SmallKV can maintain attention matching between different-scale LLMs to: 1) assist the larger model in perceiving globally important information of attention; and 2) use the smaller model's attention scores to approximate those of marginal tokens in the larger model. Extensive experiments on benchmarks including GSM8K, BBH, MT-Bench, and LongBench demonstrate the effectiveness of SmallKV. Moreover, efficiency evaluations show that SmallKV achieves 1.75 - 2.56 times higher throughput than baseline methods, highlighting its potential for efficient and performant LLM inference in resource constrained environments.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。