Skip to main content
QUICK REVIEW

[Paper Review] A Tutorial on Thompson Sampling

Daniel Russo, Benjamin Van Roy|arXiv (Cornell University)|Jul 7, 2017
Advanced Bandit Algorithms ResearchDecision Sciences71 references39 citations
TL;DR

This tutorial presents Thompson Sampling (TS) as a computationally efficient algorithm for sequential decision-making under uncertainty, balancing exploration and exploitation by sampling from posterior distributions. It demonstrates TS's effectiveness across diverse problems—bandits, shortest paths, recommendation systems, and reinforcement learning—while analyzing its limitations and comparing it to alternatives like UCB and information-directed sampling.

ABSTRACT

Thompson sampling is an algorithm for online decision problems where actions are taken sequentially in a manner that must balance between exploiting what is known to maximize immediate performance and investing to accumulate new information that may improve future performance. The algorithm addresses a broad range of problems in a computationally efficient manner and is therefore enjoying wide use. This tutorial covers the algorithm and its application, illustrating concepts through a range of examples, including Bernoulli bandit problems, shortest path problems, product recommendation, assortment, active learning with neural networks, and reinforcement learning in Markov decision processes. Most of these problems involve complex information structures, where information revealed by taking an action informs beliefs about other actions. We will also discuss when and why Thompson sampling is or is not effective and relations to alternative algorithms.

Motivation & Objective

  • To provide a thorough, accessible tutorial on Thompson Sampling for researchers and practitioners in machine learning and decision theory.
  • To illustrate how TS balances exploration and exploitation in complex information structures where actions reveal correlated information about other actions.
  • To evaluate TS's performance and limitations in real-world applications such as online advertising, product recommendation, and reinforcement learning.
  • To compare TS with alternative algorithms like Upper Confidence Bound (UCB) and Information-Directed Sampling (IDS), highlighting trade-offs in computational cost and statistical efficiency.
  • To clarify when TS is effective and when it may fail, particularly in problems with high-dimensional or structured information dependencies.

Proposed method

  • Thompson Sampling selects actions by sampling from the posterior distribution of action values, favoring actions with higher expected rewards based on current beliefs.
  • It uses Bayesian updating to maintain and refine beliefs about unknown parameters (e.g., success probabilities in Bernoulli bandits) after each action and observation.
  • For structured problems like shortest path or assortment optimization, TS incorporates prior beliefs over entire action sets and uses posterior sampling to guide exploration.
  • The algorithm is applied to problems with complex information structures, such as Markov decision processes and neural network active learning, where information from one action informs beliefs about others.
  • The tutorial uses illustrative examples—Bernoulli bandits, shortest path, product assortment, and neural network active learning—to demonstrate TS’s implementation and behavior.
  • It compares TS to UCB and IDS, analyzing their theoretical foundations, computational complexity, and performance in terms of regret and information gain.

Experimental results

Research questions

  • RQ1How does Thompson Sampling effectively balance exploration and exploitation in sequential decision problems with unknown reward distributions?
  • RQ2In what types of problems does Thompson Sampling fail to explore efficiently, and why?
  • RQ3How does Thompson Sampling compare to Upper Confidence Bound (UCB) and Information-Directed Sampling (IDS) in terms of regret, computational cost, and statistical efficiency?
  • RQ4What are the theoretical and practical limitations of Thompson Sampling in structured or high-dimensional information settings?
  • RQ5In which real-world applications—such as online advertising, recommendation systems, or reinforcement learning—does Thompson Sampling demonstrate strong performance?

Key findings

  • Thompson Sampling achieves near-optimal regret bounds in standard multi-armed bandit problems with independent arms and conjugate priors, such as the beta-Bernoulli bandit.
  • In problems with structured information—like shortest path or product assortment—TS can fail to explore efficiently, as it may not prioritize actions that maximize information gain about unknown types.
  • For example, in the customer-type assortment problem, TS may repeatedly offer the same product type, while diversifying the assortment accelerates learning by a factor of m (number of untested types).
  • Information-directed sampling (IDS) outperforms TS in such structured problems by minimizing the information ratio, but at the cost of significantly higher computational complexity.
  • Despite its limitations in certain structured settings, TS remains widely used due to its computational simplicity and strong empirical performance across diverse applications.
  • The tutorial establishes a formal connection between TS and UCB, showing that both aim to balance exploration and exploitation, though through different mechanisms: sampling vs. confidence bounds.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.