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

混合量化的缩放定律

Scaling Laws For Mixed Quantization

Department of Computer Science and Technology, University of Cambridge(计算机科学与技术系,剑桥大学);Department of Electrical & Electronic Engineering, Imperial College London(电气与电子工程系,伦敦帝国学院);Department of Computer Science, University of Hong Kong(计算机科学系,香港大学);School of Informatics, University of Edinburgh(信息学院,爱丁堡大学)

Zeyu Cao, Boyang Gu, Cheng Zhang, Pedro Gimenes, Jianqiao Lu, Jianyi Cheng, Xitong Gao, Yiren Zhao

AI总结:

本研究提出混合量化的统一缩放定律,通过量化比率和块大小预测损失退化,发现大模型可承受更高量化比率,且小块大小并非必需。

摘要:

大型语言模型(LLMs)的训练后量化已被证明能有效降低推理时的内存和计算需求。在本研究中,我们聚焦于一个直接的问题:当以低精度量化为目标追求特定精度或困惑度时,需要保留多少高精度计算,以及随着我们将LLMs扩展到更大规模,这种量化需要多细粒度?我们首先引入两个关键指标,命名为量化比率($Q_r$)和量化块大小($Q_b$)。前者衡量被量化为低精度算术的参数数量除以总参数数量的比值,而后者定义了一个块内共享缩放因子的值的数量,类似于NVIDIA Blackwell架构中FP4格式引入的块大小概念。通过在不同模型和量化方法上进行广泛且精心控制的实验,我们提出了一个关于训练后量化(PTQ)的统一缩放定律,该定律可以预测不同$Q_r$和$Q_b$下的损失退化。对于$Q_r$,我们的缩放定律表明参数缩放和比率缩放具有乘法关系。因此,更大的模型更适合更高的量化比率$Q_r$,从而支持在推理中增加混合量化的采用。关于$Q_b$,我们的发现表明,类似于Blackwell中使用的小块大小对于大模型并非必需。采用小的$Q_b$反而可能不必要地复杂化硬件电路的设计。

英文摘要:

Post-training quantization of Large Language Models (LLMs) has proven effective in reducing the memory and computational requirements for inference. In this study, we focus on a straightforward question: When aiming for a target accuracy or perplexity with low-precision quantization, how much high-precision computation needs to be preserved, and how fine-grained this quantization would need to be as we scale LLMs to larger sizes? We first introduce two critical metrics, named the quantization ratio ($Q_r$) and quantization block size ($Q_b$). The former measures the number of parameters quantized to low-precision arithmetic normalized by the total parameter count, whereas the latter defines the number of values within a block that share a scaling factor, akin to the block size concept introduced in the FP4 format in NVIDIA's Blackwell architecture. Through extensive and carefully controlled experiments across different models and quantization methods, we propose a unified scaling law on post-training quantization (PTQ) that can predict loss degeneration for varying $Q_r$ and $Q_b$. For $Q_r$, our scaling law implies that parameter scaling and ratio scaling have a multiplicative relationship. Consequently, larger models are more amenable to a higher quantization ratio $Q_r$, thus supporting an increase in the adoption of mixed quantization for inference. Regarding $Q_b$, our findings indicate that a small block size, similar to that used in Blackwell, is not essential for large models. Employing a small $Q_b$ can instead unnecessarily complicate the design of the hardware circuit.

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

↑