RL + Transformer = A General-Purpose Problem Solver
Micah Rentschler, Jesse Roberts
TL;DR
This work demonstrates that a pre-trained transformer can acquire meta-learning capabilities by fine-tuning with reinforcement learning to enable In-Context Reinforcement Learning (ICRL). By training LLaMA 3.1 8B Instruct with a DQN objective on a parametric Frozen Lake environment and evaluating on unseen maps and non-stationary changes, the model iteratively improves its performance without weight updates, stitches together previously learned skills, and adapts to non-stationary conditions. The key contributions include in-context behavior stitching, robustness to data quality, and adaptation to non-stationary environments, coupled with a practical RL-fine-tuning setup using IA3 adapters. Together, these results suggest a path toward general-purpose problem solvers that leverage context to self-improve and tackle novel challenges, with implications for scalable and adaptable AI systems.
Abstract
What if artificial intelligence could not only solve problems for which it was trained but also learn to teach itself to solve new problems (i.e., meta-learn)? In this study, we demonstrate that a pre-trained transformer fine-tuned with reinforcement learning over multiple episodes develops the ability to solve problems that it has never encountered before - an emergent ability called In-Context Reinforcement Learning (ICRL). This powerful meta-learner not only excels in solving unseen in-distribution environments with remarkable sample efficiency, but also shows strong performance in out-of-distribution environments. In addition, we show that it exhibits robustness to the quality of its training data, seamlessly stitches together behaviors from its context, and adapts to non-stationary environments. These behaviors demonstrate that an RL-trained transformer can iteratively improve upon its own solutions, making it an excellent general-purpose problem solver.
