Adaptive Data-Free Quantization

Biao Qian, Yang Wang, Richang Hong, Meng Wang · DOI

Abstract

Data-free quantization (DFQ) is essential for deploying deep neural networks on edge devices when original training data is inaccessible due to privacy or security. However, existing DFQ methods often suffer from sample mismatch, where synthetic data is either too complex for low-bit models (underfitting) or too simple for high-bit models (overfitting). We present Adaptive Data-Free Quantization (AdaDFQ), a zero-sum game framework that adaptively regulates the difficulty of synthetic samples. By optimizing a margin between "agreement" and "disagreement" samples, AdaDFQ ensures that the generator produces samples tailored to the quantized model's learning capacity. Experimental results on ImageNet show that AdaDFQ significantly outperforms state-of-the-art methods, particularly in ultra-low-bit (3-bit) settings.

Introduction

Quantization reduces the precision of neural network weights and activations to enable efficient execution on resource-constrained hardware. Standard quantization-aware training typically requires access to the original dataset for calibration. In scenarios where data is restricted, Data-Free Quantization (DFQ) utilizes a generator to synthesize training samples based on a pre-trained full-precision model.

A critical challenge in DFQ is "sample adaptability." Existing generators often operate independently of the quantized model's state, leading to a mismatch. In 3-bit precision, models often fail to converge because the generated samples are too difficult (underfitting). Conversely, in 5-bit precision, models may overfit to overly simplistic synthetic data. AdaDFQ addresses this by explicitly linking the generation process to the target model's bit-width and current performance.

Methods: The Zero-Sum Game of Adaptability

AdaDFQ frames the quantization process as a dynamic zero-sum game between a Generator ($G$) and a Quantized Network ($Q$). The core objective is to generate samples that provide the most useful "lesson" for the student's current learning stage.

Conceptual framework of AdaDFQ showing the optimization of agreement and disagreement samples within a defined margin.

The framework categorizes synthetic data into two types:

  1. Disagreement Samples: Instances where the full-precision teacher model ($P$) predicts correctly, but the quantized student ($Q$) does not. These provide the necessary signal for $Q$ to improve.
  2. Agreement Samples: Instances where both $P$ and $Q$ predict correctly, serving to stabilize $Q$ and prevent it from deviating from known good features.

AdaDFQ optimizes a "margin" between these boundaries using a hinge loss. This ensures the information entropy of generated samples remains within a desirable range, preventing the generator from becoming too aggressive or too passive. Additionally, Batch Normalization Statistics (BNS) are leveraged to ensure synthetic samples maintain the distribution of the original data.

Experimental Evaluation

The method was evaluated on CIFAR-10, CIFAR-100, and ImageNet (ILSVRC2012) across various architectures, including ResNet-18, ResNet-50, and MobileNetV2.

Comparison of disagreement levels and classification loss across different bit-widths for GDFQ, Qimera, and AdaDFQ.

As shown in the performance curves, AdaDFQ maintains stable learning across different precision levels. In the challenging 3-bit ImageNet task with ResNet-18, AdaDFQ achieved 38.10% accuracy, a substantial improvement over GDFQ (20.23%) and Qimera (1.17%). For MobileNetV2 at 3-bit, it reached 28.99%, where most competitors failed to exceed 15%. In higher-precision (5-bit) settings, AdaDFQ avoids the overfitting common in other methods, maintaining a high accuracy of 70.29% on ResNet-18.

Conclusion

AdaDFQ introduces a novel perspective on data-free quantization by treating sample generation as an adaptive process. By balancing the difficulty of synthetic data through a zero-sum game, it effectively mitigates underfitting in low-bit regimes and overfitting in high-bit regimes. While the method introduces some computational overhead due to the simultaneous training of the generator, its superior performance in ultra-low-bit scenarios makes it a powerful tool for edge deployment. Future work may explore extending this "sample adaptability" principle to other data-free tasks like pruning and knowledge distillation.

Summary updated

BibTeX
@inproceedings{qian2023adaptive,
  author = {Biao Qian and Yang Wang and Richang Hong and Meng Wang},
  title = {{Adaptive Data-Free Quantization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2023},
  doi = {10.1109/cvpr52729.2023.00769},
}
Figure