Skip to main content
QUICK REVIEW

[논문 리뷰] Are Transformers More Robust Than CNNs?

Yutong Bai, Jieru Mei|arXiv (Cornell University)|2021. 11. 10.
Adversarial Robustness in Machine Learning인용 수 93
한 줄 요약

단일 통합 학습 설정에서 CNN과 Transformer는 유사한 적대적 강건성을 보이며, Transformer의 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 기반 및 patch 기반 공격 하에서의 적대적 강건성 평가
  • ImageNet-A, ImageNet-C, Stylized-ImageNet 등 외부 분포 벤치마크에서의 강건성 일반화 평가
  • 훈련 레시피와 아키텍처가 강건성 결론에 미치는 영향 조사
  • 아키텍처 간 강건성 벤치마킹을 위한 실행 가능한 가이드 제공

제안 방법

  • 정렬된 모델 용량(~22–25M 매개변수를 가지는) ResNet-50(CNN)와 DeiT-S(Transformer) 학습
  • 표준 CNN과 DeiT 레시피를 따른 100에폭 학습으로 100에폭 DeiT-S 학습
  • AutoAttack, PGD 변형, Texture Patch Attack(TPA) 등으로 적대적 강건성 평가
  • 외부 분포 데이터셋에서의 강건성 평가: ImageNet-A, ImageNet-C, Stylized-ImageNet
  • 제한 실험: 옵티마이저, 학습률 스케줄러, 증강 전략(RandAug, Mixup, CutMix), 활성화 함수(ReLU vs GELU)
  • 아키텍처 간 강건성 전달을 확인하기 위한 증류 및 하이브리드 아키텍처 탐색

실험 결과

연구 질문

  • RQ1공정하고 정렬된 학습 설정에서 Transformer가 CNN보다 본질적으로 더 강건한가?
  • RQ2CNN에 Transformer의 학습 레시피를 적용하면 적대적 강건성이 개선되는가?
  • RQ3프리-트레이닝 규모와 무관하게 Transformer가 외부 분포 데이터에 대한 강건성에서 우수한가?
  • RQ4Transformer의 self-attention과 같은 아키텍처 때문인가, 아니면 훈련 절차 때문인가?

주요 결과

  • 통합 학습 조건 하에서 Transformer는 perturbation-based 적대적 공격에 대해 CNN보다 더 강건하지 않다.
  • CNN 스타일의 레시피로의 적대적 학습은 GELU를 사용할 때 DeiT-S의 강건성과 대등해질 수 있으며, 표준 CNN 학습에 비해 깨끗한 정확도는 감소할 수 있다.
  • 강력한 증강(CutMix 등)을 사용하면 Patch-based 공격에 대해 CNN이 현저히 강건성을 개선할 수 있으며, 일부 설정에서 Transformer에 근접하거나 능가한다.
  • Transformer는 대외 사전 학습 없이도 외부 분포 일반화 벤치마크(ImageNet-A, ImageNet-C, Stylized-ImageNet)에서 일관되게 CNN을 능가한다.
  • 외부 분포 데이터에 대한 강건성 차이는 주로 아키텍처(Self-attention) 때문이며, Transformer 블록이 포함된 하이브리드 모델은 CNN보다 강건성이 향상된다.
  • 지식 증류를 통한 전달: DeiT-S를 교사로 사용할 때 학생 ResNet-50의 강건성이 향상되지만, 그 반대는 동일한 강건성 이득을 제공하지 않아 증류를 통한 아키텍처 강건성 전달은 쉽게 일어나지 않음을 시사한다.
  • 모델 크기 간의 스케일링 비교(ResNet-18/50/101 대 DeiT-Mini/S)에서 Transformer가 외부 분포 데이터에 대한 강건성 일반화를 더 잘 제공하는 경향이 일관되게 나타난다.

더 나은 연구,지금 바로 시작하세요

논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.