Abstract
A fundamental artificial intelligence challenge is how to design agents that intelligently trade off exploration and exploitation while quickly learning about an unknown environment. However, in order to learn quickly, we must somehow generalize experience across states. One promising approach is to use Bayesian methods to simultaneously cluster dynamics and control exploration; unfortunately, these methods tend to require computationally intensive MCMC approximation techniques which lack guarantees. We propose Thompson Clustering for Reinforcement Learning (TCRL), a family of Bayesian clustering algorithms for reinforcement learning that leverage structure in the state space to remain computationally efficient while controlling both exploration and generalization. TCRL-Theoretic achieves near-optimal Bayesian regret bounds while consistently improving over a standard Bayesian exploration approach. TCRL-Relaxed is guaranteed to converge to acting optimally, and empirically outperforms state-of-the-art Bayesian clustering algorithms across a variety of simulated domains, even in cases where no states are similar.
Introduction
Reinforcement Learning (RL) agents face a dual challenge: they must explore unknown environments to find rewards and generalize their experiences to learn quickly. Standard Bayesian approaches, like Posterior Sampling for Reinforcement Learning (PSRL), are effective for exploration but often treat every state as unique. This lack of generalization is inefficient; if an action has the same effect in two different locations, the agent should not have to learn that twice.
Conversely, existing methods that do cluster states often rely on Markov Chain Monte Carlo (MCMC) techniques. These are computationally heavy, slow to run in real-time, and often lack theoretical guarantees on whether the agent will eventually find the optimal policy. This paper introduces Thompson Clustering for Reinforcement Learning (TCRL), a framework that allows agents to simultaneously explore and learn to generalize across similar states by leveraging the physical structure of the state space.
Methodology
The authors propose two variants of TCRL that use the topology of the state space (how states are connected) as a prior for which states might be similar.
TCRL-Theoretic
TCRL-Theoretic organizes states into a balanced tree starting from the initial state. It restricts the clustering search space to a small, specific set of possibilities (e.g., states sharing the same parent or grandparent in the tree). This reduces the clustering possibilities from $O(n^n)$ to a manageable number, allowing for exact Bayesian sampling and near-optimal "regret" bounds.
TCRL-Relaxed
TCRL-Relaxed uses a Directed Acyclic Graph (DAG) and a semi-greedy agglomerative clustering approach. It iterates through states and uses a Bayesian hypothesis test to decide whether to merge a state with its ancestors.
Both methods cluster state-action pairs separately for each action, providing more flexibility than traditional state-only aggregation. While TCRL-Relaxed lacks the strict regret bounds of the "Theoretic" version, it is more flexible and is guaranteed to converge to the optimal policy in the limit of infinite experience.
Experimental Results
The algorithms were evaluated on several simulated Markov Decision Process (MDP) environments, including RiverSwim (a 6-state chain), MarbleMaze (a 36-state gridworld), and a larger 200-state Gridworld.
Performance and Convergence
In the 200-state gridworld, TCRL variants significantly outperformed PSRL (which doesn't cluster) and MCMC variants that were limited by computation time. TCRL-Relaxed consistently reached near-optimal reward levels faster than baselines.
Computational Efficiency
By avoiding MCMC/Gibbs sampling, the authors turned a "black box" optimization into a structured Bayesian update. This resulted in a 600x speedup over MCMC-based baselines in some environments. TCRL-Theoretic and TCRL-Relaxed took roughly 0.2ms to 4.7ms to sample a clustering, whereas MCMC-based methods took 290ms to 1250ms.
Conclusion
The key insight of TCRL is that states physically near each other in the transition graph are much more likely to behave similarly. Using the state-space graph to prune the clustering search is the key to efficiency. While currently limited to discrete MDPs, TCRL provides a scalable and theoretically sound approach to generalization in RL. Future work will explore extending this framework to continuous state or action spaces.
Summary updated