On Thompson Sampling with Langevin Algorithms

Eric Mazumdar, Aldo Pacchiano, Yi-An Ma, Peter L. Bartlett, Michael I. JordanarXiv 2020

Abstract

Thompson Sampling (TS) is a powerful heuristic for multi-armed bandit problems but faces significant computational challenges in non-conjugate settings. This paper investigates the use of Langevin Monte Carlo methods—specifically the Unadjusted Langevin Algorithm (ULA) and Stochastic Gradient Langevin Dynamics (SGLD)—to approximate the posterior distribution. By employing a warm-start strategy, the authors demonstrate that approximate TS can achieve optimal logarithmic regret with a constant per-step computational cost, effectively bridging the gap between theoretical elegance and practical scalability.

Introduction

The Multi-Armed Bandit (MAB) problem serves as the foundational framework for studying the exploration-exploitation tradeoff. Among the various strategies developed, Thompson Sampling (TS) stands out for its empirical success and Bayesian elegance. TS operates by maintaining a posterior distribution over the expected rewards of each arm and selecting actions based on samples drawn from these distributions.

However, TS has a "dirty little secret": it is often computationally prohibitive. In complex, non-conjugate models where the posterior does not have a closed-form expression, one must resort to Markov Chain Monte Carlo (MCMC) methods. Traditional MCMC requires many iterations to produce a single high-quality sample, making it unsuitable for real-time decision-making. Furthermore, theoretical analysis has shown that even minor approximation errors in the sampling process can cause the algorithm's regret to degrade from logarithmic to linear.

Approximate Sampling via Langevin Dynamics

To address these challenges, Mazumdar et al. propose a computationally efficient variant of Thompson Sampling that utilizes Langevin-based MCMC algorithms. Specifically, they focus on the Unadjusted Langevin Algorithm (ULA) and Stochastic Gradient Langevin Dynamics (SGLD).

Algorithm 1: The general Thompson Sampling framework.

ULA is a gradient-based sampling method that mimics gradient descent while incorporating Gaussian noise to explore the target distribution. SGLD further optimizes this by using minibatches of data to estimate gradients, which is particularly beneficial in data-rich environments.

The core innovation of this approach lies in two strategies:

  1. Warm-Starting and Sample Reuse: Instead of re-initializing the MCMC chain at every time step $t$, the algorithm starts from the sample generated at $t-1$. Since the posterior changes incrementally with each new observation, the previous sample provides an excellent starting point, allowing the chain to converge with only a constant number of iterations per round.
  2. Scaled Posteriors: The authors introduce a scaling parameter $\gamma$ to "spread out" the posterior distribution. This ensures the algorithm maintains sufficient optimism to explore potentially optimal arms, a critical requirement for avoiding sub-optimal convergence.

Theoretical Guarantees: Regret and Complexity

The paper provides a rigorous theoretical foundation for Langevin-based TS. A key contribution is the link between approximation error and regret; the authors demonstrate that if the Total Variation distance of the approximation does not decrease appropriately, regret can become linear. This highlights why "naive" MCMC is dangerous for bandit applications.

By leveraging the warm-start property, the authors prove that their algorithm achieves $O(\log T)$ frequentist regret, matching the theoretical lower bounds for bandit problems. Crucially, this is achieved with $O(1)$ computational complexity per round, transforming TS into a truly "anytime" algorithm that does not slow down as more data is collected. These guarantees hold for any reward distribution that is strongly log-concave, a broad class that includes Gaussian and Laplacian distributions.

Empirical Evaluation

The authors evaluated their methods using Gaussian bandit simulations across various prior scenarios:

  • Good Priors: Initial beliefs accurately reflect the best arms.
  • Uniform Priors: Agnostic initial beliefs.
  • Bad (Adversarial) Priors: Initial beliefs that are significantly incorrect.

The results indicate that ULA and SGLD-based TS perform competitively with exact Thompson Sampling and significantly outperform the Upper Confidence Bound (UCB) algorithm in most settings. Notably, SGLD showed remarkable robustness to "bad" priors, where the stochasticity of minibatch gradients appeared to help the algorithm recover from incorrect initial beliefs more rapidly than exact methods.

Conclusion

This work bridges the gap between the theoretical appeal of Thompson Sampling and the practical constraints of large-scale systems. By demonstrating that Langevin MCMC can provide sufficiently accurate samples with minimal computational overhead, the authors provide a path forward for deploying TS in complex, non-conjugate environments without sacrificing performance guarantees. Future work remains to extend these results to non-log-concave distributions and high-dimensional contextual bandit settings.

Summary updated

BibTeX
@misc{mazumdar2020thompson,
  author = {Eric Mazumdar and Aldo Pacchiano and Yi-An Ma and Peter L. Bartlett and Michael I. Jordan},
  title = {{On Thompson Sampling with Langevin Algorithms}},
  year = {2020},
  eprint = {2002.10002},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2002.10002},
}
Figure