SmoothQuant+: Accurate and Efficient 4-bit Post-Training WeightQuantization for LLM

Jiayi Pan, Chengcan Wang, Kaifu Zheng, Yangguang Li, Zhenyu Wang +1 more
12/6/2023
cs.LGcs.CL

No official code found. Best implementation: Adlik/smoothquantplus (23 stars, MIT, last commit 2024-03-15). 1 more below.

Abstract

Large language models (LLMs) have shown remarkable capabilities in various tasks. However their huge model size and the consequent demand for computational and memory resources also pose challenges to model deployment. Currently, 4-bit post-training quantization (PTQ) has achieved some success in LLMs, reducing the memory footprint by approximately 75% compared to FP16 models, albeit with some accuracy loss. In this paper, we propose SmoothQuant+, an accurate and efficient 4-bit weight-only PTQ that requires no additional training, which enables lossless in accuracy for LLMs for the first time. Based on the fact that the loss of weight quantization is amplified by the activation outliers, SmoothQuant+ smoothes the activation outliers by channel before quantization, while adjusting the corresponding weights for mathematical equivalence, and then performs group-wise 4-bit weight quantization for linear layers. We have integrated SmoothQuant+ into the vLLM framework, an advanced high-throughput inference engine specially developed for LLMs, and equipped it with an efficient W4A16 CUDA kernels, so that vLLM can seamlessly support SmoothQuant+ 4-bit weight quantization. Our results show that, with SmoothQuant+, the Code Llama-34B model can be quantized and deployed on a A100 40GB GPU, achieving lossless accuracy and a throughput increase of 1.9 to 4.0 times compared to the FP16 model deployed on two A100 40GB GPUs. Moreover, the latency per token is only 68% of the FP16 model deployed on two A100 40GB GPUs. This is the state-of-the-art 4-bit weight quantization for LLMs as we know.

View on arXivView PDF

Code Implementations(2)

MIT

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

230PythonDec 7, 20232 years agoMIT
Adlik/vllmCommunity100%
Apache-2.0

A high-throughput and memory-efficient inference and serving engine for LLMs

120C, C++Nov 9, 202311 months agoApache-2.0

Similar Papers

Cite this paper

@article{pan2023smoothquant,
  title  = {SmoothQuant+: Accurate and Efficient 4-bit Post-Training WeightQuantization for LLM},
  author = {Jiayi Pan and Chengcan Wang and Kaifu Zheng and Yangguang Li and Zhenyu Wang and Bin Feng},
  year   = {2023},
  eprint = {2312.03788},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2312.03788v1}
}

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/2312.03788.svg)](https://codeofpaper.com/paper/2312.03788)

Discussion