Transformers Learn Temporal Difference Methods for In-Context Reinforcement Learning
In-context learning refers to the learning ability of a model during inference time without adapting its parameters. The input (i.e., prompt) to the model (e.g., transformers) consists of both a context (i.e., instance-label pairs) and a query instance. The model is then able to output a label for the query instance according to the context during inference. A possible explanation for in-context learning is that the forward pass of (linear) transformers implements iterations of gradient descent on the instance-label pairs in the context. In this paper, we prove by construction that transformers can also implement temporal difference (TD) learning in the forward pass, a phenomenon we refer to as in-context TD. We demonstrate the emergence of in-context TD after training the transformer with a multi-task TD algorithm, accompanied by theoretical analysis. Furthermore, we prove that transformers are expressive enough to implement many other policy evaluation algorithms in the forward pass, including residual gradient, TD with eligibility trace, and average-reward TD.
Code (0)
등록된 구현이 없습니다.
Tasks
In-Context LearningIn-Context Reinforcement Learningreinforcement-learningReinforcement LearningSimilar Papers 제목 키워드 기반
Emergence of Episodic Memory in Transformers: Characterizing Changes in Temporal Structure of Attention Scores During Training
We investigate in-context temporal biases in attention heads and transformer outputs. Using cognitive science methodologies, we analyze attention scores and outputs of the GPT-2 models of varying sizes. Across attention …
In-Context LearningPhysMamba: Efficient Remote Physiological Measurement with SlowFast Temporal Difference Mamba
Facial-video based Remote photoplethysmography (rPPG) aims at measuring physiological signals and monitoring heart activity without any contact, showing significant potential in various applications. Previous deep learni…
MambaState Space ModelsPhysFormer++: Facial Video-based Physiological Measurement with SlowFast Temporal Difference Transformer
Remote photoplethysmography (rPPG), which aims at measuring heart activities and physiological signals from facial video without any contact, has great potential in many applications (e.g., remote healthcare and affectiv…
Multi-Scale Temporal Difference Transformer for Video-Text Retrieval
Currently, in the field of video-text retrieval, there are many transformer-based methods. Most of them usually stack frame features and regrade frames as tokens, then use transformers for video temporal modeling. Howeve…
RetrievalText RetrievalVideo-Text RetrievalOne for All: A Non-Linear Transformer can Enable Cross-Domain Generalization for In-Context Reinforcement Learning
A central challenge in reinforcement learning (RL) is to learn models that generalize beyond the tasks on which they are trained, a goal traditionally pursued through multi-task and meta RL. Recently, transformer archite…
Reinforcement LearningDomain Generalization