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

Guangxuan Xiao, Ji Lin, Mickael Seznec, Hao Wu, Julien Demouth +1 more
11/18/2022
2,170 citations
cs.CLcs.AIcs.LG
quantization-pruning

Official code: mit-han-lab/smoothquant (1,709 stars, Python, MIT, last commit 2024-07-12).

Abstract

Large language models (LLMs) show excellent performance but are compute- and memory-intensive. Quantization can reduce memory and accelerate inference.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

MIT

[ICML 2023] SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models

1,709207PythonNov 17, 20222 years agoMIT

Similar Papers

Cite this paper

@article{xiao2022smoothquant,
  title  = {SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models},
  author = {Guangxuan Xiao and Ji Lin and Mickael Seznec and Hao Wu and Julien Demouth and Song Han},
  year   = {2022},
  eprint = {2211.10438},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2211.10438},
  journal = {ICML 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2211.10438.svg)](https://codeofpaper.com/paper/2211.10438)

Discussion