Prediction Difference Metrics (PD-Quant)
- Prediction Difference Metrics (PD-Quant) are post-training quantization techniques that optimize parameters by minimizing the KL divergence between full-precision and quantized outputs over a calibration set.
- The method jointly optimizes activation scales and rounding offsets using a hybrid loss that combines global prediction difference and local MSE regularization.
- PD-Quant mitigates overfitting with distribution correction techniques and demonstrates notable accuracy improvements in aggressive quantization scenarios.
Prediction Difference Metrics (PD-Quant) are a class of post-training quantization (PTQ) techniques that employ global measures of prediction shift to optimize quantization parameters in deep neural networks. Unlike conventional PTQ approaches based on local feature or activation distance, PD-Quant determines quantization parameters by explicitly minimizing the difference between the predicted distributions of a full-precision network and its quantized counterpart over a calibration set. This method aims to reduce accuracy degradation in aggressive (e.g., 2-bit) quantization regimes by leveraging a global prediction difference metric, typically instantiated via the Kullback–Leibler (KL) divergence between output softmax distributions (Liu et al., 2022). PD-Quant further incorporates techniques to counteract overfitting with limited calibration data, notably via distribution correction of activations.
1. Formal Definition of the Prediction Difference Metric
Let denote a full-precision neural network and its quantized version. Given a calibration dataset , define:
- : Softmax output of on input
- : Softmax output of on
The Prediction Difference Metric (PDM) is the average KL divergence between the predictions:
PDM quantifies the shift in predicted distributions resulting from quantization noise, serving as a global criterion for PTQ parameter search.
2. Optimization of Quantization Parameters via PDM
PD-Quant simultaneously optimizes per-layer/block activation scales (0) and per-weight rounding offsets (1). For block 2, given quantized output 3 and original prediction 4, the optimization problem is:
5
- 6: Global loss (prediction difference)
- 7: Blockwise output MSE regularizer
- 8: Regularization coefficient (typ. 9–0)
The quantizer for each value 1 is: 2 with scale 3, zero-point 4, and round offset 5.
3. Algorithmic Description and Workflow
PD-Quant is implemented as a blockwise, calibration-driven algorithm. The standard workflow is:
- Initialize 6; set all 7; set all 8 via min–max.
- For 9 (blocks): a. Propagate calibration samples through blocks 0 to obtain inputs 1. b. (Optional) Apply Distribution Correction (DC) to match batch statistics. c. Jointly optimize 2 by minimizing the sum of PDM loss and local regularizer for 3 iterations. d. Freeze parameters and proceed to the next block.
- Output the fully quantized network 4.
The pseudocode structure is as follows:
6
4. Overfitting Mitigation: Distribution Correction
With limited calibration data, PTQ can overfit to idiosyncratic activation statistics. PD-Quant addresses this by remapping block inputs to match the mean/variance recorded in BatchNorm layers:
Let block 5 have 6 BatchNorm layers with statistics 7. For sample batch statistics 8, solve
9
Here, 0 tunes the correction's strength (1 corresponds to no correction). Correction is performed using a few steps of gradient descent and is activated when the calibration set is small (2K).
5. Empirical Performance and Benchmarking
PD-Quant demonstrates consistent improvements in accuracy over established PTQ baselines, particularly in low-bit regimes. Selected results include:
| Model | Bit | Baseline QDrop | PD-Quant |
|---|---|---|---|
| ResNet-18 | 2/2 | 51.42% | 53.14% |
| RegNetX-600MF | 2/2 | 39.01% | 40.67% |
Wider 4-bit/2-bit (W4A2) or 2-bit/4-bit (W2A4) configurations see 3–4 improvements. At 256 calibration images, gains over QDrop remain 5–6; the benefit of DC diminishes with calibration set size.
Relative quantization time (ResNet-18, RTX A6000):
- QDrop: 7 h
- PD-Quant (no DC): 8 h
- PD-Quant (9DC): 0 h
This is substantially faster than quantization-aware training (QAT; e.g., LSQ, 1 h).
6. Hyperparameters, Calibration, and Implementation Details
Hyperparameters are found robust across model architectures:
- 2 (regularization): 3
- 4 (DC strength): 5
Calibration sets of 6K–7K in-domain images yield optimal results; even at 8 samples, performance exceeds QDrop. Notably, scale optimization for weights via PDM does not provide further benefit, as weight scale search per channel is discrete; MSE or per-channel min–max is preferred for this aspect.
7. Limitations, Methodological Extensions, and Best Practices
PD-Quant incurs additional fine-tuning cost (typically 9 h per model), contrasting with search-only approaches. Application to Vision Transformers (ViT/DeiT) shows 0–1 improvements at W4A6 and W2A6. Other potential metrics (e.g., Earth Mover’s Distance) may be substituted for KL, and mixed-precision bitwidth selection can be informed by PDM sensitivity.
Best practices include quantizing blocks in order, utilizing 2–3 in-domain calibration samples, tuning 4 on a single block, always incorporating the local 5, and applying DC for small calibration sizes.
A plausible implication is that layer-local MSE alone insufficiently captures prediction robustness under quantization, and global output-centric metrics such as PDM provide a superior quantization protocol for aggressive precision reduction (Liu et al., 2022).