Abstract
Zero-shot Adversarial Quantization (ZAQ) addresses the challenge of quantizing deep neural networks without access to original training data. By employing an adversarial generator to synthesize informative data that maximizes the discrepancy between full-precision and quantized models, ZAQ enables effective knowledge distillation. Key innovations include a Channel Relation Map (CRM) for precision-neutral feature comparison and a two-level discrepancy modeling approach. Experimental results demonstrate that ZAQ achieves state-of-the-art performance across classification, detection, and segmentation tasks, particularly at ultra-low bitwidths like 2-bit and 4-bit, while significantly reducing computation time compared to existing data-free methods.
Introduction
Deep learning models are often too large to run efficiently on mobile or edge devices. Quantization—the process of reducing the precision of a model's weights and activations (e.g., from 32-bit floats to 4-bit integers)—is a standard solution. However, quantization usually causes a significant drop in accuracy. To mitigate this, researchers typically "fine-tune" the quantized model using the original training dataset.
In real-world scenarios, accessing original data is often impossible due to privacy, proprietary restrictions, or massive data volume. Existing "data-free" methods either perform poorly at very low precision or rely on slow, iterative processes to reconstruct data from the model's internal statistics. ZAQ aims to bridge this gap by generating diverse, informative synthetic data to guide the quantization process through an adversarial framework.
Methodology
The authors propose a Zero-shot Adversarial Quantization (ZAQ) framework, operating as a minimax game between two components:
- The Generator ($G$): Synthesizes "hard" data examples that maximize the discrepancy between the original full-precision model ($P$) and the new quantized model ($Q$).
- The Quantized Model ($Q$): Learns from these synthetic examples to minimize that same discrepancy, effectively distilling knowledge from the original model.
Key Innovations
- Two-Level Discrepancy Modeling: ZAQ evaluates discrepancy at two levels: Output Discrepancy ($D_o$), comparing final predictions, and Inter-channel Discrepancy ($D_f$).
- Channel Relation Map (CRM): Directly comparing internal features of a 32-bit model and a 2-bit model is problematic due to scale differences. ZAQ uses CRM to compare the relationships (cosine similarity) between feature channels rather than raw values, creating a "precision-neutral" metric for knowledge transfer.
- Activation Regularization ($L_a$): This term encourages the generator to produce samples that trigger high activations in the original model, ensuring synthetic data remains within the model's functional domain and avoids meaningless noise.
Experimental Results
ZAQ was evaluated across classification (CIFAR, ImageNet), segmentation (Cityscapes, CamVid), and object detection (PASCAL VOC2012) tasks. It consistently outperformed existing data-free baselines like ZeroQ and GDFQ, particularly in ultra-low precision scenarios.
- ImageNet (ResNet50): At 4-bit precision (W4A4), ZAQ achieved 70.06% accuracy. At 2-bit (W2A2), it reached 65.52%, a massive improvement over the raw quantization baseline of 11.25%.
- Segmentation (Cityscapes): ZAQ achieved an mIoU of 55.12 at 4-bit, significantly higher than ZeroQ (52.73) and DFQ (19.06).
Beyond accuracy, ZAQ is significantly faster. On Cityscapes, it reduced the GPU time required for data generation by 57.5% compared to ZeroQ because its adversarial nature allows it to explore the "discrepancy space" more efficiently, requiring fewer iterations to produce high-quality samples.
Conclusion
ZAQ represents a significant advancement in data-free quantization by leveraging adversarial learning and relational feature mapping. While a performance gap still exists compared to fine-tuning with real data, ZAQ's ability to handle complex tasks like semantic segmentation at ultra-low bitwidths makes it a highly practical solution for deploying models on resource-constrained hardware. Future work may extend this framework to Natural Language Processing and automated mixed-precision quantization.
Summary updated