Lune

NeurIPS2025Top-tier venue

When Do Transformers Outperform Feedforward and Recurrent Networks? A Statistical Perspective

Alireza Mousavi-Hosseini, Clayton Sanford, Denny Wu, Murat A. Erdogdu

Abstract

Theoretical efforts to prove advantages of Transformers in comparison with classical architectures such as feedforward and recurrent neural networks have mostly focused on representational power. In this work, we take an alternative perspective and prove that even with infinite compute, feedforward and recurrent networks may suffer from larger sample complexity compared to Transformers, as the latter can adapt to a form of dynamic sparsity. Specifically, we consider a sequence-to-sequence data generating model on sequences of length NN, in which the output at each position depends only on qq relevant tokens with q≪Nq \ll N, and the positions of these tokens are described in the input prompt. We prove that a single-layer Transformer can learn this model if and only if its number of attention heads is at least qq, in which case it achieves a sample complexity almost independent of NN, while recurrent networks require NΩ(1)N^{\Omega(1)} samples on the same problem. If we simplify this model, recurrent networks may achieve a complexity almost independent of NN, while feedforward networks still require NN samples. Consequently, our proposed sparse retrieval model illustrates a natural hierarchy in sample complexity across these architectures.

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.

5 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

  • The Effect of Attention Head Count on Transformer Approximation cites Are Transformers universal approximators of sequence-to-sequence functions?
  • DeltaFormer: Unlock the state space of Transformer cites The Expressive Power of Transformers with Chain of Thought
  • DeltaFormer: Unlock the state space of Transformer cites Chain of Thought Empowers Transformers to Solve Inherently Serial Problems
  • DeltaFormer: Unlock the state space of Transformer cites Are Transformers universal approximators of sequence-to-sequence functions?
  • High-Dimensional Analysis of Single-Layer Attention for Sparse-Token Classification cites Transformers learn to implement preconditioned gradient descent for in-context learning
  • High-Dimensional Analysis of Single-Layer Attention for Sparse-Token Classification cites Asymptotics of SGD in Sequence-Single Index Models and Single-Layer Attention Networks
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers5

  1. Asymptotics of SGD in Sequence-Single Index Models and Single-Layer Attention NetworksLuca Arnaboldi, Bruno Loureiro, Ludovic Stephan, Florent Krzakala et al.NeurIPS 2025 · 10 citations
  2. Sequential Group Composition: A Window into the Mechanics of Deep LearningGiovanni Luca Marchetti, Daniel Kunin, Adele Myers, Francisco Acosta et al.ICML 2026 · 8 citations
  3. High-Dimensional Analysis of Single-Layer Attention for Sparse-Token ClassificationNicholas Barnfield, Hugo Cui, Yue M. LuICLR 2026 · 8 citations
  4. The Effect of Attention Head Count on Transformer ApproximationPenghao Yu, Haotian Jiang, Zeyu Bao, Ruoxi Yu et al.ICLR 2026 · 5 citations
  5. DeltaFormer: Unlock the state space of TransformerMingyu Xu, Tenglong Ao, Jiaao He, Jianqiao Lu et al.NeurIPS 2025 · 3 citations

Builds on24

  1. Are Transformers universal approximators of sequence-to-sequence functions?Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank J. Reddi et al.ICLR 2020 · 481 citations
  2. Transformers learn to implement preconditioned gradient descent for in-context learningKwangjun Ahn, Xiang Cheng, Hadi Daneshmand, Suvrit SraNeurIPS 2023 · 324 citations
  3. Exploring Length Generalization in Large Language ModelsCem Anil, Yuhuai Wu, Anders Andreassen, Aitor Lewkowycz et al.NeurIPS 2022 · 267 citations
  4. Chain of Thought Empowers Transformers to Solve Inherently Serial ProblemsZhiyuan Liu, Hong Liu, Denny Zhou, Tengyu MaICLR 2024 · 259 citations
  5. The Expressive Power of Transformers with Chain of ThoughtWilliam Merrill, Ashish SabharwalICLR 2024 · 243 citations

Related papers

  1. Inductive Biases and Variable Creation in Self-Attention MechanismsBenjamin L. Edelman, Surbhi Goel, Sham M. Kakade, Cyril ZhangICML 2022 · 154 citations
  2. Representational Strengths and Limitations of TransformersClayton Sanford, Daniel J. Hsu, Matus TelgarskyNeurIPS 2023 · 162 citations
  3. Understanding the Expressive Power and Mechanisms of Transformer for Sequence ModelingMingze Wang, Weinan ENeurIPS 2024 · 32 citations
  4. Approximation Rate of the Transformer Architecture for Sequence ModelingHaotian Jiang, Qianxiao LiNeurIPS 2024 · 32 citations
  5. Sub-Linear Memory: How to Make Performers SLiMValerii Likhosherstov, Krzysztof Marcin Choromanski, Jared Quincy Davis, Xingyou Song et al.NeurIPS 2021 · 25 citations
Dusk over the sea between two cliffs drawn in fine vertical lines