Abstract
We introduce a Power-of-Two low-bit post-training quantization (PTQ) method for deep neural networks that meets hardware requirements and does not call for long-time retraining. Power-of-Two (Po2) quantization can convert the multiplication introduced by quantization and dequantization to bit-shifts, which are adopted by many efficient accelerators. However, Po2 scale factors have fewer candidate values, leading to more rounding or clipping errors. We propose a novel Po2 PTQ framework, dubbed RAPQ, which dynamically adjusts the Po2 scales of the whole network instead of statically determining them layer by layer. It can theoretically trade off the rounding error and clipping error of the whole network. Meanwhile, the reconstruction method in RAPQ is based on the Batch Normalization (BN) information of every unit. Extensive experiments on ImageNet prove the excellent performance of our proposed method. Without bells and whistles, RAPQ can reach accuracy of 65% and 48% on ResNet-18 and MobileNetV2 respectively with weight INT2 and activation INT4. We are the first to propose the more constrained but hardware-friendly Po2 quantization scheme for low-bit PTQ specifically and prove that it can achieve nearly the same accuracy as SOTA PTQ methods.
Introduction
To deploy deep neural networks on edge devices, quantization is essential—converting high-precision floating-point numbers into low-bit integers (like INT4 or INT2). Most quantization methods use floating-point scale factors to map these values. However, specialized hardware accelerators such as FPGAs and ASICs are significantly more efficient if these scale factors are restricted to Powers-of-Two ($2^n$). This restriction allows hardware to replace expensive multiplications with simple, high-speed bit-shifts.
The challenge lies in the discrete and sparse nature of Po2 values. Simply rounding a standard scale factor to the nearest Po2 value often leads to accuracy collapse, particularly in lightweight models like MobileNetV2. This occurs because Po2 scales create a rigid grid that induces significant rounding or clipping errors. RAPQ aims to bridge this gap, achieving hardware efficiency without sacrificing the accuracy of unconstrained quantization.
Methodology
RAPQ introduces two primary innovations to mitigate the accuracy loss associated with Po2 constraints.
Power-of-Two Scale Grouping (Po2 SG)
Instead of selecting the optimal Po2 scale for each layer in isolation—a "greedy" approach that often leads to suboptimal global performance—RAPQ treats the entire block or network as a single optimization problem. It utilizes a "soft quantization" technique where scale factors are treated as continuous variables during an initial "warm-up" phase. This allows the network to find a global trade-off between clipping error (squashing high values) and rounding error (losing precision in small values).
BN-based L-P Loss
Standard quantization reconstruction typically employs a Mean Squared Error ($L_2$) loss. However, $L_2$ is highly sensitive to outliers. RAPQ argues that different layers have varying tolerances for outliers based on their data variance. The framework utilizes the $\gamma$ (gamma) parameter from pre-existing Batch Normalization (BN) layers as a proxy for this variance. A custom $P$ value is calculated for an $L_p$ loss function for each layer:
- High Variance (High $\gamma$): The loss function uses a higher $P$ to preserve important outliers.
- Low Variance: It uses a lower $P$ to focus on the median distribution.
Experimental Results
The researchers evaluated RAPQ primarily on the ImageNet (ILSVRC2012) dataset across several architectures, including ResNet-18, ResNet-50, and the notoriously difficult-to-quantize MobileNetV2.
RAPQ significantly outperforms previous Po2 methods and rivals state-of-the-art (SOTA) unconstrained PTQ methods:
- MobileNetV2 (W2/A4): A naive Po2 approach yields only 2.64% accuracy. RAPQ "rescues" this to 48.12%.
- ResNet-18 (W2/A4): Achieves 65.32% accuracy, nearly identical to unconstrained methods like BRECQ, despite the hardware-friendly Po2 constraint.
- Computational Efficiency: The framework includes a "Quick Mode" that can quantize a ResNet-18 model in roughly 10 minutes on a single GPU (RTX 3090), making it highly practical for industrial deployment.
Discussion and Conclusion
A key insight of this work is that choosing a scale factor is a zero-sum game between rounding and clipping errors. By leveraging BN statistics—a "free" resource already present in most modern models—RAPQ adaptively tunes the reconstruction process to the specific needs of each layer.
While RAPQ shows excellent performance for 2-bit weights, pushing activations down to 2-bit while maintaining Po2 constraints remains a challenge. Future work may explore task generalization to object detection and the potential for data-free quantization to address privacy concerns. Nonetheless, RAPQ proves that hardware-constrained Po2 quantization can achieve high accuracy without the need for expensive retraining.
Summary updated