liveBook · Manning

Rounding bias

As explained in Quantization and Fast Inference

Rounding bias is a half-step offset added before integer rescaling so that a shift approximates rounding rather than truncation.

In fixed-point multiplication, add half a step to the wide product before shifting it back to the target scale. This counters the systematic downward error of a right shift, which otherwise discards the remainder. In Q3.4, the product is shifted right by 4 bits; adding half a step first makes the rescaling approximate rounding to nearest rather than truncation. section 2.1

Q3.4 rescaling

Multiplying raw values produces a product with eight fractional bits. To return to Q3.4, add half a step before shifting right by 4; the shift alone drops the remainder and biases results downward. section 2.1

How Quantization and Fast Inference covers it

How deep it goes
Derives the extra fractional bits from multiplication and explains the half-step offset before shifting.
Examples
Uses Q3.4 multiplication to illustrate product scaling and shifting back to the original format.
What it assumes
Assumes fixed-point values and right shifts, while deriving the extra fractional bits produced by multiplication.
What you can do after
Understand how a half-step offset makes integer rescaling approximate rounding instead of truncation.
How it connects
Links fixed-point multiplication with integer right shifts and quantization error.

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.