Lune

ICLR2025Top-tier venue

Towards Understanding the Universality of Transformers for Next-Token Prediction

Michael Eli Sander, Gabriel Peyré

Abstract

Causal Transformers are trained to predict the next token for a given context. While it is widely accepted that self-attention is crucial for encoding the causal structure of sequences, the precise underlying mechanism behind this in-context autoregressive learning ability remains unclear. In this paper, we take a step towards understanding this phenomenon by studying the approximation ability of Transformers for nexttoken prediction. Specifically, we explore the capacity of causal Transformers to predict the next token x t+1 given an autoregressive sequence (x 1 , . . . , x t ) as a prompt, where x t+1 = f (x t ), and f is a context-dependent function that varies with each sequence. On the theoretical side, we focus on specific instances, namely when f is linear or when (x t ) t≥1 is periodic. We explicitly construct a Transformer (with linear, exponential, or softmax attention) that learns the mapping f in-context through a causal kernel descent method. The causal kernel descent method we propose provably estimates x t+1 based solely on past and current observations (x 1 , . . . , x t ), with connections to the Kaczmarz algorithm in Hilbert spaces. We present experimental results that validate our theoretical findings and suggest their applicability to more general mappings f .

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.

3 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

  • On learning linear dynamical systems in context with attention layers cites Language Models are Few-Shot Learners
  • On learning linear dynamical systems in context with attention layers cites Transformers Learn In-Context by Gradient Descent
  • On learning linear dynamical systems in context with attention layers cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Transformers Learn In-Context by Gradient Descent cites Language Models are Few-Shot Learners
  • Transformers Learn In-Context by Gradient Descent 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 Language Models are Few-Shot Learners
  • What Can Transformers Learn In-Context? A Case Study of Simple Function Classes cites Are Transformers universal approximators of sequence-to-sequence functions?
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers3

  1. Compositional Generalization from Learned Skills via CoT Training: A Theoretical and Structural Analysis for ReasoningXinhao Yao, Ruifeng Ren, Yun Liao, Lizhong Ding et al.ICLR 2026 · 6 citations
  2. A Theoretical Analysis of Detecting Large Model-Generated Time SeriesJunji Hou, Junzhou Zhao, Shuo Zhang, Pinghui WangAAAI 2026 · 2 citations
  3. On learning linear dynamical systems in context with attention layersMaria-Luiza Vladarean, Xuhui Zhang, Suvrit SraICLR 2026

Builds on16

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 citations
  3. What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 citations
  4. Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento et al.ICML 2023 · 729 citations
  5. 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

Related papers

  1. On Mesa-Optimization in Autoregressively Trained Transformers: Emergence and CapabilityChenyu Zheng, Wei Huang, Rongzhen Wang, Guoqiang Wu et al.NeurIPS 2024 · 10 citations
  2. How Transformers Learn Causal Structure with Gradient DescentEshaan Nichani, Alex Damian, Jason D. LeeICML 2024 · 117 citations
  3. How do Transformers Perform In-Context Autoregressive Learning ?Michael Eli Sander, Raja Giryes, Taiji Suzuki, Mathieu Blondel et al.ICML 2024 · 21 citations
  4. Transformers are Universal In-context LearnersTakashi Furuya, Maarten V. de Hoop, Gabriel PeyréICLR 2025 · 2 citations
  5. One-Layer Transformer Provably Learns One-Nearest Neighbor In ContextZihao Li, Yuan Cao, Cheng Gao, Yihan He et al.NeurIPS 2024 · 25 citations
Dusk over the sea between two cliffs drawn in fine vertical lines