Transformers Provably Learn Sparse Token Selection While Fully-Connected Nets Cannot
Zixuan Wang, Stanley Wei, Daniel Hsu, Jason D. Lee
Abstract
The transformer architecture has prevailed in various deep learning settings due to its exceptional capabilities to select and compose structural information. Motivated by these capabilities, Sanford et al. [48] proposed the sparse token selection task, in which transformers excel while fully-connected networks (FCNs) fail in the worst case. Building upon that, we strengthen the FCN lower bound to an average-case setting and establish an algorithmic separation of transformers over FCNs. Specifically, a one-layer transformer trained with gradient descent provably learns the sparse token selection task and, surprisingly, exhibits strong out-ofdistribution length generalization. We provide empirical simulations to justify our theoretical findings.
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.
25 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Quantitative Bounds for Length Generalization in Transformers cites Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation
- Learning and Transferring Sparse Contextual Bigrams with Linear Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation 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
- On the Robustness of Transformers against Context Hijacking for Linear Classification cites Language Models are Few-Shot Learners
- On the Robustness of Transformers against Context Hijacking for Linear Classification cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- What Can Transformers Learn In-Context? A Case Study of Simple Function Classes cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- What Can Transformers Learn In-Context? A Case Study of Simple Function Classes cites Language Models are Few-Shot Learners
- High-Dimensional Analysis of Single-Layer Attention for Sparse-Token Classification cites Learning and Transferring Sparse Contextual Bigrams with Linear Transformers
- High-Dimensional Analysis of Single-Layer Attention for Sparse-Token Classification cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- High-Dimensional Analysis of Single-Layer Attention for Sparse-Token Classification cites Language Models are Few-Shot Learners
- Multi-head Transformers Provably Learn Symbolic Multi-step Reasoning via Gradient Descent cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Cited by top-tier papers25
- Learning and Transferring Sparse Contextual Bigrams with Linear TransformersYunwei Ren, Zixuan Wang, Jason D. LeeNeurIPS 2024 · 9 citations
- Quantitative Bounds for Length Generalization in TransformersZachary Izzo, Eshaan Nichani, Jason D. LeeICLR 2026 · 8 citations
- High-Dimensional Analysis of Single-Layer Attention for Sparse-Token ClassificationNicholas Barnfield, Hugo Cui, Yue M. LuICLR 2026 · 8 citations
- Multi-head Transformers Provably Learn Symbolic Multi-step Reasoning via Gradient DescentTong Yang, Yu Huang, Yingbin Liang, Yuejie ChiNeurIPS 2025 · 8 citations
- On the Robustness of Transformers against Context Hijacking for Linear ClassificationTianle Li, Chenyang Zhang, Xingwu Chen, Yuan Cao et al.NeurIPS 2025 · 7 citations
Builds on36
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- 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
- Train Short, Test Long: Attention with Linear Biases Enables Input Length ExtrapolationOfir Press, Noah A. Smith, Mike LewisICLR 2022 · 1,168 citations
- What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 citations
Related papers
- Transformers Trained via Gradient Descent Can Provably Learn a Class of Teacher ModelsChenyang Zhang, Qingyue Zhao, Quanquan Gu, Yuan CaoICLR 2026
- Transformer Learns Optimal Variable Selection in Group-Sparse ClassificationChenyang Zhang, Xuran Meng, Yuan CaoICLR 2025
- When Do Transformers Outperform Feedforward and Recurrent Networks? A Statistical PerspectiveAlireza Mousavi-Hosseini, Clayton Sanford, Denny Wu, Murat A. ErdogduNeurIPS 2025 · 6 citations
- A Theoretical Understanding of Shallow Vision Transformers: Learning, Generalization, and Sample ComplexityHongkang Li, Meng Wang, Sijia Liu, Pin-Yu ChenICLR 2023 · 1 citation
- Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In ContextXiang Cheng, Yuxin Chen, Suvrit SraICML 2024 · 64 citations
