Static quantization is a post-training technique that converts both the weights and the activations of a neural network from floating point to low-precision integers, typically 8-bit, using scale factors and zero points that are fixed before deployment from a small calibration dataset. In edge AI, it is the standard route to integer-only inference on phones, microcontrollers and neural processing units, where floating-point arithmetic is slow, power-hungry or unavailable.
The word static refers to the activation ranges. Unlike dynamic quantization, which measures activation ranges at run time for every input, static quantization precomputes those ranges once, so the deployed model performs no range estimation and can run entirely in integer arithmetic. The method is also called static post-training quantization.
How static quantization maps values to integers
Static quantization uses an affine mapping between real values and integers: a real value equals the scale multiplied by the difference between the integer and the zero point. The scale sets the step size between representable values, and the zero point is the integer that represents real zero exactly, which matters for padding and ReLU outputs.
The workflow has four steps. The tool first inserts observers at every tensor to be quantized, then runs a few hundred representative inputs through the floating-point model while observers record activation statistics. Next, it computes scales and zero points from those statistics, and finally it converts the graph so that operators consume and produce integer tensors, with weights stored as int8 and biases usually as int32.
The table below lists the parameters that define a statically quantized tensor.
| Parameter | Typical value | What it controls |
|---|---|---|
| Bit width | 8 bits; 4 bits for weights in some runtimes | Number of representable levels |
| Scale | Positive floating-point constant | Step size between integer levels |
| Zero point | Integer within the quantized range | Exact representation of real zero |
| Granularity | Per-tensor activations, per-channel weights | How many scales a tensor uses |
| Symmetry | Symmetric weights, asymmetric activations | Whether the zero point is fixed at zero |
Calibration: choosing activation ranges
Calibration determines which range of activation values each integer grid covers, and it is the step where most accuracy is won or lost. A range that is too wide wastes integer levels on rare outliers and coarsens the common values, while a range that is too narrow clips large activations. Calibration data should match the deployment distribution; 100 to 1,000 samples are usually sufficient for vision models.
The following table compares the common range-selection methods used in quantization toolkits.
| Method | How the range is chosen | Trade-off |
|---|---|---|
| Min-max | Observed minimum and maximum | Simple, but sensitive to outliers |
| Moving average min-max | Smoothed extremes across batches | More stable, still outlier-prone |
| Percentile | Clips at, for example, the 99.99th percentile | Robust; percentile needs tuning |
| Entropy (KL divergence) | Minimizes information loss of the histogram | Good for CNNs; slower to compute |
| MSE minimization | Minimizes squared quantization error | Accurate; more computation per tensor |
Static quantization compared with other approaches
Static quantization sits between the cheapest and the most accurate options. Dynamic quantization quantizes weights ahead of time but computes activation scales per input, which suits LSTMs and transformer linear layers on CPUs but leaves overhead in every call. Quantization-aware training simulates quantization during training with fake quantization nodes and the straight-through estimator, recovering accuracy that static post-training quantization loses, at the cost of a training pipeline.
| Approach | Activation ranges | Retraining needed | Typical use |
|---|---|---|---|
| Static quantization | Fixed from calibration | No | CNNs on NPUs, DSPs and MCUs |
| Dynamic quantization | Computed at run time | No | RNNs and transformers on CPU |
| Weight-only quantization | Kept in floating point | No | Large language models on GPUs |
| Quantization-aware training | Learned during training | Yes | Accuracy-critical compact models |
For large language models, static activation quantization is harder because activations contain extreme outlier channels. Methods such as SmoothQuant shift difficulty from activations to weights so that W8A8 static schemes remain accurate, while many local LLM deployments use weight-only formats instead.
Benefits and costs on edge hardware
The benefits are substantial. Moving from 32-bit floats to 8-bit integers cuts model size by about four times, reduces memory bandwidth by the same factor and enables integer matrix units. On CPUs and mobile accelerators, speedups of two to four times are common, and integer operations consume markedly less energy per operation than floating-point ones.
Accuracy cost depends on the architecture. Well-behaved convolutional networks such as ResNet typically lose less than one percentage point of top-1 accuracy with per-channel weights and good calibration, whereas compact models such as MobileNet with depthwise convolutions can lose several points without careful handling.
- Fuse operators first: folding batch normalization into convolutions and fusing convolution with ReLU avoids needless requantization steps.
- Use per-channel weight scales for convolutions and linear layers, which most edge runtimes support.
- Keep sensitive layers in floating point, such as the first convolution or the final classifier, when the target runtime allows mixed precision.
- Verify operator coverage on the target delegate, because unsupported operators fall back to the CPU and erase speed gains.
Common failure modes and how to fix them
Most problems with static quantization trace back to unrepresentative calibration data or to layers with unusual value distributions. The table below links symptoms to causes and remedies.
| Symptom | Likely cause | Remedy |
|---|---|---|
| Large accuracy drop overall | Calibration data unlike real inputs | Calibrate on deployment-like samples |
| One layer dominates error | Outliers in that layer’s activations | Percentile clipping or keep layer in float |
| No speedup on device | Unsupported operators fall back to CPU | Replace or fuse unsupported operators |
| Accuracy loss after conversion only | Batch normalization not folded | Fuse modules before calibration |
When post-training methods cannot meet the accuracy target, the usual escalation path is quantization-aware fine-tuning for a few epochs, starting from the statically quantized configuration.
Stripped to the essentials
An AI model normally stores its numbers with many decimal places. Small devices handle such numbers slowly. Static quantization rounds them to simple whole numbers so the device can work faster and use less battery.
To round well, the system first watches the model on a few sample inputs. It learns the usual range of values and fixes the rounding rules in advance. After that, the device just follows those rules. The model becomes about four times smaller and usually stays almost as accurate.
Where it is applied
A manufacturer of battery-powered security cameras wants person detection to run on the camera itself instead of in the cloud. The floating-point detection model is 24 MB and runs too slowly on the camera’s low-power chip, which includes a small int8 neural accelerator.
The engineering team fuses batch normalization into the convolutions, calibrates with 500 frames recorded by real cameras at day and night, and applies static quantization with per-channel weight scales. The resulting model is about 6 MB, runs entirely on the accelerator and processes frames roughly three times faster. Detection accuracy on the validation set drops by less than one percentage point, and battery life improves enough to extend the time between charges noticeably.