Retrieval-Augmented Reinforcement Learning

Anirudh Goyal, Abram L. Friesen, Theophane Weber, Andrea Banino, Nan Rosemary Ke, Adria Puigdomenech Badia, Ksenia Konyushkova, Michal Valko, Simon Osindero, Timothy P Lillicrap, Nicolas Heess, Charles Blundell

TL;DR

Standard reinforcement learning (RL) agents struggle to retain specific details because they compress all their experiences into static neural network weights. This paper introduces Retrieval-Augmented Reinforcement Learning (R2A), a framework that allows agents to "look up" relevant past trajectories from a massive database during decision-making, significantly improving sample efficiency and multi-task performance.

What Problem Does This Paper Address?

In the current deep RL paradigm, an agent’s "knowledge" is stored in the weights of its policy or value function. To learn from an experience, the agent must perform gradient updates, effectively "distilling" a trajectory into its parameters.

This approach has three major flaws:

  1. Forgetting: Detailed information is often lost because the network has limited capacity.
  2. Slow Adaptation: It can take thousands of "replays" of a specific event before the weights adjust enough to change the agent's behavior.
  3. Task Interference: In multi-task settings, learning a new task often causes the agent to "overwrite" what it learned about a previous one.

The authors argue that agents should behave more like humans: when we face a new situation, we don't just rely on "gut instinct" (parametric weights); we often recall a specific similar time in the past to guide our current actions.

Methods

The authors propose the Retrieval-Augmented Agent (R2A). The architecture splits the agent into two distinct but interacting processes.

Retrieval-Augmented Agent Architecture
  • The Agent Process: A standard RL architecture (like DQN or R2D2) that maintains an internal state ($s_t$) and outputs actions.
  • The Retrieval Process: A separate system with its own internal state ($m_t$). It has direct access to a "Retrieval Dataset"—a large pool of past experiences, expert demos, or even trajectories from other agents.

How it works:

  1. Querying: At each timestep, the retrieval process uses the agent's current state to generate a "query."
  2. Summarization: To make the database searchable, past trajectories are encoded using forward and backward summarizers. This is a key innovation: the backward summarizer captures the "future" of a past event, telling the agent what happened after that state was reached.
  3. Attention & Slots: The retrieval state is partitioned into "slots" that independently query the database using an attention mechanism. This allows the agent to focus on multiple different relevant pieces of information simultaneously.
  4. Information Bottleneck: To ensure the agent doesn't become overly dependent on specific (and potentially noisy) retrieved data, the authors use an Information Bottleneck (IB). This forces the agent to generalize rather than just memorizing the database.

Datasets

The researchers evaluated R2A across several diverse benchmarks:

  • Atari (ALE): A classic single-task online RL benchmark.
  • Gridroboman: A minimalistic grid-world robotic manipulation environment with 30 distinct tasks, newly created by the authors to test multi-task offline RL.
  • BabyAI: A partially observable multi-room grid world where tasks are composed of simpler sub-tasks (e.g., "go to the door" + "open the door").
  • CausalWorld: A continuous control benchmark for robotic manipulation.

Key Insights and Ideas

  • Separation of States is Vital: One of the most important findings from their ablations was that the retrieval process must have its own internal state ($m_t$). Using the agent's state ($s_t$) to query the database directly performed no better than the baseline.
  • The "Future" Helps the Present: By retrieving summaries that include "backward" information (what happened next in the past), the agent gains a form of "temporally extended credit assignment." It can see the eventual reward of a past state and use that to value its current, similar state.
  • Compositional Retrieval: In BabyAI, the authors found that for complex tasks, the agent retrieved information from other tasks 54% of the time. This suggests the agent is learning to "borrow" sub-skills from different parts of the database to solve new problems.

Key Results

Atari Performance Improvements
  • Atari Performance: RA-R2D2 (the retrieval-augmented version) showed an 11.32% increase in mean human-normalized scores over the state-of-the-art R2D2 baseline. It was particularly effective in games like Frostbite that require long-term planning.
  • Scaling with Tasks: In the Gridroboman environment, as the number of tasks increased from 10 to 30, the gap between R2A and the baseline DQN widened significantly. R2A avoided the "task interference" that crippled the standard agent.
  • Sample Efficiency: In almost all tests, R2A reached higher reward levels much faster than its non-augmented counterparts, proving that "looking it up" is faster than "learning it by heart."

Limitations and Future Work

While powerful, R2A has its hurdles:

  • Computational Overhead: Querying a large database at every single timestep is computationally expensive, though the authors suggest optimizations like only querying high-return trajectories.
  • End-to-End Training: Currently, the retrieval and agent processes are often trained with different objectives (RL loss vs. auxiliary losses). The authors suggest that training them in a more unified, end-to-end fashion could yield even better results.
  • Scaling to Multi-Agent: The paper primarily looks at single agents. A promising future direction is "shared retrieval," where a swarm of agents contributes to and queries a collective memory bank.

Summary updated

BibTeX
@inproceedings{goyal2022retrieval,
  author = {Anirudh Goyal and Abram L. Friesen and Theophane Weber and Andrea Banino and Nan Rosemary Ke and Adria Puigdomenech Badia and Ksenia Konyushkova and Michal Valko and Simon Osindero and Timothy P Lillicrap and Nicolas Heess and Charles Blundell},
  title = {{Retrieval-Augmented Reinforcement Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=0q0REJNgtg},
}
Figure