Unit 3 of 12 · about 4 hours · derive, implement

Calibration, observers, outliers and activation smoothing

Outliers decide whether activation quantization survives. Calibration picks the range, and smoothing or salient scaling decides which side absorbs the difficulty.

You'll be able to

  • Run static and dynamic calibration on one linear layer and explain when each range goes stale.
  • Derive the SmoothQuant migration and the per-channel factor from activation and weight maxima.
  • Contrast activation smoothing with salient-weight scaling on an outlier channel, with error numbers.

Covers

Calibration data and observer selectionOutliers and activation smoothing
1

Read

In this order, only the parts listed

0 of 4 done

  1. Outliers, smoothing and the O1 to O3 ladderSmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models

    SmoothQuant arXiv:2211.10438v7, Section 3 Review of Quantization Difficulty (outliers near 100x, fixed channels), Section 4 SmoothQuant with the migration equation and the and settings, and Section 5.1 setups (512 Pile sentences, grid search, O1 per-token dynamic versus O2/O3 per-tensor)

    Read the O1, O2 and O3 rows as a cost ladder, not as three methods to deploy. Stop before the distributed results.

  2. Salient weights and activation-aware scalingAWQ: Activation-Aware Weight Quantization for LLM Compression and Acceleration

    AWQ arXiv:2306.00978v6, Section 3.1 (protecting 1 percent of salient weights, perplexity 43.2 to 13.0) and Section 3.2 (activation-aware scaling search), plus Figure 8 on smaller calibration sets and calibration distribution robustness

  3. Day 14: GPTQ, AWQ and SmoothQuant cells100 Days of LLM Inference - Days 13, 14 and 15

    Notebook day14/quantization-gptq-awq-smoothquant.ipynb: AWQ Activation-Aware Weight Quantization (awq_get_scales, awq_quantize) and SmoothQuant Migration Transform (smoothquant_calibrate)

  4. MIT 6.5940 Lecture 13: SmoothQuant and AWQ in lecture formMIT 6.5940 TinyML and Efficient Deep Learning Computing - Quantization Lectures

    Lecture 13 Efficient LLM Deployment slides and video, Quantization part: Weight-Activation Quantization: SmoothQuant, then Weight-Only Quantization: AWQ and TinyChat. Lectures 5 and 6, Quantization Part I and II, cover the fundamentals if you need them

2

Focus on

  • Static calibration fixes ranges from sample data and goes stale when the workload shifts; dynamic calibration reads ranges at runtime and costs compute per step. Name which one each scale uses.
  • SmoothQuant moves difficulty from activations to weights with a per-channel factor , fused offline into neighboring layers so inference sees ordinary INT8.
  • AWQ scales every weight input channel by , with the mean activation magnitude and grid-searched, so salient channels get the largest factors; the inverse folds into the previous operator. Same form as SmoothQuant, aimed at weight error at W4A16.
  • Calibration distribution matters: matched calibration and evaluation data wins, and AWQ reaches good perplexity with a much smaller set than GPTQ-style Hessian methods.
Common mistakes · 3
  • Calibrating on the evaluation set and reporting the error there. Calibration data is fitted state; score quality on held-out prompts.
  • Treating smoothing as free accuracy. It shifts quantization difficulty into the weights, so weight error rises; the win is that INT8 weights tolerate it better than INT8 activations tolerate outliers.
  • Assuming one fits all models. The paper grid-searches per model family, 0.5 for OPT and BLOOM and 0.75 for GLM-130B, because outlier strength differs.
3

Try it yourself

Closed-book, before checking anything

On one small linear layer with a planted outlier channel, compute per-channel maxima, apply the SmoothQuant factor with , and show the activation range collapses while the product is unchanged up to floating-point tolerance.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.An activation channel peaks at 100 while most peak near 1. What breaks under per-tensor INT8 activation quantization?Answer

    The single scale stretches to the outlier, so the bulk rounds to a few codes near zero. Per-channel smoothing or per-token dynamic ranges contain the damage.

  2. 2.Why is the SmoothQuant transform mathematically equivalent before rounding?Answer

    It inserts between activation and weight. The product is unchanged; only the rounding that follows sees friendlier ranges.

  3. 3.Static activation scales calibrated on chat prompts now serve code. What symptom appears?Answer

    Clipping or coarse steps on unseen magnitude patterns, hence quality drift. Recalibrate on the serving distribution or switch that tensor to dynamic ranges.

  4. 4.How do AWQ and SmoothQuant differ in what they protect?Answer

    AWQ scales all weight input channels by factors derived from activation magnitudes, largest on the salient ones, protecting weight rounding. SmoothQuant scales down outlier activation channels, protecting activations at some cost to weight error.

5

Practice

  • 100 Days of LLM Inference Day 14: SmoothQuant and AWQ cells

    Experiments: Try These in day14/quantization-gptq-awq-smoothquant.ipynb: run smoothquant_calibrate and awq_get_scales on a layer with a planted outlier channel and compare output error against naive round-to-nearest

    Report error per method on held-out inputs, and state which scales are static and which would need runtime statistics.

You're done when

You derive the migration factor from channel maxima, show the unchanged product on one layer, and can say for each scale in your pipeline whether it is static or dynamic and what data fixed it.

Only when you can do this without notes.

Leads to

Notes

Resources · 4 for this unit, 9 more in the section

Also in this section