arXiv:2409.16546cs.LG2024-09被引 6

提出精度对齐量化,显著降低大模型推理内存访问延迟。

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

  • 基于精度对齐原则,动态量化注意力键值缓存
  • 内存访问减少25%,解码阶段注意力计算提速1.3倍
  • 适合追求推理速度优化的部署场景

模型量化已成为缓解大语言模型内存消耗大和推理时间长问题的关键技术。混合精度量化通过区分重要与非重要参数,在精度与压缩率间取得平衡,但现有方法仅依赖定性分析和人工实验判断参数重要性,缺乏定量依据。本文提出'精度对齐'新准则,构建量化评估的定量框架。通过对真实场景下浮点加法的观察发现,两加数精度必须一致,否则高精度数据信息将被浪费。这一发现为矩阵乘法中各参数精度设定提供了基本原则。作为首次将该原理应用于大模型推理的尝试,本文提出动态KV缓存量化技术,直接以加速推理为目标量化浮点数。该方法实现内存访问量减少25%,解码阶段注意力计算最高提速1.3倍,且精度几乎无损失。

原文摘要 · Abstract (English)

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.

量化推理加速大模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。