arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.17849cs.LGcs.AIcs.CL
收藏

I-LLM:面向全量化低比特大语言模型的高效纯整数推理

I-LLM: Efficient Integer-Only Inference for Fully-Quantized Low-Bit Large Language Models

Houmo AI(鸿谋科技);Nanjing University(南京大学);Southeast University(东南大学)

Xing Hu, Yuan Cheng, Dawei Yang, Zhihang Yuan, Jiangyong Yu, Chen Xu, Sifan Zhou

AI总结:

针对大语言模型纯整数量化推理中激活值波动问题,提出I-LLM框架,通过FSBR平滑通道差异、DI-MatMul缓解token差异及位移非线性算子,实现W4A4下近乎无损的高效纯整数推理。

摘要:

训练后量化(PTQ)是加速大语言模型(LLMs)推理的有效技术。然而,现有工作在推理过程中仍需要大量浮点(FP)运算,包括额外的量化和反量化,以及 RMSNorm 和 Softmax 等非线性算子。这一限制阻碍了 LLMs 在边缘和云设备上的部署。在本文中,我们发现 LLMs 纯整数量化的主要障碍在于线性与非线性操作中,跨通道和跨 token 的激活值存在剧烈波动。为解决此问题,我们提出了 I-LLM,一种专为 LLMs 设计的新型纯整数全量化 PTQ 框架。具体而言:(1)我们开发了全平滑块重建(FSBR),以激进地平滑所有激活值和权重的通道间差异。(2)为缓解 token 间差异导致的性能下降,我们引入了动态纯整数矩阵乘法(DI-MatMul)。该方法通过对输入和输出进行动态量化,在全整数矩阵乘法中实现动态量化,且仅使用纯整数操作。(3)我们设计了 DI-ClippedSoftmax、DI-Exp 和 DI-Normalization,利用位移高效执行非线性算子并保持准确率。实验表明,I-LLM 实现了与 FP 基线相当的准确率,并优于非整数量化方法。例如,I-LLM 能在 W4A4 下运行且准确率损失微乎其微。据我们所知,我们是首个弥合纯整数量化与 LLMs 之间差距的研究。我们已在 anonymous.4open.science 发布代码,旨在推动该领域发展。

英文摘要:

Post-training quantization (PTQ) serves as a potent technique to accelerate the inference of large language models (LLMs). Nonetheless, existing works still necessitate a considerable number of floating-point (FP) operations during inference, including additional quantization and de-quantization, as well as non-linear operators such as RMSNorm and Softmax. This limitation hinders the deployment of LLMs on the edge and cloud devices. In this paper, we identify the primary obstacle to integer-only quantization for LLMs lies in the large fluctuation of activations across channels and tokens in both linear and non-linear operations. To address this issue, we propose I-LLM, a novel integer-only fully-quantized PTQ framework tailored for LLMs. Specifically, (1) we develop Fully-Smooth Block-Reconstruction (FSBR) to aggressively smooth inter-channel variations of all activations and weights. (2) to alleviate degradation caused by inter-token variations, we introduce a novel approach called Dynamic Integer-only MatMul (DI-MatMul). This method enables dynamic quantization in full-integer matrix multiplication by dynamically quantizing the input and outputs with integer-only operations. (3) we design DI-ClippedSoftmax, DI-Exp, and DI-Normalization, which utilize bit shift to execute non-linear operators efficiently while maintaining accuracy. The experiment shows that our I-LLM achieves comparable accuracy to the FP baseline and outperforms non-integer quantization methods. For example, I-LLM can operate at W4A4 with negligible loss of accuracy. To our knowledge, we are the first to bridge the gap between integer-only quantization and LLMs. We've published our code on anonymous.4open.science, aiming to contribute to the advancement of this field.

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

↑