Log inStart free
LESSON 30.02 · 5 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Quantization granularity

See one weight matrix lose detail with one scale, then keep it with more.


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

Go Pro · $8.25/mo
EXPLAINER · 30.02 · QUANT BAY4 CHANNELS × 8 INPUTS · OUTLIER 1.62
01
Stage 1 of 5 · The weights
Each row of the weight matrix is one output channel. The rows have different ranges, and channel 1 holds an outlier.
Explain it simply

You see a small layer: 4 rows of 8 weights. Each row makes one output, called a channel. A bigger square means a bigger weight, and an outlined square is below zero. Channel 3 holds big weights, channel 2 holds tiny ones, and channel 1 hides one large weight, 1.62.

A grid of 4 rows and 8 columns of weights. The largest size in each row: channel 1, 1.62; channel 2, 0.19; channel 3, 1.03; channel 4, 0.58.

weight w, code q (outlined: below 0)code 0error (outlined: below 0)
in 1in 2in 3in 4in 5in 6in 7in 8ch 1ch 2ch 3ch 4−0.130.27−0.300.090.201.62−0.340.11−0.050.07−0.160.190.06−0.050.11−0.05−1.030.93−0.560.390.970.370.27−0.31−0.44−0.17−0.47−0.45−0.280.54−0.21−0.58largest |w|1.620.191.030.58the weightslargest |w| per channel: 1.62 · 0.19 · 1.03 · 0.58in 1in 2in 3in 4in 5in 6in 7in 8ch 1ch 2ch 3ch 4−0.130.27−0.300.090.201.62−0.340.11−0.050.07−0.160.190.06−0.050.11−0.05−1.030.93−0.560.390.970.370.27−0.31−0.44−0.17−0.47−0.45−0.280.54−0.21−0.58largest |w|1.620.191.030.58the weightslargest |w| per channel: 1.62 · 0.19 · 1.03 · 0.58
Toy: a 4 × 8 weight matrix, made up (not trained)
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
W∈R4×8,max⁡j∣wij∣\sy{w}{param}{W} \in \mathbb{R}^{4 \times 8},\quad \max_j |\sy{w}{param}{w_{ij}}|
max⁡∣w1j∣=1.62, max⁡∣w2j∣=0.19\max |w_{1j}| = 1.62,\ \max |w_{2j}| = 0.19

Each row has its own largest weight.

Common mix-ups

MYTHPer-channel scales remove the outlier problem.

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

Predict, then reveal
3 CHECKS · PRO
Q01With per-channel scales and INT4 codes, how many weights of channel 2 become 0?

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

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 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.