liveBook · Manning

Exact zero constraint

As explained in Quantization and Fast Inference

The exact zero constraint requires real zero to map to an integer value without quantization error.

The exact zero constraint requires real 0.0 to map to an integer zero point Z without quantization error. In affine quantization, r = S(q − Z), so q = Z reconstructs exactly to zero. section 2.2

During calibration, include zero in the real range and choose an integer zero point. For example, extend an observed range of [1.0, 5.0] to [0.0, 5.0]. Widening the range can reduce resolution for the observed values when the integer range is fixed. section 2.2

Use Z when padding an integer tensor to obtain real-zero padding. Exact zeros also preserve ReLU sparsity: hardware that supports zero-skipping can skip them, while small nonzero reconstruction errors can prevent skipping and leak signal. section 2.2

Quantizing ReLU outputs

For unsigned 8-bit quantization of [0.0, 0.0, 0.25, 1.5, 6.0], calibration gives scale 0.023529 and zero point 0. The quantized values are [0, 0, 11, 64, 255]; both zeros reconstruct exactly, while 0.25 reconstructs to about 0.258824. section 2.2

How Quantization and Fast Inference covers it

How deep it goes
Explains the affine mapping, calibration range adjustment, and consequences for padding and zero-skipping hardware.
Examples
Uses a positive-only range extension and an unsigned 8-bit ReLU quantization example.
What you can do after
Operate/configure affine quantization by including zero in the calibration range and using an integer zero point.
How it connects
Connects affine quantization with calibration, ReLU, sparsity, and zero-skipping.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quantization and Fast Inference. The section links point to the parts of the book it draws on.