Log inStart free
LESSON 30.C1 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Quantizing one layer four ways

Watch four quantization methods round the same layer and its outlier channel.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 30.C1 · QUANT BAYCHANNEL 6 · INPUTS UP TO 14.47 · WEIGHT 1.24
01
Stage 1 of 6 · One layer
Channel 6 holds the largest weight, 1.24, and the largest inputs, up to 14.47.
Explain it simply

The grid holds the 64 weights of one layer, one row per output. The teal bars above show the largest input of each channel. Channel 6 is an outlier channel: its inputs are about 7 times larger. All four methods must deal with it.

An 8 by 8 grid of ochre weights. Teal bars above show the largest input per channel. Channel 6 reaches 14.47; the others stay within 2.71.

inputsweights, steps Δ, factors serroroutlier channel, old bar height
channel 6max |x|123456780.21−0.32−0.07−0.210.470.340.05−0.50−0.110.25−0.11−0.460.00−0.140.50−0.340.120.09−0.370.26−0.15−0.230.200.09−0.160.24−0.290.010.281.24−0.630.130.110.02−0.38−0.05−0.36−0.01−0.100.260.030.01−0.170.110.190.300.440.09−0.58−0.31−0.27−0.140.00−0.06−0.080.23−0.270.08−0.04−0.04−0.060.31−0.13−0.622.311.612.712.642.3914.472.502.1312345678output error, all 16 tokensRound to nearestGPTQAWQSmoothQuantthe layerchannel 6max |x|123456780.21−0.32−0.07−0.210.470.340.05−0.50−0.110.25−0.11−0.460.00−0.140.50−0.340.120.09−0.370.26−0.15−0.230.200.09−0.160.24−0.290.010.281.24−0.630.130.110.02−0.38−0.05−0.36−0.01−0.100.260.030.01−0.170.110.190.300.440.09−0.58−0.31−0.27−0.140.00−0.06−0.080.23−0.270.08−0.04−0.04−0.060.31−0.13−0.622.311.612.712.642.3914.472.502.1312345678output error, all 16 tokensRound to nearestGPTQAWQSmoothQuantthe layer
Toy: the 30.C1 layer, 8 × 8 weights and 16 calibration tokens
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
yi=∑jwij xj\sy{y}{out}{y_i} = \sum_j \sy{w}{param}{w_{ij}}\,\sy{x}{data}{x_j}
y4=∑jw4j xj=19.66 (token 6)y_{4} = \textstyle\sum_j w_{4j}\,x_{j} = 19.66 \text{ (token 6)}

Each output adds every input times its weight.

Common mix-ups

MYTHOne method is the best in every format.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With all 16 calibration tokens, if the inputs are INT4 too, which method gives the smallest error?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.