Large Batch Experience Replay

Thibault Lahire, Matthieu Geist, Emmanuel Rachelson

TL;DR

This paper introduces LaBER (Large Batch Experience Replay), a theoretically grounded method for non-uniformly sampling the replay buffer in Reinforcement Learning (RL). By prioritizing transitions within a "large batch" using up-to-date model parameters, LaBER significantly improves learning speed and stability across Atari and continuous control benchmarks while avoiding the hyperparameter sensitivity of previous heuristics.

What Problem Does This Paper Address?

Deep RL agents rely on an "experience replay buffer" to store and reuse past transitions. While sampling these transitions uniformly is standard, it is inefficient because some experiences are far more informative for learning than others.

Prioritized Experience Replay (PER) was introduced to solve this by sampling transitions with high Temporal Difference (TD) errors more frequently. However, PER has two major flaws:

  1. Theoretical Gap: It is largely a heuristic; exactly why prioritizing TD error works has not been rigorously explained.
  2. Staleness: Priorities in PER are only updated when a transition is sampled. In a buffer of a million transitions, a priority might be based on a model version from thousands of steps ago, making it "outdated."

The authors aim to provide a solid theoretical foundation for prioritization and a practical algorithm that fixes the stale priority problem.

Methods

The authors cast replay sampling as an importance sampling problem designed to minimize the variance of the stochastic gradient estimate. They prove that the theoretically optimal sampling distribution is proportional to the per-sample gradient norm.

Since computing exact gradient norms for the entire buffer is computationally prohibitive, they propose a taxonomy of methods based on whether priorities are Exact vs. Approximate and Outdated vs. Up-to-date:

Taxonomy of sampling algorithms based on priority freshness and accuracy.

The core contribution is LaBER, which ensures priorities are always up-to-date through a four-step process:

  1. Uniform Large Batch: Sample a large batch of transitions (size $mB$) uniformly from the buffer.
  2. Fresh Prioritization: Compute surrogate priorities (like TD errors) for these transitions using the current model parameters.
  3. Down-sampling: Use these fresh priorities to select a smaller mini-batch (size $B$) for the actual gradient update.
  4. Normalization: Introduce a scaling factor (like LaBER-mean, which uses the average gradient norm of the large batch) to properly scale the learning step.

Key Insights

  • Freshness > Exactness: One of the most striking findings is that using an approximate priority (like TD error) that is up-to-date performs better than using the exact gradient norm if that norm is outdated.
  • Variance Reduction is Key: Prioritization works because it reduces the variance of the gradient estimate. When variance is low, the agent can take more stable and effective steps toward the optimal policy.
  • Surrogate Accuracy: The authors demonstrate that TD error is a remarkably good "surrogate" for the true gradient norm. The difference between the surrogate and optimal distributions is much smaller than the difference between uniform and optimal distributions.
  • Simplicity: Unlike PER, which requires complex data structures like sum-trees to manage priorities across the whole buffer, LaBER only needs to prioritize within the freshly sampled large batch.

Key Results

LaBER was evaluated on a diverse set of benchmarks, including MinAtar, Atari 2600 (ALE), PyBullet, and LunarLander.

  • Superior Performance: LaBER consistently outperforms standard uniform sampling and PER across almost all tested games.
  • Versatility: It successfully improves a wide range of base algorithms, including C51 (distributional RL), SAC, and TD3 (actor-critic methods for continuous control).
  • Efficiency: While LaBER requires extra forward passes for the large batch, these are computationally cheap compared to backward passes. In practice, LaBER with a large batch 4x the size of the mini-batch ($m=4$) provides a significant "free" performance boost.
Comparison of LaBER against DQN, C51, SAC, and TD3 across various environments.

Limitations and Future Work

  • Hyperparameter $m$: While $m=4$ was a robust default, the optimal size of the "large batch" is still a hyperparameter that might need tuning for specific hardware or extremely complex tasks.
  • Computational Overhead: Although forward passes are cheap, they aren't free. On systems where the forward pass is the bottleneck, the overhead of LaBER might be more noticeable.
  • On-Policy Extension: The current work focuses on off-policy RL. Extending these variance-reduction principles to on-policy algorithms (like PPO) remains an open area for research.

Summary updated

BibTeX
@inproceedings{lahire2022large,
  author = {Thibault Lahire and Matthieu Geist and Emmanuel Rachelson},
  title = {{Large Batch Experience Replay}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=egIdZl2VJb},
}
Figure