NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Diversifying Sample Generation for Accurate Data-Free Quantization

Xiangguo Zhang, Haotong Qin, Yifu Ding, Ruihao Gong, Qinghua Yan, Renshuai Tao, Yuhang Li, Fengwei Yu, Xianglong Liu

Abstract

Data-free quantization (DFQ) is a critical technique for compressing Deep Neural Networks (DNNs) when original training data is unavailable due to privacy or security concerns. Current DFQ methods typically generate synthetic data by strictly matching the Batch Normalization (BN) statistics of the pre-trained model. However, this approach leads to "homogenized" data that lacks the diversity of real-world distributions, causing significant performance degradation in ultra-low-bit quantization. We propose Diverse Sample Generation (DSG), a novel scheme that intentionally relaxes these constraints to produce more varied and representative synthetic samples. By implementing Slack Distribution Alignment (SDA) and Layerwise Sample Enhancement (LSE), DSG achieves substantial accuracy improvements, particularly in 4-bit models, sometimes even surpassing the performance of models calibrated with limited real data.

Introduction

Quantization reduces the precision of DNN weights and activations (e.g., from 32-bit to 4-bit), enabling efficient deployment on resource-constrained devices. While standard quantization relies on a small calibration dataset, Data-Free Quantization (DFQ) synthesizes data using internal model statistics. A major hurdle in DFQ is the homogenization of synthetic data; because existing methods aim for a perfect match with internal BN statistics, the resulting data is overly uniform. Real-world data is inherently diverse and "messy," and synthetic data that fails to capture this variance results in poor calibration for low-bit models.

Methodology: Diverse Sample Generation (DSG)

The DSG scheme addresses the homogenization problem through two primary mechanisms designed to inject diversity at both the distribution and sample levels.

The Diverse Sample Generation (DSG) framework, featuring Slack Distribution Alignment (SDA) and Layerwise Sample Enhancement (LSE).

Slack Distribution Alignment (SDA)

Instead of forcing synthetic data to align perfectly with BN statistics, SDA introduces relaxation constants or "margins." This allows feature distributions to fluctuate within a controlled range, preventing the synthetic data from overfitting to the static BN layers and better approximating the natural variance found in real datasets.

Layerwise Sample Enhancement (LSE)

Standard DFQ methods often optimize entire batches using a global loss function. LSE differentiates this process by assigning unique enhancement targets to different layers for individual samples within a batch. This ensures that each synthetic image represents different hierarchical features of the network, significantly increasing sample-level diversity.

Experimental Results

The researchers evaluated DSG on the ImageNet (ILSVRC12) dataset across various architectures, including ResNet, InceptionV3, and mobile-optimized networks like SqueezeNext and ShuffleNet.

Comparison of feature distributions (a) and mean-std statistics (b) between real data, ZeroQ, and the proposed DSG.

Accuracy Gains in Ultra-Low-Bit Regimes

The most significant improvements were observed in 4-bit (W4A4) configurations:

  • ResNet-18: DSG achieved 34.53% accuracy, a marked improvement over the 26.04% achieved by the previous state-of-the-art method, ZeroQ.
  • InceptionV3: DSG reached 34.89% accuracy, compared to only 12.00% for ZeroQ.
  • SqueezeNext (W6A6): DSG outperformed ZeroQ by over 20 percentage points (60.50% vs 39.83%).

When combined with advanced post-training quantization techniques like AdaRound, DSG achieved near-lossless 5-bit quantization, maintaining accuracy within 0.05% of the original full-precision model.

Discussion and Conclusion

The success of DSG highlights a counter-intuitive "overfitting paradox" in data-free quantization: synthetic data that matches a model's internal statistics too perfectly is less effective for calibration. Diversity is the critical factor for high-accuracy quantization. Notably, in some ultra-low-bit scenarios, DSG-calibrated models outperformed those using limited real data, suggesting that synthetic diversity can effectively cover edge cases that small real-world samples might miss.

While DSG offers a powerful "plug-and-play" solution, future work is needed to optimize the computational cost of generating high-quality synthetic samples and to extend these techniques to tasks beyond image classification, such as object detection and segmentation.

Summary updated

BibTeX
@inproceedings{zhang2021diversifying,
  author = {Xiangguo Zhang and Haotong Qin and Yifu Ding and Ruihao Gong and Qinghua Yan and Renshuai Tao and Yuhang Li and Fengwei Yu and Xianglong Liu},
  title = {{Diversifying Sample Generation for Accurate Data-Free Quantization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  doi = {10.1109/cvpr46437.2021.01540},
}
Figure