NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Racing Thompson: an Efficient Algorithm for Thompson Sampling with Non-conjugate Priors

Yichi Zhou, Jun Zhu, Jingwei Zhuo

Introduction

Thompson Sampling (TS) is a highly effective strategy for balancing exploration and exploitation in Multi-Armed Bandit (MAB) problems. However, its standard implementation relies heavily on conjugate priors—situations where the posterior distribution shares the same algebraic form as the prior, making exact Bayesian inference tractable.

In many real-world applications, such as web advertising or complex recommendation engines, the underlying dependencies or likelihoods are non-conjugate. In these scenarios, exact inference becomes computationally intractable. While researchers often turn to approximate methods like Markov Chain Monte Carlo (MCMC) or Sequential Monte Carlo (SMC), these come with significant drawbacks. MCMC is typically too slow for online decision-making, and SMC lacks a principled method for determining the necessary number of samples (particles), often resulting in inefficiency or sub-optimal performance.

To bridge this gap, researchers have introduced "Racing Thompson," a novel algorithm that enables efficient Thompson Sampling for MAB problems with non-conjugate priors by bypassing the need for computationally expensive posterior inference.

The Racing Thompson Approach

The authors propose a three-step reformulation to make Thompson Sampling tractable without relying on exact inference:

  1. The Gumbel-Max Trick: The algorithm transforms the problem of sampling from a discrete distribution (the probability of an arm being optimal) into an optimization problem. By adding Gumbel-distributed noise to the log-probabilities, the arm that maximizes the resulting value is mathematically equivalent to a sample drawn from the original distribution.
  2. Importance Sampling with Prior Swapping: Because computing the true posterior is difficult, the optimization objective is expressed as an expectation over a tractable proposal distribution. The authors employ a "prior-swapping trick," substituting a "false" conjugate prior to create a proposal that is easy to sample from while still capturing essential information from the observed data.
  3. The Racing Algorithm: To efficiently find the maximum of these expectations, the sub-problem is treated as a Best Arm Identification (BAI) task. Instead of drawing a fixed number of samples, Racing Thompson draws samples incrementally. It "races" the arms against each other and halts as soon as one arm is statistically significantly better than the rest, based on a theoretical confidence threshold.

Key Insights

A profound insight from this work is that performing Thompson Sampling does not strictly require knowing the full posterior distribution; it only requires identifying which arm would have been the maximum if a sample had been drawn.

Furthermore, unlike SMC, which relies on a fixed number of particles, Racing Thompson features dynamic sample complexity. It adaptively determines how many samples are needed at any given time. As more data is collected and uncertainty decreases, the "race" concludes faster, drastically reducing the required number of samples over time.

Sample complexity of Racing Thompson over time, demonstrating how the algorithm requires fewer samples as uncertainty decreases.

Additionally, the prior-swapping technique proves highly effective because the likelihood term eventually dominates the posterior as more data is gathered. This makes the specific choice of the initial prior less critical to the overall quality of the proposal distribution.

Experimental Results

The algorithm was evaluated using synthetic bandit benchmarks specifically designed to highlight non-conjugacy, including Bernoulli bandits with Gaussian priors and Gaussian bandits with non-conjugate priors.

Regret Reduction: Racing Thompson significantly outperformed standard TS (using improper surrogates), SMC, and Prior Swapping (PS) in terms of cumulative regret across both non-conjugate Bernoulli and Gaussian tasks.

Cumulative regret comparisons across conjugate and non-conjugate bandit tasks, showing Racing Thompson's superior performance.

Efficiency: The algorithm achieved these superior results using remarkably few samples—only about 3 to 3.5 samples per arm per time step. In contrast, SMC and PS were allocated 10 to 20 particles and still underperformed, highlighting that where you sample is often more critical than how much you sample. The authors also provided theoretical validation, proving that their approach converges to the true Thompson Sampling distribution as confidence parameters approach zero.

Limitations and Future Directions

While highly effective, the algorithm has areas for potential refinement:

  • Threshold Selection: The threshold function used in the racing step is adapted from Gaussian bandit theory. A threshold specifically optimized for the importance sampling estimator used in this paper could yield even better performance.
  • Scalability: Although the algorithm reduces complexity to scale with the number of active arms, environments with massive arm sets (e.g., thousands of arms) might still present computational challenges in early rounds before suboptimal arms are eliminated.
  • Real-World Validation: Current evaluations rely on synthetic data. Future research should test Racing Thompson in complex, high-stakes real-world environments where non-conjugacy is prevalent.

Summary updated

BibTeX
@inproceedings{zhou2018racing,
  author = {Yichi Zhou and Jun Zhu and Jingwei Zhuo},
  title = {{Racing Thompson: an Efficient Algorithm for Thompson Sampling with Non-conjugate Priors}},
  booktitle = {International Conference on Machine Learning},
  year = {2018},
  url = {https://openreview.net/forum?id=S1b_3o-dZH},
}
Figure