Introduction
Deep Neural Networks (DNNs) are increasingly deployed on resource-constrained mobile and embedded devices. Quantization—the process of reducing precision from 32-bit floats to lower-bit integers—is a critical technique for optimizing memory and power consumption. However, current methods present a stark trade-off: Dynamic Quantization offers high accuracy by calculating parameters per-input but introduces significant computational overhead (2–10%) due to tensor scanning. Conversely, Static Quantization is fast but lacks robustness; if real-world data deviates from the calibration set, accuracy can drop sharply.
This paper introduces QPP (Quantization Parameter Predictor), a novel approach that bridges this gap. By utilizing a lightweight linear regressor to predict optimal quantization parameters from input data at runtime, QPP maintains the accuracy of dynamic methods with the speed of static ones.
The QPP Architecture
The core innovation of QPP is treating quantization parameter estimation as a regression task rather than a direct calculation. Instead of scanning every activation tensor, QPP uses a simple linear model to map input statistics to optimal clipping thresholds for subsequent layers.
Implementation Details
- Predictor Mechanism: At runtime, the system calculates a few key statistics (e.g., specific quantiles) for the input image once. The linear regressor then instantly provides parameters for the entire network, enabling "fused" operations where convolution and quantization happen simultaneously.
- Offline Training: The regressor is trained during a brief calibration phase on a small dataset, learning the relationship between input features and optimal dynamic parameters.
- Extra QPP Blocks: In very deep networks, the correlation between initial input and deep layers can diminish. To counter this, "Extra QPP" blocks can be placed at intermediate stages to refresh predictions.
Theoretical Foundation: Linearity in Deep Networks
A key insight justifying the use of simple linear regression is the strong linear relationship between the variance of input data and the variance of internal activations. The authors demonstrate both theoretically and empirically that this correlation holds true, particularly in shallower layers.
This linearity allows QPP to act as a stabilizer, especially in Dense+Sparse (D+S) quantization. In D+S, a small percentage of outliers are kept in high precision. Static methods often suffer from "density spikes" where minor prediction errors cause the number of outliers to explode. QPP adjusts thresholds dynamically based on the input, keeping outlier density stable and preventing computational hangs.
Experimental Results
The authors evaluated QPP across diverse tasks, including ImageNet classification (ResNet), CityScapes segmentation (HRNet), and super-resolution (ESPCN).
- Accuracy: QPP-based models achieved performance nearly identical to full dynamic quantization. On ResNet34, QPP reached 72.67% accuracy, effectively matching the 72.72% of dynamic quantization while outperforming static methods.
- Stability: In segmentation tasks, the "Failure Rate" (significant deviation from outlier targets) dropped from 0.7% with static quantization to just 0.06% with QPP.
- Efficiency: On a Kirin 980 mobile CPU, QPP-enabled D+S quantization achieved a 1.46x speedup over the FP16 baseline and was 11% faster than standard dynamic quantization by bypassing expensive quantile calculations.
Conclusion and Future Work
QPP offers a practical solution for real-time DNN deployment, combining the accuracy of dynamic quantization with the efficiency of static methods. While "vanishing correlation" in extremely deep networks remains a challenge addressed by intermediate predictor blocks, future work may explore more sophisticated yet lightweight estimators. Additionally, the full realization of QPP's benefits, particularly in D+S quantization, will benefit from broader hardware support for fused quantized-sparse operations.
Summary updated