What is Post-training quantization?
Converting a trained model's weights and activations to lower precision after examining value ranges with representative data.
Japanese name: 学習後量子化
Converting a trained model's weights and activations to lower precision after examining value ranges with representative data.
Japanese name: 学習後量子化
Post-training quantization (PTQ) starts from a model already trained in 32-bit floating point and maps each tensor onto a small integer grid, most often INT8. Every real value is represented as an integer times a scale factor, sometimes with a zero-point offset. Weights are fixed after training, so their scales can be computed directly from their stored values, often separately for each output channel to follow differences between filters. No gradient updates take place, so PTQ finishes in a short time and needs no labeled training data, only a small set of inputs for calibration.
Activations change with every input, so their range cannot be read from the model itself. Calibration runs a few hundred representative inputs through the network, records each layer's activation distribution and picks the range to map onto the symmetric INT8 grid of -127 to 127. Using the absolute maximum guarantees nothing is clipped, but a few rare outliers then stretch the scale and waste most of the available levels on values that almost never occur. Narrowing the range to cover most of the distribution clips the outliers while giving finer resolution to the common values.
Quantization-aware training (QAT) inserts simulated rounding into the forward pass during training or fine-tuning, so the weights learn to tolerate the quantization error. PTQ skips this step entirely, which makes it far cheaper and usable when the original training pipeline or dataset is not available. The price is accuracy: at INT8 the loss is often small, but as the bit width shrinks toward 4 bits rounding error grows quickly and PTQ alone may no longer be acceptable. QAT is the usual fallback, because it can preserve accuracy at precisions where PTQ breaks down.
An INT8 weight occupies a quarter of the memory of an FP32 weight, so the same model needs less DRAM capacity and, more importantly, less memory bandwidth per inference. Integer multiply-accumulate units are also much smaller and use less energy per operation than floating-point units, which is why many neural processing units and edge accelerators are built around low-precision integer arrays. PTQ is the most common way to move an existing model onto such hardware, and deployment toolchains generally provide a calibration step for it.
Answer: B. PTQ quantizes a trained model as is; QAT simulates quantization during training so the weights adapt and errors stay small at low precision
Post-training quantization converts a trained model's weights (and activations) to lower precision after examining value ranges with a small representative dataset. It is easy but loses accuracy as bit width shrinks. Quantization-aware training simulates quantization rounding in the forward pass during training and adjusts weights with that error included, preserving accuracy even at precisions as low as 4 bits.
Answer: A. Running representative input data to observe each layer's activation range and set the quantization scales
Weights are fixed once training ends, but activation values vary with the input. So a few hundred inputs resembling real usage are run through the model to observe each layer's activation range and distribution, and the range mapped onto INT8 values (the scale) is chosen. In symmetric quantization, this range maps to -127 to 127. Matching the maximum lets outliers waste resolution, so the range is sometimes narrowed to cover most of the distribution.
Post-training quantization converts an already trained model to low precision without retraining, using only a small calibration set. Quantization-aware training simulates the rounding during training so the weights adapt, which costs a training run but keeps accuracy better at very low bit widths such as 4 bits.
Weights are known after training, but activation values depend on the input, so their ranges must be observed by running representative inputs through the model. Those observed ranges set the scale factors that map activations onto the integer grid.
No full training dataset or labels are required. A few hundred unlabeled inputs that resemble real usage are normally enough to calibrate activation ranges.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.