Data-Free Quantization through Weight Equalization and Bias Correction

Markus Nagel, Mart van Baalen, Tijmen Blankevoort, Max Welling · DOI

Introduction

Deploying deep learning models on edge devices, such as smartphones and IoT sensors, requires significant optimization to meet power and memory constraints. Quantization—the process of converting 32-bit floating-point (FP32) weights into 8-bit integers (INT8)—is a standard technique for achieving these efficiencies. However, for modern architectures like MobileNetV2, naive quantization often leads to catastrophic accuracy loss, dropping from over 70% to near 0%.

Traditional methods to recover this accuracy typically require access to the original training data for fine-tuning (Level 3 or 4 solutions). This paper introduces Data-Free Quantization (DFQ), a "Level 1" solution that enables high-accuracy quantization using only the model's weights and architecture, without requiring a single training image.

The DFQ Methodology

The authors propose a three-step pipeline designed to prepare a model for quantization by addressing the underlying causes of accuracy degradation.

The Data-Free Quantization (DFQ) pipeline consisting of equalization, absorption, and correction steps.

1. Cross-Layer Range Equalization

Modern architectures often exhibit extreme variance in weight ranges across different channels. A single "outlier" channel with large weights can force a coarse quantization grid, destroying the precision of all other channels in that layer. DFQ exploits the scale-equivariance of the ReLU activation function ($f(sx) = sf(x)$) to rebalance weights between consecutive layers. By shrinking weights in a high-range layer and proportionally scaling up weights in the subsequent layer, the mathematical output remains identical while the weight distribution becomes significantly easier to quantize.

2. Bias Absorption

If the equalization process introduces large biases that might saturate subsequent activations, these biases are mathematically "absorbed" into the following layer to maintain numerical stability.

3. Bias Correction

Quantization noise often introduces a systematic shift in the mean output of a layer, known as biased error. DFQ utilizes an analytic method to correct this shift. By leveraging the mean and variance statistics already stored in the model's Batch Normalization (BN) layers, the expected quantization error can be calculated and subtracted from the layer's bias term, effectively "re-centering" the distribution.

Key Insights: BN Layers as Data Proxies

A fundamental insight of this work is that Batch Normalization parameters ($\beta$ and $\gamma$) serve as a statistical "memory" of the training data. Even without access to the original images, these parameters provide enough information about the activation distributions to perform effective bias correction. This realization allows DFQ to achieve results previously thought to require data-driven retraining.

Experimental Results

The DFQ method was evaluated across various computer vision tasks, including classification (ImageNet), semantic segmentation (Pascal VOC), and object detection.

Comparison of DFQ vs. Baseline accuracy across various bit-widths, demonstrating DFQ's robustness down to 6-bit quantization.
  • MobileNetV2 Classification: DFQ improved INT8 accuracy from a broken 0.12% to 71.19%, nearly matching the FP32 baseline of 71.72%.
  • Object Detection: On SSD-lite, DFQ recovered performance from 10.63 mAP to 67.91 mAP (FP32: 68.56).
  • Hardware Compatibility: By utilizing per-tensor quantization, DFQ remains highly compatible with a wide array of hardware accelerators compared to more complex per-channel methods.

Conclusion

Data-Free Quantization demonstrates that mathematical transformations of model weights can overcome the limitations of naive quantization without the need for training data. While more intensive methods still hold an edge for extreme low-bit quantization (below 6-bit), DFQ provides a powerful, simple API-level solution for deploying efficient INT8 models in privacy-sensitive or compute-constrained environments.

Summary updated

BibTeX
@inproceedings{nagel2019data,
  author = {Markus Nagel and Mart van Baalen and Tijmen Blankevoort and Max Welling},
  title = {{Data-Free Quantization through Weight Equalization and Bias Correction}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2019},
  doi = {10.1109/iccv.2019.00141},
}
Figure