Learning Unknown Markov Decision Processes: A Thompson Sampling Approach

Yi Ouyang, Mukul Gagrani, Ashutosh Nayyar, Rahul Jain

This paper by Yi Ouyang and colleagues presents a significant step forward in Reinforcement Learning (RL) theory. It introduces TSDE (Thompson Sampling with Dynamic Episodes), an algorithm that balances the computational efficiency of Bayesian methods with the rigorous performance guarantees typically reserved for more complex "optimistic" algorithms.

The Challenge of Unknown MDPs

In Reinforcement Learning, an agent must navigate an unknown environment to minimize costs, creating the classic exploration-exploitation trade-off: should the agent stick to what it knows works (exploit), or try new things to learn the environment better (explore)?

Two main strategies exist to handle this:

  1. Optimism in the Face of Uncertainty (OFU): The agent assumes the environment is as favorable as possible within its current knowledge. While theoretically sound, algorithms like UCRL2 are often computationally expensive because they require solving complex optimization problems over sets of possible models.
  2. Thompson Sampling (TS): The agent samples a single model from its current belief (posterior distribution) and acts optimally for that sample. TS is computationally efficient and often works better in practice, but proving its performance (regret bounds) in infinite-horizon MDPs has been notoriously difficult.

The specific challenge addressed here is the infinite-horizon, weakly communicating MDP. In these settings, there is no natural "end" to an episode, and the agent can eventually reach any state from any other. Previous TS approaches either required knowing a specific "recurrent state" or had flaws in their mathematical proofs regarding how long an episode should last before updating the agent's knowledge.

Introducing TSDE: Thompson Sampling with Dynamic Episodes

To solve this, the authors propose TSDE. The algorithm operates in episodes of varying lengths. At the start of each episode, the agent samples a model from its posterior distribution and follows the optimal policy for that specific sample.

The "secret sauce" of TSDE lies in its two stopping criteria for ending an episode:

  1. Linear Growth Criterion: An episode ends if its length exceeds the length of the previous episode. This ensures that the agent doesn't spend too much time following a potentially "bad" sampled model early on, but allows for longer periods of stable behavior as it learns.
  2. Doubling Criterion: An episode ends if the number of visits to any state-action pair doubles. This is a standard "doubling trick" that triggers an update when the agent has gained significant new information about a specific part of the environment.

By combining these, the authors provide a way to bound the number of times the agent needs to re-solve the MDP, keeping the computational overhead sublinear.

Key Insights

  • The Power of Linear Growth: The introduction of the linear growth stopping criterion is the key theoretical innovation. It allows the authors to prove that the "regret" (the cost of not knowing the true model from the start) doesn't grow too fast, effectively bridging the gap between TS and OFU theories.
  • No Prior Knowledge Needed: Unlike previous algorithms, TSDE doesn't need to know the total time horizon ($T$), the "span" of the optimal value function ($H$), or specific recurrent states. This makes it much more applicable to real-world scenarios where these parameters are unknown.
  • Computational Efficiency: Because TSDE only solves a single sampled MDP at the start of an episode (rather than searching through a confidence set of many MDPs), it is significantly faster to run than optimistic algorithms like UCRL2.

Empirical and Theoretical Results

The authors prove a Bayesian regret bound of $\tilde{O}(HS\sqrt{AT})$. This is "optimal" in the sense that it matches the best-known bounds for this class of problems and hits the theoretical lower bound for time $T$ (ignoring logarithmic factors).

Beyond theory, the paper evaluates the algorithm using two simulated environments: randomly generated MDPs and the classic RiverSwim benchmark.

Expected Regret vs Time for random MDPs
Expected Regret vs Time for RiverSwim

In simulations, TSDE significantly outperformed UCRL2 and other TS variants like Lazy PSRL. In the RiverSwim environment—designed to be difficult because the agent must explore past several low-reward states to reach a high-reward state—TSDE was much more efficient at finding the optimal policy. This demonstrates that its dynamic episode schedule isn't just a theoretical trick; it actively improves the balance between exploration and exploitation.

Limitations and Future Work

While a strong step forward, the approach has limitations:

  • Weakly Communicating Assumption: While this covers many interesting MDPs, it doesn't cover environments with "dead ends" or disconnected components.
  • Bayesian vs. Frequentist Regret: The main proof is for Bayesian regret (average performance over a prior). While the authors conjecture that TSDE would also perform well in a non-Bayesian (frequentist) setting, a formal proof remains open.
  • Scaling to Large State Spaces: Like most tabular MDP algorithms, the regret scales with the number of states ($S$) and actions ($A$). Applying these dynamic episode ideas to deep reinforcement learning with continuous or massive state spaces remains a frontier for future research.

Summary updated

BibTeX
@inproceedings{ouyang2017learning,
  author = {Yi Ouyang and Mukul Gagrani and Ashutosh Nayyar and Rahul Jain},
  title = {{Learning Unknown Markov Decision Processes: A Thompson Sampling Approach}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2017},
}
Figure