Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN019 · Training method
SmoothQuant
Migrates activation outlier scale into weights through equivalent transformations, enabling lower-precision weight-and-activation computation.
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
Migrates activation outlier scale into weights through equivalent transformations, enabling lower-precision weight-and-activation computation.
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
Per-channel calibration scales transform the linear operator before quantization.
Assumptions
The activation range seen during calibration must reasonably reflect deployment. Backend integer kernels, accumulator precision, and unsupported operators determine realized speed.
Formula / computational definition
Parameters and notation
Calibration estimates channel maxima and scales. Hyperparameters: smoothing alpha, clipping, bit widths, calibration corpus, channel axes. Model weights remain otherwise fixed in PTQ.
Fitting, fine-tuning, and adaptation
Apply transformations consistently across adjacent operators, calibrate quantizers, and rerun end-to-end evaluations. Recalibrate after substantial domain adaptation or checkpoint changes.
How to use and calibrate
Inspect outlier channels and saturation counts. Example: enable W8A8 matrix multiplication for a transformer with activation outliers.
Example application
enable W8A8 matrix multiplication for a transformer with activation outliers.
Interpretation / pitfalls
Watch out
Axis conventions depend on matrix layout. The equivalence is pre-quantization; the chosen alpha trades weight error against activation error.
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.
Component demo, not a trained model — numerical mechanism demonstration. · needs numpy
import numpy as np
X=np.array([[1.,20.],[2.,10.]]); W=np.array([[.3,.4],[.1,.2]]); d=np.array([1.,5.])
print(np.allclose(X@W,(X/d)@(W*d[:,None])))
Component demo, not a trained model — numerical mechanism demonstration.
X <- rbind(c(1,20),c(2,10)); W <- rbind(c(.3,.4),c(.1,.2)); d <- c(1,5)
print(isTRUE(all.equal(X%*%W,sweep(X,2,d,"/")%*%sweep(W,1,d,"*"))))
Sources
- Primary/official source 1arxiv.org
From the CodeSplash reference, entry TRN019.