Transformers Provably Learn Sparse XOR with Polylogarithmic Parameters
Not on the map. Why?
Abstract (arXiv)
Learning sparse parity functions has become a theoretical testbed for studying feature learning in neural networks. However, existing analyses primarily focus on Feed-Forward Neural Networks (FFNNs). Meanwhile, theoretical understanding of Transformers in this setting remains limited, despite their empirical success and structural suitability for discovering sparse support over long sequences. To address this gap, we analyze how a single-layer, two-head Transformer learns the sparse XOR problem. Considering samples (x, y) ∈ lbrace± 1rbraced × lbrace± 1rbrace, where the label is defined by y = -xi^* xj^* for some unknown i^*, j^* ∈ [d], we prove that, with only O(polylog(d)) trainable parameters, Transformers can successfully discover the relevant features and drive the loss for every input to nearly 0 with one gradient step. This result establishes that Transformers break the fundamental Omega(d) parameter bottleneck inherent to FFNNs for this problem. Furthermore, we empirically show that this rapid feature discovery is uniquely driven by the exact softmax attention, outperforming common substitutes such as linear or component-wise attention. Finally, we provide a theoretical sample complexity bound for learning from finite data, demonstrating the generalization ability of Transformers in this task.
Key facts. Cited by 1 paper in the map (data through 13 Oct 2026). Builds on 21 of its 25 references that are in the map. First posted on arXiv 11 Feb 2025.
Builds on
21 of 25 references.
References · 21
- 2017Attention Is All You Needcited by 60,106
- 2022Hidden Progress in Deep Learning: SGD Learns Parities Near the Computational Limitcited by 184
- 2023A mathematical perspective on Transformerscited by 161
- 2019Linearized two-layers neural networks in high dimensioncited by 155
- 2023SGD learning on neural networks: leap complexity and saddle-to-saddle dynamicscited by 142
- 2023Representational Strengths and Limitations of Transformerscited by 132
- 2023In-Context Convergence of Transformerscited by 114
- 2023Linear attention is (maybe) all you need (to understand transformer optimization)cited by 97
- 2020Learning Parities with Neural Networkscited by 77
- 2023Exposing Attention Glitches with Flip-Flop Language Modelingcited by 74
- 2022Simplicity Bias in Transformers and their Ability to Learn Sparse Boolean Functionscited by 69
- 2024Asymptotic theory of in-context learning by linear attentioncited by 54
9 more
- 2024Transformers Provably Solve Parity Efficiently with Chain of Thoughtcited by 49
- 2024Bridging the Divide: Reconsidering Softmax and Linear Attentioncited by 48
- 2023SGD Finds then Tunes Features in Two-Layer Neural Networks with near-Optimal Sample Complexity: A Case Study in the XOR problemcited by 38
- 2022Random Feature Amplification: Feature Learning and Generalization in Neural Networkscited by 33
- 2023Provable Advantage of Curriculum Learning on Parity Targets with Mixed Inputscited by 22
- 2024Provably learning a multi-head attention layercited by 21
- 2023A Mathematical Model for Curriculum Learning for Paritiescited by 19
- 2023Why Softmax Attention Outperforms Linear Attentioncited by 15
- 2024Attention layers provably solve single-location regressioncited by 15
Built on by
Citing papers per year: 2025: 1.
1 paper.
- 2025On the Existence of Universal Simulators of Attentioncited by 1
- 2025On the Existence of Universal Simulators of Attention23 Jun 2025