SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models
arXiv:2211.10438
Abstract
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.
ICML 2023. First two authors contributed equally to this work
Cited by in corpus (11)
- Tiny Machine Learning: Progress and Futures
- LLM-FP4: 4-Bit Floating-Point Quantized Transformers
- T-MAC: CPU Renaissance via Table Lookup for Low-Bit LLM Deployment on Edge
- An empirical study of LLaMA3 quantization: from LLMs to MLLMs
- Fly-Swat or Cannon? Cost-Effective Language Model Choice via Meta-Modeling
- Teola: Towards End-to-End Optimization of LLM-based Applications
- Revisiting Block-based Quantisation: What is Important for Sub-8-bit LLM Inference?
- Shaping the Future of Endangered and Low-Resource Languages -- Our Role in the Age of LLMs: A Keynote at ECIR 2024
- Search-Optimized Quantization in Biomedical Ontology Alignment
- Neuralink: Fast LLM Inference on Smartphones with Neuron Co-Activation Linking
- ModuLoRA: Finetuning 2-Bit LLMs on Consumer GPUs by Integrating with Modular Quantizers