🤖 AI Summary
This work addresses a fundamental question in in-context reinforcement learning (ICRL): why can pretrained Transformers solve novel tasks via forward pass alone—without parameter updates? The authors provide the first theoretical and empirical demonstration that the Transformer’s forward pass implicitly implements temporal-difference learning TD(0). Specifically, self-attention constructs implicit Bellman targets, while residual connections realize step-size-controlled TD updates. A rigorous error bound is derived, explicitly governed by effective learning rate and discount factor. Extensive experiments on synthetic MDPs and GridWorld confirm this equivalence. This constitutes the first algorithm-level interpretable mechanism for ICRL, revealing the intrinsic basis of large language models’ emergent “online RL capability.” Crucially, the in-context approach achieves significantly superior generalization compared to fine-tuning baselines.
📝 Abstract
Traditionally, reinforcement learning (RL) agents learn to solve new tasks by updating their neural network parameters through interactions with the task environment. However, recent works demonstrate that some RL agents, after certain pretraining procedures, can learn to solve unseen new tasks without parameter updates, a phenomenon known as in-context reinforcement learning (ICRL). The empirical success of ICRL is widely attributed to the hypothesis that the forward pass of the pretrained agent neural network implements an RL algorithm. In this paper, we support this hypothesis by showing, both empirically and theoretically, that when a transformer is trained for policy evaluation tasks, it can discover and learn to implement temporal difference learning in its forward pass.