4.3.13 · D1Pretraining & Fine-Tuning LLMs

Foundations — Quantization (INT8, INT4, GPTQ)

2,359 words11 min readBack to topic

This is a prerequisites page for the Quantization topic. We assume you have seen nothing. Every symbol used up in the parent note is earned here, in order.


0. What is a "weight"? (the thing we are shrinking)

Picture one weight as a single dot sitting somewhere on a number line.

WHY the topic needs this: quantization does one small thing to every weight — it slides each dot onto the nearest allowed mark. If you don't picture a weight as a point on a line, none of the rounding language later will land. The whole game is: billions of dots, snap each to a nearby mark.


1. Bits, and what "precision" costs

Count the marks a ruler can have:

bits patterns name
4 16 INT4
8 256 INT8
16 65 536 FP16

WHY the topic needs this: "INT8" and "INT4" are just "how many marks on the ruler." INT8 has 256 marks, INT4 only 16. When the parent says INT4 "hurts," it means 16 marks is a coarse ruler and dots must jump far.

Recall Why does INT4 use so much less memory than FP16?

FP16 spends 16 bits per weight; INT4 spends 4. Same weights, one-quarter the bits, so roughly one-quarter the file size — a shrink. ::: 4 bits vs 16 bits per number.


2. Float vs integer — the two kinds of number

We need a rule that turns a float into an integer and back. That rule needs two ingredients, defined next: the scale and the zero-point.


3. The scale — how big is one step of the ruler

Read off the picture directly: it is the gap between marks.

WHY divide by to quantize? To turn a real value into "which mark," you ask "how many steps of size fit inside ?" — that is division: . Then you round to the nearest whole step. This is exactly why the parent's formula opens with .


4. Rounding, and the error it creates

WHY error jumps when you drop bits: halving the bits does not halve the marks, it square-roots the count... no — it quarters them (). Each dropped bit roughly doubles , so the error roughly doubles per bit. That non-linear jump is exactly why the parent warns INT4 needs help (GPTQ, AWQ (Activation-aware Weight Quantization)).


5. Zero-point — shifting the ruler so 0 lands on a mark


6. Clamping — the ruler has ends


7. Granularity — one ruler, or many?


8. The symbols GPTQ pulls in

The parent's GPTQ section quietly assumes several more symbols. Building them fully belongs to a later deep dive and to Hessian and Second-Order Methods, but here is the minimum vocabulary so nothing is unnamed.


The prerequisite map

weight w as a dot on a line

bits give 2 to the b marks

float vs integer

scale s equals step size

round snaps dot to mark

error up to half of s

zero point z shifts the ruler

symmetric vs asymmetric

fewer bits means bigger error INT4 hurts

clamp to ruler ends

granularity per group rulers

GPTQ needs inputs X and Hessian H

Quantization topic


Equipment checklist

Self-test: cover the right side and answer each aloud before revealing.

A weight is
one single number inside the network; picture it as a dot on a number line.
bits can represent how many distinct values?
— so INT8 gives 256, INT4 gives 16.
The difference between a float and an integer
a float has a fractional part (); an integer is whole (). Quantization trades floats for integers.
What the scale means physically
the real-value gap between two neighboring integer marks — one "step" of the ruler.
Why we divide by when quantizing
to count how many steps of size fit in , i.e. which mark is nearest to.
What the hat in means
the reconstructed value you get back after rounding — an approximation of .
The maximum quantization error
about , because a dot is at most half a step from the nearest mark.
Why INT4 error is much larger than INT8
16 marks vs 256 → much bigger step → dots jump farther.
What the zero-point does
names the integer mark that stands for real value 0, letting you shift the ruler for one-sided data.
Why must be an integer
marks are integers; forcing whole makes real 0 map exactly onto a mark.
What clamping fixes
outliers that compute an integer past the ruler's ends get pinned to or , preventing overflow.
Why per-group beats per-tensor
a local outlier only stretches its own small ruler, not everyone's, so most weights keep fine steps.
Why GPTQ needs inputs
it minimizes output error , so it must see how the layer responds to real inputs.