Skip to main content
QUICK REVIEW

[论文解读] On the Adversarial Robustness of Vision Transformers

Rulin Shao, Zhouxing Shi|arXiv (Cornell University)|Mar 29, 2021
Adversarial Robustness in Machine LearningComputer Science被引用 50
一句话总结

本文分析 Vision Transformers (ViTs) 相对于 CNNs 和 MLP-Mixers 的对抗鲁棒性,显示 ViTs 提供更强的鲁棒性,包括经过认证的鲁棒性,并研究基于频率的解释与训练策略。

ABSTRACT

Following the success in advancing natural language processing and understanding, transformers are expected to bring revolutionary changes to computer vision. This work provides a comprehensive study on the robustness of vision transformers (ViTs) against adversarial perturbations. Tested on various white-box and transfer attack settings, we find that ViTs possess better adversarial robustness when compared with MLP-Mixer and convolutional neural networks (CNNs) including ConvNeXt, and this observation also holds for certified robustness. Through frequency analysis and feature visualization, we summarize the following main observations contributing to the improved robustness of ViTs: 1) Features learned by ViTs contain less high-frequency patterns that have spurious correlation, which helps explain why ViTs are less sensitive to high-frequency perturbations than CNNs and MLP-Mixer, and there is a high correlation between how much the model learns high-frequency features and its robustness against different frequency-based perturbations. 2) Introducing convolutional or tokens-to-token blocks for learning high-frequency features in ViTs can improve classification accuracy but at the cost of adversarial robustness. 3) Modern CNN designs that borrow techniques from ViTs including activation function, layer norm, larger kernel size to imitate the global attention, and patchify the images as inputs, etc., could help bridge the performance gap between ViTs and CNNs not only in terms of performance, but also certified and empirical adversarial robustness. Moreover, we show adversarial training is also applicable to ViT for training robust models, and sharpness-aware minimization can also help improve robustness, while pre-training with clean images on larger datasets does not significantly improve adversarial robustness.

研究动机与目标

  • 评估并比较 ViTs 在白盒、迁移与认证设定下对抗鲁棒性,相对于 CNNs 和 MLP-Mixer。
  • 通过频率分析和特征可视化识别 ViT 鲁棒性的来源。
  • 探索架构选择(卷积、token-to-token 块,以及纯 Transformer 块)如何影响鲁棒性与准确性。
  • 评估对抗性训练和敏锐度感知优化对 ViT 鲁棒性的影响。

提出的方法

  • 在ℓ∞ 范围内的攻击下评估鲁棒性(PGD、AutoAttack),涵盖广泛模型,包括 ViT 变体、ConvNeXt、MLP-Mixer 和 CNN。
  • 进行频率过滤的 PGD 攻击,以分离高频与低频扰动并分析鲁棒性趋势。
  • 使用去噪随机平滑来认证鲁棒性并计算认证半径作为鲁棒性度量。
  • 可视化第一层特征以将学习到的频率内容与鲁棒性联系起来,并在混合架构(CNN+ViT、T2T-ViT、Swin)上进行消融研究,以研究鲁棒性-准确性权衡。
  • 研究对抗性样本在 ViTs 与 CNN 之间的迁移性,并评估预训练与敏锐度感知优化的影响。

实验结果

研究问题

  • RQ1Vision Transformers 是否在白盒与迁移攻击下展现出比 CNNs 和 MLP-Mixer 更高的对抗鲁棒性?
  • RQ2构成 ViT 鲁棒性的基于频率的因素有哪些,架构选择如何影响这一点?
  • RQ3去噪随机平滑是否可以为 ViTs 相对于 CNNs 提供认证鲁棒性优势?
  • RQ4诸如对抗性训练和敏锐度感知最小化等训练策略如何影响 ViT 的鲁棒性与净准确性?
  • RQ5混合架构中 Transformer 块与 CNN 块的比例如何影响鲁棒性?

主要发现

  • ViTs 在若干攻击下实现更高的鲁棒准确率(RA),例如在特定条件下 ViT-S/16 的 RA 高达 59.8%,而 CNN 的提升最多约 16.7%。
  • ViTs 对高频扰动的敏感性较低,与 CNNs 和 MLP-Mixer 相比,高频特征与鲁棒性差距相关。
  • 在相同设置下,去噪随机平滑为 ViTs 提供显著更好的认证鲁棒性,优于 CNN。
  • 在 ViT 中加入 CNN 块或 token-to-token 块可以提高净识别准确性,但通常会降低对抗鲁棒性。
  • 在混合架构中增加 Transformer 块的比例可以提高鲁棒性,尽管单纯的纯 Transformer 大小并不能保证(例如 ViT-S/16 比 ViT-B/16 更鲁棒)。
  • 在没有对抗性训练的情况下,在更大数据集上进行预训练并不能显著提升鲁棒性;对抗性训练和敏锐度感知最小化能提高 ViT 的鲁棒性和/或净准确性。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。