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

AlignedKV:利用精度对齐量化减少KV缓存的内存访问

AlignedKV: Reducing Memory Access of KV-Cache with Precision-Aligned Quantization

Tsinghua University(清华大学);Sunlune(三朗科技)

Yifan Tan, Haoze Wang, Chao Yan, Yangdong Deng

AI总结:

本文提出“精度对齐”准则并构建定量框架评估混合精度量化中参数重要性,据此开发动态KV缓存量化技术,在几乎无损精度下减少25%内存访问并实现最高1.3倍解码加速。

摘要:

模型量化已成为解决大语言模型(LLM)内存消耗大和推理时间长等问题的关键技术。混合精度量化通过区分重要参数与不重要参数,在众多量化方案中脱颖而出,因为它能在精度和压缩率之间取得平衡。然而,现有方法只能通过定性分析和人工实验来识别重要参数,未能定量分析其重要性是如何确定的。我们提出了一种新的准则,称为“精度对齐”,以构建一个定量框架,从而整体评估混合精度量化中参数的重要性。我们在多种真实场景下对浮点加法的观察表明,两个加数应具有相同的精度,否则较高精度数值中的信息将被浪费。这一观察为确定矩阵乘法运算中每个参数的精度提供了基本原则。作为将上述发现应用于大模型推理的第一步,我们开发了一种动态KV缓存量化技术,以有效降低内存访问延迟。与现有侧重于节省内存的量化方法不同,本工作直接旨在通过量化浮点数来加速LLM推理。所提出的技术在LLM解码阶段的注意力计算中实现了25%的内存访问节省,并带来高达1.3倍的加速,同时几乎没有精度损失。

英文摘要:

Model quantization has become a crucial technique to address the issues of large memory consumption and long inference times associated with LLMs. Mixed-precision quantization, which distinguishes between important and unimportant parameters, stands out among numerous quantization schemes as it achieves a balance between precision and compression rate. However, existing approaches can only identify important parameters through qualitative analysis and manual experiments without quantitatively analyzing how their importance is determined. We propose a new criterion, so-called 'precision alignment', to build a quantitative framework to holistically evaluate the importance of parameters in mixed-precision quantization. Our observations on floating point addition under various real-world scenarios suggest that two addends should have identical precision, otherwise the information in the higher-precision number will be wasted. Such an observation offers an essential principle to determine the precision of each parameter in matrix multiplication operation. As the first step towards applying the above discovery to large model inference, we develop a dynamic KV-Cache quantization technique to effectively reduce memory access latency. Different from existing quantization approaches that focus on memory saving, this work directly aims to accelerate LLM inference through quantifying floating numbers. The proposed technique attains a 25% saving of memory access and delivers up to 1.3x speedup in the computation of attention in the decoding phase of LLM, with almost no loss of precision.

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

↑