让合成数据更懂模型,提升视觉Transformer的无数据量化效果
Selective Coupling of Decoupled Informative Regions: Masked Attention Alignment for Data-Free Quantization of Vision Transformers

- 识别注意力机制中关键的稀疏信息区域,分离出有用特征
- 通过掩码对齐使合成数据与量化模型保持高互信息,精度提升显著
- 支持持续更新合成数据,适配训练中动态变化的量化模型
无数据量化(DFQ)在不访问真实数据的前提下通过生成样本解决数据安全问题,尤其适用于自注意力机制优于传统卷积的视觉Transformer(ViTs)。然而,现有方法常因合成样本与量化模型期望输入分布不匹配,导致性能不佳。本文提出新型掩码注意力对齐方法(MaskAQ),揭示:1)自注意力中的语义信息主要集中于少量稀疏补丁区域,即信息区域;2)这些信息区域主导了合成样本与量化模型输出之间的互信息。为此,我们通过最大化合成样本补丁相似性的微分熵,实现信息区域与噪声背景的解耦。为适配不同量化模型,采用掩码注意力对齐目标,选择关键信息区域以对齐全精度模型与量化模型,生成高质量合成样本。此外,引入周期性样本刷新策略,使MaskAQ能持续适应量化模型在训练过程中的演化状态,保持理想的互信息。大量实验表明,该方法在多种骨干网络和下游任务上均优于现有最优方案。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。