Pidoku

AWQ (2023)

Module 30 Lesson 30.m 35 min Difficulty 3/5

Prerequisites 30.i, 30.k, 13.c


Before you start: words you need#

WordPlain meaning
AWQActivation-aware Weight Quantization: a 4-bit (or 3-bit) weight-only method that decides which weights matter by looking at the activations that hit them.
Salient weightsThe small fraction of weights whose rounding error hurts the model most.
Input channelOne row of a weight matrix as seen by the input: all the weights multiplied by the same activation dimension.
Group quantization (g128)One scale per 128 consecutive weights (13.c).
W4A164-bit weights, 16-bit activations. Weights are expanded to FP16 inside the kernel.
Calibration overfittingWhen a quantization method tunes itself so closely to its calibration text that it does worse on other kinds of text.
Grid searchTrying a fixed list of values for a parameter (here 20 values of α between 0 and 1) and keeping the best.

1. The paper#

  • Title: “AWQ: Activation-aware Weight Quantization for On-Device LLM Compression and Acceleration”
  • Authors: Ji Lin, Jiaming Tang, Haotian Tang, Shang Yang, Wei-Ming Chen, Wei-Chen Wang, Guangxuan Xiao, Xingyu Dang, Chuang Gan, Song Han (MIT and others)
  • Venue: MLSys 2024, Best Paper Award (arXiv June 2023).
  • Link: arXiv:2306.00978 · code: mit-han-lab/llm-awq

2. The problem#

GPTQ (30.i) gets 4-bit weights accurate by reconstructing each layer’s output on calibration data. That works, but it adjusts weights to fit the calibration set closely, and the authors found it can overfit: quantize with one kind of text and quality drops on another domain or modality.

Keeping the most important weights in FP16 fixes accuracy, but a mixed FP16/INT4 matrix is awkward and slow on hardware. The authors wanted something as accurate as mixed precision, as simple as rounding, and fast on desktops, laptops and edge devices.


3. The idea#

Two observations, then a trick borrowed in spirit from SmoothQuant (30.k):

  1. Only about 1% of weights are salient — and you find them by activation magnitude, not weight magnitude. Weight channels that multiply large activations matter most. On OPT-6.7B at INT3-g128, keeping just 1% of channels in FP16, chosen by activation size, cut perplexity from 23.54 to 11.39; choosing by weight size barely helped (Table 1).
  2. Scaling a channel up before quantizing protects it. Multiply a salient input channel of W by s > 1 and divide the matching activation by s. The product is unchanged, but the channel’s relative rounding error shrinks by about 1/s, because the group’s scale barely moves.

So instead of keeping salient weights in FP16, scale them up, then quantize everything uniformly to INT4. All weights stay in one format.

flowchart LR
  C["Small calibration set"] --> A["Mean |activation| per input channel: s_X"]
  A --> G["Grid search α in [0, 1]: s = s_X^α"]
  G --> S["Scale W channels by s, fold 1/s into previous op"]
  S --> Q["Uniform INT4 group quantization"]
  Q --> K["W4A16 kernel at inference"]
  class C io
  class A,G neutral
  class S memory
  class Q,K compute

4. How it works#

The scale per input channel is s = s_X^α, where s_X is the average activation magnitude of that channel. One number, α, sets how hard to protect salient channels: 0 is no scaling, 1 is the most aggressive. AWQ picks α per layer by a quick grid search that minimises the layer’s output error on calibration data. It also searches a small clipping range for the weights.

Why this does not overfit like GPTQ: AWQ only measures a per-channel average and picks one α. It does not solve for new weight values to fit the calibration outputs, so it needs fewer samples and depends less on their domain.

Why the scale cannot be too large: scaling one channel up can enlarge its group’s maximum, which coarsens the step for the other weights in that group. The paper shows s = 2 was best on OPT-6.7B when scaling the 1% salient channels by hand; bigger s hurt the rest (Table 2). That is what the search over α balances.

The paper also built TinyChat, a runtime for 4-bit models on edge GPUs and CPUs, with fused dequantize-and-multiply kernels and weight packing tuned for each platform (for example reordering 4-bit values so ARM NEON can unpack them with a mask and a shift).


5. Results#

Perplexity, WikiText-2, INT4 with group size 128 (Table 4; lower is better):

ModelFP16RTNGPTQGPTQ with reorderAWQ
Llama-2-7B5.475.735.695.635.60
Llama-2-70B3.323.463.423.433.41
LLaMA-7B5.685.966.225.835.78

At INT3-g128 the gaps were larger: Llama-2-7B went 6.66 (RTN), 6.43 (GPTQ), 6.24 (AWQ).

Generalisation. AWQ worked on instruction-tuned models, on code models, on Mixtral MoE, and on vision-language models (OpenFlamingo, VILA), where GPTQ’s reconstruction was more fragile.

Speed (TinyChat). About 3.2–3.3× average speed-up over Hugging Face FP16 across devices, up to 3.9× on an RTX 4090 and 3.5× on Jetson Orin. Llama-2-70B ran on a single 64 GB Jetson Orin.

The speed-ups are for batch-1 on-device decode, the memory-bound case. They are not server throughput numbers.


6. What held up and what did not#

Held up

  • Activation-aware importance. Using activation statistics to decide what matters in the weights is now standard. It is in AWQ itself, in GPTQ variants, and in the scale searches of many FP4/INT4 recipes.
  • Equivalent scaling, then uniform quantization. Keeps one format and simple kernels.
  • AWQ checkpoints are everywhere. It became one of the two default 4-bit formats (with GPTQ) on the Hugging Face Hub, and vLLM, SGLang, TensorRT-LLM and llama.cpp-adjacent tools all run it.

Did not, or changed

  • AWQ and GPTQ are now combined, not rivals. Tools apply AWQ-style scaling and then GPTQ-style rounding, and the accuracy gap between them on modern models is small.
  • The original serving kernels were slow at batch. Like GPTQ’s, they were built for batch 1. In servers, AWQ checkpoints are run with Marlin-family kernels (awq_marlin in vLLM; 25.g).
  • AutoAWQ, the most-used community library, is archived; AWQ is maintained in llm-compressor (vLLM project) and NVIDIA ModelOpt.
  • On Hopper and Blackwell data-centre GPUs, FP8 and NVFP4 (13.e, 13.g) often replace INT4 W4A16 when throughput matters; W4A16 stays strong for memory-limited and single-user serving.

7. Where it lives in 2026#

  • Taught in depth: GPTQ and AWQ in 13.c, INT4 inference in 13.f, edge quantization in 29.f, mixed-input kernels in 25.g, quantization in vLLM in 18.j.
  • vLLM detects AWQ checkpoints and uses awq_marlin kernels on supported NVIDIA GPUs.
  • The MIT llm-awq repository and TinyChat are maintained; TinyChat targets edge devices.

Checked on 13 November 2026.


8. Questions#

  1. How does AWQ decide which weights are salient, and why activations rather than weights?
  2. Show that scaling a weight channel by s and the activation by 1/s leaves the output unchanged.
  3. Why does scaling a channel up reduce its relative quantization error?
  4. Why can s be too large? What does the α search balance?
  5. Why is AWQ less prone to calibration overfitting than GPTQ?
  6. AWQ reports 3.2–3.3× speed-ups. Under what conditions, and why would a server see less?
  7. On an H100 serving 200 concurrent users, would you choose AWQ INT4 or FP8? Why?

9. Further reading#

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in