Attention-based PCA
Not on the map. Why?
Abstract (arXiv)
We study attention mechanisms through the lens of a canonical unsupervised problem: principal component analysis (PCA). We show that, when trained on Gaussian data, both softmax and linear attention layers learn parameters that align with the principal eigenvectors of the covariance matrix, thereby establishing a direct and explicit connection with PCA. Our analysis covers both finite and infinite prompt regimes. In the infinite-prompt limit, we prove convergence to globally optimal solutions aligned with the leading spectral direction, while in the finiteprompt setting we show that the same behavior emerges up to sampling effects. We further extend the analysis to an in-context setting with spiked Wishart covariances, where attention successfully recovers the underlying signal direction. These results demonstrate that attention inherently performs PCA-like computations under unsupervised objectives, providing a theoretical foundation for its representation-learning capabilities.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 20 of its 33 references that are in the map. First posted on arXiv 18 May 2026.
Builds on
20 of 33 references.
References · 20
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
- 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,139
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
- 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,592
- 2015Effective Approaches to Attention-based Neural Machine Translationcited by 1,026
- 2022Transformers learn in-context by gradient descentcited by 732
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
- 2019Stand-Alone Self-Attention in Vision Modelscited by 542
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
- 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 222
8 more
- 2024Transformers are Universal In-context Learnerscited by 43
- 2016Gradient Descent Only Converges to Minimizers: Non-Isolated Critical Points and Invariant Regionscited by 34
- 2025A Unified Perspective on the Dynamics of Deep Transformerscited by 32
- 2023Leveraging the two timescale regime to demonstrate convergence of neural networkscited by 19
- 2024One-Layer Transformer Provably Learns One-Nearest Neighbor In Contextcited by 16
- 2025Statistical Advantage of Softmax Attention: Insights from Single-Location Regressioncited by 7
- 2025Attention-based clusteringcited by 3
- 2025Softmax as Linear Attention in the Large-Prompt Regime: a Measure-based Perspectivecited by 3
Built on by
Not cited yet.