· 4 min read
Quantization, explained without the math
What happens to a model when you give each number fewer bits, and why it often still works.
A neural network is mostly a large pile of numbers. Quantization stores each of those numbers with fewer bits, so the model takes less memory and runs on smaller hardware.
Fewer bits means fewer levels
With 16 bits a number can take 65,536 different values. With 8 bits it can take 256, and with 4 bits only 16. Each weight gets rounded to the nearest level that is still available.
- 16 bits: 65,536 levels
- 8 bits: 256 levels
- 4 bits: 16 levels
Fewer bits, same signal?
An illustrative 1-D signal, not a real model. Drag to change the precision.
Why it often still works
A model does not depend on any single weight being exact. Rounding errors are small, spread out and tend to cancel each other, so the output barely changes until the precision gets very low.
Where it breaks
Below a certain number of bits the steps become too coarse and the error shows up in the answers. Where that line sits depends on the model and the task, so it has to be measured, not assumed.
The slider above is an illustration, not a real model, but it shows the same trade: size goes down quickly while the error stays small, until it does not.