Abstract
Quantizing Vision Transformers (ViTs) to low-bit representations is essential for edge deployment but typically requires access to original training data. Data-Free Quantization (DFQ) attempts to circumvent this by synthesizing data, yet existing methods for ViTs often produce semantically distorted or inadequate images. We introduce SARDFQ (Semantics Alignment and Reinforcement Data-Free Quantization), a framework that leverages structural attention priors and local semantic reinforcement. By forcing synthetic images to align with structured attention maps and diversifying patch-level semantics, SARDFQ achieves substantial accuracy improvements, notably boosting 4-bit ViT-B top-1 accuracy on ImageNet by over 15%.
Introduction
The deployment of large-scale Vision Transformers (ViTs) on resource-constrained hardware necessitates aggressive quantization. While standard quantization-aware training relies on original datasets, privacy and security concerns often restrict data access, leading to the rise of Data-Free Quantization (DFQ). Unlike Convolutional Neural Networks (CNNs), ViTs lack Batch Normalization layers, which are typically exploited in DFQ to recover data statistics. Consequently, synthetic data generated for ViTs often suffers from two primary issues: semantic distortion, where features fail to align with real-world object structures, and semantic inadequacy, where generated images lack the textural complexity needed to effectively calibrate the model.
Methodology: SARDFQ
To address these challenges, we propose SARDFQ, which incorporates three innovative modules: Attention Priors Alignment (APA), Multi-Semantic Reinforcement (MSR), and Soft-Label Learning (SL).
Attention Priors Alignment (APA)
APA serves as a semantic anchor. Instead of allowing the generator to produce unconstrained noise, APA enforces structural constraints by requiring the model's internal attention maps to match predefined "attention priors." These priors are generated using Gaussian Mixture Models (GMMs) to simulate the spatial distribution of objects. By optimizing synthetic images to evoke these structured attention responses, the framework ensures that the generated data possesses a coherent global structure similar to real-world imagery.
Multi-Semantic Reinforcement (MSR)
To combat "semantic inadequacy," MSR focuses on increasing the information density of synthetic images. Rather than optimizing an image for a single global concept, MSR divides the image into local patches and optimizes each to represent distinct semantic features. This process creates "information-dense" synthetic samples that provide a more rigorous stress test for the quantization process than the relatively "dull" images produced by prior methods.
Soft-Label Learning (SL)
Because MSR produces composite images containing multiple semantic concepts, traditional one-hot labels are insufficient. Soft-Label Learning assigns a distribution of targets to these multi-semantic images, allowing the model to learn from complex textures without the confusion of misaligned hard labels.
Experimental Results
We evaluated SARDFQ on the ImageNet-1K benchmark across various architectures, including ViT, DeiT, and Swin Transformers.
As shown in the attention map visualizations, SARDFQ's APA module successfully recovers structured attention patterns that closely resemble those elicited by real images, whereas previous methods like PSAQ-ViT produce scattered or inactive maps.
Performance Gains
SARDFQ demonstrates state-of-the-art performance, particularly in ultra-low bit settings:
- ViT-B (W4/A4): Achieved 51.84% accuracy, a 15.52% improvement over the previous best of 36.32%.
- DeiT-S (W4/A4): Improved from 58.28% to 62.29%.
- Swin-B (W4/A4): Reached 76.42%, nearing the performance of models calibrated with real data (78.80%).
Conclusion
SARDFQ significantly advances the state of data-free quantization for Vision Transformers by prioritizing semantic structure and richness over mere statistical alignment. By treating attention as a structural prior and reinforcing local semantics, the method bridges much of the gap between data-free and data-driven quantization. Future work will explore the theoretical underpinnings of these semantic priors and extend the framework to multi-modal models.
Summary updated