← Back to article

Equation 1 · Edge AI Electronics and Sensor Systems in Practice: Quantization, Power Budgets, and Sensor Front Ends

What does this equation mean?

r=S(q−Z),r = S \left( q - Z \right),

A neural network may work with values such as −0.75, 0, or 1.25. Small devices can store a nearby integer code instead. This equation tells you which model value that code represents.

Why “real-valued” matters

A real number is a position on the number line. In this article, r is one weight or activation of a neural network before it is reduced to a small integer code. The original model may need values between whole numbers, such as 0.9 or −0.35. An integer code can only choose from separate steps. Quantization trades some precision for smaller storage and integer arithmetic.

Explore real numbers and floating-point values →

Read it piece by piece

rr

Real-valued model value

One numerical weight or activation as the model uses it. “Real-valued” means it belongs on the continuous number line: it can be negative, zero, fractional, or positive. In a computer it is stored with finite precision, so the stored float is only an approximation to a mathematical real number.

Understand this part →

Explore this idea →
qq

Stored integer code

The whole-number code kept in the compact representation. For example, q = 14 is a code; it is not itself the model value 14. The allowed code range depends on the chosen integer format.

Understand this part →

Explore this idea →
ZZ

Zero-point

The integer code that stands for the real value zero. If Z = 10, then q = 10 decodes to r = 0 exactly. It shifts the integer code range left or right relative to real zero.

Understand this part →

Explore this idea →
q−Zq-Z

Offset from zero

Count how many integer steps q lies above or below the zero-point. A positive result gives a positive model value; a negative result gives a negative one.

Understand this part →

Explore this idea →
SS

Scale or step size

A positive number saying how much one integer step is worth in the model’s units. If S = 0.25, moving q by 1 changes the decoded value by 0.25. A larger S covers more range with coarser spacing.

Understand this part →

Explore this idea →
r=S(q−Z)r=S(q-Z)

Decoded value

Subtract Z from the stored code, then multiply by S. For q = 14, Z = 10, and S = 0.25, the code represents r = 0.25 × (14 − 10) = 1.00.

Understand this part →

Explore this idea →

Try the mapping

Move the stored integer code or change the scale and zero-point. Watch which model value it represents.

Integer code 14subtract Z 4multiply by S 1.00
Integer code to model value number lineThe selected integer code aligns with its decoded real value. Each neighboring code is one scale step away.

With q = 14, Z = 10, and S = 0.25, the represented value is 1.00.

Illustrative values. The article does not specify these particular calibration settings.

What is being shifted and scaled?

Z picks the integer code that means real zero. Subtracting it recenters the code: q − Z = 0 at the origin. S converts a one-code move into a change in the model value. Together they form an affine mapping: first shift, then scale.

Explore the zero-point →

What this equation leaves out

The formula describes one scalar value. Real neural networks contain arrays of weights and activations. Different arrays, and sometimes different channels, can use different scales. The integer range also depends on the implementation. Values outside the chosen range may be clipped.

How to interpret it

This is the decoding direction: integer code → represented model value. The original value might have been 0.9, while the nearest code decodes to 1.0, so quantization can introduce error. Encoding goes the other way: round r/S + Z to a permitted integer code and clamp it if necessary. The equals sign defines the value represented by q; it does not promise that every original real value survives exactly.

Sources and further reading

Return to Edge AI Electronics and Sensor Systems in Practice: Quantization, Power Budgets, and Sensor Front Ends

See this formula across 1 published context →

Browse the mathematical compendium →