Attentive Experience Replay

Peiquan Sun, Wengang Zhou, Houqiang LiAAAI 2020

Abstract

Experience Replay (ER) is a fundamental component of off-policy Deep Reinforcement Learning (DRL). However, standard uniform sampling often retrieves outdated or irrelevant states that can destabilize the training process. This paper introduces Attentive Experience Replay (AER), a novel sampling strategy that prioritizes past experiences most similar to the agent's current state. By focusing training on these "on-distribution" states, AER significantly enhances sample efficiency, computational speed, and final performance compared to uniform sampling and Prioritized Experience Replay (PER).

Introduction

In off-policy reinforcement learning algorithms such as DQN, SAC, or DDPG, agents store interactions in a replay buffer and sample them to update neural networks. While uniform random sampling is the standard, it suffers from the inclusion of "off-distribution" states—behaviors the agent no longer executes as its policy evolves. Training on these rarely visited states can lead the network to fit undesired regions of the state space, degrading the performance of the current policy.

The Limitations of Prioritized Experience Replay

Prioritized Experience Replay (PER) attempts to address sampling inefficiency by prioritizing transitions with high Temporal-Difference (TD) error. While effective for value-based methods like DQN, high TD error often correlates with states that diverge significantly from the current policy. In actor-critic architectures, updating the policy network (actor) using these highly surprising, off-policy states can actively destabilize training.

TD error comparison across different sampling strategies. AER maintains a lower and more stable error profile compared to PER and uniform sampling.

As illustrated in Figure 4, PER exhibits significantly higher and more volatile TD errors, which can be detrimental to stable policy optimization. AER, by contrast, maintains a much lower and more consistent error profile.

Methodology: Attentive Experience Replay (AER)

AER approximates the current policy's state distribution by sampling states similar to the agent's current state $s_t$. The algorithm follows a four-step process:

  1. Oversampling: A pool of $\lambda \cdot k$ transitions is uniformly sampled from the buffer (where $k$ is the final batch size).
  2. Similarity Scoring: Similarity is computed between the pool and $s_t$. Cosine similarity is used for low-dimensional tasks, while high-dimensional inputs use negative L2 distance between embeddings from a fixed, random CNN.
  3. Attentive Selection: The top $k$ most similar transitions are selected for the training batch.
  4. Bias Annealing: To ensure unbiased updates near convergence, the multiplier $\lambda$ is linearly annealed to 1 over time.

Experimental Results

The authors evaluated AER across OpenAI Gym MuJoCo (continuous control) and Atari 2600 (discrete control) benchmarks, coupling it with SAC, TD3, DDPG, and DQN.

Sample Efficiency and Performance

On MuJoCo tasks, AER demonstrated remarkable efficiency, requiring less than 65% of the environment steps needed by vanilla ER to reach peak performance. AER consistently outperformed PER in continuous control settings, where PER's focus on high TD error often hindered the actor's progress.

Cumulative reward on the HalfCheetah-v2 environment. AER (blue) shows faster convergence and higher final reward compared to vanilla-ER and PER.

Figure 5 demonstrates the performance gains in the HalfCheetah-v2 environment, where AER achieves higher cumulative rewards more rapidly than competing methods.

Computational Efficiency

AER maintains high computational speed. Unlike PER, which requires $O(\log N)$ complexity for its segment-tree data structure, AER's similarity calculations on a small batch are highly efficient. In practice, AER is nearly as fast as uniform sampling and approximately twice as fast as PER (e.g., 10.5k seconds vs 19k seconds on HalfCheetah).

Conclusion

Attentive Experience Replay provides a simple yet powerful alternative to standard replay strategies. By leveraging state similarity as a proxy for policy relevance, it ensures that updates are "on-distribution," leading to more stable and efficient learning in complex environments. Future work may explore more sophisticated anchors for similarity beyond the immediate current state to handle extreme exploration phases.

Summary updated

BibTeX
@inproceedings{sun2020attentive,
  author = {Peiquan Sun and Wengang Zhou and Houqiang Li},
  title = {{Attentive Experience Replay}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2020},
  doi = {10.1609/aaai.v34i04.6049},
}
Figure