Skip to content

Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN018 · Training method

Activation-aware weight quantization (AWQ)

Uses activation statistics to choose channel scaling that protects important weight channels during low-bit quantization.

Explained here Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Uses activation statistics to choose channel scaling that protects important weight channels during low-bit quantization.

Question / hypotheses

Does this intervention improve the intended quality, adaptation, resource, or reliability objective under a controlled comparison? It defines a method, not an intrinsic null-hypothesis test.

Architecture / computational structure

Equivalent rescaling of inputs and weights precedes weight quantization; specialized kernels exploit the resulting format.

Assumptions

Calibration data should span realistic activations. Equivalent scaling is exact before quantization but finite precision introduces error afterward.

Formula / computational definition

WX=(WD)(D−1X),Y^=Q(WD)D−1X.WX=(WD)(D^{-1}X),\qquad\hat Y=Q(WD)D^{-1}X.

Parameters and notation

Model weights originate from pretraining; calibration selects diagonal scaling D. Hyperparameters: bit width, group size, calibration samples, scaling search, quantization scheme.

Fitting, fine-tuning, and adaptation

Calibrate without using held-out benchmark labels, export with the supported backend, and evaluate after quantization. Do not assume an AWQ checkpoint can be trained by any generic optimizer.

How to use and calibrate

Measure real device memory/latency and task retention. Example: serve a quantized decoder model on a smaller accelerator.

Example application

serve a quantized decoder model on a smaller accelerator.

Interpretation / pitfalls

Watch out

Weight-only quantization does not necessarily reduce activation or KV-cache memory. Activation salience can change under domain shift.

Python and R code examples

Scope: numerical mechanism demonstration. Validation: Python executed successfully on the supplied synthetic inputs; R reviewed but not executed (Rscript unavailable).

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — numerical mechanism demonstration. · needs numpy

import numpy as np
W=np.array([[1.,2.],[3.,4.]]); X=np.array([[.2,.4],[3.,2.]]); d=np.array([2.,.5])
print(np.allclose(W@X,(W*d)@(X/d[:,None])))
R

Component demo, not a trained model — numerical mechanism demonstration.

W <- rbind(c(1,2),c(3,4)); X <- rbind(c(.2,.4),c(3,2)); d <- c(2,.5)
print(isTRUE(all.equal(W%*%X,sweep(W,2,d,"*")%*%sweep(X,1,d,"/"))))

Sources

From the CodeSplash reference, entry TRN018.