Experience Replay Optimization

Daochen Zha, Kwei-Herng Lai, Kaixiong Zhou, Xia Hu

Experience replay is a cornerstone of modern off-policy reinforcement learning (RL), allowing agents to break temporal correlations and improve sample efficiency by storing and revisiting past transitions. However, the standard methods for selecting which experiences to replay—typically uniform sampling or heuristic-based prioritization—often fail to adapt to the specific needs of an agent at different stages of learning.

Presented at IJCAI 2019, Experience Replay Optimization (ERO) introduces a framework that treats the replay process itself as a learning problem. Instead of relying on fixed rules, ERO employs a learned "replay policy" that dynamically selects transitions to maximize the agent's performance improvement.

The Problem with Fixed Replay Rules

In traditional off-policy RL, agents store transitions (state, action, reward, next state) in a massive buffer. To train the agent, we must sample from this buffer.

  1. Uniform Sampling: Treats all memories as equally important, which is inefficient as many transitions may be redundant or uninformative.
  2. Prioritized Experience Replay (PER): Uses a fixed rule to prioritize transitions with high Temporal Difference (TD) error (the "most surprising" ones). While better than uniform sampling, PER is rigid and may not be optimal for every environment or learning phase.

ERO addresses these limitations by replacing heuristics with a data-driven "teacher" policy.

The ERO Framework

ERO utilizes a dual-policy architecture consisting of an Agent Policy ($\pi$) and a Replay Policy ($\phi$). The Agent Policy is a standard RL agent (such as DDPG) learning to solve a task, while the Replay Policy acts as a teacher, selecting the most beneficial training data for the agent.

The ERO framework architecture showing the interaction between the environment, the agent, and the learned replay policy.

How the Replay Policy Learns

For every transition in the buffer, ERO extracts three key features: the transition's reward, its TD error, and its age (how long ago it was recorded). The replay policy uses these features to assign a score to transitions.

The "aha!" moment of ERO is its reward signal for the replay policy: the improvement in the agent’s cumulative reward after training on a selected batch. If the agent’s performance increases, the replay policy is rewarded via the REINFORCE algorithm. To handle the massive scale of the buffer, ERO uses an efficient strategy where scores are only updated when a transition is sampled, keeping computational overhead low.

Key Insights: Challenging the Dogma

ERO's learned behavior revealed surprising insights into what makes a "good" memory:

  • Beyond TD-Error: While PER assumes high-error transitions are always best, ERO often preferred transitions with low TD errors. Replaying well-understood experiences can stabilize training and prevent "catastrophic forgetting," a common issue in deep RL.
  • The Importance of Recency: The replay policy naturally learned to favor more recent transitions. This aligns with the intuition that recent experiences are more relevant to the agent's current policy than stale memories from early in training.

Empirical Results

The framework was evaluated on eight continuous control tasks from the OpenAI Gym MuJoCo suite, including locomotion (e.g., HalfCheetah, Hopper) and robotics tasks.

Performance comparison showing ERO (blue) consistently outperforming vanilla DDPG and Prioritized Experience Replay variants.

ERO consistently outperformed both vanilla DDPG and PER variants across nearly all benchmarks. Notably, ERO demonstrated significantly higher sample efficiency, reaching reward thresholds faster than its counterparts. Despite the addition of a second neural network for the replay policy, the computational overhead remained negligible compared to the time required for environment interaction.

Future Directions

While ERO currently focuses on how to sample, the authors suggest the framework could be extended to manage the buffer itself—learning which transitions to store or delete. Furthermore, while demonstrated on DDPG, the principles of ERO are broadly applicable and could be integrated into other off-policy architectures like Soft Actor-Critic (SAC) or Rainbow DQN to further push the boundaries of sample-efficient reinforcement learning.

Summary updated

BibTeX
@inproceedings{zha2019experience,
  author = {Daochen Zha and Kwei-Herng Lai and Kaixiong Zhou and Xia Hu},
  title = {{Experience Replay Optimization}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.24963/ijcai.2019/589},
}
Figure