mlsanityData to 7 Oct 2026

A Theoretical Understanding of Shallow Vision Transformers: Learning, Generalization, and Sample Complexity

arXiv 2302.06015 ↗First posted 12 Feb 2023cs.LG cs.CV stat.MLcited by 77

Not on the map. Why?

Abstract (arXiv)

Vision Transformers (ViTs) with self-attention modules have recently achieved great empirical success in many vision tasks. Due to non-convex interactions across layers, however, theoretical learning and generalization analysis is mostly elusive. Based on a data model characterizing both label-relevant and label-irrelevant tokens, this paper provides the first theoretical analysis of training a shallow ViT, i.e., one self-attention layer followed by a two-layer perceptron, for a classification task. We characterize the sample complexity to achieve a zero generalization error. Our sample complexity bound is positively correlated with the inverse of the fraction of label-relevant tokens, the token noise level, and the initial model error. We also prove that a training process using stochastic gradient descent (SGD) leads to a sparse attention map, which is a formal verification of the general intuition about the success of attention. Moreover, this paper indicates that a proper token sparsification can improve the test performance by removing label-irrelevant and/or noisy tokens, including spurious correlations. Empirical experiments on synthetic data and CIFAR-10 dataset justify our theoretical results and generalize to deeper ViTs.

Key facts. Cited by 77 papers in the map (data through 7 Oct 2026). Builds on 66 of its 84 references that are in the map. First posted on arXiv 12 Feb 2023.

Builds on

66 of 84 references.

References · 66

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2020Language Models are Few-Shot Learnerscited by 32,199
  4. 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
  5. 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,082
  6. 2020Training data-efficient image transformers & distillation through attentioncited by 4,560
  7. 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,530
  8. 2018Neural Tangent Kernel: Convergence and Generalization in Neural Networkscited by 2,597
  9. 2021Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutionscited by 1,960
  10. 2021Decision Transformer: Reinforcement Learning via Sequence Modelingcited by 1,528
  11. 2019BERT4Rec: Sequential Recommendation with Bidirectional Encoder Representations from Transformercited by 952
  12. 2021DynamicViT: Efficient Vision Transformers with Dynamic Token Sparsificationcited by 849
38 more
  1. 2018A Convergence Theory for Deep Learning via Over-Parameterizationcited by 784
  2. 2018Gradient Descent Provably Optimizes Over-parameterized Neural Networkscited by 655
  3. 2018Universal Transformerscited by 613
  4. 2021Twins: Revisiting the Design of Spatial Attention in Vision Transformerscited by 565
  5. 2019Fine-Grained Analysis of Optimization and Generalization for Overparameterized Two-Layer Neural Networkscited by 562
  6. 2017Deep Interest Network for Click-Through Rate Predictioncited by 541
  7. 2021Attention is Not All You Need: Pure Attention Loses Rank Doubly Exponentially with Depthcited by 411
  8. 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
  9. 2021AdaViT: Adaptive Tokens for Efficient Vision Transformercited by 360
  10. 2022Not All Patches are What You Need: Expediting Vision Transformers via Token Reorganizationscited by 359
  11. 2018Learning and Generalization in Overparameterized Neural Networks, Going Beyond Two Layerscited by 340
  12. 2020An Investigation of Why Overparameterization Exacerbates Spurious Correlationscited by 310
  13. 2019On the Relationship between Self-Attention and Convolutional Layerscited by 299
  14. 2020Towards Understanding Ensemble, Knowledge Distillation and Self-Distillation in Deep Learningcited by 292
  15. 2021Post-Training Quantization for Vision Transformercited by 274
  16. 2018Learning Overparameterized Neural Networks via Stochastic Gradient Descent on Structured Datacited by 260
  17. 2019Generalization Bounds of Stochastic Gradient Descent for Wide and Deep Neural Networkscited by 221
  18. 2022Online Decision Transformercited by 194
  19. 2020The Lipschitz Constant of Self-Attentioncited by 171
  20. 2021FQ-ViT: Post-Training Quantization for Fully Quantized Vision Transformercited by 148
  21. 2021All Tokens Matter: Token Labeling for Training Better Vision Transformerscited by 144
  22. 2021Inductive Biases and Variable Creation in Self-Attention Mechanismscited by 144
  23. 2020Tensor Programs II: Neural Tangent Kernel for Any Architecturecited by 139
  24. 2021Patch Slimming for Efficient Vision Transformerscited by 131
  25. 2019Behavior Sequence Transformer for E-commerce Recommendation in Alibabacited by 128
  26. 2019An Improved Analysis of Training Over-parameterized Deep Neural Networkscited by 120
  27. 2021Toward Understanding the Feature Learning Process of Self-supervised Contrastive Learningcited by 119
  28. 2020Infinite attention: NNGP and NTK for deep attention networkscited by 117
  29. 2020Feature Purification: How Adversarial Training Performs Robust Deep Learningcited by 107
  30. 2021Long-Short Transformer: Efficient Transformers for Language and Visioncited by 102
  31. 2021Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformerscited by 101
  32. 2017Recovery Guarantees for One-hidden-layer Neural Networkscited by 94
  33. 2022Vision Transformers provably learn spatial structurecited by 92
  34. 2019What Can ResNet Learn Efficiently, Going Beyond Kernels?cited by 91
  35. 2020On the Computational Power of Transformers and its Implications in Sequence Modelingcited by 85
  36. 2021Scalable Vision Transformers with Hierarchical Poolingcited by 84
  37. 2020Learning Parities with Neural Networkscited by 77
  38. 2021Vision Transformer Pruningcited by 77

50 most cited of 66 All 66 (JSON)

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2023: 17; 2024: 34; 2025: 20; 2026: 6.

77 papers.

Sort:

By area:

  1. 2023In-Context Convergence of Transformerscited by 112
  2. 2023Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformercited by 101
  3. 2023Linear attention is (maybe) all you need (to understand transformer optimization)cited by 97
  4. 2023White-Box Transformers via Sparse Rate Reductioncited by 77
  5. 2023Transformers as Support Vector Machinescited by 67
  6. 2023Max-Margin Token Selection in Attention Mechanismcited by 57
  7. 2023JoMA: Demystifying Multilayer Transformers via JOint Dynamics of MLP and Attentioncited by 52
  8. 2023On the Role of Attention in Prompt-tuningcited by 49
  9. 2024Why Larger Language Models Do In-context Learning Differently?cited by 44
  10. 2023Memorization Capacity of Multi-Head Attention in Transformerscited by 39
  11. 2023What can a Single Attention Layer Learn? A Study Through the Random Features Lenscited by 39
  12. 2024Attention with Markov: A Framework for Principled Analysis of Transformers via Markov Chainscited by 39
38 more
  1. 2025When is Task Vector Provably Effective for Model Editing? A Generalization Analysis of Nonlinear Transformerscited by 38
  2. 2023On the Optimization and Generalization of Multi-head Attentioncited by 37
  3. 2023Patch-level Routing in Mixture-of-Experts is Provably Sample-efficient for Convolutional Neural Networkscited by 35
  4. 2024How Do Nonlinear Transformers Learn and Generalize in In-Context Learning?cited by 35
  5. 2024From Self-Attention to Markov Models: Unveiling the Dynamics of Generative Transformerscited by 34
  6. 2024Mechanics of Next Token Prediction with Self-Attentioncited by 34
  7. 2024Graph Transformers: A Surveycited by 32
  8. 2025Transformers Learn to Implement Multi-step Gradient Descent with Chain of Thoughtcited by 32
  9. 2024Implicit Bias and Fast Convergence Rates for Self-attentioncited by 31
  10. 2024A phase transition between positional and semantic learning in a solvable model of dot-product attentioncited by 30
  11. 2024Transformers on Markov Data: Constant Depth Sufficescited by 26
  12. 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
  13. 2024Provably learning a multi-head attention layercited by 21
  14. 2024A Provably Effective Method for Pruning Experts in Fine-tuned Sparse Mixture-of-Expertscited by 21
  15. 2024Transformers Provably Learn Sparse Token Selection While Fully-Connected Nets Cannotcited by 21
  16. 2024Federated Learning from Vision-Language Foundation Models: Theoretical Analysis and Methodcited by 21
  17. 2024Bypassing the Exponential Dependency: Looped Transformers Efficiently Learn In-context by Multi-step Gradient Descentcited by 21
  18. 2023Dissecting Chain-of-Thought: Compositionality through In-Context Filtering and Learningcited by 19
  19. 2023On the Convergence and Sample Complexity Analysis of Deep Q-Networks with ε-Greedy Explorationcited by 17
  20. 2024Superiority of Multi-Head Attention in In-Context Linear Regressioncited by 17
  21. 2023Enhancing Graph Transformers with Hierarchical Distance Structural Encodingcited by 16
  22. 2024Implicit Regularization of Gradient Flow on One-Layer Softmax Attentioncited by 16
  23. 2024On the Training Convergence of Transformers for In-Context Classification of Gaussian Mixturescited by 15
  24. 2024What Improves the Generalization of Graph Transformers? A Theoretical Dive into the Self-attention and Positional Encodingcited by 14
  25. 2024Training Nonlinear Transformers for Chain-of-Thought Inference: A Theoretical Generalization Analysiscited by 14
  26. 2023On the Convergence of Encoder-only Shallow Transformerscited by 13
  27. 2024Non-asymptotic Convergence of Training Transformers for Next-token Predictioncited by 13
  28. 2023Quantifying the Optimization and Generalization Advantages of Graph Neural Networks Over Multilayer Perceptronscited by 12
  29. 2025Gating is Weighting: Understanding Gated Linear Attention through In-context Learningcited by 11
  30. 2025How Transformers Learn Regular Language Recognition: A Theoretical Study on Training Dynamics and Implicit Biascited by 10
  31. 2024Dissecting the Interplay of Attention Paths in a Statistical Mechanics Theory of Transformerscited by 9
  32. 2024Optimizing Attention with Mirror Descent: Generalized Max-Margin Token Selectioncited by 9
  33. 2025Asymptotics of SGD in Sequence-Single Index Models and Single-Layer Attention Networkscited by 9
  34. 2024Interpretable Lightweight Transformer via Unrolling of Learned Graph Smoothness Priorscited by 8
  35. 2024Learning on Transformers is Provable Low-Rank and Sparse: A One-layer Analysiscited by 8
  36. 2024Training Dynamics of Transformers to Recognize Word Co-occurrence via Gradient Flow Analysiscited by 8
  37. 2024How does promoting the minority fraction affect generalization? A theoretical study of the one-hidden-layer neural network on group imbalancecited by 6
  38. 2024On the Learn-to-Optimize Capabilities of Transformers in In-Context Sparse Recoverycited by 6

50 most cited of 77 All 77 (JSON)