[论文解读] When Adversarial Training Meets Vision Transformers: Recipes from Training to Architecture
本文对视觉Transformer(ViTs)的对抗性训练进行了全面研究,识别出预训练和SGD作为实现鲁棒性的关键训练组件。文章提出了两种新型的架构感知方法——注意力随机丢弃(ARD)和扰动随机掩码(PRM),通过在训练过程中随机掩码注意力模块中的梯度或图像块上的扰动,显著提升了对抗鲁棒性,在CIFAR-10和ImageNet-1K基准上达到了最先进性能。
Vision Transformers (ViTs) have recently achieved competitive performance in broad vision tasks. Unfortunately, on popular threat models, naturally trained ViTs are shown to provide no more adversarial robustness than convolutional neural networks (CNNs). Adversarial training is still required for ViTs to defend against such adversarial attacks. In this paper, we provide the first and comprehensive study on the adversarial training recipe of ViTs via extensive evaluation of various training techniques across benchmark datasets. We find that pre-training and SGD optimizer are necessary for ViTs' adversarial training. Further considering ViT as a new type of model architecture, we investigate its adversarial robustness from the perspective of its unique architectural components. We find, when randomly masking gradients from some attention blocks or masking perturbations on some patches during adversarial training, the adversarial robustness of ViTs can be remarkably improved, which may potentially open up a line of work to explore the architectural information inside the newly designed models like ViTs. Our code is available at https://github.com/mo666666/When-Adversarial-Training-Meets-Vision-Transformers.
研究动机与目标
- 识别在对抗性训练下提升视觉Transformer(ViTs)对抗鲁棒性的关键训练技术。
- 探究ViT独特的架构组件是否可被利用,以在标准训练配方之外进一步提升鲁棒性。
- 提供一个实用的、基于实证验证的基准(即“技巧合集”),用于对抗性训练ViT。
- 提出并评估基于梯度和扰动掩码的新型架构感知防御机制——ARD和PRM。
提出的方法
- 在CIFAR-10和ImageNet-1K上,通过对抗性训练对ViTs的多种训练技术(优化器、预训练、数据增强、损失函数)进行实证评估。
- 提出注意力随机丢弃(ARD),在反向传播过程中随机掩码选定注意力模块的梯度,以正则化特征学习。
- 引入扰动随机掩码(PRM),在对抗样本生成过程中随机掩码选定图像块上的扰动,以提升鲁棒性。
- 将ARD和PRM作为早期训练阶段的预热策略,两者共享一个超参数 $ n_w $。
- 将ARD和PRM与现有防御方法(如TRADES和MART)结合,评估其泛化能力和有效性。
- 对超参数 $ n_w $ 进行消融研究,包括对ARD和PRM分别进行调优,以优化性能。
实验结果
研究问题
- RQ1在ViTs中,哪些训练技术——如优化器选择、预训练或数据增强——对对抗鲁棒性最为关键?
- RQ2与CNN相比,ViT的架构设计(特别是其自注意力机制)如何影响对抗鲁棒性?
- RQ3ViT中的架构归纳偏置能否被利用,以在标准对抗训练之外进一步提升对抗鲁棒性?
- RQ4ARD和PRM在预热阶段的最优配置是什么?其与标准防御方法的交互关系如何?
- RQ5ARD和PRM的组合是否在不同ViT变体和数据集上均能持续提升鲁棒性?
主要发现
- 预训练和使用SGD优化器是实现ViTs高对抗鲁棒性的关键,AdamW在对抗训练设置下表现较差。
- 结合ARD和PRM的对抗训练在CIFAR-10上将DeiT-Ti模型在PGD-100攻击下的鲁棒性提升最高达1.63%,且在多个模型上均表现出一致增益。
- 将ARD和PRM与TRADES和MART结合,可实现最先进性能,分别使DeiT-Ti在AA鲁棒性上提升0.77%和1.63%。
- ARD表现出与较长预热周期($ n_w $)的正相关性,而PRM在超过最优$ n_w $后收益递减,表明其敏感性特征不同。
- 所提方法对超参数调优具有鲁棒性,性能在$ n_w \in \{10,15,20\}$范围内稳定,便于部署。
- ARD和PRM在多种ViT架构(包括DeiT-Ti、ConViT-Ti和Swin-Ti)中均表现有效,证明了其泛化能力。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。