提出量化比例与分块大小的统一缩放规律,指导大模型混合量化设计。
Scaling Laws For Mixed Quantization
- 引入量化比例和分块大小两个核心指标,量化精度与参数规模呈乘积关系。
- 大模型可承受更高量化比例,而小分块对大模型并非必要。
- 为推理端硬件设计提供依据,适合关注模型压缩与部署优化的研究者。
后训练量化(PTQ)在降低大语言模型(LLM)推理的内存与计算开销方面已被证明有效。本文聚焦一个关键问题:在目标精度或困惑度下,采用低精度量化时需保留多少高精度计算,以及随着模型规模增大,量化粒度应如何调整?我们提出两个关键指标:量化比例($Q_r$)和量化分块大小($Q_b$)。$Q_r$ 衡量被低精度量化参数占总参数的比例;$Q_b$ 定义共享缩放因子的值块大小,类似于NVIDIA Blackwell架构中的FP4格式。通过在多种模型与量化方法上进行系统实验,我们建立了一个统一的后训练量化缩放定律,可预测不同 $Q_r$ 与 $Q_b$ 下的性能退化情况。结果表明,参数量与量化比例之间存在乘积关系,因此更大模型更适用于更高的 $Q_r$,支持更广泛的混合量化应用。对于 $Q_b$,研究发现小分块并非大模型必需,反而会增加硬件电路设计复杂度。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。