Skip to main content
QUICK REVIEW

[Paper Review] An Impartial Take to the CNN vs Transformer Robustness Contest

Francesco Pinto, Philip H. S. Torr|arXiv (Cornell University)|Jul 22, 2022
Adversarial Robustness in Machine LearningComputer Science6 citations
TL;DR

This paper conducts a rigorous, fair comparison of state-of-the-art CNNs (especially ConvNeXt) and Transformers (ViT, Swin-T) on ImageNet-1K and shift benchmarks, demonstrating that CNNs can match or exceed Transformers in robustness, calibration, and uncertainty estimation. The key finding is that self-attention does not inherently confer superior robustness, and both architectures suffer from similar biases like simplicity and texture bias.

ABSTRACT

Following the surge of popularity of Transformers in Computer Vision, several studies have attempted to determine whether they could be more robust to distribution shifts and provide better uncertainty estimates than Convolutional Neural Networks (CNNs). The almost unanimous conclusion is that they are, and it is often conjectured more or less explicitly that the reason of this supposed superiority is to be attributed to the self-attention mechanism. In this paper we perform extensive empirical analyses showing that recent state-of-the-art CNNs (particularly, ConvNeXt) can be as robust and reliable or even sometimes more than the current state-of-the-art Transformers. However, there is no clear winner. Therefore, although it is tempting to state the definitive superiority of one family of architectures over another, they seem to enjoy similar extraordinary performances on a variety of tasks while also suffering from similar vulnerabilities such as texture, background, and simplicity biases.

Motivation & Objective

  • To challenge the widespread belief that Transformers are inherently more robust and better calibrated than CNNs due to self-attention.
  • To perform a fair, unbiased comparison using current best training recipes and architectures for both CNNs and Transformers.
  • To investigate whether the self-attention mechanism is truly responsible for improved robustness or if architectural components like normalization and activation functions play a larger role.
  • To evaluate model reliability using multiple metrics beyond accuracy, including calibration, OoD detection, and misclassification detection.
  • To highlight flaws in prior comparisons, such as unfair model capacity scaling and inappropriate metric choices (e.g., AURP over AUROC in imbalanced settings).

Proposed method

  • Compared state-of-the-art CNNs (BiT and ConvNeXt) and Transformers (ViT, Swin-T) using identical ImageNet-1K training and evaluation protocols.
  • Used standard evaluation protocols without modifying training recipes to ensure models were at their peak performance.
  • Evaluated robustness on distribution shift benchmarks: ImageNet-A, ImageNet-R, ImageNet-Sketches, and ImageNet-V2.
  • Employed multiple reliability metrics: expected calibration error (ECE), AUROC and AURP for OoD detection, and Prediction Rejection Ratio (PRR) for misclassification detection.
  • Conducted a simplicity bias experiment to assess whether models rely on spurious, simple features rather than complex, invariant ones.
  • Analyzed model confidence distributions to detect overconfidence on misclassified samples, especially in out-of-distribution settings.

Experimental results

Research questions

  • RQ1Do Transformers consistently outperform CNNs in robustness and calibration across multiple distribution shift benchmarks?
  • RQ2Is the self-attention mechanism the primary driver of improved robustness, or are other architectural components equally or more influential?
  • RQ3How do different evaluation metrics (e.g., AURP vs. AUROC) affect the perceived performance difference between CNNs and Transformers in OoD detection?
  • RQ4To what extent do both CNNs and Transformers exhibit simplicity bias, favoring easy-to-discriminate features over robust, invariant ones?
  • RQ5Can modern CNNs like ConvNeXt achieve performance comparable to Transformers without using self-attention?

Key findings

  • ConvNeXt models outperform or match state-of-the-art Transformers in in-distribution calibration, with ConvNeXt-XL achieving a PRR of 74.37% on ImageNet-1K, surpassing ViT-L/16 (76.03%) and Swin-L (72.89%).
  • On ImageNet-R, Swin-L is the only model with a positive PRR (36.53%), while ConvNeXt-XL and L show negative PRRs (-19.32% and -23.60%), indicating overconfidence on misclassified samples.
  • For out-of-distribution detection, no clear winner emerged: ViT-L/16 and ConvNeXt-XL performed comparably on ImageNet-Sketches and ImageNet-V2, with AUROC values around 0.85–0.87.
  • BiT-R152x4 achieved the highest PRR (92.04%) on ImageNet-A, significantly outperforming all Transformers, suggesting CNNs can be more reliable in extreme domain shifts.
  • Despite low miscalibration error (ECE), several models—especially on ImageNet-R—showed high overconfidence on misclassified samples, indicating that ECE alone is insufficient for assessing reliability.
  • The simplicity bias experiment revealed that both CNNs and Transformers tend to focus on simple, spurious features rather than complex, invariant ones, undermining claims that self-attention enables better feature learning.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.