[Paper Review] OmniQuant: Omnidirectionally Calibrated Quantization for Large Language Models
OmniQuant introduces Learnable Weight Clipping and Learnable Equivalent Transformation to enable high-quality weight-only and weight-activation quantization of large language models with PTQ efficiency.
Large language models (LLMs) have revolutionized natural language processing tasks. However, their practical deployment is hindered by their immense memory and computation requirements. Although recent post-training quantization (PTQ) methods are effective in reducing memory footprint and improving the computational efficiency of LLM, they hand-craft quantization parameters, leading to low performance, especially in extremely low-bit quantization. To tackle this issue, we introduce an Omnidirectionally calibrated Quantization ( extbf{OmniQuant}) technique for LLMs, which achieves good performance in diverse quantization settings while maintaining the computational efficiency of PTQ by efficiently optimizing various quantization parameters. OmniQuant comprises two innovative components including Learnable Weight Clipping (LWC) and Learnable Equivalent Transformation (LET). LWC modulates the extreme values of weights by optimizing the clipping threshold. Meanwhile, LET tackles activation outliers by shifting the challenge of quantization from activations to weights. Operating within a differentiable framework using block-wise error minimization, OmniQuant can optimize the quantization process efficiently for both weight-only and weight-activation quantization. For instance, the LLaMA-2 model family size 7-70B can be processed with OmniQuant on a single A100-40G GPU within 1-16 hours using 128 samples. Extensive experiments validate OmniQuant's superior performance across diverse quantization configurations such as W4A4 (4-bit weight, 4-bit activation), W6A6, W4A16, W3A16, and W2A16. Additionally, OmniQuant demonstrates effectiveness in instruction-tuned models and delivers notable improvements in inference speed and memory reduction on real devices. Codes are available at \url{https://github.com/OpenGVLab/OmniQuant}.
Motivation & Objective
- Motivate reducing memory and compute needs of large language models (LLMs) without sacrificing accuracy.
- Develop a differentiable, post-training quantization framework that achieves QAT-like performance.
- Enable reliable low-bit quantization (e.g., W2A16, W4A4) across diverse LLM families.
- Maintain PTQ-style data efficiency and single-GPU practicality for large models.
Proposed method
- Formulate a block-wise quantization error minimization objective that freezes full-precision weights while learning a small set of quantization parameters.
- Introduce Learnable Weight Clipping (LWC) to optimize weight clipping thresholds for better weight quantization.
- Introduce Learnable Equivalent Transformation (LET) to shift quantization difficulty from activations to weights via channel-wise scaling/shifting in linear and attention layers.
- Apply differentiable optimization to jointly optimize LWC and LET within a block-wise framework, enabling weight-only and weight-activation quantization.
- Quantize using a MinMax quantizer for activations and weights, with parameters fused into the original weights after optimization.
- Validate on multiple models (LLaMA, OPT, Falcon, LLaMA-2, LLaMA-2-chat) and quantization settings (W4A4, W3A16, W2A16, W6A6, etc.).
Experimental results
Research questions
- RQ1Can gradient-based optimization be incorporated into PTQ to achieve QAT-like performance for LLM quantization?
- RQ2How can weight distributions and activation outliers in transformers be mitigated to enable extremely low-bit quantization?
- RQ3Do learnable components (LWC and LET) generalize across model families and instruction-tuned variants?
- RQ4What are the practical data and time requirements to quantize large models on single-GPU hardware?
- RQ5How do OmniQuant’s weight-only and weight-activation quantizations compare to prior PTQ/QAT methods in zero-shot tasks and language generation perplexity?
Key findings
- OmniQuant outperforms prior PTQ-based methods across diverse configurations (W4A4, W3A16, W2A16, W6A6, etc.) and model families.
- For W2A16 quantization, OmniQuant achieves substantially better perplexities than GPTQ and other baselines on LLaMA-1/2 models.
- In weight-activation settings, OmniQuant delivers notable gains in zero-shot task accuracy (e.g., average improvements of roughly 5–12 points on several LLaMA variants) and can surpass some QAT approaches in smaller models.
- OmniQuant enables quantization of LLaMA-2-chat and other instruction-tuned models with competitive performance under GPT-4 evaluation protocol.
- quantization on LLaMA-2 family and other models can be performed on a single A100-40G GPU with as few as 128 samples and 1–16 hours of compute per model size.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.