IntactKV:通过保持枢轴标记完整来改进大语言模型量化
IntactKV: Improving Large Language Model Quantization by Keeping Pivot Tokens Intact
AI总结:
针对大语言模型量化中性能下降问题,本文发现输入初始枢轴标记是关键异常值,提出IntactKV方法无损生成其KV缓存,可无缝集成现有量化方案,降低量化误差上界,并在多种模型与任务上取得一致提升,达到新最优水平。
摘要:
大语言模型(LLMs)在自然语言处理中表现出色,但需要密集的计算。为缓解这一问题,人们探索了各种量化方法,然而它们会损害LLM的性能。本文揭示了大语言模型中一种先前被忽视的异常值类型。这些异常值被发现将大部分注意力分数分配给输入的初始标记,称为枢轴标记,它们对量化LLM的性能至关重要。鉴于此,我们提出IntactKV,从全精度模型中无损生成枢轴标记的KV缓存。该方法简单且易于与现有量化解决方案结合,且无额外推理开销。此外,IntactKV可作为附加LLM参数进行校准,以最小的训练成本进一步提升量化LLM。数学分析也证明,IntactKV有效降低了量化误差的上界。实证结果表明,IntactKV在各种量化方法、不同LLM和下游任务上带来了一致的改进,从而实现了LLM量化的新最先进水平。代码可在https://github.com/ruikangliu/IntactKV获取。
英文摘要:
Large language models (LLMs) excel in natural language processing but demand intensive computation. To mitigate this, various quantization methods have been explored, yet they compromise LLM performance. This paper unveils a previously overlooked type of outliers in LLMs. Such outliers are found to allocate most of the attention scores on initial tokens of input, termed as pivot tokens, which are crucial to the performance of quantized LLMs. Given that, we propose IntactKV to generate the KV cache of pivot tokens losslessly from the full-precision model. The approach is simple and easy to combine with existing quantization solutions with no extra inference overhead. Besides, IntactKV can be calibrated as additional LLM parameters to boost the quantized LLMs further with minimal training costs. Mathematical analysis also proves that IntactKV effectively reduces the upper bound of quantization error. Empirical results show that IntactKV brings consistent improvement over various quantization methods across different LLMs and downstream tasks, leading to the new state-of-the-art for LLM quantization. The codes are available at https://github.com/ruikangliu/IntactKV.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。