Selective Coupling of Decoupled Informative Regions: Masked Attention Alignment for Data-Free Quantization of Vision Transformers
Biao Qian ⋅ Yang Wang ⋅ Yong Wu ⋅ Jungong Han
Abstract
Data-Free Quantization (DFQ) addresses data security concerns by synthesizing samples, without accessing real data. It has garnered increasing attention in the context of Vision Transformers (ViTs), owing to the superiority of the self-attention mechanism compared to classical convolutional operation. However, previous DFQ arts for ViTs often suffer from a distribution mismatch between synthetic samples and input distribution expected by quantized models $Q$, resulting in the suboptimal performance. In this paper, we propose a novel Masked Attention Alignment approach for Data-Free Quantization of ViTs, named MaskAQ, revealing that: 1) the semantics in the self-attention mechanism is predominantly localized to a sparse subset of patches, called informative regions; 2) the informative regions dominate the mutual information between synthetic samples and $Q$'s outputs. To these ends, we incorporate differential entropy maximum over patch similarity of synthetic samples, to decouple informative regions from noisy background. To couple with varied $Q$, the informative regions are selected to align full-precision models with $Q$ via a masked attention alignment objective, thus yielding high-quality synthetic samples. Furthermore, a periodic sample refreshing strategy comes up to endow MaskAQ with the capacity to continually adapt to the evolving state of $Q$ throughout the training process, to preserve desirable mutual information with synthetic samples. Extensive experiments verify the merits of MaskAQ over state-of-the-art approaches across multiple backbones and downstream tasks. Our code is available at https://github.com/hfutqian/MaskAQ.
Lay Summary
Data-Free Quantization (DFQ) aims to make large Vision Transformers (ViTs) smaller and more efficient without accessing original real data, which helps protect data privacy by synthesizing fake samples. However, for ViTs, the synthetic images used in this process may not match what the quantized model $Q$ needs, leading to lower performance. In this paper, we propose MaskAQ, a new method that improves the quality of synthetic samples. Our key idea is that important visual information in ViTs is mainly located in a small number of useful image regions. MaskAQ identifies these informative regions and uses them to better guide $Q$, while reducing the influence of noisy or less useful background areas. We also introduce a sample refreshing strategy so that the synthetic samples can continuously adapt as the quantized model changes during training. Experiments on different models and tasks show that MaskAQ performs better than existing data-free quantization methods. Our code is publicly available at https://github.com/hfutqian/MaskAQ.
Successful Page Load