Concentration, a union bound and log T regret step by step, plus KL-UCB’s sharper bonus.
Optimism's promise is a theorem: the regret of UCB grows like logT. This lesson proves it from scratch with a good event, a union bound and a careful choice of confidence level, derives the worst-case KTlogT and the trick that removes its logarithm, and then asks how good the constant is. The answer leads to KL-UCB, whose index replaces Hoeffding's quadratic penalty by the Bernoulli relative entropy and attains the Lai–Robbins constant.
What you’ll learn
Prove E[Ni(T)]≤3+16lnT/Δi2 for UCB with confidence level δ=1/T2, using a good event and a union bound over sample counts.
Derive the gap-free bound 8KTlnT+3∑iΔi and explain how MOSS removes the logarithm.
Explain why indices built on Hoeffding's inequality cannot attain the Lai–Robbins constant for Bernoulli arms, using Pinsker's inequality and a Taylor expansion of the divergence.
Define the KL-UCB index, compute it, and sketch the proof that its regret attains ∑iΔi/kl(μi,μ⋆) asymptotically.
The algorithm and the theorem
Work with subgaussian rewards: X is σ-subgaussian if E[eλ(X−EX)]≤eλ2σ2/2 for all λ. An average of s independent σ-subgaussian variables then satisfies Pr(μ^s−μ≥ε)≤e−sε2/(2σ2), and the same below. Gaussians with variance σ2 qualify, and rewards in [0,1] are 21-subgaussian by Hoeffding's lemma. With σ=1, the confidence level δ gives the index
The algorithm "UCB(δ)" of Lattimore and Szepesvári (ch. 7). With δ=1/T2 the bonus is 4lnT/Ni; UCB1's 2lnt/Ni is the anytime analogue for rewards in [0,1].
Auer, Cesa-Bianchi and Fischer's original proof for UCB1 counts, round by round, the event that a suboptimal arm's index beats the optimal arm's, and bounds it by a triple sum over rounds and both arms' sample counts. The proof below decouples the randomness from the algorithm instead: it fixes, before the game starts, a "good event" on which the algorithm cannot misbehave, and then bounds the probability that the good event fails. It is the template for most optimism proofs, including those for MDPs.
Setup. Let arm 1 be optimal, fix a suboptimal arm i, and imagine every arm's rewards drawn in advance as a sequence, so that μ^j,s, the average of arm j's first s rewards, is defined whether or not the arm is pulled s times. For a number ui to be chosen, define the good event: the optimal arm's index never falls below its mean, and arm i's index after ui pulls is below μ1:
On Gi, arm i is pulled at most ui times. Otherwise there is a round t with Ni(t−1)=ui and At=i. But then arm i's index is μ^i,ui+2ln(1/δ)/ui<μ1<UCB1(t−1,δ), so arm 1 has the larger index and At=i: a contradiction. Since Ni(T)≤T always,
The optimal arm is rarely underestimated. Its index at any round uses its first s rewards for some random s, so cover every possible s with a union bound, applying the subgaussian tail to each fixed s:
Arm i's index falls below μ1 after ui pulls. Choose ui so that the bonus uses at most a fraction 1−c of the gap, 2ln(1/δ)/ui≤(1−c)Δi for some c∈(0,1). Then the event requires a deviation of at least cΔi:
E[Ni(T)]≤Δi216lnT+1+1+1=3+Δi216lnT
Choose the constants. Take ui=⌈2ln(1/δ)/((1−c)2Δi2)⌉ and δ=1/T2. Then T⋅Tδ=1, and the second failure term contributes Texp(−uic2Δi2/2)≤T1−2c2/(1−c)2. With c=21 the exponent is 1−2=−1, so this term is at most 1, and ui≤16lnT/Δi2+1:
Check your understanding
In the third step, why does the union bound run over the possible sample counts s=1,…,T rather than applying the tail bound once?
Because the rewards of arm 1 are not independent
Because the number of samples behind arm 1's index at a given round is random and depends on the algorithm, so the bound must hold for every count the algorithm could produce
Because Hoeffding's inequality only applies to one sample at a time
Because the regret decomposition requires it
Show the answer
B. Because the number of samples behind arm 1's index at a given round is random and depends on the algorithm, so the bound must hold for every count the algorithm could produce
The tail bound holds for an average of a fixed number of samples. The count N1(t−1) is chosen by the algorithm from the data, so it can be correlated with how lucky the samples were. Bounding the failure for every fixed s simultaneously sidesteps that dependence, at a price of a factor T, which is why the confidence level must be δ=1/T2 rather than 1/T.
The proof shows where the constant 16 comes from: a factor 4 from ln(1/δ)=2lnT with the 2 in the bonus, and a factor 4 from c=21, which spends half the gap on the bonus and half on the deviation. Both are artifacts of a proof that works at every finite T. A refined analysis with a slightly larger, anytime confidence level brings the asymptotic constant down to 2/Δi (next steps).
Fix a threshold Δ>0. Arms with Δi<Δ cost at most Δ per pull and at most T pulls in total; the others obey Theorem 7.1:
RT≤TΔ+Δ16KlnT+3i∑Δi=8KTlnT+3i∑Δi
Bound 1/Δi≤1/Δ and balance TΔ against 16KlnT/Δ at Δ=16KlnT/T:
The minimax lower bound is of order KT, so the lnT is the price of the union bound over sample counts. MOSS (Audibert & Bubeck, 2009) removes it with a confidence level that depends on how many pulls an arm already has relative to its fair share T/K:
For 1-subgaussian rewards its regret is at most 39KT+∑iΔi (Lattimore & Szepesvári, Theorem 9.1). The analysis replaces the union bound over counts by a maximal inequality, Pr(∃s≤n:Ss≥ε)≤e−ε2/(2nσ2) for sums of independent σ-subgaussian variables, which follows from Doob's inequality applied to eλSs. An arm with more than T/K pulls has no bonus at all: its average is already accurate to about K/T, the scale of the minimax regret per round. MOSS needs the horizon and is not asymptotically optimal; KL-UCB++ (Ménard & Garivier, 2017) is minimax optimal and asymptotically optimal at once.
Predict before you look
Compare the bounds 8KTlnT (UCB) and 39KT (MOSS), ignoring the additive terms. Above what value of lnT is MOSS's bound the smaller one?
Show the answer
23.8
8lnT>39 when lnT>(39/8)2≈23.8, that is T≳2×1010. Removing the logarithm is a statement about rates and about the minimax constant in principle, not an improvement visible at practical horizons with these constants, which come from proofs, not from the algorithms' actual behavior.
The constant: from Hoeffding to KL
With a slightly more generous confidence level, the index μ^i+2lnf(t)/Ni with f(t)=1+tln2t, a sharper analysis shows limsupTRT/lnT≤∑i2/Δi for 1-subgaussian rewards (Lattimore & Szepesvári, Theorem 8.1). For unit-variance Gaussian arms that is exactly the Lai–Robbins constant, so this UCB is asymptotically optimal there. For Bernoulli arms, rescaled to their subgaussian constant 21, it gives ∑i1/(2Δi), against the Lai–Robbins ∑iΔi/kl(μi,μ⋆).
Pinsker's inequality for Bernoulli distributions, kl(p,q)≥2(p−q)2, gives Δi/kl(μi,μ⋆)≤1/(2Δi) term by term: a Hoeffding-based index is never better than the lower bound allows, as it must be. A second-order expansion shows how far it can be from it:
Hoeffding's inequality uses the worst variance in [0,1], 41, while the Bernoulli divergence uses the actual variance μ(1−μ). Near μ=21 the two agree; for arms near 0 or 1 the quadratic penalty explores far more than needed. On the arms 0.9, 0.7, 0.5, 0.3, 0.1, the Lai–Robbins constant is 3.12, a Hoeffding index tuned to σ=21 achieves about 5.21, and UCB1's bonus, which is tuned to σ=1, about ∑i2/Δi≈20.8.
Predict before you look
An arm has average μ^=0.1 after n=100 pulls, and the confidence budget is lnf≈6.9. Its KL-UCB index is the largest q with 100kl(0.1,q)≤6.9. What is it, approximately? (A Hoeffding index with σ=21 would give 0.1+6.9/200≈0.29.)
Show the answer
0.246
Solving kl(0.1,q)=0.069 gives q≈0.246. The divergence knows that an arm averaging 0.1 has small variance, so its plausible range is narrower than the worst-case Hoeffding range, and KL-UCB spends fewer pulls ruling it out.
Average μ^ (100 pulls, budget 6.9)
KL-UCB
Hoeffding, σ=21
UCB1-style, 2⋅6.9/100
0.1
0.246
0.286
0.472
0.5
0.680
0.686
0.872
0.9
0.976
1.086
1.272
Near 21 KL-UCB and the correctly scaled Hoeffding index almost coincide; near the boundaries KL-UCB is much tighter, and it never claims a mean above 1.
KL-UCB attains the Lai–Robbins constant
DerivationProof sketch: two counting lemmas
Ni(T)≤τ+κ,κ=s=1∑T1{skl(μ^i,s,μ⋆−ε2)≤lnf(T)}
Let arm 1 be optimal and fix ε1,ε2. A pull of arm i at round t needs Ui(t)≥U1(t), so either the optimal arm's index is low, U1(t)<μ⋆−ε2, or arm i's index is high, Ui(t)≥μ⋆−ε2. Let τ be the first round after which the optimal arm's index never drops below μ⋆−ε2, and κ the number of sample sizes s at which arm i's index can still reach that level:
E[τ]≤ε222
The optimal arm is rarely too pessimistic (Lemma 10.7). A union bound over sample counts and Chernoff's bound for Bernoulli averages give Pr(τ>t)≤1/(2f(t)ε22). The choice f(t)=1+tln2t makes ∫dt/f(t) finite, so the tail integrates to
E[κ]≤kl(μi+ε1,μ⋆−ε2)lnf(T)+2ε121
The suboptimal arm's index sinks (Lemma 10.8). For a sample size s to count in κ, either its average is unusually high, μ^i,s≥μi+ε1, which has total expected count at most ∑se−skl(μi+ε1,μi)≤1/(2ε12) by Chernoff and Pinsker, or s is small:
Add the two, multiply by Δi and sum over arms for the finite-time bound. Divide by lnT (note lnf(T)∼lnT), let T→∞ and then ε1,ε2→0; continuity of kl gives the Lai–Robbins constant. The same two-lemma structure, an optimistic optimal arm and a sinking suboptimal one, recurs in the analysis of Thompson sampling.
Key takeaways
UCB with δ=1/T2 pulls each suboptimal arm at most 3+16lnT/Δi2 times in expectation: on a good event the optimal arm is never underestimated and arm i's index sinks below μ⋆ after ui pulls, and a union bound over sample counts controls the rest.
Splitting arms at a threshold gap gives the worst-case bound 8KTlnT+3∑iΔi; MOSS's count-dependent confidence level removes the logarithm, reaching 39KT.
Hoeffding-based indices pay for the worst variance 41: their asymptotic constant exceeds Lai–Robbins by a factor of about 1/(4μi(1−μi)), large near 0 or 1.
KL-UCB's index max{q:Nikl(μ^i,q)≤lnf(t)} attains limsupRT/lnT=∑iΔi/kl(μi,μ⋆), the Lai–Robbins constant, through two counting lemmas.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Question 1
In the proof of Theorem 7.1, what does the choice δ=1/T2 achieve?
It keeps every index below 1
It makes the bonus vanish at the horizon
It makes the contribution of the optimal arm's failures, T⋅Tδ, at most a constant
Nothing specific: any δ≤1/T gives the same bound
Show the answer
C. It makes the contribution of the optimal arm's failures, T⋅Tδ, at most a constant
The union bound over T possible sample counts gives failure probability Tδ, and a failure can cost up to T pulls, so the term is T⋅Tδ. With δ=1/T2 it is 1; with δ=1/T it would be T, destroying the bound.
Question 2
MOSS gives no bonus at all to an arm that has more than T/K pulls. Why is that safe?
Because its average is then accurate to about K/T, the scale of the minimax regret per round, so further optimism cannot pay for itself in the worst case
Because such an arm must be optimal
Because the arm has been eliminated
Because the union bound no longer applies
Show the answer
A. Because its average is then accurate to about K/T, the scale of the minimax regret per round, so further optimism cannot pay for itself in the worst case
An arm pulled T/K times has an average with error about K/T; mistakes of that size cost K/T per round, about KT over the horizon, which is already the minimax rate. Exploring it further would only add regret without improving the worst-case guarantee.
Question 3
Two Bernoulli arms have means 0.1 (best) and 0.05. About how many times larger is the asymptotic constant of a Hoeffding-based index tuned to σ=21, 1/(2Δ), than the Lai–Robbins constant Δ/kl(0.05,0.1)? (Here kl(0.05,0.1)≈0.0167.)
About 1: they agree
About 10
About 0.3
About 3.3
Show the answer
D. About 3.3
1/(2×0.05)=10, while 0.05/0.0167≈3.0: a ratio of about 3.3. Hoeffding's bound assumes the worst variance 41, but a Bernoulli arm near 0 has variance about 0.05, so its plausible range is much narrower than the Hoeffding index assumes.
Question 4
Why can the KL-UCB index of a Bernoulli arm never exceed 1, while a Hoeffding index can?
Because KL-UCB clips its index at 1 by an explicit rule
Because the index is defined as the largest Bernoulli mean q∈[0,1] consistent with the data at the given budget
Because the divergence is symmetric
Because KL-UCB uses fewer samples
Show the answer
B. Because the index is defined as the largest Bernoulli mean q∈[0,1] consistent with the data at the given budget
KL-UCB optimizes over the actual parameter space of the model, so it only ever proposes plausible Bernoulli means. A Hoeffding index adds a width designed for any distribution in [0,1] and can exceed 1, which is optimism no Bernoulli arm can justify.
Further reading
P. Auer, N. Cesa-Bianchi & P. Fischer, "Finite-time analysis of the multiarmed bandit problem," Machine Learning 47, 235–256 (2002).
A. Garivier & O. Cappé, "The KL-UCB algorithm for bounded stochastic bandits and beyond," Conference on Learning Theory (2011).
O. Cappé, A. Garivier, O.-A. Maillard, R. Munos & G. Stoltz, "Kullback–Leibler upper confidence bounds for optimal sequential allocation," Annals of Statistics 41(3), 1516–1541 (2013).
J.-Y. Audibert & S. Bubeck, "Minimax policies for adversarial and stochastic bandits," Conference on Learning Theory (2009).
T. Lattimore & C. Szepesvári, Bandit Algorithms, ch. 7–10 (Cambridge University Press, 2020).