OstQuant:利用正交和缩放变换优化大型语言模型量化以更好地拟合分布
OstQuant: Refining Large Language Model Quantization with Orthogonal and Scaling Transformations for Better Distribution Fitting
AI总结:
本文提出OSTQuant方法,通过正交和缩放变换优化量化空间分布,并引入QSUR指标和KL-Top损失,在多种LLM基准上提升量化性能,显著缩小精度差距。
摘要:
后训练量化(PTQ)已成为压缩和加速大型语言模型(LLM)的一种广泛采用的技术。LLM量化中的主要挑战在于,不均匀且重尾的数据分布会扩大量化范围,从而降低大多数数值的位精度。近期方法尝试通过采用线性变换来消除异常值并平衡通道间差异;然而,这些方法仍属于启发式方法,且往往忽视了在整个量化空间内优化数据分布。在本文中,我们引入了量化空间利用率(QSUR),这是一种新的度量标准,通过衡量数据在量化空间中的空间利用率来有效评估变换后数据的可量化性。我们通过数学推导补充了QSUR,分析了各种变换的效果和局限性,指导我们开发了基于正交和缩放变换的量化(OSTQuant)。OSTQuant采用一种可学习的等价变换,由正交变换和缩放变换组成,以优化整个量化空间中权重和激活的分布。此外,我们提出了KL-Top损失函数,旨在减轻优化过程中的噪声,同时在PTQ所限定的有限校准数据内保留更丰富的语义信息。OSTQuant在各种LLM和基准测试上均优于现有工作。在仅W4设置下,它保留了浮点精度的99.5%。在更具挑战性的W4A4KV4配置中,与最先进的方法相比,OSTQuant在LLaMA-3-8B模型上将性能差距缩小了32%。https://github.com/BrotherHappy/OSTQuant
英文摘要:
Post-training quantization (PTQ) has emerged as a widely adopted technique for compressing and accelerating Large Language Models (LLMs). The major challenge in LLM quantization is that uneven and heavy-tailed data distributions can expand the quantization range, thereby reducing bit precision for most values. Recent methods attempt to eliminate outliers and balance inter-channel differences by employing linear transformations; however, they remain heuristic and are often overlook optimizing the data distribution across the entire quantization space.In this paper, we introduce Quantization Space Utilization Rate (QSUR), a novel metric that effectively assesses the quantizability of transformed data by measuring the space utilization of the data in the quantization space. We complement QSUR with mathematical derivations that examine the effects and limitations of various transformations, guiding our development of Orthogonal and Scaling Transformation-based Quantization (OSTQuant). OSQuant employs a learnable equivalent transformation, consisting of an orthogonal transformation and a scaling transformation, to optimize the distributions of weights and activations across the entire quantization space. Futhermore, we propose the KL-Top loss function, designed to mitigate noise during optimization while retaining richer semantic information within the limited calibration data imposed by PTQ. OSTQuant outperforms existing work on various LLMs and benchmarks. In the W4-only setting, it retains 99.5\% of the floating-point accuracy. In the more challenging W4A4KV4 configuration, OSTQuant reduces the performance gap by 32\% on the LLaMA-3-8B model compared to state-of-the-art methods. \href{https://github.com/BrotherHappy/OSTQuant}{https://github.com/BrotherHappy/OSTQuant}.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。