Joint Post-Training Quantization of Vision Transformers with Learned Prompt-Guided Data Generation
Organizations: vivo Tech Research GmbH · Torr Vision Group, Universtiy of Oxford
Abstract
We present a framework for end-to-end joint quantization of Vision Transformers trained on ImageNet for the purpose of image classification. Unlike prior post-training or block-wise reconstruction methods, we jointly optimize over the entire set of all layers and inter-block dependencies without any labeled data, scaling effectively with the number of samples and completing in just one hour on a single GPU for ViT-small. We achieve state-of-the-art W4A4 and W3A3 accuracies on ImageNet and, to the best of our knowledge, the first PTQ results that maintain strong accuracy on ViT, DeiT, and Swin-T models under extremely low-bit settings (W1.58A8), demonstrating the potential for efficient edge deployment. Furthermore, we introduce a data-free calibration strategy that synthesizes diverse, label-free samples using Stable Diffusion Turbo guided by learned multi-mode prompts. By encouraging diversity in both the learned prompt embeddings and the generated image features, our data-free approach achieves performance on par with real-data ImageNet calibration and surpasses simple text-prompt baselines such as "a <adjective> photo of <adjective> <cls>".
Figures & tables
| Method | ViT | DeiT | Swin | |||
|---|---|---|---|---|---|---|
| S | B | S | B | S | B | |
| Full-Precision | 81.39 | 84.54 | 79.85 | 81.80 | 83.23 | 85.27 |
| W1.58A8 | ||||||
| ReQ-Vit [ 14 ] | 0.12 | 0.13 | 0.11 | 0.11 | 0.09 | 0.09 |
| FIMA-Q [ 26 ] | 4.84 | 45.55 | 33.93 | 57.75 | 38.13 | 48.10 |
| Ours (Synth) | 63.71 | 76.58 | 67.06 | 77.18 | 73.06 | 75.51 |
Explore similar work
ScalePredictor: Instance-aware Scale Learning for Accurate Quantization of Vision Transformers
GPLQ: A General, Practical, and Lightning QAT Method for Vision Transformers
basin'' to maintain generalization. Consequently, GPLQ employs a sequential activation-first, weights-later'' strategy. Stage 1 keeps weights in FP32 while quantizing activations with a feature mimicking loss in only 1 epoch to keep it stay in the same ``basin'', thereby preserving generalization. Stage 2 quantizes weights using a PTQ method. As a result, GPLQ is 100x faster than existing QAT methods, lowers memory footprint to levels even below FP32 training, and achieves 4-bit model performance that is highly competitive with FP32 models in terms of both accuracy on ImageNet and generalization to diverse downstream tasks, including fine-grained visual classification and object detection. We will release an easy-to-use open-source toolkit supporting multiple vision tasks.