Posterior Sampling for Reinforcement Learning Without Episodes

Ian Osband, Benjamin Van RoyarXiv 2016

Introduction

Posterior Sampling for Reinforcement Learning (PSRL) has emerged as a powerful and computationally efficient alternative to "Optimism in the Face of Uncertainty" (OFU) algorithms. In episodic environments—where a task resets after a fixed number of steps—PSRL is backed by rigorous theoretical guarantees, often achieving near-optimal regret bounds. However, many real-world applications are non-episodic, operating over an infinite horizon without natural resets.

To bridge this gap, researchers have historically employed "artificial episodes" or "doubling tricks," where a new policy is sampled only after the accumulated data doubles. While this approach was thought to be theoretically sound for PSRL, this technical note identifies a subtle but critical flaw in existing proofs. By providing a concrete counterexample, the authors demonstrate that the standard logic for episodic PSRL breaks down when episode lengths are determined by the data collected within them.

The Independence Trap: Why Proofs Fail

The mathematical backbone of PSRL is the Posterior Sampling Lemma. This lemma essentially states that if a model is sampled from a posterior distribution based on a history $\mathcal{H}$, then the sampled model and the true environment are identically distributed, conditioned on that history.

In episodic RL, the history is fixed at the start of each episode. However, in infinite-horizon settings using a "doubling trick," the length of an episode is not fixed; it depends on the observations (rewards and transitions) made during that episode. This creates a hidden dependency. Because the timing of the next sample depends on the current sample's performance, the sampled model is no longer independent of the transitions it generates. This invalidates the standard regret decomposition used in previous literature, specifically Theorem 2 in Abbasi-Yadkori and Szepesvári (2015).

Optimism vs. Sampling

The paper highlights a fundamental divergence between OFU algorithms (like UCRL2) and PSRL.

  • OFU Algorithms: These work effectively with dynamic episodes because they always select the most optimistic model within a confidence set. The validity of the confidence set does not depend on the timing of the samples.
  • PSRL: This relies on the sample being "equal in distribution" to the true environment. This property is fragile; it is destroyed if the agent uses the data to decide when to stop and re-sample.

The "Heaven and Hell" Counterexample

To prove the error, the authors construct a "Heaven and Hell" Markov Decision Process (MDP). In this environment, an agent's initial choice can lead it to a state of high reward ("Heaven") or a state of permanent low reward ("Hell").

In this MDP, the authors show that the mathematical step used in previous proofs leads to a clear contradiction. Specifically, while the original proof assumed a certain expected regret term would be zero, the authors calculate that for a horizon of $T=1000$, the term is actually greater than 249. This numerical contradiction confirms that the $O(\sqrt{T})$ regret bound for "Lazy-PSRL" (PSRL with dynamic episodes) cannot be considered an established theorem and should instead be treated as a conjecture.

The Necessity of Connectedness

A secondary insight from the counterexample is the role of MDP structure. In infinite horizons, achieving sublinear regret is impossible unless the MDP is "communicating"—meaning any state can eventually be reached from any other state. Without this property, a single exploratory mistake in a non-episodic setting can trap an agent in a sub-optimal state (like "Hell") forever, making recovery impossible.

Pragmatic Strategies for Infinite Horizons

Despite the theoretical gap, PSRL remains a popular choice for practitioners. The authors suggest three pragmatic ways to implement PSRL when environment resets are unavailable:

  1. Fixed-Length Episodes: Use episodes of a fixed, pre-determined length. While this may be less efficient than a doubling trick, it preserves the independence required for theoretical guarantees.
  2. Data-Independent Switching: Switch policies at pre-determined time steps (e.g., $t = 2^k$) that do not depend on the observed rewards or transitions.
  3. Slowly Varying Noise: Instead of discrete episodes, use a continuous exploration strategy with noise that decreases over time, though this currently lacks a rigorous proof of optimality.

Conclusion

This technical note serves as a vital course correction for reinforcement learning theory. By identifying the "independence trap" in dynamic episode lengths, the authors clarify why infinite-horizon PSRL is more mathematically complex than its episodic counterpart. While the $O(\sqrt{T})$ regret bound remains a likely conjecture, the field must now seek new proof techniques that can account for the dependencies inherent in continuous, non-episodic learning.

Summary updated

BibTeX
@misc{osband2016posterior,
  author = {Ian Osband and Benjamin Van Roy},
  title = {{Posterior Sampling for Reinforcement Learning Without Episodes}},
  year = {2016},
  eprint = {1608.02731},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1608.02731},
}
Figure