arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2501.06417cs.LGcs.AIcs.DS
收藏

DiscQuant:一种受偏差理论启发的神经网络量化方法

DiscQuant: A Quantization Method for Neural Networks Inspired by Discrepancy Theory

Cornell University(康奈尔大学);Microsoft Research(微软研究院);University of Washington(华盛顿大学)

Jerry Chee, Arturs Backurs, Rainie Heck, Li Zhang, Janardhan Kulkarni, Thomas Rothvoss, Sivakanth Gopi

AI总结:

该研究从偏差理论视角出发,提出神经网络权重量化的舍入算法DiscQuant,在Phi3mini-3.8B、Llama3.1-8B模型的多个基准上显著优于GPTQ和RTN方法。

摘要:

神经网络权重量化包含两个步骤:(1)为权重找到一种良好的低比特复杂度表示(我们称之为量化网格);(2)将原始权重舍入到量化网格中的值。本文研究了在给定任意量化网格的情况下实现最优舍入的问题。最简单且最常用的舍入方式是最近邻舍入(Round-to-Nearest,RTN)。而通过采用依赖数据的舍入方式,可以显著提升量化模型的质量。\n我们从偏差理论(discrepancy theory)的视角研究舍入问题,该理论研究如何在不过度影响解的质量的前提下,将连续解舍入为离散解。我们证明,当原始模型的梯度空间近似低秩时(我们通过实验验证了这一点),从数据分布中采样得到$m=\text{poly}(1/\u03b5)$个样本后,我们可以对除$O(m)$个之外的所有权重进行舍入,使得量化模型在真实数据分布上的期望近似误差$\u2264\u03b5$。\n我们的证明具有算法性,由此启发了一种简单实用的舍入算法——DiscQuant。在实验中,我们在Phi3mini-3.8B和Llama3.1-8B模型的多个基准测试上验证了,DiscQuant相较于此前最先进的舍入方法GPTQ和基线方法RTN有显著提升。例如,使用DiscQuant将Phi3mini-3.8B舍入到每个参数3.25比特的固定量化网格时,在GSM8k数据集上的准确率为64%,而GPTQ达到54%,RTN达到31%(原始模型准确率为84%)。我们的代码已发布在https://github.com/jerry-chee/DiscQuant。

英文摘要:

Quantizing the weights of a neural network has two steps: (1) Finding a good low bit-complexity representation for weights (which we call the quantization grid) and (2) Rounding the original weights to values in the quantization grid. In this paper, we study the problem of rounding optimally given any quantization grid. The simplest and most commonly used way to round is Round-to-Nearest (RTN). By rounding in a data-dependent way instead, one can improve the quality of the quantized model significantly. We study the rounding problem from the lens of \emph{discrepancy theory}, which studies how well we can round a continuous solution to a discrete solution without affecting solution quality too much. We prove that given $m=\mathrm{poly}(1/ε)$ samples from the data distribution, we can round all but $O(m)$ model weights such that the expected approximation error of the quantized model on the true data distribution is $\le ε$ as long as the space of gradients of the original model is approximately low rank (which we empirically validate). Our proof, which is algorithmic, inspired a simple and practical rounding algorithm called \emph{DiscQuant}. In our experiments, we demonstrate that DiscQuant significantly improves over the prior state-of-the-art rounding method called GPTQ and the baseline RTN over a range of benchmarks on Phi3mini-3.8B and Llama3.1-8B. For example, rounding Phi3mini-3.8B to a fixed quantization grid with 3.25 bits per parameter using DiscQuant gets 64\% accuracy on the GSM8k dataset, whereas GPTQ achieves 54\% and RTN achieves 31\% (the original model achieves 84\%). We make our code available at https://github.com/jerry-chee/DiscQuant.

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

↑