GenQ: Quantization in Low Data Regimes with Generative Synthetic Data

Yuhang Li, Youngeun Kim, Donghyun Lee, Souvik Kundu, Priyadarshini Panda

Abstract

Deep neural network quantization is essential for efficient edge deployment but typically requires access to original training data to mitigate accuracy degradation. In many real-world scenarios, this data is unavailable due to privacy or proprietary restrictions. We present GenQ, a framework that utilizes advanced text-to-image diffusion models (e.g., Stable Diffusion) to synthesize high-fidelity calibration data. By combining generative sampling with specialized filtering mechanisms, GenQ achieves state-of-the-art performance in both data-free and data-scarce quantization tasks, significantly outperforming traditional inversion-based methods in both accuracy and generation speed.

Introduction

To deploy large-scale models on resource-constrained devices, engineers employ quantization—converting 32-bit weights into low-precision formats like 4-bit or 2-bit. While effective for reducing memory and power consumption, quantization often introduces significant errors. The standard remedy is fine-tuning with original training data, which is frequently inaccessible due to regulations like GDPR or HIPAA.

Existing "data-free" solutions rely on model inversion or GANs. However, these methods are computationally expensive, often produce low-quality "dream-like" textures, and fail to capture the diversity of complex datasets like ImageNet. GenQ addresses these challenges by shifting the paradigm from optimizing pixels to sampling from a powerful, pre-trained generative prior.

The GenQ Framework

GenQ leverages the rich internal knowledge of Stable Diffusion (v1.5) to create photorealistic synthetic data. The framework operates in two primary modes:

  1. Data-Free Quantization (DFQ): Generates images using simple class-label prompts (e.g., "A photo of a [class]").
  2. Data-Scarce Quantization (DSQ): When a minimal amount of real data is available (e.g., 1-shot), GenQ uses prompt tuning to learn token embeddings that capture the specific style and characteristics of the target domain.
Overview of the GenQ pipeline, illustrating synthetic data generation via Stable Diffusion followed by energy and architecture-specific filtering.

Robust Filtering Mechanisms

A key contribution of GenQ is its filtering pipeline, which bridges the "distribution gap" between synthetic and real data. Not all generated images are equally useful for quantization. GenQ employs:

  • Energy Filtering: An energy-based Out-of-Distribution (OOD) detector identifies images that the pre-trained model recognizes with high confidence.
  • Architecture-Specific Filtering: For CNNs, BatchNorm (BN) Sensitivity Filtering selects images matching the original model's internal statistics. For Vision Transformers (ViTs), Patch Similarity Filtering ensures data diversity by analyzing differential entropy.

Experimental Results

GenQ was evaluated on ImageNet-1k across various architectures, including ResNet, MobileNetV2, and Vision Transformers.

State-of-the-Art Accuracy

In 4-bit Quantization-Aware Training (QAT) for ResNet-50, GenQ achieved 76.10% accuracy, a 5.4% improvement over previous methods. In the ultra-low bit regime (W2A4), GenQ outperformed existing benchmarks by over 4% on MobileNetV2 and MnasNet.

Efficiency and Transferability

Unlike GAN-based methods where generators are often tied to specific models, GenQ’s synthetic data is highly transferable across architectures. Furthermore, sampling from a diffusion model is up to 15x faster than the iterative optimization required for high-quality image inversion.

Performance comparison of GenQ against existing methods in PTQ, QAT, and data generation speed.

Conclusion

GenQ demonstrates that high-quality, photorealistic synthetic data is a superior proxy for real data in quantization tasks compared to traditional model inversion. By leveraging the generative power of diffusion models and implementing rigorous filtering, GenQ provides a robust, efficient, and highly accurate solution for deploying deep learning models in data-restricted environments.

Summary updated

BibTeX
@inproceedings{li2024genq,
  author = {Yuhang Li and Youngeun Kim and Donghyun Lee and Souvik Kundu and Priyadarshini Panda},
  title = {{GenQ: Quantization in Low Data Regimes with Generative Synthetic Data}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72624-8\_13},
}
Figure