Skip to main content
QUICK REVIEW

[論文レビュー] Are Transformers More Robust Than CNNs?

Yutong Bai, Jieru Mei|arXiv (Cornell University)|Nov 10, 2021
Adversarial Robustness in Machine Learning被引用数 93
ひとこと要約

統一された訓練設定の下で、CNNとTransformersは類似の adversarial robustness を示す一方、Transformers の self-attention アーキテクチャは out-of-distribution データに対するロバストネスを向上させる。

ABSTRACT

Transformer emerges as a powerful tool for visual recognition. In addition to demonstrating competitive performance on a broad range of visual benchmarks, recent works also argue that Transformers are much more robust than Convolutions Neural Networks (CNNs). Nonetheless, surprisingly, we find these conclusions are drawn from unfair experimental settings, where Transformers and CNNs are compared at different scales and are applied with distinct training frameworks. In this paper, we aim to provide the first fair & in-depth comparisons between Transformers and CNNs, focusing on robustness evaluations. With our unified training setup, we first challenge the previous belief that Transformers outshine CNNs when measuring adversarial robustness. More surprisingly, we find CNNs can easily be as robust as Transformers on defending against adversarial attacks, if they properly adopt Transformers' training recipes. While regarding generalization on out-of-distribution samples, we show pre-training on (external) large-scale datasets is not a fundamental request for enabling Transformers to achieve better performance than CNNs. Moreover, our ablations suggest such stronger generalization is largely benefited by the Transformer's self-attention-like architectures per se, rather than by other training setups. We hope this work can help the community better understand and benchmark the robustness of Transformers and CNNs. The code and models are publicly available at https://github.com/ytongbai/ViTs-vs-CNNs.

研究の動機と目的

  • CNN と Transformer のロバストネスを比較する公正なベンチマークを動機づけ、偏ったスケール差のある評価を避ける
  • perturbation-based および patch-based 攻撃に対する adversarial robustness を評価
  • out-of-distribution ベンチマーク(ImageNet-A, ImageNet-C, Stylized-ImageNet)での robust ness generalization を評価
  • 訓練レシピとアーキテクチャがロバストネスの結论に与える影響を調査
  • さまざまなアーキテクチャ間でのロバストネスのベンチマークを実行可能な指針として提供

提案手法

  • ResNet-50 (CNN) と DeiT-S (Transformer) を均等な容量(約22–25M パラメータ)で訓練
  • 標準的な CNN および DeiT レシピに従い 100-epoch 訓練と DeiT-S の 100-epoch 訓練を実施
  • AutoAttack、PGD 変種、Texture Patch Attack (TPA) に対する adversarial robustness を評価
  • ImageNet-A、ImageNet-C、Stylized-ImageNet などの out-of-distribution データセットでの robust ness を評価
  • 最適化手法、学習率スケジューラー、augmentation 戦略(RandAug、Mixup、CutMix)、活性化関数(ReLU vs GELU)のアブレーションを実施
  • アーキテクチャ間のロバストネス移転を検証するための蒸留やハイブリッドアーキテクチャを探索

実験結果

リサーチクエスチョン

  • RQ1Transformers が、公平で整列された訓練設定の下で CNN を上回る adversarial robustness を inherently 示すのか?
  • RQ2CNN に Transformers の訓練レシピを適用することで adversarial robustness が改善されるか?
  • RQ3Transformers は pre-training のスケールに依存せず out-of-distribution データに対する robustness を提供するのか?
  • RQ4Transformers の自己注意型アーキテクチャによるロバストネスの優位性が、訓練設定だけでなくアーキテクチャ自体に起因するのか?

主な発見

  • 統一された訓練条件の下では、Transformers は perturbation-based adversarial attacks に対して CNN よりロバストではない。
  • CNN-style のレシピでの adversarial training は GELU を用いると DeiT-S のロバストネスに匹敵するが、標準的な CNN 訓練と比較してクリーン精度が低下する可能性がある。
  • CNN は強力な augmentation(例: CutMix)を用いることで patch-based 攻撃のロバストネスを大幅に改善でき、Transformers に近づくか超える設定もある。
  • Transformers は large な外部事前訓練がなくても out-of-distribution generalization ベンチマーク(ImageNet-A、ImageNet-C、Stylized-ImageNet)で一貫して CNN を上回る。
  • out-of-distribution データに対するロバストネスのギャップは、主にアーキテクチャ(self-attention)に起因するものであり、訓練設定だけではなく Transformer ブロックを用いたハイブリッドモデルが CNN よりロバストネスを向上させる。
  • 知識蒸留はロバストネスを伝達する:教師として DeiT-S を用いると student の ResNet-50 のロバストネスが向上するが、逆(ResNet-50 を教師とする)は同じロバストネス向上を生じない、蒸留によるアーキテクチャのロバスト性移転は容易でないことを示唆。
  • モデルサイズを拡大した比較(ResNet-18/50/101 対 DeiT-Mini/S)を横断しても、Transformers の方が out-of-distribution データに対するロバストネス一般化を強く提供することを一貫して示している。

より良い研究を、今すぐ始めましょう

論文の読解から最終レビューまで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。