arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.18800cs.LGcs.AI
收藏

基于平坦度的理论最优量化

Theory-optimal Quantization Based on Flatness

The Key Laboratory of Cognition and Decision Intelligence for Complex Systems, Institute of Automation, Chinese Academy of Sciences(认知与决策智能复杂系统重点实验室,自动化研究所,中国科学院);School of Artificial Intelligence, University of Chinese Academy of Sciences(中国科学院大学人工智能学院);Beijing Academy of Artificial Intelligence(北京人工智能研究院);AMD;Ritzz-AI

Xiusheng Huang, Zhe Li, Xuanwu Yin, Lu Wang, Yequan Wang, Dong Li, Emad Barsoum, Kang Liu

AI总结:

本文提出了一种基于平坦度的理论最优量化方法,通过分析量化误差与异常值之间的数学关系,引入了平坦度指标来量化异常值分布,并提出了双向对角量化框架BDQ,有效分散异常值模式,提升了大语言模型在低比特精度下的性能。

摘要:

后训练量化已成为压缩和加速大型语言模型(LLMs)推理的广泛采用技术。LLMs量化的首要挑战源于激活异常值,这些异常值在低比特精度下显著降低模型性能。尽管近期方法试图通过跨特征维度的线性变换来缓解异常值,我们的分析表明,变换后的权重和激活仍然表现出持续的异常值模式,具有集中化的幅度分布。在本文中,我们首先建模量化误差与异常值之间的数学关系,然后引入一个新的指标平坦度来量化异常值的分布。基于此,我们推导出与平坦度相关的理论最优解。基于这些见解,我们提出了双向对角量化(BDQ),一种新的后训练量化框架,通过优化的矩阵变换有效分散异常值模式。BDQ通过学习的对角操作策略性地将异常值幅度分布到矩阵维度中。广泛的实验表明,BDQ建立了新的量化基准。在LLaMA-3-8B模型上,BDQ在W4A4量化中实现了小于1%的精度下降。在更具挑战性的W2A4KV16实验中,与最先进的方法相比,BDQ在DeepSeek-R1-Distill-LLaMA-70B模型上将性能差距减少了39.1%。

英文摘要:

Post-training quantization has emerged as a widely adopted technique for compressing and accelerating the inference of Large Language Models (LLMs). The primary challenges in LLMs quantization stem from activation outliers, which significantly degrade model performance especially at lower bit precision. While recent approaches attempt to mitigate outliers through linear transformations across feature dimensions, our analysis reveals that the transformed weights and activations still exhibit persistent outlier patterns with concentrated magnitude distributions. In this paper, we first model the mathematical relationship between quantization error and outliers, and then introduce a new metric Flatness to quantify the distribution of outliers. Based on this, we derive the theoretical optimal solution with respect to Flatness. Building on these insights, we propose Bidirectional Diagonal Quantization (BDQ), a novel post-training quantization framework that effectively disperses outlier patterns through optimized matrix transformations. BDQ strategically distributes outlier magnitudes across matrix dimensions via learned diagonal operations. Extensive experiments demonstrate that BDQ establishes a new quantization benchmark. It achieves less than 1\% accuracy drop in W4A4 quantization on the LLaMA-3-8B model. In the more challenging W2A4KV16 experiment, compared to state-of-the-art approaches, BDQ reduces the performance gap by 39.1\% on the DeepSeek-R1-Distill-LLaMA-70B model.

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

↑