Do Vision Transformers See Like Convolutional Neural Networks?

Maithra Raghu, Thomas Unterthiner, Simon Kornblith, Chiyuan Zhang, Alexey Dosovitskiy
8/19/2021
1,604 citations
cs.CVcs.AIcs.LG
transformer-attention

No official code found. Best implementation: dmarx/cka_pytorch (17 stars).

Abstract

Convolutional neural networks (CNNs) have so far been the de-facto model for visual data. Recent work has shown that (Vision) Transformer models (ViT) can achieve comparable or even superior performance on image classification tasks.

Show full abstract

This raises a central question: how are Vision Transformers solving these tasks? Are they acting like convolutional networks, or learning entirely different visual representations? Analyzing the internal representation structure of ViTs and CNNs on image classification benchmarks, we find striking differences between the two architectures, such as ViT having more uniform representations across all layers. We explore how these differences arise, finding crucial roles played by self-attention, which enables early aggregation of global information, and ViT residual connections, which strongly propagate features from lower to higher layers. We study the ramifications for spatial localization, demonstrating ViTs successfully preserve input spatial information, with noticeable effects from different classification methods. Finally, we study the effect of (pretraining) dataset scale on intermediate features and transfer learning, and conclude with a discussion on connections to new architectures such as the MLP-Mixer.

View on arXivView PDF

Code Implementations(1)

dmarx/cka_pytorchCommunity25%

Reproducing Raghu et al 2021 - Do Vision Transformers See Like Convolutional Neural Networks?

173

Similar Papers

Cite this paper

@article{raghu2021vision,
  title  = {Do Vision Transformers See Like Convolutional Neural Networks?},
  author = {Maithra Raghu and Thomas Unterthiner and Simon Kornblith and Chiyuan Zhang and Alexey Dosovitskiy},
  year   = {2021},
  eprint = {2108.08810},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2108.08810}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2108.08810.svg)](https://codeofpaper.com/paper/2108.08810)

Discussion