QAT
How it works
1) Simulated quantization (fake-quant) nodes are inserted on weights and usually activations, together with observers that estimate value ranges (scale, zero-point). 2) In the forward pass, values are quantized to a low-bit grid and dequantized, so the model computes on quantization-noised values. 3) In the backward pass the non-differentiable rounding is bypassed with the straight-through estimator (STE), treating quantization as an identity for the gradient. 4) Weights are updated to minimise the loss despite quantization. 5) After training, the model is exported to a real integer/low-bit representation for efficient inference. QAT is often applied as a short fine-tuning stage on a pretrained model.
Problem solved
Low-bit quantization drastically reduces model size and inference cost, but naively rounding the weights of a trained model (PTQ) degrades accuracy, especially below 8-bit precision. QAT addresses this by letting the model learn to compensate for quantization error while still training.
Components
Implementation
The rounding operation blocks the gradient; without a workaround training does not learn.
Activations are harder to quantize than weights; outliers heavily degrade accuracy at low precision.
Full QAT requires substantial training resources, which can be impractical for large models.
Evolution
Bengio, Léonard and Courville formalised gradient propagation through non-differentiable/stochastic neurons — the foundation for later QAT.
Jacob et al. co-designed a training procedure with simulated quantization, defining modern QAT for efficient CPU inference (MobileNets).
Brought QAT to large language models with a data-free approach, quantizing weights, activations and the KV cache.
Language models trained from scratch with ternary (1.58-bit) weights, demonstrating extreme low-bit quantization-aware training.
An efficient QAT algorithm (block-wise training) enabling low-bit LLM quantization, including ~2-bit, with reduced resources.
Hyperparameters (configurable axes)
Target precision of weights/activations (e.g. 8, 4, 2 bits). Lower precision = smaller model, harder training.
Per-tensor, per-channel, or per-group — trades off accuracy against overhead.
Symmetric vs asymmetric; separate handling of weights and activations.
Number of steps/data in the QAT stage — balances training cost against accuracy recovery.
Parallelism
QAT parallelizes like ordinary training (data/model parallelism); the extra overhead comes from fake-quant operations.
Hardware requirements
The original scheme targeted integer-only inference on commonly available CPUs (e.g. on-device MobileNets).
Low-bit (INT8/INT4) tensor-core paths accelerate inference of QAT-trained models.