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

SmoothQuant:面向大语言模型的精确且高效训练后量化方法

SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models

Massachusetts Institute of Technology(麻省理工学院);NVIDIA(英伟达公司)

Guangxuan Xiao, Ji Lin, Mickael Seznec, Hao Wu, Julien Demouth, Song Han

AI总结:

SmoothQuant 提出一种无需训练的训练后量化方法,通过数学等价变换将激活离群值难度迁移到权重,实现大语言模型 W8A8 INT8 量化,在保持精度的同时获得最高 1.56 倍加速和 2 倍内存降低。

摘要:

大语言模型(LLMs)表现出卓越的性能,但计算和内存开销巨大。量化可以降低内存占用并加速推理。然而,现有方法无法同时保持精度和硬件效率。我们提出 SmoothQuant,一种无需训练、保持精度且通用的训练后量化(PTQ)解决方案,以实现大语言模型的 8 位权重、8 位激活(W8A8)量化。基于权重易于量化而激活不易量化这一事实,SmoothQuant 通过离线方式将量化难度从激活迁移到权重,采用数学上等价的变换来平滑激活中的离群值。SmoothQuant 能够对大语言模型中所有矩阵乘法实现权重和激活的 INT8 量化,涵盖 OPT、BLOOM、GLM、MT-NLG、Llama-1/2、Falcon、Mistral 和 Mixtral 等模型。我们展示了大语言模型最高 1.56 倍的加速和 2 倍的内存降低,且精度损失可忽略不计。SmoothQuant 使得在单个节点内服务 530B 大语言模型成为可能。我们的工作提供了一套交钥匙解决方案,可降低硬件成本并使大语言模型更加普及。代码可在 https://github.com/mit-han-lab/smoothquant 获取。

英文摘要:

Large language models (LLMs) show excellent performance but are compute- and memory-intensive. Quantization can reduce memory and accelerate inference. However, existing methods cannot maintain accuracy and hardware efficiency at the same time. We propose SmoothQuant, a training-free, accuracy-preserving, and general-purpose post-training quantization (PTQ) solution to enable 8-bit weight, 8-bit activation (W8A8) quantization for LLMs. Based on the fact that weights are easy to quantize while activations are not, SmoothQuant smooths the activation outliers by offline migrating the quantization difficulty from activations to weights with a mathematically equivalent transformation. SmoothQuant enables an INT8 quantization of both weights and activations for all the matrix multiplications in LLMs, including OPT, BLOOM, GLM, MT-NLG, Llama-1/2, Falcon, Mistral, and Mixtral models. We demonstrate up to 1.56x speedup and 2x memory reduction for LLMs with negligible loss in accuracy. SmoothQuant enables serving 530B LLM within a single node. Our work offers a turn-key solution that reduces hardware costs and democratizes LLMs. Code is available at https://github.com/mit-han-lab/smoothquant.

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

↑