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

AffineQuant:大型语言模型的仿射变换量化

AffineQuant: Affine Transformation Quantization for Large Language Models

Xiamen University(厦门大学);ByteDance Inc.(字节跳动公司);Peng Cheng Laboratory(鹏城实验室);Institute of Artificial Intelligence, Xiamen University(厦门大学人工智能研究院)

Yuexiao Ma, Huixia Li, Xiawu Zheng, Feng Ling, Xuefeng Xiao, Rui Wang, Shilei Wen, Fei Chao, Rongrong Ji

AI总结:

AffineQuant提出在LLM后训练量化中直接使用仿射变换优化,扩展优化范围并保证可逆性,显著降低量化误差,在多项基准上达到新最优性能。

摘要:

大型语言模型(LLMs)对资源的巨大需求引起了人们对压缩和加速神经网络技术的广泛兴趣。在这些技术中,后训练量化(PTQ)因其显著的压缩效率和训练成本效益而成为备受关注的研究主题。现有的针对LLMs的PTQ方法将优化范围限制在量化前后权重之间的缩放变换。在本文中,我们主张在PTQ中直接使用等效的仿射变换进行优化(AffineQuant)。这种方法扩展了优化范围,从而显著减少了量化误差。此外,通过使用相应的逆矩阵,我们可以确保PTQ量化前后输出的等效性,从而保持其效率和泛化能力。为了确保优化过程中变换的可逆性,我们进一步引入了一种渐进掩码优化方法。该方法最初专注于优化对角元素,并逐渐扩展到其他元素。这种方法符合Levy-Desplanques定理,理论上保证了变换的可逆性。因此,在不同数据集上的不同LLMs中,性能提升显著。例如,在LLaMA2-7B模型上,我们在W4A4量化下实现了C4困惑度15.76(比OmniQuant的18.02低2.26),且无额外开销。在零样本任务中,AffineQuant在使用4/4位量化LLaMA-30B时平均准确率达到58.61(比OmniQuant的56.63高1.98),为LLMs中的PTQ设立了新的最先进基准。

英文摘要:

The significant resource requirements associated with Large-scale Language Models (LLMs) have generated considerable interest in the development of techniques aimed at compressing and accelerating neural networks. Among these techniques, Post-Training Quantization (PTQ) has emerged as a subject of considerable interest due to its noteworthy compression efficiency and cost-effectiveness in the context of training. Existing PTQ methods for LLMs limit the optimization scope to scaling transformations between pre- and post-quantization weights. In this paper, we advocate for the direct optimization using equivalent Affine transformations in PTQ (AffineQuant). This approach extends the optimization scope and thus significantly minimizing quantization errors. Additionally, by employing the corresponding inverse matrix, we can ensure equivalence between the pre- and post-quantization outputs of PTQ, thereby maintaining its efficiency and generalization capabilities. To ensure the invertibility of the transformation during optimization, we further introduce a gradual mask optimization method. This method initially focuses on optimizing the diagonal elements and gradually extends to the other elements. Such an approach aligns with the Levy-Desplanques theorem, theoretically ensuring invertibility of the transformation. As a result, significant performance improvements are evident across different LLMs on diverse datasets. To illustrate, we attain a C4 perplexity of 15.76 (2.26 lower vs 18.02 in OmniQuant) on the LLaMA2-7B model of W4A4 quantization without overhead. On zero-shot tasks, AffineQuant achieves an average of 58.61 accuracy (1.98 lower vs 56.63 in OmniQuant) when using 4/4-bit quantization for LLaMA-30B, which setting a new state-of-the-art benchmark for PTQ in LLMs.

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

↑