Analysis of Thompson Sampling for the Multi-armed Bandit Problem 1: Logarithmic Regret for Two ArmsResearch Paper
Motivation
Thompson Sampling (TS) is the oldest heuristic for the stochastic multi-armed bandit problem: it was proposed by Thompson in 1933 (Biometrika 25) and is used in practice for online advertising and recommendation, where it often performs as well as or better than upper-confidence-bound methods (Chapelle and Li, NIPS 2011; Scott 2010). Until 2012 its theoretical guarantees for the frequentist regret were weak: earlier analyses gave only regret in time (Granmo 2010; May, Korda, Lee and Leslie 2011).
Agrawal and Goyal, Analysis of Thompson Sampling for the Multi-armed Bandit Problem (arXiv:1111.1797v3, COLT 2012), gave the first logarithmic finite-time bound on the expected regret of TS. This mission formalizes their two-armed result, Theorem 1. A companion mission covers the -armed bound, Theorem 2.
Timeline. Lai and Robbins (1985) proved that every consistent algorithm has regret at least . Auer, Cesa-Bianchi and Fischer (2002) gave UCB1 with an finite-time bound. Agrawal and Goyal (2012) proved for two-armed TS. Kaufmann, Korda and Munos (ALT 2012) and Agrawal and Goyal (AISTATS 2013) later proved asymptotically optimal bounds for Bernoulli TS.
Setting
There are two arms. Arm has a fixed, unknown reward distribution supported in , with mean . Plays of an arm give i.i.d. rewards, independent of the other arm. Arm 1 is the unique optimal arm, , and is the gap.
Thompson Sampling for general stochastic bandits (Algorithm 2 of the paper) keeps, for each arm , a success count and a failure count , both starting at . In each round it
- samples, independently for each arm, ;
- plays and observes a reward ;
- performs a Bernoulli trial with success probability , with outcome ;
- increments if and otherwise.
is the number of plays of arm before round . The expected regret in time is
the expectation being over the rewards and the algorithm's randomness.
The analysis uses the Beta cdf , the binomial cdf , and the random variable : the number of independent draws made before one exceeds .
Formalization targets
Goal: Theorem 1 (p. 3)
There is an absolute constant such that for every two-armed instance with rewards in and , and every ,
The constant is not fixed numerically: the paper states the theorem in form (footnote 1), and the explicit display it reports on p. 8, , is not the formal claim.
Milestones
- Fact 1 (p. 12): for positive integers .
- Lemma 1 (p. 6): .
- Lemma 6 (p. 13): Hoeffding-type bounds (10)–(11) on binomial cdfs.
- Fact 2 (p. 13): every median of is or .
- Lemma 2 (p. 7): , where .
- Lemma 3 (p. 7): a three-case bound on for .
- Eq. (1) (p. 7): .
Significance
The result. Theorem 1 shows that TS, a randomized Bayesian heuristic with no explicit confidence bonus, has regret logarithmic in on every two-armed instance, matching the order in of the Lai–Robbins lower bound. The proof introduced a way to control the optimal arm's waiting time between plays through the Beta–Binomial duality, and later analyses of TS reuse that device.
Formalizing it. The result is proved on paper and has no machine-checked proof that we know of. The platform's existing TS results concern Gaussian TS (Lattimore and Szepesvári, Ch. 36) and Bayesian regret, which are different algorithms or regret notions. A formalization adds a reusable Lean model of Algorithm 2 on -valued rewards, Beta–Binomial facts (Fact 1, Lemma 1), a binomial-median theorem, and binomial Hoeffding bounds. It also produces a proof with a constant that has been checked, since the printed constants contain an arithmetic slip.
Difficulty
The standard UCB argument does not transfer to TS. For UCB, the optimal arm's index exceeds its mean with high probability however often the arm has been played, because the exploration bonus is deterministic; the analysis then only has to count plays of the suboptimal arm until its own index concentrates, after plays. Under TS the optimal arm's sample is random and, if the arm has been played rarely or its early rewards were poor, it falls below with constant probability. The optimal arm may then wait a long, random time between plays, and the length of that wait depends on the arm's posterior, which in turn depends on how long it has waited. Counting plays of the suboptimal arm with a union bound over rounds, under the assumption that the optimal arm is already concentrated, therefore does not work; controlling these waiting times is the central difficulty and is where the dependence enters.
Formalization scope
- Model. The instance is the platform's
StochasticBandit 2(a probability measure on per arm, meanbanditArmMean), with the hypothesis that each reward law gives mass to . Lean arm0is the paper's arm 1 and Lean arm1the paper's arm 2. Lean rounds are indexed from . - Algorithm. Algorithm 2 is realized on one probability space with three independent i.i.d. tables: Beta draws , rewards , and uniforms . Round uses , and . Ties in the arg max go to the smaller index (a null event).
- Values. Regret and expectations are lower Lebesgue integrals in . is -valued, so Lemma 1 at reads , as in the paper.
- O(·). The paper's (footnote 1: for ) is stated with one universal constant , quantified before the instance, the means and the horizon, for all . Eq. (1) is stated the same way, without its printed numerals.
- Not trivial. The goal is about Algorithm 2 itself, with fresh Beta samples, fresh rewards and the Bernoulli coin. A statement about "any policy satisfying Lemma 2's event bound", or one whose constant depends on , the reward laws or , would not be Theorem 1.
- Edge cases. is assumed only in Lemma 3, where the paper's and require it. It is not a hypothesis of the goal.
- Infrastructure. A complete proof needs: inverse-transform or order-statistics facts for Beta laws (Fact 1); geometric expectations; Hoeffding's inequality for sums of Bernoulli variables (Mathlib has Hoeffding/Azuma); the binomial median theorem (Jogdeo–Samuels; Kaas–Buhrman); and the coupling from the reward tables to the per-arm i.i.d. output stacks the paper reasons with. Fact 1, Lemma 6 and Fact 2 are reusable beyond this mission. Contributions to any milestone are welcome, and so is a direct proof of the regret bound with an explicit constant.
Selected references
- S. Agrawal and N. Goyal, Analysis of Thompson Sampling for the Multi-armed Bandit Problem, COLT 2012; arXiv:1111.1797v3. https://arxiv.org/abs/1111.1797
- W. R. Thompson, On the likelihood that one unknown probability exceeds another in view of the evidence of two samples, Biometrika 25 (1933) 285–294. https://doi.org/10.2307/2332286
- T. L. Lai and H. Robbins, Asymptotically efficient adaptive allocation rules, Advances in Applied Mathematics 6 (1985) 4–22. https://doi.org/10.1016/0196-8858(85)90002-8
- P. Auer, N. Cesa-Bianchi and P. Fischer, Finite-time analysis of the multiarmed bandit problem, Machine Learning 47 (2002) 235–256. https://doi.org/10.1023/A:1013689704352
- K. Jogdeo and S. M. Samuels, Monotone convergence of binomial probabilities and a generalization of Ramanujan's equation, Annals of Mathematical Statistics 39 (1968) 1191–1195. https://doi.org/10.1214/aoms/1177698243
- R. Kaas and J. M. Buhrman, Mean, median and mode in binomial distributions, Statistica Neerlandica 34 (1980) 13–18. https://doi.org/10.1111/j.1467-9574.1980.tb00681.x
- O. Chapelle and L. Li, An empirical evaluation of Thompson Sampling, NIPS 2011. https://papers.nips.cc/paper/4321-an-empirical-evaluation-of-thompson-sampling