AWQ: Activation-aware Weight Quantization for On-Device LLM Compression and Acceleration

Ji Lin, Jiaming Tang, Haotian Tang, Shang Yang, Wei-Ming Chen, Wei-Chen Wang, Guangxuan Xiao, Xingyu Dang, Chuang Gan, Song Han

TL;DR

This paper introduces AWQ, a novel weight quantization technique that significantly compresses large language models (LLMs) for efficient on-device deployment. By intelligently protecting a small fraction of "salient" weights based on activation patterns, AWQ achieves remarkable accuracy with minimal performance degradation, enabling LLMs to run on resource-constrained devices with substantial speedups.

What Problem Does This Paper Address?

Large Language Models (LLMs) have revolutionized AI, but their massive size poses a significant hurdle for deployment on edge devices. Running LLMs locally is crucial for reducing cloud costs, enhancing privacy, and enabling real-time applications. However, the sheer number of parameters in models like GPT-3 (175B parameters, 350GB in FP16) makes them impractical for devices with limited memory and computational power. Existing quantization methods either suffer from significant accuracy loss (post-training quantization) or are computationally expensive to train (quantization-aware training), creating a need for efficient, hardware-friendly compression techniques.

Methods

The core innovation of AWQ lies in its "Activation-aware Weight Quantization" approach. The authors observe that not all weights in an LLM contribute equally to its performance. They identify a small percentage (0.1%-1%) of "salient" weights that are critical. Instead of quantizing all weights uniformly, AWQ focuses on protecting these salient weights.

Key aspects of the AWQ method include:

  • Activation-Aware Salient Weight Identification: AWQ determines salient weights not by their magnitude, but by analyzing the distribution of activations. Channels with larger activation magnitudes are considered more important, as they process more significant features.
  • Per-Channel Scaling: To avoid hardware-inefficient mixed-precision formats (where some weights are FP16 and others are quantized), AWQ mathematically derives that scaling up the salient weight channels can effectively reduce quantization error. This is achieved through a per-channel scaling factor.
  • Hardware-Friendly Approach: AWQ is designed to be hardware-friendly. It avoids complex reconstruction or backpropagation steps, making it efficient and generalizable across different domains and modalities without overfitting to calibration data.
  • TinyChat Inference Framework: To translate the theoretical memory savings into practical speedups, the authors developed TinyChat. This framework optimizes LLM inference on edge devices by employing kernel fusion and platform-aware weight packing, specifically tailored for 4-bit quantized models.

Datasets

The paper mentions using the following datasets:

  • The Pile: Used as a calibration set for AWQ.
  • WikiText-2: Used for perplexity evaluation of quantized models.
  • COCO Captioning: Used for evaluating visual language models.
  • MBPP (Mostly Basic Python Problems): Used for evaluating performance on programming tasks.
  • GSM8K: Used for evaluating performance on math word problems.

The authors also refer to existing benchmarks for language modeling, instruction-tuned models, and visual-language models.

Key Insights and Ideas

  • Salient Weights are Key: The most impactful insight is that a tiny fraction of weights (as low as 0.1%) are disproportionately important for LLM performance. Protecting these specific weights is far more effective than uniform quantization.
  • Activations, Not Weights, Reveal Salience: Counter-intuitively, the authors found that analyzing activation magnitudes, rather than weight magnitudes, is the better way to identify which weights are most critical. This highlights the dynamic nature of LLM computations.
  • Scaling is More Hardware-Friendly Than Mixed Precision: The derivation that per-channel scaling can mitigate quantization error without resorting to mixed-precision formats is crucial for practical hardware implementation.
  • Generalization Without Overfitting: AWQ's ability to achieve good performance without backpropagation or complex reconstruction means it generalizes well to unseen data and different domains, a significant advantage over methods that might overfit to calibration sets.

Key Results

  • Improved Perplexity: AWQ consistently outperforms baseline methods like RTN (Round-to-Nearest) and GPTQ across various LLM sizes and bit-precisions, achieving better perplexity scores. For instance, on Llama-2 models, AWQ shows better perplexity than GPTQ.
  • Significant Speedups: The TinyChat framework, combined with AWQ's 4-bit quantization, delivers substantial speedups. On desktop GPUs (RTX 4090), TinyChat offers over 3x speedup compared to FP16 implementations. On mobile GPUs (Jetson Orin), similar speedups are observed.
  • Democratized Deployment: AWQ and TinyChat enable the deployment of large models like Llama-2-70B on resource-constrained devices, such as a single Jetson Orin with 8GB of memory, and even allow interactive speeds for models on laptops with limited VRAM.
  • Lossless Performance on VLMs: AWQ achieves lossless quantization performance on visual-language models (VLMs) across multiple benchmarks, demonstrating its broad applicability.
  • Robustness to Calibration Data: AWQ is less sensitive to the calibration set distribution compared to GPTQ, showing more stable performance even with different calibration data.

Limitations and Future Work

  • Hardware Efficiency of Mixed Precision: While AWQ avoids mixed-precision formats for protection, the paper notes that mixed-precision implementations can be hardware-inefficient. AWQ's scaling approach aims to circumvent this.
  • Calibration Set Size: Although AWQ requires a smaller calibration set than GPTQ, it still relies on one. The paper demonstrates AWQ's efficiency with a small calibration set (e.g., 16 sequences vs. 192 for GPTQ).
  • Future Work: The paper suggests that AWQ is orthogonal to GPTQ and can be combined to further improve performance, especially for extreme low-bit quantization (e.g., INT2). The authors also highlight the potential for further optimization of TinyChat for various hardware platforms.

Summary updated

BibTeX
@inproceedings{lin2024awq,
  author = {Ji Lin and Jiaming Tang and Haotian Tang and Shang Yang and Wei-Ming Chen and Wei-Chen Wang and Guangxuan Xiao and Xingyu Dang and Chuang Gan and Song Han},
  title = {{AWQ: Activation-aware Weight Quantization for On-Device LLM Compression and Acceleration}},
  booktitle = {MLSys},
  year = {2024},
}
Figure