arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2503.00022cs.CLcs.AIcs.LG
收藏

KVCrush: 利用头部行为相似性进行键值缓存尺寸缩减

KVCrush: Key value cache size-reduction using similarity in head-behaviour

Intel Corporation(英特尔公司)

Gopi Krishna Jha, Sameh Gobriel, Liubov Talamanova, Nilesh Jain

AI总结:

KVCrush通过利用头部行为相似性,减少KV缓存尺寸并提升模型精度,兼容多种实际部署方案。

摘要:

键值(KV)缓存已成为加速大语言模型(LLMs)推理的关键优化技术。通过允许注意力操作按总序列长度线性而非平方扩展,KV缓存显著提高了生成吞吐量。然而,由于现代LLMs具有很长的上下文长度,KV的内存占用成为模型部署的主要瓶颈,直接影响模型的批量大小,阻碍其高吞吐能力的实现。现有研究通过丢弃低注意力令牌、量化和矩阵近似等技术解决这一挑战,但通常会对模型精度产生负面影响。在本文中,我们提出了KVCrush技术,可以与多种KV压缩技术结合,以更小的内存占用提高模型精度。KVCrush提供了一种替代的键值状态表示方案,并辅以低开销的令牌修剪算法,该算法考虑了KV缓存中令牌的分布,从而在保持模型精度的同时实现更小的足迹。基于我们的结果,KVCrush将LongBench KV缓存大小减少4倍,精度下降不到1%,并实现了最先进的平均精度,同时开销极低,总推理延迟低于0.5%。KVCrush不仅在精度上优于最先进的基于重要性令牌保留方案,还与使用KV缓存分页方案(如vLLM和混合精度量化)的典型实际LLM部署兼容。

英文摘要:

Key-value (KV) caching has emerged as a crucial optimization technique for accelerating inference in large language models (LLMs). By allowing the attention operation to scale linearly rather than quadratically with the total sequence length, KV caching significantly enhances generation throughput. However, due to large context lengths in the modern LLMs, the memory footprint of the KV is a huge bottleneck for model deployment directly impacting the model's batch size, hindering its ability to deliver high-throughput. Existing research addresses this challenge using several techniques, such as discarding low-attention tokens, quantization, and matrix approximation which typically lead to a negative impact on the model accuracy. In this paper, We propose KVCrush technology which can be combined with many KV compression technologies to improve the model accuracy at a much smaller memory. KVCrush provides an alternate representation scheme for key-value states, along with a low-overhead token pruning algorithm that accounts for the token distribution in the KV cache, which in turn allows for a a smaller footprint while maintaining the accuracy of the model. Based on our results, KVCrush reduces LongBench KV Cache size by 4x with less than 1% accuracy drop and achieves state-of-the-art average accuracy with minimal overhead, incurring less than 0.5% total inference latency. KVCrush not only outperforms the accuracy of state-of-the-art importance-based token retention schemes but is also compatible with typical practical LLM deployments using KV cache paging schemes such as vLLM and mixed precision quantization.

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

↑