Multi-Armed Bandits and Thompson Sampling - Overview

Summary

The multi-armed bandit (MAB) problem formalizes sequential decision-making under uncertainty: a set of actions (“arms”) with unknown reward distributions is played repeatedly, and the agent must balance exploiting arms known to pay well against exploring arms that might pay better. Thompson sampling (TS) — also called posterior sampling or probability matching — is a 1933-vintage algorithm that resolves this trade-off by selecting each action with probability equal to the posterior probability that it is optimal, implemented simply by drawing one sample from the current posterior over model parameters and acting greedily on that sample. This note is the topic map for a six-note ingestion of Russo, Van Roy, Kazerouni, Osband & Wen (2018), A Tutorial on Thompson Sampling — the vault’s answer to its previously identified “biggest gap” for the earn-while-learning paradigm (see Q - BED vs Bayesian Optimization vs Bandits for Media Experimentation).

Overview

Bandit problems have been studied since WWII as the canonical crystallization of the exploration–exploitation trade-off in sequential decision-making (cf. The Global Optimisation Problem, which frames the same trade-off for continuous black-box optimization). The name comes from a gambler at a “one-armed bandit” slot machine choosing among several arms with unknown, fixed payout probabilities, trying to maximize cumulative winnings over many pulls. The internet made this practically urgent: online systems (ad placement, recommendation, pricing) can run thousands of small experiments per second, and every impression is simultaneously a trial and a payout — so exploration is not free but must be earned back through improved future decisions.

Thompson sampling was proposed by Thompson (1933, 1935) for two-armed clinical-trial allocation, essentially ignored for eight decades, and then rediscovered as a highly effective heuristic (Wyatt 1997; Strens 2000) before two influential empirical papers (Chapelle & Li 2011; Scott 2010) triggered an explosion of industrial and academic interest. It has since been deployed at Adobe, Amazon, Facebook, Google, LinkedIn, Microsoft, Netflix, and Twitter, across revenue management, marketing, website optimization, Monte Carlo tree search, A/B testing, internet advertising, recommendation, hyperparameter tuning, and arcade games.

Main Content

The problem, in one definition

Multi-armed bandit problem

There are actions (arms). At each period , the agent selects an action , and the system generates an outcome/reward drawn from a distribution associated with that depends on unknown parameters , fixed over time. The agent’s objective is to maximize cumulative reward (equivalently minimize cumulative regret) over a horizon , learning about only through experimentation.

The canonical instance is the Bernoulli bandit (Example 1.1): action produces success (reward 1) with unknown probability , failure (reward 0) otherwise; see Bernoulli Bandit and Thompson Sampling Algorithm. The tutorial repeatedly stress-tests the same idea on richer information structures: an online shortest-path problem (edge travel times, exponentially many “arms” = paths), news article recommendation and product assortment (contextual/combinatorial actions), cascading recommendations (ordered lists), active learning with neural networks, and reinforcement learning in MDPs — see Contextual and Linear Bandits and Approximate Thompson Sampling and Practical Extensions.

Why not just be greedy?

A greedy algorithm estimates from history and always plays the currently-best-looking action. It can get permanently stuck on a suboptimal arm because it never revisits actions it currently believes are worse, however uncertain that belief is. Dithering (e.g. -greedy) fixes this by forcing occasional random exploration, but wastes effort by exploring uniformly rather than where uncertainty is actually decision-relevant. TS and UCB algorithms explore judiciously instead — see UCB and Greedy Algorithms for Bandits.

The core idea of Thompson sampling

Thompson sampling (informal)

Maintain a Bayesian posterior over . At each period, draw one sample from the posterior, then act as if were the true parameter (play the action optimal under ). Update the posterior on the observed outcome and repeat.

This is probability matching: because is a posterior draw, the probability that action is selected exactly equals the posterior probability that is optimal. Actions that could plausibly be optimal keep getting tried; actions that are implausible get abandoned — all without ever computing an explicit confidence bound. The full algorithm (Beta-Bernoulli special case and the general form) is in Bernoulli Bandit and Thompson Sampling Algorithm.

Why it works, and where it doesn’t

TS enjoys both frequentist regret guarantees matching the Lai–Robbins lower bound for the classical Bernoulli bandit and much more general Bayesian regret bounds — via a UCB-analogy and via an information-theoretic analysis based on the information ratio — that extend to linear models, generalized linear models, and beyond. See Regret Bounds for Thompson Sampling for the formal statements. TS is not universally best, however: it under-performs on problems that need no active exploration, pure best-arm-identification (“ranking and selection”), time-sensitive learning, and problems where the most informative action is not the most rewarding one (revealing actions, sparse linear models, assortment diversification) — the tutorial’s Section 8.2 catalogs these failure modes and points to information-directed sampling as a fix.

Connections

See Also