Learning Unknown Markov Decision Processes: A Thompson Sampling Approach

Yi Ouyang, Mukul Gagrani, Ashutosh Nayyar, Rahul Jain

Abstract

Reinforcement learning in unknown environments requires balancing exploration and exploitation. While "Optimism in the Face of Uncertainty" (OFU) provides a theoretical framework, it often lacks practical efficiency. We introduce Thompson Sampling with Dynamic Episodes (TSDE), an algorithm that utilizes dynamic episode lengths to manage model updates. TSDE achieves a state-of-the-art Bayesian regret bound of $\tilde{O}(HS\sqrt{AT})$ for infinite-horizon MDPs. Our experiments show that TSDE consistently outperforms standard optimistic and posterior sampling methods across various benchmarks.

Introduction

In Reinforcement Learning (RL), an agent navigates a Markov Decision Process (MDP) with unknown transition dynamics. The core challenge is the exploration-exploitation trade-off. Traditional OFU algorithms, such as UCRL2, are theoretically sound but computationally intensive and often overly conservative in practice. Thompson Sampling (TS) offers a more efficient alternative by sampling from a posterior distribution. However, applying TS to infinite-horizon MDPs is difficult due to the sensitivity of episode lengths. Updating too frequently prevents learning, while updating too rarely leads to sub-optimal policy execution.

Methods

TSDE operates in episodes. At the start of each episode, the agent samples an MDP model from its current posterior and follows the optimal policy for that sample. The innovation lies in two dynamic stopping criteria:

  1. Growth Control: The current episode ends if its length exceeds the length of the previous episode plus one. This linear growth ensures the agent spends more time on policies as it becomes more confident.
  2. The Doubling Trick: The episode ends if the number of visits to any state-action pair doubles. This forces an update if the agent encounters a specific situation much more frequently than expected, suggesting its current model might be outdated.

By combining these, the algorithm balances the need for stable policy execution with the need to incorporate new data, matching the best-known theoretical limits.

Empirical Evaluation

The paper evaluates TSDE using two primary simulated environments: randomly generated MDPs and the classic RiverSwim benchmark. Unlike optimistic algorithms that require solving complex optimization problems over sets of MDPs, TSDE only needs to solve one sampled MDP per episode, making it significantly more computationally efficient.

Regret comparison on randomly generated MDPs. TSDE (dashed blue line) shows significantly lower cumulative regret compared to UCRL2 and other variants.

In the RiverSwim task, a "hard" exploration problem where agents must swim against a current to reach high rewards, TSDE demonstrates superior robustness. It effectively manages the exploration-exploitation trade-off without requiring specific knowledge of recurrent states, which is a limitation of some other Thompson Sampling variants.

Regret comparison on the RiverSwim benchmark. TSDE maintains near-zero regret growth compared to the linear regret of UCRL2 and TSMDP variants.

Conclusion

TSDE provides a theoretically optimal and practically efficient solution for learning unknown MDPs. By utilizing dynamic episode lengths, it bridges the gap between Bayesian sampling and frequentist performance guarantees. Future work includes extending these dynamic episode ideas to continuous state and action spaces and formalizing frequentist proofs for the TSDE framework.

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