liveBook · Manning

Integer computation

As explained in Quantization and Fast Inference

Arithmetic performed on integer-valued representations with discrete, fixed-step values.

Integer computation uses fixed-width values with uniform spacing. In quantized neural-network inference, it trades floating point’s flexible range and precision for bounded representations and simpler, more efficient operations. section 1.3 section 1.3.2

The key implementation tradeoff is range versus resolution:

  • An INT8 value has 256 possible levels, evenly spaced within a chosen range. section 1.3.2
  • Integer operations use fixed-width values and predictable execution; integer hardware can offer higher throughput and lower energy per operation. section 1.3.2
  • A fixed bit-width forces a choice: more range means coarser resolution, while finer resolution narrows the range. section 1.3.2

Fixed-point arithmetic in Q3.4

A Python simulation stores 1.5 as raw integer 24 and 0.5 as 8; multiplying them gives 0.75, stored as 12. With this format, 10.0 and the sum 5.0 + 5.0 both exceed the representable range and saturate at 7.9375. section 2.1

Figure 1.3 Floating point concentrates precision near zero (top), leaving large values sparsely represented. Integers use uniform spacing across your chosen range (bottom). Quantization is the act of deciding where to place that fixed grid.

Compare floating-point precision concentrated near zero with the uniform spacing of integers across a chosen range. section 1.3.2

How Quantization and Fast Inference covers it

How deep it goes
Defines bounded uniform grids and hardware tradeoffs, then simulates fixed-point multiplication and saturation; quantitative quantization analysis is deferred.
Examples
Uses INT8’s 256 levels and a Q3.4 simulation of multiplication, overflow, and saturation.
What it assumes
Assumes a neural-network inference context and familiarity with trained networks’ tolerance of perturbations, while explaining the representation shift from first principles.
What you can do after
Understand how fixed-width range, uniform spacing, and saturation affect fixed-point arithmetic.
How it connects
Connects integer arithmetic to floating-point arithmetic, quantization, fixed-point arithmetic, and neural-network inference.

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.