Explain post-training quantisation vs quantisation-aware training, symmetric vs asymmetric and per-tensor vs per-channel scales, and when int8 accuracy collapses.
Answer
Model answer, written in a candidate's voice
In short
- Affine mapping: x_q = round(x/s) + z, with scale s and zero-point z; activations need calibration data to estimate ranges.
- Symmetric uses z=0 and is simple for signed weights; asymmetric uses z to match skewed activation distributions.
- Per-tensor uses one scale for a whole tensor; per-channel uses one scale per output channel, and per-channel weight scales usually preserve accuracy much better.
- QAT inserts fake quantisation during training and uses straight-through gradients so the model adapts to quantisation noise.
- Int8 accuracy collapses with activation outliers, calibration mismatch, sensitive layers, or unsupported operators; LLMs need SmoothQuant-style rescaling or mixed precision.
- Hardware support decides feasibility: an NPU may require full int8 and limited operator coverage, so mixed precision or fallback ops may be needed.
In full
Post-training quantisation maps values with an affine rule, x_q = round(x/s) + z, where s is the scale and z is the zero-point; weights can often be quantised from the tensor itself, while activations need representative calibration data to estimate ranges. Symmetric quantisation keeps z=0 and is convenient for signed weights, whereas asymmetric quantisation uses z to fit skewed activation distributions. Per-tensor quantisation uses one scale for an entire tensor and is cheap but can lose accuracy when channels have very different magnitudes; per-channel weight scales, one per output channel, preserve accuracy much better and are the usual reason int8 weights stay close to fp16, while activations are often still per-tensor because per-channel activation scales are expensive at runtime. Quantisation-aware training instead simulates quantisation in the forward pass and uses straight-through gradients so the network learns to be robust to quantisation error, usually at the cost of extra training. Int8 accuracy collapses when activation outliers dominate the range, calibration data does not match deployment, sensitive layers such as first/last layers, attention, softmax, or normalisation are quantised too aggressively, or the target stack cannot execute the required operators; in LLMs this is why SmoothQuant-style rescaling, outlier-aware handling, or keeping a small fraction of sensitive tensors in higher precision is common. Hardware support is decisive: an NPU may require full int8 and only a limited operator set, so a model that looks fine in simulation can still fail or need fallback ops, and the right choice is the lowest-precision configuration that the target actually supports without accuracy loss.
What a strong answer covers
- Affine mapping with scale and zero-point; calibration data for activation ranges.
- Per-channel weights preserve accuracy.
- QAT simulates quantisation in training with straight-through gradients.
- Outlier activations (LLMs) need special handling (SmoothQuant-style rescaling, mixed precision).
- Hardware support matters (an NPU may require full int8; operator coverage).
Common mistakes
- calibrating on unrepresentative data
- assuming every op is supported in int8 on the target.