Concentration of Measure for Bandits

How fast a sample mean learns the true mean. Tail probabilities of the empirical mean; Markov and Chebyshev and why their 1/(nε²) decay is too slow; calibrating against the central limit theorem with the Gaussian tail bound, and why the CLT is asymptotic, unreliable for rare events, and fails for Bernoulli(1/n); the Cramér–Chernoff method, moment- and cumulant-generating functions, light and heavy tails; σ-subgaussian random variables, their Gaussian-like tails, closure under scaling and independent sums, and the deviation-form confidence bounds µ ≤ µ̂ + √(2σ²log(1/δ)/n); examples (Gaussian, bounded, exponential); and the results from the notes and exercises — Hoeffding's lemma and inequality, Bennett and Bernstein, large-deviation rate functions and the Bernoulli KL rate, the Bernoulli subgaussianity constant, χ² tails, the expected maximum of subgaussians, and the Bretagnolle–Huber–Carol inequality.

· 20 min read · 3,885 words

Corresponds to Lattimore & Szepesvári, Chapter 5.

Motivation: how long does it take to learn a mean?

The regret decomposition reduces every bandit analysis to one question: how many times must each arm be pulled before we can tell, with enough confidence, that it isn’t the best? That requires knowing how fast an empirical mean concentrates around its true mean, and not just on average but in the tails: how often the estimate is badly wrong.

IntuitionThe central question

After nn samples of an arm, how unlikely is it that the sample mean is off by more than ε\varepsilon, and how does that probability fall with nn and ε\varepsilon? Bandit algorithms need answers that are finite-time (valid for this nn, not as n→∞n\to\infty) and exponentially small (so that confidence intervals can be made very reliable cheaply).

flowchart TD
  M["Markov: mean only, decays like 1 over epsilon"] --> C["Chebyshev: variance, decays like 1 over n epsilon squared"]
  M --> CC["Cramér-Chernoff: Markov applied to exp of lambda X"]
  CC --> SG["Subgaussian: exp of minus n epsilon squared over 2 sigma squared"]
  SG --> H["Hoeffding: bounded variables"]
  CC --> B["Bennett and Bernstein: variance plus a one-sided bound"]
  CC --> LD["Large deviations: exact exponential rate"]

Tail probabilities

Setup. X,X1,…,XnX, X_1, \ldots, X_n are i.i.d. with mean μ\mu and variance σ2\sigma^2.

DefinitionSample (empirical) mean

μ^=1n∑i=1nXi\hat\mu = \frac1n\sum_{i=1}^nX_i

By linearity, E[μ^]=μ\mathbb E[\hat\mu] = \mu: the sample mean is an unbiased estimator.

TheoremVariance of the average (Exercise 5.1)

V[μ^]=E[(μ^−μ)2]=σ2n(5.1)\mathbb V[\hat\mu] = \mathbb E\big[(\hat\mu - \mu)^2\big] = \frac{\sigma^2}n \tag{5.1}

ProofVariances of independent terms add

μ^−μ=1n∑i(Xi−μ)\hat\mu - \mu = \frac1n\sum_i(X_i - \mu). Expanding the square, the cross terms E[(Xi−μ)(Xj−μ)]\mathbb E[(X_i-\mu)(X_j-\mu)] vanish for i≠ji\ne j by independence, leaving 1n2⋅nσ2\frac1{n^2}\cdot n\sigma^2.

∎

IntuitionThe squared error shrinks like 1/n1/n

The typical error is of order σ/n\sigma/\sqrt n: halving it takes four times as many samples. But a mean squared error says little about how often the error is large, which is what decides whether a bandit algorithm discards a good arm.

DefinitionTail probabilities

As functions of ε>0\varepsilon > 0:

  • upper tail: P(μ^≥μ+ε)\mathbb P(\hat\mu\ge\mu + \varepsilon) (overestimate);
  • lower tail: P(μ^≤μ−ε)\mathbb P(\hat\mu\le\mu - \varepsilon) (underestimate);
  • two-sided tail: P(∣μ^−μ∣≥ε)\mathbb P(|\hat\mu - \mu|\ge\varepsilon).
ComponentDetail
Signatureε↦P(μ^−μ≥ε)\varepsilon\mapsto\mathbb P(\hat\mu - \mu\ge\varepsilon), a function [0,∞)→[0,1][0,\infty)\to[0,1]
InputAn error tolerance.
OutputThe probability the estimate misses by at least that much, in that direction.
What we wantExplicit upper bounds valid for every finite nn.

Markov and Chebyshev

TheoremLemma 5.1

For any random variable XX and ε>0\varepsilon > 0:

  1. Markov: P(∣X∣≥ε)≤E∣X∣ε\mathbb P(|X|\ge\varepsilon)\le\dfrac{\mathbb E|X|}\varepsilon;
  2. Chebyshev: P(∣X−EX∣≥ε)≤V[X]ε2\mathbb P(|X - \mathbb EX|\ge\varepsilon)\le\dfrac{\mathbb V[X]}{\varepsilon^2}.

NoteAlready covered

Proofs, the tight balls-in-buckets example, and Chebyshev confidence intervals are in concentration-inequalities-and-limit-theorems and concentration-inequalities-and-limit-theorems. Markov is “one of the golden hammers of probability theory”, and everything below is Markov applied to a cleverly chosen function of XX.

FormulaChebyshev for the sample mean

Combining (5.1) with Chebyshev:

P(∣μ^−μ∣≥ε)≤σ2nε2(5.2)\mathbb P(|\hat\mu - \mu|\ge\varepsilon)\le\frac{\sigma^2}{n\varepsilon^2} \tag{5.2}

It needs only a finite variance, which is its strength. Its weakness is the decay: only polynomial in nn, and very loose for well-behaved XX.

IntuitionHigher moments help, and the limit of that idea is the MGF

Applying Markov to ∣μ^−μ∣k|\hat\mu - \mu|^k for larger kk gives faster decay, provided those moments exist, and one could optimize over kk. Doing this optimization over a continuous parameter is the Cramér–Chernoff method.


Calibrating with the central limit theorem

What should we hope for? Let Sn=∑t≤n(Xt−μ)S_n = \sum_{t\le n}(X_t - \mu). With nothing beyond a finite variance, the CLT says Sn/nσ2S_n/\sqrt{n\sigma^2} converges in distribution to Z∼N(0,1)Z\sim\mathcal N(0,1).

FormulaGaussian tail bound

For u>0u > 0:

P(Z≥u)=∫u∞12πe−x2/2dx≤1u2π∫u∞xe−x2/2dx=12πu2 e−u2/2(5.3)\mathbb P(Z\ge u) = \int_u^\infty\frac1{\sqrt{2\pi}}e^{-x^2/2}dx\le\frac1{u\sqrt{2\pi}}\int_u^\infty xe^{-x^2/2}dx = \sqrt{\frac1{2\pi u^2}}\,e^{-u^2/2} \tag{5.3}

DerivationMultiply by x/u≥1x/u\ge1

On [u,∞)[u,\infty), xu≥1\frac xu\ge1, so inserting it can only increase the integral. Then xe−x2/2xe^{-x^2/2} has antiderivative −e−x2/2-e^{-x^2/2}, which evaluates to e−u2/2e^{-u^2/2}. (The Φ\Phi table gives exact values.)

FormulaThe CLT heuristic for the sample mean

P(μ^≥μ+ε)=P(Snσ2n≥εnσ2)≈P(Z≥εnσ2)≤σ22πnε2exp⁡(−nε22σ2)(5.4)\mathbb P(\hat\mu\ge\mu + \varepsilon) = \mathbb P\Big(\frac{S_n}{\sqrt{\sigma^2n}}\ge\varepsilon\sqrt{\frac n{\sigma^2}}\Big)\approx\mathbb P\Big(Z\ge\varepsilon\sqrt{\frac n{\sigma^2}}\Big)\le\sqrt{\frac{\sigma^2}{2\pi n\varepsilon^2}}\exp\Big(-\frac{n\varepsilon^2}{2\sigma^2}\Big) \tag{5.4}

It decays slightly faster than e−nε2/2σ2e^{-n\varepsilon^2/2\sigma^2}: the sample mean concentrates exponentially fast. This is the benchmark.

ExampleGaussian tail versus Chebyshev (Exercise 5.3)

Let u=εn/σ2u = \varepsilon\sqrt{n/\sigma^2}. Chebyshev’s one-sided bound is 1/u21/u^2, and the Gaussian is 1u2πe−u2/2\frac{1}{u\sqrt{2\pi}}e^{-u^2/2}. Their ratio is u2πe−u2/2\frac{u}{\sqrt{2\pi}}e^{-u^2/2}, which is at most e−1/22π≈0.24\frac{e^{-1/2}}{\sqrt{2\pi}}\approx0.24 (maximized at u=1u = 1). So the Gaussian bound is always smaller.

  • The improvement is dramatic for large uu, i.e. many samples or a coarse tolerance. At u=5u = 5: Chebyshev 0.040.04, Gaussian about 1.5×10−71.5\times10^{-7}.
  • Both bounds are trivial (at least 1) for small uu: Chebyshev for u≤1u\le1, the Gaussian bound for u≤1/2π≈0.4u\le1/\sqrt{2\pi}\approx0.4.

(Worked here; the book poses it as an exercise.)

WarningWhy the CLT can’t be used to design algorithms

  • It’s asymptotic. It says nothing for any particular nn, and a bandit algorithm must act at every nn.
  • "n≥30n\ge30" is folklore. Take XtX_t Bernoulli(1/n)(1/n). As n→∞n\to\infty, ∑Xt→\sum X_t\to Poisson(1)(1) (Poisson limit), which looks nothing like a Gaussian. (Exercise 5.6 explores this; there is no contradiction with the CLT because the distribution changes with nn.)
  • The error rate is too coarse for small tails. Berry–Esseen: if ρ=E∣X−μ∣3<∞\rho = \mathbb E|X - \mu|^3 < \infty, then sup⁡x∣P(Snσn≤x)−Φ(x)∣≤Cρσ3n,C<12\sup_x\Big|\mathbb P\Big(\frac{S_n}{\sigma\sqrt n}\le x\Big) - \Phi(x)\Big|\le\frac{C\rho}{\sigma^3\sqrt n},\qquad C < \tfrac12 (in the book’s normalization, which takes σ=1\sigma = 1). The 1/n1/\sqrt n rate is tight for that class, but it is vacuous when the tail probabilities themselves are smaller than 1/n1/\sqrt n, which is exactly the regime confidence bounds live in.

Finite-time exponential bounds need extra assumptions on the distribution.


The Cramér–Chernoff method and subgaussian random variables

DefinitionMoment- and cumulant-generating functions

MX(λ)=E[eλX],ψX(λ)=log⁡MX(λ)M_X(\lambda) = \mathbb E[e^{\lambda X}], \qquad \psi_X(\lambda) = \log M_X(\lambda)

ComponentDetail
SignatureMX:dom(MX)⊆R→(0,∞]M_X : \mathrm{dom}(M_X)\subseteq\mathbb R\to(0,\infty]
DomainThe λ\lambda where the expectation is finite: an interval containing 0 (Exercise 5.9).
NameMX(k)(0)=E[Xk]M_X^{(k)}(0) = \mathbb E[X^k] when 0 is interior, hence “moment-generating”.
ShapeMXM_X is convex, and ψX\psi_X is convex (MXM_X is log-convex). MX(λ)≥eλEXM_X(\lambda)\ge e^{\lambda\mathbb EX} by Jensen.

DefinitionLight and heavy tails

XX is heavy tailed if MX(λ)=∞M_X(\lambda) = \infty for all λ>0\lambda > 0, and light tailed otherwise.

Example: for X∼X\sim Exponential(1), E[eλX]=∫0∞e−xeλxdx=∞\mathbb E[e^{\lambda X}] = \int_0^\infty e^{-x}e^{\lambda x}dx = \infty for λ≥1\lambda\ge1. The MGF exists only on (−∞,1)(-\infty, 1), which is light tailed but not globally finite.

AlgorithmThe Cramér–Chernoff method

For any λ>0\lambda > 0, exponentiating preserves the event, and Markov does the rest:

P(X≥ε)=P(eλX≥eλε)≤MX(λ)e−λε\mathbb P(X\ge\varepsilon) = \mathbb P(e^{\lambda X}\ge e^{\lambda\varepsilon})\le M_X(\lambda)e^{-\lambda\varepsilon}

Then optimize λ\lambda: P(X≥ε)≤exp⁡(−sup⁡λ≥0(λε−ψX(λ)))\mathbb P(X\ge\varepsilon)\le\exp\big(-\sup_{\lambda\ge0}(\lambda\varepsilon - \psi_X(\lambda))\big).

IntuitionMarkov on the right function

Markov is weak because ε↦1/ε\varepsilon\mapsto1/\varepsilon decays slowly. Applying it to eλXe^{\lambda X} turns a polynomial bound into an exponential one. The free parameter λ\lambda trades how much the exponential amplifies the tail against how large the MGF is.

DefinitionSubgaussian random variable (Def. 5.2)

XX is σ\sigma-subgaussian if for all λ∈R\lambda\in\mathbb R,

E[eλX]≤exp⁡(λ2σ22),equivalentlyψX(λ)≤λ2σ22\mathbb E[e^{\lambda X}]\le\exp\Big(\frac{\lambda^2\sigma^2}2\Big),\qquad\text{equivalently}\qquad\psi_X(\lambda)\le\frac{\lambda^2\sigma^2}2

ComponentDetail
Parameterσ≥0\sigma\ge0, the “variance proxy” scale.
BenchmarkN(0,σ2)\mathcal N(0,\sigma^2) has MX(λ)=eλ2σ2/2M_X(\lambda) = e^{\lambda^2\sigma^2/2} exactly, so it is σ\sigma-subgaussian with equality.
MeaningThe MGF is dominated everywhere by a centred Gaussian’s.
Not centred?Convention: say XX is σ\sigma-subgaussian when the noise X−EXX - \mathbb EX is. Subgaussianity is a property of a variable and its law, so the terminology is doubly abused.

TheoremTheorem 5.3 — Subgaussian tails

If XX is σ\sigma-subgaussian, then for all ε≥0\varepsilon\ge0,

P(X≥ε)≤exp⁡(−ε22σ2)(5.5)\mathbb P(X\ge\varepsilon)\le\exp\Big(-\frac{\varepsilon^2}{2\sigma^2}\Big) \tag{5.5}

ProofCramér–Chernoff with the subgaussian bound

For λ>0\lambda > 0:

P(X≥ε)≤E[eλX]e−λε≤exp⁡(λ2σ22−λε)\mathbb P(X\ge\varepsilon)\le\mathbb E[e^{\lambda X}]e^{-\lambda\varepsilon}\le\exp\Big(\frac{\lambda^2\sigma^2}2 - \lambda\varepsilon\Big)

The exponent is a parabola in λ\lambda, minimized at λ=ε/σ2\lambda = \varepsilon/\sigma^2, where it equals −ε22σ2-\frac{\varepsilon^2}{2\sigma^2}.

∎

FormulaTwo-sided and deviation forms

−X-X is also σ\sigma-subgaussian, so the lower tail obeys the same bound, and by the union bound P(∣X∣≥ε)≤2e−ε2/2σ2\mathbb P(|X|\ge\varepsilon)\le2e^{-\varepsilon^2/2\sigma^2}. Solving for ε\varepsilon:

P(X≥2σ2log⁡(1/δ))≤δ,P(∣X∣≥2σ2log⁡(2/δ))≤δ\mathbb P\Big(X\ge\sqrt{2\sigma^2\log(1/\delta)}\Big)\le\delta, \qquad \mathbb P\Big(|X|\ge\sqrt{2\sigma^2\log(2/\delta)}\Big)\le\delta

With overwhelming probability, XX lies in [−2σ2log⁡(2/δ), 2σ2log⁡(2/δ)]\big[-\sqrt{2\sigma^2\log(2/\delta)},\ \sqrt{2\sigma^2\log(2/\delta)}\big].

LemmaLemma 5.4 — Calculus of subgaussians

If XX is σ\sigma-subgaussian, and X1,X2X_1, X_2 are independent and σ1\sigma_1-, σ2\sigma_2-subgaussian:

  1. E[X]=0\mathbb E[X] = 0 and V[X]≤σ2\mathbb V[X]\le\sigma^2;
  2. cXcX is ∣c∣σ|c|\sigma-subgaussian;
  3. X1+X2X_1 + X_2 is σ12+σ22\sqrt{\sigma_1^2 + \sigma_2^2}-subgaussian.
ProofTaylor expansion, substitution, and factorized MGFs

1. Expand both sides for small λ\lambda: 1+λE[X]+λ22E[X2]+o(λ2)≤1+λ2σ22+o(λ2)1 + \lambda\mathbb E[X] + \frac{\lambda^2}2\mathbb E[X^2] + o(\lambda^2)\le1 + \frac{\lambda^2\sigma^2}2 + o(\lambda^2). Dividing by λ\lambda and letting λ→0±\lambda\to0^\pm gives EX≤0\mathbb EX\le0 and EX≥0\mathbb EX\ge0, so EX=0\mathbb EX = 0. Then dividing by λ2\lambda^2 gives E[X2]≤σ2\mathbb E[X^2]\le\sigma^2.

2. E[eλcX]≤e(λc)2σ2/2=eλ2(∣c∣σ)2/2\mathbb E[e^{\lambda cX}]\le e^{(\lambda c)^2\sigma^2/2} = e^{\lambda^2(|c|\sigma)^2/2}.

3. By independence, E[eλ(X1+X2)]=E[eλX1] E[eλX2]≤eλ2(σ12+σ22)/2\mathbb E[e^{\lambda(X_1+X_2)}] = \mathbb E[e^{\lambda X_1}]\,\mathbb E[e^{\lambda X_2}]\le e^{\lambda^2(\sigma_1^2+\sigma_2^2)/2}.

(Exercise 5.7.)

∎

RemarkWithout independence (Exercise 5.8)

For dependent X1,X2X_1, X_2, the sum is still (σ1+σ2)(\sigma_1+\sigma_2)-subgaussian (via Hölder’s inequality), so the scales add linearly instead of in quadrature.

The sample mean

CorollaryCorollary 5.5 — Subgaussian concentration of the sample mean

If the Xi−μX_i - \mu are independent and σ\sigma-subgaussian, then for all ε≥0\varepsilon\ge0,

P(μ^≥μ+ε)≤exp⁡(−nε22σ2),P(μ^≤μ−ε)≤exp⁡(−nε22σ2)\mathbb P(\hat\mu\ge\mu + \varepsilon)\le\exp\Big(-\frac{n\varepsilon^2}{2\sigma^2}\Big),\qquad\mathbb P(\hat\mu\le\mu - \varepsilon)\le\exp\Big(-\frac{n\varepsilon^2}{2\sigma^2}\Big)

ProofAverage, then apply Theorem 5.3

By Lemma 5.4 parts 2 and 3, μ^−μ=∑i(Xi−μ)/n\hat\mu - \mu = \sum_i(X_i - \mu)/n is nσ2/n2=σ/n\sqrt{n\sigma^2/n^2} = \sigma/\sqrt n-subgaussian. Apply (5.5) with σ2/n\sigma^2/n in place of σ2\sigma^2.

∎

FormulaConfidence bounds (deviation form)

For any δ∈(0,1]\delta\in(0,1], each of the following holds with probability at least 1−δ1 - \delta:

μ≤μ^+2σ2log⁡(1/δ)n(5.6)\mu\le\hat\mu + \sqrt{\frac{2\sigma^2\log(1/\delta)}n} \tag{5.6} μ≥μ^−2σ2log⁡(1/δ)n(5.7)\mu\ge\hat\mu - \sqrt{\frac{2\sigma^2\log(1/\delta)}n} \tag{5.7}

A union bound gives a two-sided interval with log⁡(2/δ)\log(2/\delta).

ImportantThis is the formula behind UCB

(5.6) is an upper confidence bound on an arm’s mean from nn pulls. Its width shrinks like 1/n1/\sqrt n and grows only like log⁡(1/δ)\sqrt{\log(1/\delta)} as the required reliability increases. Algorithms built on it are in explore-then-commit-and-ucb-algorithms.

ExampleWhy log⁡(1/δ)\log(1/\delta) instead of 1/δ1/\delta matters

Two-sided confidence-interval half-widths, in units of σ/n\sigma/\sqrt n:

δ\deltaChebyshev, 1/δ\sqrt{1/\delta}Subgaussian, 2log⁡(2/δ)\sqrt{2\log(2/\delta)}
10−110^{-1}3.22.4
10−310^{-3}31.63.9
10−610^{-6}10005.4

Bandit algorithms take union bounds over many arms and rounds, so they need tiny δ\delta. Chebyshev intervals would explode. (Numbers computed here.)

RemarkChebyshev versus Chernoff once more

Since e−x≤1exe^{-x}\le\frac1{ex} for x>0x > 0, the subgaussian bound beats Chebyshev except when ε\varepsilon is very small, and is exponentially smaller once nε2≫σ2n\varepsilon^2\gg\sigma^2.

Which variables are subgaussian

ExampleExample 5.6

Random variableSubgaussian?
N(0,σ2)\mathcal N(0,\sigma^2)σ\sigma-subgaussian
mean zero, ∣X∣≤B\lvert X\rvert\le B a.s.BB-subgaussian
mean zero, X∈[a,b]X\in[a,b] a.s.b−a2\frac{b-a}2-subgaussian (Hoeffding’s lemma)
Bernoulli(p)(p) (centred)12\frac12-subgaussian for every pp
Exponential (any rate)not subgaussian for any σ\sigma
χ2\chi^2not subgaussian (but Chernoff still works)

WarningSubgaussian is a real restriction

Exponential, χ2\chi^2, Poisson-type and heavier tails are not subgaussian. The broader classes subexponential and subgamma cover such tails with weaker MGF conditions. Standard bandit analyses assume subgaussian rewards (Bernoulli, bounded, or Gaussian noise).


Refinements and companions (Notes and Exercises)

Converse: Gaussian tails imply subgaussianity, with slack

TheoremTails to MGF

If EX=0\mathbb EX = 0 and P(∣X∣≥ε)≤2e−ε2/2\mathbb P(|X|\ge\varepsilon)\le2e^{-\varepsilon^2/2} for all ε\varepsilon, then XX is 5\sqrt5-subgaussian.

ProofExpand the MGF, bound each moment by a tail integral

E[eλX]≤1+∑i≥2λiE∣X∣ii!=1+∑i≥2∫0∞P(∣X∣≥(i!)1/iλx1/i)dx≤⋯≤e5λ2/2\mathbb E[e^{\lambda X}]\le1 + \sum_{i\ge2}\frac{\lambda^i\mathbb E|X|^i}{i!} = 1 + \sum_{i\ge2}\int_0^\infty\mathbb P\Big(|X|\ge\frac{(i!)^{1/i}}\lambda x^{1/i}\Big)dx\le\cdots\le e^{5\lambda^2/2}

The linear term vanishes because EX=0\mathbb EX = 0. Each moment is written as a tail integral, the assumed tail bound is plugged in, and the sum is evaluated (the book uses Mathematica, getting an error-function expression).

∎

ExampleSome slack is unavoidable (Exercise 5.4)

The density p(x)=12∣x∣e−x2/2p(x) = \frac12|x|e^{-x^2/2} has exactly Gaussian tails, P(∣X∣≥ε)=e−ε2/2\mathbb P(|X|\ge\varepsilon) = e^{-\varepsilon^2/2}, yet XX is not 2−ϵ\sqrt{2-\epsilon}-subgaussian for any ϵ>0\epsilon > 0, so the best constant is 2\sqrt2, not 1. Tail behaviour and MGF behaviour match only up to constants.

RemarkBeating the subgaussian bound

For Gaussians, (5.4) is slightly sharper than e−nε2/2σ2e^{-n\varepsilon^2/2\sigma^2} by the polynomial prefactor. Talagrand (1995) showed similar refinements hold for bounded random variables.

Hoeffding

TheoremHoeffding’s lemma

If EX=0\mathbb EX = 0 and X∈[a,b]X\in[a,b] a.s., then MX(λ)≤exp⁡(λ2(b−a)2/8)M_X(\lambda)\le\exp\big(\lambda^2(b-a)^2/8\big), i.e. XX is b−a2\frac{b-a}2-subgaussian.

ProofTaylor with remainder, plus a tilted distribution (Exercise 5.11 hint)

Step 1: by Taylor, ψX(λ)=ψX(0)+ψX′(0)λ+ψX′′(λ′)λ22\psi_X(\lambda) = \psi_X(0) + \psi_X'(0)\lambda + \psi_X''(\lambda')\frac{\lambda^2}2 for some λ′\lambda' between 0 and λ\lambda. Here ψX(0)=0\psi_X(0) = 0 and ψX′(0)=EX=0\psi_X'(0) = \mathbb EX = 0.

Step 2: Tilt. Define Pλ(dz)=e−ψX(λ)eλzP(dz)P_{\lambda}(dz) = e^{-\psi_X(\lambda)}e^{\lambda z}P(dz). Then ψX′′(λ)\psi_X''(\lambda) is the variance of Z∼PλZ\sim P_\lambda.

Step 3: Z∈[a,b]Z\in[a,b], and any variable supported on an interval of length b−ab-a has variance at most (b−a)24\frac{(b-a)^2}4. So ψX(λ)≤λ2(b−a)28\psi_X(\lambda)\le\frac{\lambda^2(b-a)^2}8.

∎

TheoremHoeffding’s inequality

If X1,…,XnX_1, \ldots, X_n are independent with Xt∈[at,bt]X_t\in[a_t,b_t] a.s., then

P(1n∑t=1n(Xt−EXt)≥ε)≤exp⁡(−2n2ε2∑t(bt−at)2)(5.8)\mathbb P\Big(\frac1n\sum_{t=1}^n(X_t - \mathbb EX_t)\ge\varepsilon\Big)\le\exp\Big(-\frac{2n^2\varepsilon^2}{\sum_t(b_t - a_t)^2}\Big) \tag{5.8}

For [0,1][0,1]-valued rewards this is e−2nε2e^{-2n\varepsilon^2}, i.e. σ=12\sigma = \frac12 in Corollary 5.5.

ProofLemma, then subgaussian calculus

Each centred XtX_t is bt−at2\frac{b_t-a_t}2-subgaussian. The average is subgaussian with σ2=∑t(bt−at)24n2\sigma^2 = \frac{\sum_t(b_t-a_t)^2}{4n^2}, and e−ε2/2σ2e^{-\varepsilon^2/2\sigma^2} is the claim.

∎

Bennett and Bernstein: use the variance

IntuitionHoeffding ignores the variance

A [0,1][0,1]-valued arm with mean 0.010.01 has variance about 0.010.01, far below Hoeffding’s worst case of 14\frac14. Bounds that use the actual variance can be much tighter for such low-variance arms.

TheoremBennett and Bernstein (Exercise 5.14)

Let XtX_t be independent with Xt−EXt≤bX_t - \mathbb EX_t\le b a.s., S=∑t(Xt−EXt)S = \sum_t(X_t - \mathbb EX_t), v=∑tV[Xt]v = \sum_t\mathbb V[X_t], and α=bε/v\alpha = b\varepsilon/v. Then

P(S≥ε)≤exp⁡(−vb2((1+α)log⁡(1+α)−α))≤exp⁡(−ε22v(1+bε3v))(5.10–5.11)\mathbb P(S\ge\varepsilon)\le\exp\Big(-\frac v{b^2}\big((1+\alpha)\log(1+\alpha) - \alpha\big)\Big)\le\exp\Big(-\frac{\varepsilon^2}{2v\big(1 + \frac{b\varepsilon}{3v}\big)}\Big) \tag{5.10–5.11}

The first form is Bennett, the second Bernstein. In deviation form, with probability at least 1−δ1-\delta,

S<2vlog⁡(1/δ)+2b3log⁡(1/δ)S < \sqrt{2v\log(1/\delta)} + \frac{2b}3\log(1/\delta)

IntuitionTwo regimes

For small deviations the variance term 2vlog⁡(1/δ)\sqrt{2v\log(1/\delta)} dominates, which is Gaussian-like with the true variance. For large deviations the range term 2b3log⁡(1/δ)\frac{2b}3\log(1/\delta) dominates, which is Poisson-like.

RemarkMartingale versions

Bennett’s bound holds for adapted sequences with conditional means, with the variance replaced by the predictable variation V=∑tEt−1[(Xt−μt)2]V = \sum_t\mathbb E_{t-1}[(X_t - \mu_t)^2], on the event {V≤v}\{V\le v\}. Exercise 5.15 gives a related version with a free parameter η\eta:

P(∑t(Xt−μt)≥η∑tEt−1[(Xt−μt)2]+1ηlog⁡1δ)≤δif η(Xt−μt)≤1\mathbb P\Big(\sum_t(X_t - \mu_t)\ge\eta\sum_t\mathbb E_{t-1}[(X_t - \mu_t)^2] + \frac1\eta\log\frac1\delta\Big)\le\delta\quad\text{if }\eta(X_t - \mu_t)\le1

η\eta must be fixed in advance (choosing it from the data would make it random). Fixing that takes union bounds or the method of mixtures (Chapter 20). Empirical-variance versions also exist (Audibert et al.; Maurer–Pontil).

Large deviations: the exact exponential rate

TheoremChernoff bound with the rate function (Exercise 5.10)

For i.i.d. zero-mean XtX_t whose MGF is finite everywhere,

1nlog⁡P(μ^n≥ε)≤−ψX∗(ε)=−sup⁡λ(λε−log⁡MX(λ))(5.9)\frac1n\log\mathbb P(\hat\mu_n\ge\varepsilon)\le-\psi_X^*(\varepsilon) = -\sup_\lambda\big(\lambda\varepsilon - \log M_X(\lambda)\big) \tag{5.9}

and this becomes an equality as n→∞n\to\infty (Cramér’s theorem). Here ψ∗\psi^* is the Legendre transform (convex conjugate, Fenchel dual, Cramér transform, rate function) of ψX\psi_X.

Distribution (centred)Rate function ψ∗(ε)\psi^*(\varepsilon)
N(0,σ2)\mathcal N(0,\sigma^2)ε2/(2σ2)\varepsilon^2/(2\sigma^2)
Rademacher, ±1\pm11+ε2log⁡(1+ε)+1−ε2log⁡(1−ε)\frac{1+\varepsilon}2\log(1+\varepsilon) + \frac{1-\varepsilon}2\log(1-\varepsilon) for ∣ε∣<1\lvert\varepsilon\rvert < 1; ∞\infty otherwise
Bernoulli(p)(p), centredd(p+ε,p)d(p+\varepsilon, p) for p+ε≤1p+\varepsilon\le1; ∞\infty otherwise

where d(p,q)=plog⁡pq+(1−p)log⁡1−p1−qd(p,q) = p\log\frac pq + (1-p)\log\frac{1-p}{1-q} is the relative entropy between Bernoulli(p)(p) and Bernoulli(q)(q).

IntuitionThe rate of a Bernoulli deviation is a KL divergence

The chance that a pp-coin looks like a (p+ε)(p+\varepsilon)-coin over nn flips is about e−n d(p+ε,p)e^{-n\,d(p+\varepsilon,p)}. The cost of being fooled is exactly how distinguishable the two coins are. KL divergence reappears later in bandit lower bounds and in KL-UCB.

WarningThe CLT gets large deviations wrong

  • Scales. The CLT describes SnS_n deviating at scale n\sqrt n. Large deviation theory describes deviations at scale nn (P(μ^n≥ε)=P(Sn≥nε)\mathbb P(\hat\mu_n\ge\varepsilon) = \mathbb P(S_n\ge n\varepsilon)). Pretending the CLT applies there predicts rate ε2/2σ2\varepsilon^2/2\sigma^2, which is generally wrong: the true rate is ψ∗(ε)\psi^*(\varepsilon).
  • Moderate deviations, at scale nαn^\alpha with 12<α<1\frac12<\alpha<1, are where “ruthless” use of the Gaussian formula happens to give correct answers.

ExampleHow wrong for a Bernoulli arm (Exercise 5.13)

Take p=0.1p = 0.1, Δ=0.1\Delta = 0.1, and ask for the smallest nn with P(p^n≥p+Δ)≤δ\mathbb P(\hat p_n\ge p + \Delta)\le\delta as δ→0\delta\to0. The required nn is about log⁡(1/δ)/rate\log(1/\delta)/\text{rate}, so the ratio of sample sizes is the inverse ratio of rates:

nBernGauss→Δ2/(2p(1−p))d(p+Δ,p)=0.05560.0444≈1.25\frac{n_{\text{Ber}}}{n_{\text{Gauss}}}\to\frac{\Delta^2/(2p(1-p))}{d(p+\Delta,p)} = \frac{0.0556}{0.0444}\approx1.25

The Gaussian approximation underestimates the samples needed by about 25%. The upper tail of a low-mean Bernoulli is heavier than the matching Gaussian’s, even though the CLT holds. (Worked here.)

Smaller constants for Bernoulli

TheoremBernoulli subgaussianity constant (Exercise 5.12; Kearns–Saul)

Bernoulli(p)(p) is 12\frac12-subgaussian for every pp, and its best constant is

Q(p)=1−2p2ln⁡((1−p)/p)Q(p) = \sqrt{\frac{1 - 2p}{2\ln\big((1-p)/p\big)}}

with Q(12)=12Q(\frac12) = \frac12 by taking the limit. Q(p)Q(p) is larger than the standard deviation p(1−p)\sqrt{p(1-p)} away from p=12p = \frac12; for small pp it shrinks only like 1/ln⁡(1/p)1/\sqrt{\ln(1/p)}. For the one-sided upper tail with p≥12p\ge\frac12, the variance itself suffices: E[eλX]≤exp⁡(p(1−p)λ2/2)\mathbb E[e^{\lambda X}]\le\exp\big(p(1-p)\lambda^2/2\big) for λ≥0\lambda\ge0 (MGF of the centred variable).

χ2\chi^2: Chernoff without a global MGF

ExampleTail of a χn2\chi^2_n variable

Y=∑i≤nXi2Y = \sum_{i\le n}X_i^2 with XiX_i i.i.d. standard Gaussian has MY(λ)=(1−2λ)−n/2M_Y(\lambda) = (1-2\lambda)^{-n/2} for λ<12\lambda < \frac12 only. Chernoff over λ∈[0,12)\lambda\in[0,\frac12) with the optimal λ=12−n2(n+ε)\lambda = \frac12 - \frac n{2(n+\varepsilon)} gives

P(Y≥n+ε)≤(1+εn)n/2e−ε/2\mathbb P(Y\ge n + \varepsilon)\le\Big(1 + \frac\varepsilon n\Big)^{n/2}e^{-\varepsilon/2}

which is essentially tight (Laurent–Massart). Cramér–Chernoff works whenever the MGF exists on some interval [0,λ0)[0,\lambda_0).

Maxima and categorical distributions

TheoremExpected maximum of subgaussians (Exercise 5.18)

If X1,…,XnX_1, \ldots, X_n are σ\sigma-subgaussian, possibly dependent, and Z=max⁡tXtZ = \max_tX_t, then

E[Z]≤2σ2log⁡n,P(Z≥2σ2log⁡(n/δ))≤δ\mathbb E[Z]\le\sqrt{2\sigma^2\log n}, \qquad \mathbb P\Big(Z\ge\sqrt{2\sigma^2\log(n/\delta)}\Big)\le\delta

ProofJensen, then bound the max by the sum

For λ>0\lambda > 0: eλEZ≤EeλZ≤∑tEeλXt≤neλ2σ2/2e^{\lambda\mathbb E Z}\le\mathbb E e^{\lambda Z}\le\sum_t\mathbb E e^{\lambda X_t}\le ne^{\lambda^2\sigma^2/2}. So EZ≤log⁡nλ+λσ22\mathbb EZ\le\frac{\log n}\lambda + \frac{\lambda\sigma^2}2; choose λ=2log⁡n/σ2\lambda = \sqrt{2\log n/\sigma^2}. The tail bound is a union bound over the nn applications of (5.5). (Proof filled in from the hint.)

∎

IntuitionMany draws, only log⁡n\sqrt{\log n} growth

The largest of nn subgaussian noise terms is of size σ2log⁡n\sigma\sqrt{2\log n}. This is why union bounds over kk arms or nn rounds cost only a log⁡\sqrt{\log} factor in confidence widths.

TheoremBretagnolle–Huber–Carol (Exercise 5.17)

For XtX_t i.i.d. on [m][m], with true pmf pp and empirical pmf p^\hat p,

P(∥p−p^∥1≥2(log⁡(1/δ)+mlog⁡2)n)≤δ(5.12)\mathbb P\Big(\|p - \hat p\|_1\ge\sqrt{\frac{2(\log(1/\delta) + m\log2)}n}\Big)\le\delta \tag{5.12}

Proof idea: ∥p−p^∥1=max⁡λ∈{±1}m⟨λ,p−p^⟩\|p-\hat p\|_1 = \max_{\lambda\in\{\pm1\}^m}\langle\lambda, p - \hat p\rangle. Each inner product is an average of bounded terms, and a union bound over the 2m2^m sign vectors produces the mlog⁡2m\log2.

NoteTwo more exercises

5.16: if P(Xt≤x)≤x\mathbb P(X_t\le x)\le x on [0,1][0,1] (stochastically at least uniform), then P(∑tlog⁡(1/Xt)≥ε)≤(ε/n)nen−ε\mathbb P\big(\sum_t\log(1/X_t)\ge\varepsilon\big)\le(\varepsilon/n)^ne^{n-\varepsilon}. This is a Chernoff bound for a sum of exponentials, used for p-values. 5.19: a tight bound on ∑tE[Xt∣Ft−1]\sum_t\mathbb E[X_t\mid\mathcal F_{t-1}] when ∑tXt≤1\sum_tX_t\le1 a.s., with Bernoulli variables as the worst case.


Quick reference

ObjectStatementNote
Sample mean varianceV[μ^]=σ2/n\mathbb V[\hat\mu] = \sigma^2/nerror of order σ/n\sigma/\sqrt n
ChebyshevP(∣μ^−μ∣≥ε)≤σ2/(nε2)\mathbb P(\lvert\hat\mu-\mu\rvert\ge\varepsilon)\le\sigma^2/(n\varepsilon^2)variance only, polynomial
Gaussian tailP(Z≥u)≤1u2πe−u2/2\mathbb P(Z\ge u)\le\frac{1}{u\sqrt{2\pi}}e^{-u^2/2}the CLT benchmark
Berry–EsseenCDF error ≤Cρ/(σ3n)\le C\rho/(\sigma^3\sqrt n)useless for tiny tails
Cramér–ChernoffP(X≥ε)≤inf⁡λ≥0MX(λ)e−λε\mathbb P(X\ge\varepsilon)\le\inf_{\lambda\ge0}M_X(\lambda)e^{-\lambda\varepsilon}Markov on eλXe^{\lambda X}
SubgaussianψX(λ)≤λ2σ2/2\psi_X(\lambda)\le\lambda^2\sigma^2/2Gaussian-dominated MGF
Subgaussian tailP(X≥ε)≤e−ε2/2σ2\mathbb P(X\ge\varepsilon)\le e^{-\varepsilon^2/2\sigma^2}λ=ε/σ2\lambda = \varepsilon/\sigma^2
Calculusmean 0, V≤σ2\mathbb V\le\sigma^2; cXcX: ∣c∣σ\lvert c\rvert\sigma; independent sum: σ12+σ22\sqrt{\sigma_1^2+\sigma_2^2}dependent sum: σ1+σ2\sigma_1+\sigma_2
Sample meanP(μ^≥μ+ε)≤e−nε2/2σ2\mathbb P(\hat\mu\ge\mu+\varepsilon)\le e^{-n\varepsilon^2/2\sigma^2}μ^−μ\hat\mu - \mu is σ/n\sigma/\sqrt n-subgaussian
Confidence boundμ≤μ^+2σ2log⁡(1/δ)/n\mu\le\hat\mu + \sqrt{2\sigma^2\log(1/\delta)/n} w.p. ≥1−δ\ge1-\deltathe UCB width
Hoeffding[a,b][a,b] ⇒ b−a2\frac{b-a}2-subgaussian; tail e−2n2ε2/∑(bt−at)2e^{-2n^2\varepsilon^2/\sum(b_t-a_t)^2}[0,1][0,1]: e−2nε2e^{-2n\varepsilon^2}
BernsteinS<2vlog⁡1δ+2b3log⁡1δS<\sqrt{2v\log\frac1\delta} + \frac{2b}3\log\frac1\deltauses the true variance
Rate function1nlog⁡P(μ^≥ε)→−ψ∗(ε)\frac1n\log\mathbb P(\hat\mu\ge\varepsilon)\to-\psi^*(\varepsilon)Bernoulli: KL d(p+ε,p)d(p+\varepsilon,p)
χn2\chi^2_nP(Y≥n+ε)≤(1+ε/n)n/2e−ε/2\mathbb P(Y\ge n+\varepsilon)\le(1+\varepsilon/n)^{n/2}e^{-\varepsilon/2}MGF only on [0,12)[0,\frac12)
Expected maximumEmax⁡tXt≤2σ2log⁡n\mathbb E\max_tX_t\le\sqrt{2\sigma^2\log n}holds under dependence
Bretagnolle–Huber–Carol∥p−p^∥1≲2(log⁡1δ+mlog⁡2)/n\lVert p-\hat p\rVert_1\lesssim\sqrt{2(\log\frac1\delta+m\log2)/n}categorical ℓ1\ell_1

Facts to keep to hand

  • Every bound here is Markov’s inequality in disguise. Chebyshev applies it to (X−μ)2(X-\mu)^2; Cramér–Chernoff applies it to eλXe^{\lambda X} and optimizes λ\lambda. The more of the distribution the function captures, the faster the decay.
  • Subgaussian means Gaussian-quality tails without being Gaussian. It is preserved by scaling and independent sums, so sample means of subgaussian rewards concentrate like e−nε2/2σ2e^{-n\varepsilon^2/2\sigma^2} at every finite nn. Bounded rewards are subgaussian (Hoeffding); exponential and χ2\chi^2 are not.
  • The confidence width is 2σ2log⁡(1/δ)/n\sqrt{2\sigma^2\log(1/\delta)/n}. Reliability costs only log⁡(1/δ)\sqrt{\log(1/\delta)}, which is what makes union bounds over arms and rounds affordable, and is the core of UCB.
  • The CLT is the wrong tool for algorithms. It is asymptotic, its error is 1/n1/\sqrt n even when tails are far smaller, and at large-deviation scales its rate is wrong. The right rate is a Legendre transform, which for Bernoulli rewards is a KL divergence.
  • Use the variance when it’s small. Bennett and Bernstein add a range term but replace the worst-case scale with the true variance, which pays off for low-variance arms.

References

← All notes