Safe and Efficient Off-Policy Reinforcement Learning

Rémi Munos, Tom Stepleton, Anna Harutyunyan, Marc G. Bellemare

Abstract

In this work, we take a fresh look at some old and new algorithms for off-policy, return-based reinforcement learning. Expressing these in a common form, we derive a novel algorithm, Retrace($\lambda$), with three desired properties: (1) it has low variance; (2) it safely uses samples collected from any behaviour policy, whatever its degree of "off-policyness"; and (3) it is efficient as it makes the best use of samples collected from near on-policy behaviour policies. We analyze the contractive nature of the related operator under both off-policy policy evaluation and control settings and derive online sample-based algorithms. We believe this is the first return-based off-policy control algorithm converging a.s. to $Q^*$ without the GLIE assumption (Greedy in the Limit with Infinite Exploration). As a corollary, we prove the convergence of Watkins' Q($\lambda$), which was an open problem since 1989. We illustrate the benefits of Retrace($\lambda$) on a standard suite of Atari 2600 games.

Introduction

Reinforcement learning (RL) agents often face a fundamental trade-off when updating value estimates: bootstrapping from current value functions (single-step) versus looking ahead at multi-step returns. While multi-step returns propagate information more rapidly and harmonize better with function approximation, they are notoriously difficult to implement in off-policy learning. In off-policy settings, an agent learns about a target policy $\pi$ using data generated by a different behavior policy $\mu$ (e.g., from an experience replay buffer).

Existing methods for off-policy returns typically suffer from one of three major drawbacks:

  1. Importance Sampling (IS): Corrects policy mismatch but leads to exploding variance.
  2. Tree-backup (TB($\lambda$)): Safe and low-variance, but inefficiently truncates traces even when policies are similar.
  3. $Q^\pi(\lambda)$: Efficient but "unsafe," potentially diverging if the behavior and target policies differ significantly.

The Retrace($\lambda$) Algorithm

The authors unify several off-policy algorithms by expressing them through a "trace coefficient" $c_s$, which determines the weight of future returns in the current update. They propose Retrace($\lambda$), which defines this coefficient as: $$c_s = \lambda \min\left(1, \frac{\pi(a_s|x_s)}{\mu(a_s|x_s)}\right)$$

This truncation mechanism ensures that the algorithm remains safe by capping the importance weight at 1, preventing variance explosion. Simultaneously, it remains efficient by not cutting the trace as aggressively as Tree-backup when the behavior policy is near the target policy.

Comparison of off-policy return-based algorithms. Retrace($\lambda$) uniquely combines low variance, safety (guaranteed convergence for any $\pi, \mu$), and efficiency (use of full returns near on-policy).

The authors rigorously demonstrate that the Retrace operator is a contraction mapping for both policy evaluation and control, ensuring convergence to the optimal value function $Q^*$.

Theoretical Contributions

Beyond the introduction of Retrace($\lambda$), this work provides significant theoretical advancements:

  • Convergence without GLIE: Retrace($\lambda$) is the first return-based off-policy control algorithm proven to converge to $Q^*$ without requiring the Greedy in the Limit with Infinite Exploration (GLIE) assumption. This is crucial for practical applications where behavior policies may not eventually become greedy.
  • Solving Watkins' Q($\lambda$): The paper provides the first formal proof of convergence for Watkins' Q($\lambda$) in the control setting, resolving a theoretical open problem that had persisted since 1989.

Experimental Evaluation

Retrace($\lambda$) was evaluated on the Arcade Learning Environment (ALE), encompassing 60 Atari 2600 games. The experiments utilized an experience replay setting within a multi-threaded, CPU-based framework.

Performance comparison on Atari 2600 games at 40M and 200M training frames. Retrace($\lambda$) consistently outperforms Q-learning and Tree-backup across a larger fraction of games.

Key results include:

  • Superior Performance: Retrace($\lambda=1$) achieved the best performance on 30 out of 60 games, significantly outperforming Tree-backup (15 games) and standard Q-learning (12 games).
  • Robustness: Unlike baseline algorithms like $Q^*(\lambda)$, which fail for $\lambda > 0.5$, Retrace remains stable and performs optimally at $\lambda=1$, demonstrating high robustness to the trace decay parameter.

Conclusion

Retrace($\lambda$) represents a significant step forward in off-policy RL, offering a safe, efficient, and theoretically grounded approach to multi-step returns. While the current proofs rely on certain technical assumptions, such as Markovian traces and asymptotic commutativity of transition matrices, the empirical success on the Atari benchmark underscores its practical utility. Future work may focus on relaxing these assumptions and exploring scenarios where the behavior policy $\mu$ is estimated from data.

Summary updated

BibTeX
@inproceedings{munos2016safe,
  author = {Rémi Munos and Tom Stepleton and Anna Harutyunyan and Marc G. Bellemare},
  title = {{Safe and Efficient Off-Policy Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2016},
  url = {https://openreview.net/forum?id=rJN1fF-dWr},
}
Figure