Skip to main content
QUICK REVIEW

[Paper Review] Can CNNs Be More Robust Than Transformers?

Zeyu Wang, Yutong Bai|arXiv (Cornell University)|Jun 7, 2022
Advanced Neural Network ApplicationsComputer Science14 citations
TL;DR

This paper demonstrates that Convolutional Neural Networks (CNNs) can achieve robustness comparable to or exceeding that of Vision Transformers by incorporating three simple architectural modifications: patchifying input images, using large kernel sizes (e.g., 11×11), and reducing normalization and activation layers. Without any self-attention mechanisms, the resulting Robust-ResNet outperforms DeiT-S on multiple out-of-distribution benchmarks, including 4.0% better accuracy on ImageNet-R and 3.9% on ImageNet-Sketch.

ABSTRACT

The recent success of Vision Transformers is shaking the long dominance of Convolutional Neural Networks (CNNs) in image recognition for a decade. Specifically, in terms of robustness on out-of-distribution samples, recent research finds that Transformers are inherently more robust than CNNs, regardless of different training setups. Moreover, it is believed that such superiority of Transformers should largely be credited to their self-attention-like architectures per se. In this paper, we question that belief by closely examining the design of Transformers. Our findings lead to three highly effective architecture designs for boosting robustness, yet simple enough to be implemented in several lines of code, namely a) patchifying input images, b) enlarging kernel size, and c) reducing activation layers and normalization layers. Bringing these components together, we are able to build pure CNN architectures without any attention-like operations that are as robust as, or even more robust than, Transformers. We hope this work can help the community better understand the design of robust neural architectures. The code is publicly available at https://github.com/UCSC-VLAA/RobustCNN.

Motivation & Objective

  • To challenge the prevailing belief that Vision Transformers are inherently more robust than CNNs due to self-attention mechanisms.
  • To identify specific architectural components in Transformers that contribute to improved robustness, independent of self-attention.
  • To develop a simple, effective CNN-based architecture that achieves robustness on par with or better than Transformers without using attention mechanisms.
  • To demonstrate that robustness improvements can be achieved through architectural design alone, not just training recipes or data augmentation.

Proposed method

  • Patchifying input images into non-overlapping patches, with larger patch sizes shown to improve robustness.
  • Replacing standard small kernels (e.g., 3×3) with large kernels (e.g., 7×7 or 11×11) to enhance global receptive fields and robustness.
  • Reducing the number of normalization layers (e.g., BatchNorm) and activation functions (e.g., GELU) to minimize distribution shift and improve generalization.
  • Combining these three components into a modified ResNet architecture, termed Robust-ResNet, to evaluate their collective impact.
  • Using knowledge distillation with DeiT-S as a teacher model to validate that the improvements stem from architecture, not training dynamics.
  • Scaling the architecture to larger models (e.g., DeiT-Base level) to test generalization and scalability of the design principles.

Experimental results

Research questions

  • RQ1Which architectural components in Vision Transformers contribute most to their superior out-of-distribution robustness?
  • RQ2Can a pure CNN architecture achieve robustness comparable to or exceeding that of a Vision Transformer without using self-attention?
  • RQ3Does the robustness gain from large kernel sizes, patchification, and reduced normalization/activation layers hold across different model scales and datasets?
  • RQ4Can knowledge distillation transfer the robustness of a Vision Transformer to a CNN, or is the robustness intrinsic to the architecture itself?
  • RQ5Is the performance gap between CNNs and Transformers in robustness due to architectural design or training recipes?

Key findings

  • Robust-ResNet, a CNN with large kernels (11×11), patchified inputs, and reduced normalization/activation layers, outperforms DeiT-S by 2.4% on Stylized-ImageNet (16.2% vs. 18.6%).
  • On ImageNet-R, Robust-ResNet achieves 41.9% accuracy compared to DeiT-S’s 45.9%, a 4.0% improvement, demonstrating superior robustness to style and distribution shift.
  • On ImageNet-Sketch, Robust-ResNet achieves 33.0% accuracy, outperforming DeiT-S by 3.9% (29.1% vs. 33.0%), confirming consistent gains across diverse out-of-distribution benchmarks.
  • The same architectural improvements lead to a 23% training speedup due to fewer normalization layers, showing efficiency gains alongside robustness.
  • Knowledge distillation from DeiT-S fails to transfer robustness to standard ResNets, but succeeds when applied to the proposed Robust-ResNet, confirming that robustness stems from architecture, not training.
  • When scaled to DeiT-Base FLOPs, Robust-ResNet variants (e.g., Robust-ResNet-Up-Inverted-DW-B) achieve 50.5% accuracy on ImageNet-R, outperforming DeiT-B (44.7%), proving scalability of the design.

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.