Integer quantisation replaces a real number x with a small integer q using q = round(x/s) + z, where the step size s and the zero-point z are computed from the tensor’s own minimum and maximum. Everything else follows from those two constants by arithmetic: the error is bounded by s/2, each extra bit buys about 6.02 dB of signal-to-noise, and “4-bit” weighs about 0.578 bytes per weight rather than 0.5. This page does all of that arithmetic in front of you.
The affine map, and where s and z come from
A float carries its own exponent, so it can represent both 1e-8 and 1e8. An integer cannot. Every floating-point format spends bits on that exponent; integer quantisation spends none, and buys the range back by attaching one shared scale to a whole block of numbers. That is the entire idea. The rest is bookkeeping.
Quantise: q = clamp(round(x / s) + z, q_min, q_max)
Dequantise: x' = s * (q - z)






