Introduction
Reinforcement Learning (RL) agents often struggle in environments where the Markov property does not hold—situations where the current observation is insufficient for optimal decision-making. In such partially observable environments, agents must rely on memory to bridge the gap between past informative events and current actions. While Recurrent Neural Networks (RNNs) are the standard approach, their reliance on Backpropagation Through Time (BPTT) makes them computationally expensive and difficult to scale for long-term dependencies in online settings. This paper proposes a novel architecture that integrates an external episodic memory using reservoir sampling, enabling efficient, long-term credit assignment.
Problem Statement
The primary challenge in online RL is learning long-range temporal dependencies without the computational overhead of full BPTT. Truncated BPTT, while efficient, limits the agent's "look-back" window, preventing it from learning from events that occurred thousands of steps prior. External memory banks offer a potential solution, but training them to selectively store relevant information in an online, differentiable manner remains a significant hurdle.
Proposed Architecture
The authors introduce an architecture combining an Advantage Actor-Critic (A2C) framework with a specialized episodic memory module. The system consists of three primary components:
- Query Network (q): This network processes the current state to generate a query, which is used to retrieve the most relevant past experiences from the memory bank.
- Write Network (w): This module performs "information triage" by assigning a weight to each new state. This weight represents the state's perceived importance for future decision-making.
- Reservoir Sampling: To maintain a fixed-size memory buffer (M) efficiently, the agent employs a reservoir sampling algorithm. The probability of a state being retained in the reservoir is proportional to the importance weight assigned by the Write Network.
A key innovation is the development of a gradient estimator that allows the Write Network to be updated online. This estimator evaluates the counterfactual utility of remembered states, adjusting weights based on whether different memory contents would have led to higher rewards, all without requiring expensive backpropagation through the entire reservoir history.
Experimental Setup: The Secret Informant Problem
The architecture was evaluated on "The Secret Informant Problem," a synthetic benchmark designed to test long-term memory and selective attention. In this task, an agent traverses a chain of states. Early in the episode, it encounters an "informative" state—the secret informant—providing a cue for the correct action at the end of the chain. The remainder of the chain consists of "uninformative" states that mimic the informant's structure but contain random noise. Success requires the agent to selectively remember the informant while ignoring the noise over long temporal gaps.
Key Results and Discussion
The experimental results demonstrate that the episodic memory agent effectively learns to prioritize relevant information. As shown in the "Write weights" analysis, the agent quickly learns to assign weights near 1.0 to informative states, while weights for uninformative states converge toward zero.
In terms of performance, the episodic memory agent consistently achieved near-perfect returns. When compared to a Gated Recurrent Unit (GRU) baseline, the episodic approach proved more stable and required significantly less hyperparameter tuning. While the GRU could solve the task under ideal conditions (full BPTT and extensive tuning), the episodic memory agent's ability to store raw past states provided a more direct mechanism for credit assignment, allowing it to "see" exactly which past event led to a current reward.
Conclusion and Future Work
This work presents a computationally efficient method for integrating long-term episodic memory into RL agents. By combining reservoir sampling with a differentiable write mechanism, the agent achieves O(n) complexity relative to memory size, making it suitable for true online learning.
Future research will focus on scaling this approach to high-dimensional visual environments and relaxing the independence assumptions in the current gradient math. Additionally, exploring the storage of learned latent representations rather than raw observations could further enhance the system's robustness and generalization capabilities.
Summary updated