Regret Bounds for Thompson Sampling
Frequentist proofs, and the information-ratio analysis of Bayesian regret.
Thompson proposed his rule in 1933; the first proofs that its regret grows only logarithmically appeared in 2012. Two kinds of proof now exist. Frequentist proofs fix the arms and show that Thompson sampling attains the Lai–Robbins constant, through a change of measure that only probability matching allows. Bayesian proofs average over the prior and need remarkably little: any confidence bound, or a single information-theoretic inequality, bounds the regret. This lesson proves both and marks where they stop.
What you’ll learn
- Distinguish frequentist from Bayesian regret, and state the main bounds for Thompson sampling with their conditions.
- Prove Agrawal and Goyal's key lemma, which charges pulls of a suboptimal arm to pulls of the optimal arm through the odds , and assemble the bound .
- Prove Russo and Van Roy's posterior-sampling decomposition, and derive a Bayesian regret bound of order from Hoeffding's inequality.
- Define the information ratio, prove that it is at most for arms, and derive the bound .
- Identify the known gaps: dependence on the prior, Gaussian Thompson sampling's extra , and the frequentist analysis of structured models.
Two kinds of guarantee
Two different questions can be asked about Thompson sampling. The frequentist question fixes the instance , the arms' reward distributions, and asks how large the regret can be when the algorithm runs with a fixed prior, typically uniform. The Bayesian question assumes that the instance itself was drawn from a prior , the same prior the algorithm uses, and asks for the regret averaged over that draw.
| Result | Setting | Bound |
|---|---|---|
| Agrawal & Goyal (2012) | Bernoulli, uniform prior | First finite-time logarithmic bound, |
| Kaufmann, Korda & Munos (2012); Agrawal & Goyal (2013) | Bernoulli, uniform prior | : asymptotically optimal |
| Korda, Kaufmann & Munos (2013) | One-parameter exponential families, Jeffreys prior | Asymptotically optimal |
| Honda & Takemura (2014) | Gaussian, unknown mean and variance, prior | Optimal if ; not if (reference prior , Jeffreys , whose regret is polynomial) |
| Agrawal & Goyal (2013, 2017) | Rewards in , worst case over instances | Beta: . Gaussian: , attained on some instance |
| Russo & Van Roy (2014) | Any prior, rewards in | Bayesian , from any UCB analysis |
| Russo & Van Roy (2016) | Any prior, rewards in an interval of length 1 | Bayesian |
| Bubeck & Liu (2013) | Any prior, rewards in | Bayesian ; some prior forces every algorithm above |
Charging bad pulls to the best arm
Take Bernoulli arms with uniform priors, and let arm 1 be optimal. Fix a suboptimal arm and two thresholds between its mean and the best one, . Write for arm 's empirical mean before round , for the posterior samples drawn in round , and for the history. Agrawal and Goyal sort the rounds in which arm is pulled with two events: , its average is honest, and , its sample is modest.
Every pull of arm falls into one of three cases:
(a) Each such round has a different count of earlier pulls, and after pulls an average above has probability at most by Chernoff's bound. Summing over :
(b) With pulls and an honest average, the Beta–binomial identity and Chernoff's bound give , which is at most once . At most pulls happen before that, and the rounds after it contribute at most :
(c) is where probability matching enters. In these rounds arm won the comparison although its own sample was at most , so the best arm's sample was below as well, an event of conditional probability , where
Summing the lemma over rounds charges each bad round to a pull of arm 1. The odds depend only on arm 1's posterior, which changes only when arm 1 is pulled. Between the -th pull of arm 1, at round , and the next one the odds are frozen, and exactly one pull of arm 1 is charged:
After pulls with successes, , close to 1 once settles near . Agrawal and Goyal show that is at most for , where , and decays exponentially in afterwards, so the whole sum is a constant, of order at worst. Adding (a), (b) and (c):
Choosing so close to that gives the asymptotically optimal bound, with a constant that grows like as the thresholds close in.
Why can the sum in (c) be regrouped by pulls of arm 1, one term per pull?
- Because arm 1 is pulled in every round
- Because depends only on arm 1's posterior, which changes only when arm 1 is pulled, and each stretch between its pulls contains exactly one of them
- Because is the same in every round
- Because the samples of different rounds are independent
Show the answer
B. Because depends only on arm 1's posterior, which changes only when arm 1 is pulled, and each stretch between its pulls contains exactly one of them
From round up to and including the round of the next pull of arm 1, the odds are frozen at their value after pulls, and the indicator is 1 exactly once in that stretch. So the stretch contributes , evaluated after pulls.
Bayesian regret from any confidence bound
Let be any function of the history and the arm. Given , is fixed and has the law of , so . Add and subtract it in the regret of round :
Instantiate with Hoeffding bounds for rewards in : with , and for an arm never pulled. Given the means the rewards are i.i.d., so Hoeffding's inequality with a union bound over arms, possible counts and both tails shows that the event , "every average lies within of its mean", rarely fails:
On the bound never fails at , and the width at the played arm is at most ; each arm is played once with no data, at a cost of at most 1. Sum the widths arm by arm with , then use Cauchy–Schwarz, :
Russo and Van Roy state this with slightly different constants. The power of the argument is that is arbitrary: confidence ellipsoids give for linear bandits, and for a general class of reward functions they bound the widths with a complexity measure they introduced, the eluder dimension. Thompson sampling never computes any of these bounds, so its Bayesian regret is at most the best of them.
The information ratio
The UCB route pays for its union bound over rounds. Russo and Van Roy (2016) found a route that never mentions confidence bounds. Let and condition on , let be the reward observed in round , and compare the expected regret of the round with what the round reveals about the optimal arm:
Write . Thompson sampling plays independently of the means and of the outcomes, so its expected regret is a sum over the arms:
The information splits the same way: alone carries no information about , and given the round reveals . A mutual information is an average of KL divergences between conditional and marginal laws:
Pinsker's inequality, , together with for in an interval of length 1, turns each divergence into a squared difference of means. Since :
Apply Cauchy–Schwarz to the regret, writing over terms, then add the off-diagonal terms of the double sum, which are nonnegative:
So in every round, for every prior, and the theorem gives . Probability matching entered only through the weights: regret and information are averaged with the same , which is what lets one bound the other.
| Feedback | Bound on for Thompson sampling | Bayesian regret |
|---|---|---|
| Full information (every arm's reward observed) | ||
| -armed bandit | ||
| Linear bandit in , finite action set |
Evaluate the information-ratio bound for arms and rounds.
Show the answer
340
, whose square root is about 339. The confidence-bound route gives , and Bubeck and Liu's prior-free bound . The information argument is sixteen times sharper here: it needs no union bound over rounds, and its constants are small.
The ratio is useful beyond Thompson sampling. Information-directed sampling (Russo & Van Roy, 2018) chooses in every round the action distribution that minimizes itself, which is how it pulls the informative but suboptimal arm that Thompson sampling ignores in the revealing-action example of Thompson Sampling & Bayesian Bandits. The ratio also reaches beyond Bayesian settings: combined with a minimax theorem relating worst-case Bayesian regret to minimax regret, Lattimore and Szepesvári (2019) generalized these tools to prove a minimax bound of for adversarial -armed bandits and new bounds for partial monitoring.
Where the analyses stop
Priors. Frequentist guarantees exist for specific prior–likelihood pairs, and the pair matters: uniform priors for Bernoulli arms, Jeffreys priors for one-parameter exponential families, and, for Gaussian arms with unknown variance, priors uniform in the variance or the standard deviation, while the Jeffreys and reference priors fail (Honda & Takemura, 2014). Bayesian guarantees hold for every prior, but only on average over instances drawn from it.
The worst case. The instance-free frequentist bounds are for Beta Thompson sampling and for the Gaussian version, and Agrawal and Goyal exhibit an instance on which the Gaussian version suffers regret of order , so it misses the minimax rate of Regret Lower Bounds. Clipping the samples repairs this: MOTS (Jin, Xu, Shi, Xiao & Gu, 2021) achieves , and a variant for Gaussian rewards is in addition asymptotically optimal.
Structure. For linear bandits Thompson sampling's Bayesian regret is by both routes above, but frequentist proofs inflate the posterior's spread so that each sample is optimistic with constant probability, and lose a factor : (Agrawal & Goyal, 2013; Abeille & Lazaric, 2017). Hamidi and Bayati (2020) argue that the inflation is fundamental: without it, linear Thompson sampling can suffer linear regret. Linear Bandits: LinUCB & OFUL compares this with optimism.
Key takeaways
- Frequentist bounds hold on every fixed instance; Bayesian bounds average over instances drawn from the algorithm's own prior. Thompson sampling has both: the Lai–Robbins constant for Bernoulli arms with uniform priors, and Bayesian regret of order for any prior.
- Agrawal and Goyal's key lemma charges each pull of a suboptimal arm made with a modest sample to a pull of the optimal arm, at the odds that the optimal arm's sample is low; for Beta posteriors these odds sum to a constant, leaving .
- Russo and Van Roy's decomposition: because and share their conditional law, any history-based confidence bound splits the Bayesian regret into widths and failures, giving from Hoeffding's inequality, for linear models and eluder-dimension bounds in general.
- The information ratio is at most for Thompson sampling, by Pinsker's inequality and Cauchy–Schwarz with regret and information weighted by the same , so .
- Gaps remain: frequentist guarantees depend on the prior, Gaussian Thompson sampling loses in the worst case, and linear Thompson sampling needs an inflated posterior and an extra .
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
In Agrawal and Goyal's analysis, how are the rounds in which a suboptimal arm is pulled despite a modest sample, , accounted for?
- They are impossible once arm has been pulled times
- They are charged to rounds in which the optimal arm is pulled, with weight the odds that the optimal arm's sample falls below
- They are bounded by Hoeffding's inequality applied to arm 's rewards
- They are charged to the prior, whose weight vanishes as grows
Show the answer
B. They are charged to rounds in which the optimal arm is pulled, with weight the odds that the optimal arm's sample falls below
If arm wins with a low sample, the optimal arm's sample must be low too. The key lemma compares this event with the event that the optimal arm wins against the same competition, which costs a factor . Summed over the pulls of the optimal arm, these odds give a constant for Beta posteriors.
Bubeck and Liu prove that Thompson sampling's Bayesian regret is at most for every prior. What does this say about one particular instance?
- Nothing directly: it bounds the average regret over instances drawn from the prior the algorithm uses, and an instance the prior considers unlikely can have larger regret
- The regret on every instance is at most
- The regret on every instance grows logarithmically
- Thompson sampling with any prior has worst-case frequentist regret of order
Show the answer
A. Nothing directly: it bounds the average regret over instances drawn from the prior the algorithm uses, and an instance the prior considers unlikely can have larger regret
Bayesian regret is an average over , with the algorithm's own prior. It implies, for instance, that the regret exceeds only on a set of instances of prior probability at most (Markov's inequality), but no bound for any single instance.
Russo and Van Roy's decomposition rests on . What makes this true?
- is an upper confidence bound, so it exceeds every mean
- The rewards are bounded in
- Given the history, is a fixed function and has the same distribution as , provided the instance was drawn from the algorithm's prior
- The arms are independent under the prior
Show the answer
C. Given the history, is a fixed function and has the same distribution as , provided the instance was drawn from the algorithm's prior
Probability matching says that and have the same conditional law, and is determined by , so the two expectations agree. No property of is needed for the identity; whether is a good bound only affects how small the two resulting terms are. The identity does need to follow the posterior, that is, a correct prior.
Which assumptions does the proof that Thompson sampling's information ratio is at most actually use?
- Independent priors across the arms
- Bernoulli rewards
- Uniform priors
- Rewards in an interval of length 1, and an action drawn from the posterior of independently of the outcomes
Show the answer
D. Rewards in an interval of length 1, and an action drawn from the posterior of independently of the outcomes
Pinsker's inequality turns information into squared differences of means, which needs rewards in an interval of length 1, and probability matching makes the regret and the information share the weights . Nothing else is used: the prior can be arbitrary, with any dependence between arms.
Further reading
- S. Agrawal & N. Goyal, "Near-optimal regret bounds for Thompson sampling," Journal of the ACM 64(5) (2017).
- E. Kaufmann, N. Korda & R. Munos, "Thompson sampling: An asymptotically optimal finite-time analysis," Algorithmic Learning Theory (2012).
- D. Russo & B. Van Roy, "Learning to optimize via posterior sampling," Mathematics of Operations Research 39(4), 1221–1243 (2014).
- D. Russo & B. Van Roy, "An information-theoretic analysis of Thompson sampling," Journal of Machine Learning Research 17(68), 1–30 (2016).
- T. Lattimore & C. Szepesvári, Bandit Algorithms, ch. 34–36 (Cambridge University Press, 2020).