AWQ: Activation-aware Weight Quantization for 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

AWQ (Activation-aware Weight Quantization) is a hardware-friendly method for compressing Large Language Models (LLMs) down to 4-bit precision without losing their "generalist" abilities. By identifying and protecting just 1% of the most important weights—determined by activation patterns rather than weight magnitude—AWQ enables 3x+ speedups and allows massive models like Llama-2-70B to run on consumer-grade and edge hardware.

What Problem Does This Paper Address?

Deploying LLMs on edge devices (laptops, phones, or embedded systems like NVIDIA Jetson) is a massive challenge. These models are astronomically large; for instance, GPT-3 requires 350GB of memory in standard FP16 precision, far exceeding the capacity of most consumer GPUs.

Quantization—reducing the precision of weights from 16-bit to 4-bit—is the standard solution, but it usually comes with a catch. Existing methods either require expensive re-training (Quantization-Aware Training) or suffer from "overfitting" to specific datasets during post-training quantization (PTQ). Furthermore, many high-accuracy methods use "mixed-precision," which keeps some weights in high precision. While accurate, mixed-precision is a nightmare for hardware engineers to implement efficiently, often leading to no actual speedup.

Methods

The authors of AWQ started with a simple but profound observation: not all weights are created equal. Protecting just 1% of the most "salient" weights from quantization error can bridge almost the entire performance gap between a compressed model and the original.

The core innovations of AWQ are:

  1. Activation-Awareness: Traditionally, researchers looked at weight magnitudes to find important parameters. AWQ argues that we should look at the activations instead. Channels that process features with larger magnitudes are more salient, even if the weights themselves are small.
  2. Salience Protection via Scaling: To avoid the hardware inefficiency of mixed-precision, AWQ uses a clever mathematical trick. Instead of keeping salient weights in FP16, it scales them up before quantization. This reduces their relative quantization error. Because this scaling is applied to the weights and inversely to the activations, the mathematical output of the layer remains unchanged (an "equivalent transformation").
  3. TinyChat Inference Engine: To turn these theoretical gains into real-world speed, the authors developed TinyChat. It uses kernel fusion (combining multiple operations into one) and SIMD-aware weight packing to ensure that 4-bit weights actually result in faster execution on CPUs and GPUs.
AWQ identifies salient weights via activations and uses scaling to protect them, avoiding hardware-inefficient mixed precision.

Datasets

The researchers evaluated AWQ across a diverse array of benchmarks to ensure it didn't just "memorize" the calibration data:

  • Language Modeling: WikiText-2 (perplexity).
  • Calibration: A small, non-overlapping subset of the Pile dataset.
  • Domain-Specific: MBPP for Python coding and GSM8K for grade-school math.
  • Multi-modal: COCO captioning and VILA benchmarks for Visual Language Models (VLMs).
  • Instruction-Tuning: Vicuna benchmarks evaluated by GPT-4.

Key Insights and Ideas

  • Weights follow the data: The "aha moment" is that weight importance is a function of the input distribution. By looking at activation statistics offline, AWQ identifies which weight channels are critical for preserving the model's reasoning capabilities.
  • Scaling is hardware's best friend: By transforming the protection problem into a scaling problem, the authors made the method "hardware-friendly." The model remains in a uniform 4-bit format, which standard hardware can accelerate easily.
  • Generalization is King: Unlike previous state-of-the-art methods like GPTQ, which can overfit to the calibration set, AWQ's simple scaling approach preserves the model's ability to handle new domains, coding, and even images.
AWQ maintains better generalization on instruction-tuned models compared to other quantization methods.

Key Results

AWQ delivers impressive quantitative and qualitative improvements:

  • Speed: TinyChat achieves a 3.2–3.3× average speedup over standard FP16 implementations on desktop and mobile GPUs.
  • Efficiency: It enables the 70B Llama-2 model to run on a single NVIDIA Jetson Orin (64GB) and allows 13B models to run at an interactive 30 tokens/second on a laptop with only 8GB of VRAM.
  • Versatility: For the first time, the paper demonstrates successful 4-bit quantization for multi-modal models (VLMs), showing nearly lossless performance on visual reasoning tasks.
AWQ provides significant speedups across various GPU platforms, including mobile and desktop.

Limitations and Future Work

While AWQ is a major step forward, the authors and the current state of the field note some limitations:

  • Weight-Only Quantization: AWQ focuses on W4A16 (4-bit weights, 16-bit activations). While this is ideal for the memory-bound "generation" phase of LLMs, high-throughput serving might eventually require quantizing activations as well (W8A8 or W4A4).
  • Search Space: The current method uses a simple grid search for the scaling factor $\alpha$. More complex optimization strategies could potentially squeeze out even more accuracy.
  • Extreme Compression: At 2-bit quantization, even AWQ begins to struggle, though it remains orthogonal to and can be combined with other methods like GPTQ to improve results in those extreme cases.

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 LLM Compression and Acceleration}},
  booktitle = {MLSys},
  year = {2024},
}
Figure