mlsanityData to 14 Oct 2026

Transformers Provably Implement In-Context Reinforcement Learning with Policy Improvement

arXiv 2605.05755 ↗First posted 7 May 2026stat.ML cs.AI cs.LGcited by 3

On the map: Deep reinforcement learning methods → Deep RL algorithms and representations

Abstract (arXiv)

We investigate the ability of transformers to perform in-context reinforcement learning (ICRL), where a model must infer and execute learning algorithms from trajectory data without parameter updates. We show that a linear self-attention transformer block can provably implement policy-improvement methods, including semi-gradient SARSA and actor-critic, via explicit parameter constructions. Beyond existence, we design a teacher-mimicking training procedure, analyze its gradient-flow dynamics, and establish the first convergence guarantee in the ICRL literature: under suitable richness conditions on the training MDP distribution, gradient flow converges locally and exponentially to an optimal parameter manifold corresponding to the desired RL update. Empirically, training transformers on randomly generated tabular MDPs confirms these predictions: the learned models recover the parameter structure of our explicit constructions and, when deployed on unseen MDPs, deliver strong in-context control performance. Together, these results illuminate how transformer architectures internalize and execute classical reinforcement learning algorithms in context, bridging mechanistic understanding and training dynamics in ICRL.

Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Placed in Deep RL algorithms and representations, one of 15 directions in Deep reinforcement learning methods. Builds on 24 of its 28 references that are in the map. First posted on arXiv 7 May 2026.

Builds on

24 of 28 references.

Closest ancestors · 2

Same direction, newest first

  1. 2025A Survey of In-Context Reinforcement Learning11 Feb
  2. 2024Transformers Can Learn Temporal Difference Methods for In-Context Reinforcement Learning22 May

Other references · 22

  1. 2017Attention Is All You Needcited by 60,361
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2023GPT-4 Technical Reportcited by 18,396
  4. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
  5. 2021Decision Transformer: Reinforcement Learning via Sequence Modelingcited by 1,546
  6. 2022Transformers learn in-context by gradient descentcited by 732
  7. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
  8. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
  9. 2021Offline Reinforcement Learning as One Big Sequence Modeling Problemcited by 644
  10. 2023Trained Transformers Learn Linear Models In-Contextcited by 337
  11. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 298
  12. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
10 more
  1. 2022In-context Reinforcement Learning with Algorithm Distillationcited by 190
  2. 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 170
  3. 2023Supervised Pretraining Can Learn In-Context Reinforcement Learningcited by 139
  4. 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
  5. 2023Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformercited by 102
  6. 2023Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretrainingcited by 83
  7. 2024Can large language models explore in-context?cited by 76
  8. 2024Training Dynamics of Multi-Head Softmax Attention for In-Context Learning: Emergence, Convergence, and Optimalitycited by 74
  9. 2022Large Language Models can Implement Policy Iterationcited by 31
  10. 2024Transformers Handle Endogeneity in In-Context Linear Regressioncited by 8

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 3.

3 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026In-Context Reinforcement Learning From Suboptimal Historical Data
  2. 2025RL + Transformer = A General-Purpose Problem Solver
  3. 2025Heuristic Transformer: Belief Augmented In-Context Reinforcement Learning
  4. 2023Transformers in Reinforcement Learning: A Survey
  5. 2026Beyond Linear Attention: Softmax Transformers Implement In-Context Reinforcement Learning
  6. 2026Vintix II: Decision Pre-Trained Transformer is a Scalable In-Context Reinforcement Learner
  7. 2026Learning in Context, Guided by Choice: A Reward-Free Paradigm for Reinforcement Learning with Transformers
  8. 2025Scalable In-Context Q-Learning