AlgoViz

What quantization does to a weight

medium 7 min

A trained layer contains real-valued parameters represented at finite precision.

Where it shows up

The same pattern appears across everyday software.

  • Fit a small weight and an outlier on four bits

    These two weights share a toy group. The first lies inside the fine codebook range and the second exceeds it. Round 2.6 to 3. Round 10.4 to 10 and clip to the maximum signed index of 7. Reconstruct with the stored scale. The errors are 0.04 and 0.34, so the outlier dominates these two local errors. Codes become 1 and 5, reconstructing 0.2 and 1.0. Errors become 0.06 and 0.04. Evaluate the whole layer and downstream tasks before choosing a production format.