Lune

NeurIPS2022Top-tier venue

Vision Transformers provably learn spatial structure

Samy Jelassi, Michael E. Sander, Yuanzhi Li

Abstract

Vision Transformers (ViTs) have achieved comparable or superior performance than Convolutional Neural Networks (CNNs) in computer vision. This empirical breakthrough is even more remarkable since, in contrast to CNNs, ViTs do not embed any visual inductive bias of spatial locality. Yet, recent works have shown that while minimizing their training loss, ViTs specifically learn spatially localized patterns. This raises a central question: how do ViTs learn these patterns by solely minimizing their training loss using gradient-based methods from random initialization? In this paper, we provide some theoretical justification of this phenomenon. We propose a spatially structured dataset and a simplified ViT model. In this model, the attention matrix solely depends on the positional encodings. We call this mechanism the positional attention mechanism. On the theoretical side, we consider a binary classification task and show that while the learning problem admits multiple solutions that generalize, our model implicitly learns the spatial structure of the dataset while generalizing: we call this phenomenon patch association. We prove that patch association helps to sample-efficiently transfer to downstream datasets that share the same structure as the pre-training one but differ in the features. Lastly, we empirically verify that a ViT with positional attention performs similarly to the original one on CIFAR-10/100, SVHN and ImageNet.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

87 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • In-context Convergence of Transformers cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • In-context Convergence of Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • In-context Convergence of Transformers cites Decision Transformer: Reinforcement Learning via Sequence Modeling
  • In-context Convergence of Transformers cites Language Models are Few-Shot Learners
  • In-context Convergence of Transformers cites Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer
  • Emerging Properties in Self-Supervised Vision Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection cites Decision Transformer: Reinforcement Learning via Sequence Modeling
  • Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection cites Language Models are Few-Shot Learners
  • An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale cites Language Models are Few-Shot Learners
  • How Transformers Learn Causal Structure with Gradient Descent cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • How Transformers Learn Causal Structure with Gradient Descent cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • How Transformers Learn Causal Structure with Gradient Descent cites Decision Transformer: Reinforcement Learning via Sequence Modeling
  • How Transformers Learn Causal Structure with Gradient Descent cites Language Models are Few-Shot Learners
  • How Transformers Learn Causal Structure with Gradient Descent cites Birth of a Transformer: A Memory Viewpoint
  • How Transformers Learn Causal Structure with Gradient Descent cites Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer
  • Decision Transformer: Reinforcement Learning via Sequence Modeling cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Decision Transformer: Reinforcement Learning via Sequence Modeling cites Language Models are Few-Shot Learners
  • Birth of a Transformer: A Memory Viewpoint cites Language Models are Few-Shot Learners
  • Birth of a Transformer: A Memory Viewpoint cites Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer
  • An Empirical Study of Training Self-Supervised Vision Transformers cites Emerging Properties in Self-Supervised Vision Transformers
  • An Empirical Study of Training Self-Supervised Vision Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • An Empirical Study of Training Self-Supervised Vision Transformers cites Language Models are Few-Shot Learners
  • Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers87

  1. Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm SelectionYu Bai, Fan Chen, Huan Wang, Caiming Xiong et al.NeurIPS 2023 · 356 citations
  2. Birth of a Transformer: A Memory ViewpointAlberto Bietti, Vivien Cabannes, Diane Bouchacourt, Hervé Jégou et al.NeurIPS 2023 · 182 citations
  3. Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer TransformerYuandong Tian, Yiping Wang, Beidi Chen, Simon S. DuNeurIPS 2023 · 125 citations
  4. How Transformers Learn Causal Structure with Gradient DescentEshaan Nichani, Alex Damian, Jason D. LeeICML 2024 · 117 citations
  5. In-context Convergence of TransformersYu Huang, Yuan Cheng, Yingbin LiangICML 2024 · 114 citations

Builds on27

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
  3. Emerging Properties in Self-Supervised Vision TransformersMathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou et al.ICCV 2021 · 8,921 citations
  4. Decision Transformer: Reinforcement Learning via Sequence ModelingLili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee et al.NeurIPS 2021 · 2,557 citations
  5. An Empirical Study of Training Self-Supervised Vision TransformersXinlei Chen, Saining Xie, Kaiming HeICCV 2021 · 2,340 citations

Related papers

  1. Do Vision Transformers See Like Convolutional Neural Networks?Maithra Raghu, Thomas Unterthiner, Simon Kornblith, Chiyuan Zhang et al.NeurIPS 2021 · 1,553 citations
  2. ConViT: Improving Vision Transformers with Soft Convolutional Inductive BiasesStéphane d'Ascoli, Hugo Touvron, Matthew L. Leavitt, Ari S. Morcos et al.ICML 2021 · 1,021 citations
  3. RegionViT: Regional-to-Local Attention for Vision TransformersChun-Fu Chen, Rameswar Panda, Quanfu FanICLR 2022 · 246 citations
  4. Patch-level Representation Learning for Self-supervised Vision TransformersSukmin Yun, Hankook Lee, Jaehyung Kim, Jinwoo ShinCVPR 2022 · 52 citations
  5. CvT: Introducing Convolutions to Vision TransformersHaiping Wu, Bin Xiao, Noel Codella, Mengchen Liu et al.ICCV 2021 · 2,397 citations
Dusk over the sea between two cliffs drawn in fine vertical lines