Throughout, one convention: a real weight x is stored as an integer q via a scales (how many real units each integer step is worth) and a zero-pointz (the integer that the real value 0 lands on):
q=round(sx)+z,x^=s(q−z).
x^ is the dequantized value — our best reconstruction of x from the stored integer. The gap x^−x is the quantization error.
The picture above is the mental model for every problem: a real-number axis, a ladder of allowed integer levels spaced s apart, and each weight snapping to its nearest rung.
Why symmetric: weights cluster around 0, so a symmetric grid centered at 0 wastes no range and needs no zero-point add.
max∣w∣=0.7⇒s=0.7/127=0.005512.
q=round(w/s):
−0.4/s=−72.57→−73
0.7/s=127→127
0.2/s=36.29→36
So q=[−73,127,36].
w^=sq=[−0.4024,0.7000,0.1984].
Error w^−w=[−0.0024,0,−0.0016].
Why so small: step s≈0.0055, so any rounding error is at most s/2≈0.0028.
Recall Solution
The tool and why: affine (asymmetric) quantization is used when the data is not centered on 0 (here it leans positive). We force the two endpoints to line up and solve.
s=qmax−qminxmax−xmin=255−01.0−(−0.2)=2551.2=0.004706.z=round(qmin−sxmin)=round(0−0.004706−0.2)=round(42.5)=43.Why round z: the zero-point must be a real integer so that the value 0 maps exactly to code 43 (important for padding).
Check: does xmax map inside range? q=round(1.0/s)+z=213+43=256 → clamp to 255. This is expected; endpoint rounding can overshoot by one, and clamping fixes it.
Error on 0.2: 0 here — lucky, because 0.2 is an exact multiple of s=0.1.
Lesson: INT4 error is usually large (s=0.1 vs 0.0055 for INT8 → ~18× coarser grid), but if a value lands exactly on a rung the error vanishes. Don't generalize from a lucky vector.
Quantize 0.015: q=round(0.015/0.023622)=round(0.635)=1, so w^=0.023622.
Error =0.023622−0.015=0.008622 — 57% relative error on that weight.
The analysis: the single outlier 3.0 inflated max∣w∣ by ~200×, stretching the grid so wide that all the "normal" small weights fall between just a couple of rungs. 253 of the 256 levels sit unused in the empty range between 0.02 and 3.0. Fix:per-group scales (one s per block of 128) so the outlier only spoils its own group — see the parent's granularity section.
Recall Solution
Why s2/12: for a uniform distribution on width w, the variance is w2/12; here width =s, giving s2/12.
INT8: s8=0.7/127=0.005512, σ8=s8/12=0.001591.
INT4: s4=0.7/7=0.1, σ4=s4/12=0.028868.
Ratio σ4/σ8=s4/s8=0.1/0.005512=18.14.
The point: memory only halved (8→4 bits), but the noise standard deviation jumped ~18×. Each dropped bit doubless, and the step scaling with the number of levels (2b) makes it geometric, not linear. This is precisely why INT4 needs GPTQ/AWQ compensation while INT8 needs almost nothing.
Recall Solution
(a) wq−w^q is the rounding error just committed on weight q — the amount we snapped it off the grid.
(b) [H−1]qq is the "self-sensitivity" of weight q; dividing normalizes the correction so the pushed error exactly cancels weight q's contribution to the output. It's a Newton-style step (see Hessian and Second-Order Methods).
(c) The objective minimizes output error ∥WX−W^X∥2. The curvature of that quadratic in the weights depends on how the inputs X correlate: H=2XX⊤. Weights that are hit by correlated inputs must be corrected together — that correlation lives in X, not in W.
Why add overhead: per-group scales are the reason real INT4 files exceed the naive 3.5 GB.
bits/weight=4+12816=4+0.125=4.125.
Bytes per weight =4.125/8=0.5156.
size=7×109×0.5156B=3.61GB.Interpretation: the extra 0.125 bit/weight (a 3.1% overhead) buys per-group scales that keep INT4 accurate. Naive 3.5 GB → real ≈3.6 GB.
Recall Solution
The tool: GPTQ tells us output error scales with the input Hessian H=2XX⊤. A larger H (bigger, more energetic inputs) means a given weight rounding error produces a larger output perturbation.
Layer A: ∑[HA]ii=1000 → its weights are hit by high-energy inputs → rounding errors are amplified more.
Layer B: ∑[HB]ii=50 → errors barely propagate.
Decision: keep Layer A in INT8 (halve its rounding error there), quantize B hard to INT4. Spend precision where the Hessian says errors are most amplified. This is the seed of mixed-precision quantization; see Mixed-Precision Training (FP16, BF16) and AWQ (Activation-aware Weight Quantization).
Recall Solution
Step 1 — quantize w1. Nearest rung to 0.30 on step 0.5 is 0.5⋅round(0.30/0.5)=0.5⋅round(0.6)=0.5⋅1=0.5. So w^1=0.5.
Rounding error on weight 1: w1−w^1=0.30−0.50=−0.20.
Step 2 — spread it. The correction to the remaining weights:
δrest=−[H−1]11w1−w^1H:,1−1=−1−0.20[10.5]=[0.200.10].
We only apply the part for the untouched weight w2: δw2=+0.10.
w2new=0.30+0.10=0.40.Result:w^1=0.50, compensated w2=0.40 (to be quantized next). We raisedw2 to absorb the fact that w1 was pushed up, keeping the layer's output closer to the original.
Substitute xmin=−max∣x∣ and qmin=−qmax:
s=qmax−qminxmax−xmin=qmax−(−qmax)max∣x∣−(−max∣x∣)=2qmax2max∣x∣=qmaxmax∣x∣.
And the zero-point z=round(qmin−xmin/s)=round(−qmax+max∣x∣/s)=round(−qmax+qmax)=0. So symmetric quantization is genuinely the z=0 special case. ■
Recall Solution
Effective bits =4+16/g:
g=32: 4+0.5=4.5 bits.
g=64: 4+0.25=4.25 bits.
g=128: 4+0.125=4.125 bits.
g=256: 4+0.0625=4.0625 bits.
Recommendation:g=128. Going from 128→64 costs an extra 0.125 bit/weight (3% more memory) for a marginal accuracy gain, while 128→256 saves only 0.06 bit but coarsens the scale so outliers spread across twice as many weights. g=128 is the community sweet spot precisely because the overhead curve 16/g is already nearly flat there.
Recall Solution
By definition w^=s⋅round(w/s). Let r=w/s. Rounding to the nearest integer means ∣round(r)−r∣≤21 (with 21 hit at half-integers). Multiply by s>0:
∣w^−w∣=s∣round(r)−r∣≤s⋅21=2s.
Equality is approached when w sits exactly halfway between two rungs, i.e. w/s is a half-integer. This bound is why doubling s (dropping a bit) doubles the worst-case error — the L3.2 nonlinearity in one line. ■
One line to recall each level.
INT4 has how many levels? ::: 24=16.
Symmetric scale formula? ::: s=max∣w∣/qmax, with z=0.
Why is INT4 error ~18× INT8's at fixed range? ::: step s scales as 1/2b, so 4 fewer... no — 4 bits fewer means 24 coarser grid; concretely s4/s8=127/7≈18.
What does H:,q−1 do in GPTQ? ::: distributes weight q's rounding error into correlated untouched weights.
Effective bits for INT4, g=128, FP16 scales? ::: 4+16/128=4.125.