arXiv:2502.06786cs.LGcs.AI2025-02ICML被引 11

一种可动态切换精度的量化方法,支持从int2到int8的多级部署。

Matryoshka Quantization

  • 利用整数嵌套结构,训练单模型实现多精度推理。
  • int2模型性能比传统方法提升4%~7%,2.05位有效精度再增6%。
  • 适合需要灵活部署、低延迟场景的模型服务系统。

模型权重量化对降低大模型通信与推理成本至关重要。然而,尤其是对int4或int2等低位宽进行量化时,通常需在模型质量上做出妥协;其中int2尤其会导致模型质量显著下降。因此,实践者常需维护多个不同量化级别的模型,或仅部署一个在质量与延迟间折中的单一模型。另一方面,如int8等整数类型天然具有嵌套(马特罗什卡)结构,较小位宽的整数(如int4、int2)可嵌入其高位中。基于此,本文提出马特罗什卡量化(Matryoshka Quantization, MatQuant),一种新型多尺度量化技术。该技术允许训练并维护单一量化模型,但可根据部署需求以不同精度服务。此外,通过MatQuant的联合训练与联合蒸馏正则化,由MatQuant提取的int2模型相比标准int2量化,在OmniQuant和QAT基线算法下分别提升4%和7%。最后,通过额外使用1比特表示异常值,有效精度达2.05位的模型在OmniQuant基线下进一步提升6%。

原文摘要 · Abstract (English)

Quantizing model weights is critical for reducing the communication and inference costs of large models. However, quantizing models -- especially to low precisions like int4 or int2 -- requires a trade-off in model quality; int2, in particular, is known to severely degrade model quality. Consequently, practitioners are often forced to maintain multiple models with different quantization levels or serve a single model that best satisfies the quality-latency trade-off. On the other hand, integer data types, such as int8, inherently possess a nested (Matryoshka) structure where smaller bit-width integers, like int4 or int2, are nested within the most significant bits. Leveraging this insight, in this paper, we propose Matryoshka Quantization (MatQuant), a novel multi-scale quantization technique that alleviates the aforementioned challenge. This technique allows us to train and maintain a single quantized model but serve it with the precision demanded by the deployment. Furthermore, leveraging MatQuant's co-training and co-distillation regularization, int2 precision models extracted by MatQuant outperform standard int2 quantization by up to to 4% and 7% with OmniQuant and QAT as base algorithms respectively. Finally, we demonstrate that by using an extra bit to represent outliers, a model with an effective precision of 2.05-bit gives an additional 6% improvement with OmniQuant as the base algorithm.

量化多精度模型压缩嵌套结构

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。