arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2603.00907cs.CL
收藏

KVSlimmer: 对非对称KV合并的理论洞察与实用优化

KVSlimmer: Theoretical Insights and Practical Optimizations for Asymmetric KV Merging

School of Information and Communication Engineering, Hainan University, Haikou, China(信息与通信工程学院,海南大学,海口,中国);School of Cyberspace Security, Hainan University, Haikou, China(网络安全学院,海南大学,海口,中国);MAC Lab, Department of Artificial Intelligence, School of Informatics, Xiamen University, Xiamen, China(人工智能系信息学院MAC实验室,厦门大学,厦门,中国);School of Computer Science and Technology, Hainan University, Haikou, China(计算机科学与技术学院,海南大学,海口,中国)

Lianjun Liu, Hongli An, Weiqi Yan, Xin Du, Shengchuan Zhang, Huazhong Liu, Yunshan Zhong

AI总结:

KVSlimmer通过理论分析和高效算法优化非对称KV合并,提升模型性能并降低内存与延迟开销。

摘要:

键值(KV)缓存日益增长的计算和内存需求显著限制了大型语言模型(LLMs)的能力。尽管KV合并已作为一种有前途的解决方案出现,但现有方法依赖于KV不对称性的经验观察和基于梯度的Hessian近似,缺乏理论基础且导致压缩和推理开销不优。为弥合这些差距,我们建立了一个理论框架,通过投影权重的谱能量分布来表征这种不对称性,证明在查询/键权重中集中化的谱会引发特征同质性,而在值权重中分散化的谱则保留异质性。然后,我们引入KVSlimmer,一种高效的算法,通过数学精确的公式捕获精确的Hessian信息,并利用仅向前传递变量推导出闭合解,从而得到一种无梯度的方法,该方法在内存和时间效率上都表现优异。在各种模型和基准上的广泛实验表明,KVSlimmer在各方面都优于现有最先进方法。例如,在Llama3.1-8B-Instruct上,它将LongBench平均分数提高0.92,同时将内存成本和延迟分别降低29%和28%。代码可在https://github.com/lianjunl13-sudo/KVSlimmer上获得。

英文摘要:

The growing computational and memory demands of the Key-Value (KV) cache significantly limit the ability of Large Language Models (LLMs). While KV merging has emerged as a promising solution, existing methods that rely on empirical observations of KV asymmetry and gradient-based Hessian approximations lack a theoretical foundation and incur suboptimal compression and inference overhead. To bridge these gaps, we establish a theoretical framework that characterizes this asymmetry through the spectral energy distribution of projection weights, demonstrating that concentrated spectra in Query/Key weights induce feature homogeneity, whereas dispersed spectra in Value weights preserve heterogeneity. Then, we introduce KVSlimmer, an efficient algorithm that captures exact Hessian information through a mathematically exact formulation, and derives a closed-form solution utilizing only forward-pass variables, resulting in a gradient-free approach that is both memory- and time-efficient. Extensive experiments across various models and benchmarks demonstrate that KVSlimmer consistently outperforms SOTA methods. For instance, on Llama3.1-8B-Instruct, it improves the LongBench average score by 0.92 while reducing memory costs and latency by 29% and 28%, respectively.Code is available at https://github.com/lianjunl13-sudo/KVSlimmer.

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

↑