A weight tensor of 100 million parameters stored in FP32 (4 bytes each) spans the range [−0.64,+1.91]. What are the unsigned INT8 ([0,255]) affine scale s and zero-point z, what are the quantised and dequantised values and error for w=0.314, and how much parameter memory is saved?

ML systems and evaluation, Model compression
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can perform affine uniform quantisation and compute both reconstruction error and memory savings.

Key idea

Affine quantisation maps real values w∈[wmin⁡,wmax⁡] to integers q∈[0,255] via s=wmax⁡−wmin⁡255 and z=round⁡(−wmin⁡/s), with q=clamp⁡(round⁡(w/s)+z,0,255) and w^=s(q−z).

Steps

  1. Compute the scale: s=1.91−(−0.64)255−0=2.55255=0.01.
  2. Compute the zero-point so that w=0 maps cleanly to an integer: z=round⁡ ⁣(0−−0.640.01)=64.
  3. Quantise w=0.314: q=round⁡(0.314/0.01)+64=round⁡(31.4)+64=31+64=95.
  4. Dequantise: w^=s(q−z)=0.01×(95−64)=0.31. The absolute quantisation error is ∣0.314−0.31∣=0.004 (within the maximum rounding bound s/2=0.005).
  5. Compute memory savings: FP32 uses 100×106×4=400 MB; INT8 uses 100×106×1=100 MB (plus negligible per-tensor s and z metadata), saving 300 MB (75% reduction, or 4× smaller).

Common mistakes

How long your answer should be

Five lines of arithmetic; 3–4 minutes.

Last checked on 4 December 2026.

Read this

Previous in ML systems and evaluation: How does permutation feature importance measure a feature’s contribution, why must it be computed on held-out validation data rather than training data, and what happens when two strongly correlated features (x1≈x2) are evaluated with it?
Next in ML systems and evaluation: What are the Shapley value formula and its four uniqueness axioms, and for a 3-feature model F={1,2,3} with coalition values v(∅)=10, v({1})=14, v({2})=12, v({3})=11, v({1,2})=20, v({1,3})=15, v({2,3})=13 and v({1,2,3})=25, what are the exact Shapley attributions ϕ1,ϕ2,ϕ3 (verifying efficiency)?