1 of 4

Your RightSignal

How LLMs work · 10 of 141 / 3

Quantization

The concept

Why a 140 GB model can shrink to 35 GB and still answer well

Quantization stores each model weight in fewer bits. A 70-billion-weight model in 16-bit floats (2 bytes each) takes about 140 GB. At 4 bits per weight it takes about 35 GB.

You divide a group of weights by one scale s and round each result to the nearest integer the format can hold: −127 to 127 for 8-bit, −8 to 7 for 4-bit. When it runs, the model uses s · q in place of w.

What you lose is the rounding error, the gap between w and s · q. The fewer bits you use, the coarser the grid of values and the bigger that gap.

What it’s forTurns a full-precision weight into a small integer that takes far fewer bits to store.

q = round(w / s)

w
the original weight, e.g. 0.5
s
the scale for this group: its largest |w| divided by 127 for 8-bit
q
the stored integer, from −127 to 127 in 8-bit

What it givesA small integer q, and the model later uses s · q as an approximation of w.

  1. Largest weight 2.54 → s = 2.54 / 127 = 0.02
  2. w = 0.5 → 0.5 / 0.02 = 25 → q = 25 → back to 25 × 0.02 = 0.5 exactly
  3. w = 0.013 → 0.65 → q = 1 → back to 0.02, an error of 0.007