Emergence of In-Context Reinforcement Learning from Noise Distillation

Ilya Zisman, Vladislav Kurenkov, Alexander Nikulin, Viacheslav Sinii, Sergey Kolesnikov

Abstract: Recently, extensive studies in Reinforcement Learning have been carried out on the ability of transformers to adapt in-context to various environments and tasks. Current in-context RL methods are limited by their strict requirements for data, which needs to be generated by RL agents or labeled with actions from an optimal policy. In order to address this prevalent problem, we propose AD$^\varepsilon$, a new data acquisition approach that enables in-context Reinforcement Learning from noise-induced curriculum. We show that it is viable to construct a synthetic noise injection curriculum which helps to obtain learning histories. Moreover, we experimentally demonstrate that it is possible to alleviate the need for generation using optimal policies, with in-context RL still able to outperform the best suboptimal policy in a learning dataset by a 2x margin.

Introduction

In-Context Reinforcement Learning (ICRL) represents a significant shift in how agents adapt to new environments. Unlike traditional RL, which requires weight updates, ICRL allows a model—typically a Transformer—to adapt during a single evaluation phase by "learning how to learn" from a sequence of states, actions, and rewards.

However, the field faces a significant data bottleneck. Existing approaches like Algorithm Distillation (AD) require thousands of expensive RL training histories, while Decision Pretrained Transformers (DPT) rely on optimal action labels that are rarely available for complex tasks. This research introduces AD$\epsilon$ (Algorithm Distillation with epsilon-noise), a method that triggers the emergence of ICRL using only synthetic, noise-injected data from suboptimal policies.

Methods: The AD$\epsilon$ Approach

AD$\epsilon$ bypasses the need for actual RL algorithm runs by creating "synthetic learning histories" through a noise-injection curriculum. The process involves three main steps:

  1. Policy Selection: The process begins with a demonstrator policy, which can be either optimal or suboptimal.
  2. Noise Curriculum: An $\epsilon$-greedy strategy is applied where the probability of taking a random action ($\epsilon$) starts at 1.0 (pure exploration) and decays to 0 (pure exploitation) over multiple episodes.
  3. Distillation: A GPT-2 based Transformer is trained to predict the next action based on the history of states, actions, and rewards.
Comparison of AD, DPT, and the proposed AD$\epsilon$ method showing the noise-decay curriculum.

By ordering trajectories from noisy to clean, the Transformer distills the underlying policy improvement operator rather than simply imitating a static policy. This allows the model to internalize the gradient of improvement.

Experimental Setup

The researchers evaluated AD$\epsilon$ across three environments of varying complexity:

  • Dark Room: A 2D grid-world task focused on finding a hidden goal.
  • Key-to-Door: A multi-stage 2D task requiring the agent to secure a key before accessing a reward behind a door.
  • Watermaze: A 3D environment with continuous state space and pixel-based observations, where the agent must navigate to a hidden platform.

Key Results

The experimental results demonstrate that AD$\epsilon$ can significantly outperform the policies used to generate its training data. In the Dark Room environment, the model achieved a +120% improvement over the best policy in its training set. Similar gains were observed in Key-to-Door (+74%) and Watermaze (+76%).

In-context learning curves for AD$\epsilon$ across Dark Room, Key-to-Door, and Watermaze environments.

Notably, the model demonstrated zero-shot generalization, successfully solving tasks with goal locations never encountered during training. Furthermore, AD$\epsilon$ achieved performance parity with the original Algorithm Distillation method without the computational overhead of training thousands of source RL agents.

Discussion and Insights

The core finding is that ICRL does not require expert data; it requires improving data. By providing a curriculum of improvement, the Transformer learns the "intent" of the policy and filters out the noise. However, the pace of noise decay is critical—a "Goldilocks" rate is necessary to ensure the model sees enough exploration without burying the improvement signal in randomness.

While promising, future work is needed to test AD$\epsilon$ in high-dimensional, open-ended environments. Additionally, the computational cost of long sequence lengths in Transformers and the safety implications of high initial noise in real-world robotics remain open challenges.

Summary updated

BibTeX
@inproceedings{zisman2024emergence,
  author = {Ilya Zisman and Vladislav Kurenkov and Alexander Nikulin and Viacheslav Sinii and Sergey Kolesnikov},
  title = {{Emergence of In-Context Reinforcement Learning from Noise Distillation}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=Y8KsHT1kTV},
}
Figure