Bandit Algorithms
Tor Lattimore and Csaba Szepesvári
- Location
- Ch. 7; KL-UCB extension in Ch. 10
- Pages
- online pp. 102–111; KL-UCB pp. 133–141
Teaching chapter 04 of 10 · Canonical route compiled
History-based ordinary-UCB and KL-UCB scores, count thresholds, generated policies, arm streams, same-trajectory confidence, finite-arm reward kernels, and expected regret.
How to read the status. It describes this page's canonical local Lean route, not completion of the cited textbook chapter or every extension listed below.
Who should read this. Read ETC first if confidence-event arguments are new to you.
Textbook crosswalk
The Book Map is a curated formalization curriculum anchored in Bandit Algorithms, not a chapter-for-chapter reproduction of one book. Visible page labels use the numbered pages of its free online edition; source buttons use the PDF viewer's physical page index, which includes front matter and can therefore be larger. Companion papers cover algorithm-specific results.
Tor Lattimore and Csaba Szepesvári
Read top to bottom: each step supplies the state or proof fact used by the next one.
Pull every arm so that each empirical mean and count is defined.
Add a confidence bonus to the arm's empirical mean; less data means a wider bonus.
Pull an arm with maximal upper-confidence score.
Update that arm's count and empirical mean, then recompute scores next round.
On the good event, choosing a suboptimal arm forces its count to still be small; sum gap times count to obtain regret.
Confidence validity implies a suboptimal arm can be selected only while its sample count is small enough to keep its bonus competitive.
BanditRLlib relationship. BanditRLlib's ordinary-UCB route uses an explicit generated trajectory and confidence schedule. Its exact hypotheses, constants, gap-sum form, and Tδ failure term are therefore not presented as a line-for-line formalization of Theorem 7.2; KL-UCB remains a separate extension.
The mathematical content is restated in this site's notation; wording is ours. See online p. 108 in the linked source for the original statement and full assumptions.
The mathematical readings are explanatory summaries. The exact generated Lean statement and its source link remain authoritative for hypotheses, types, constants, and indexing.
A curated route through definitions, key bridges, and canonical terminals stays visible. 2 additional dependency, extension, or research-frontier notes are grouped below.
Lean declarationBandit
Plain-English statement. The generated finite-arm UCB policy has a textbook-shaped expected pseudo-regret gap-sum bound for sub-Gaussian arm laws, including zero variance proxies.
BanditRLProof.pseudoRegret_eq_finset_sum_gap_mul_pullCounttheorem integral_real_pseudoRegret_selectedPolicySuccessorGeneratedUCBRegretAction_le_textbookGapSum_finiteArmSubgaussianLaws_without_proxy_positivity {K : Nat} (model : FiniteBanditModel K) (armLaw : Fin K -> Measure Rat) (hprob : forall arm, IsProbabilityMeasure (armLaw arm)) (varianceProxy : Fin K -> NNReal) (hmean : forall arm, integral (armLaw arm) (fun reward : Rat => ((reward : Rat) : Real)) = ((model.mean arm : Rat) : Real)) (hsubG : forall arm, HasSubgaussianMGF (fun reward : Rat => (((reward - model.mean arm : Rat) : Real))) (varianceProxy arm) (armLaw arm)) (defaultAction : Fin K) (T : Nat) (hT : 0 < T) (delta : Real) (hdelta : 0 < delta) : let sigma2 := Concentration.finiteArmPositiveVarianceProxy varianceProxy let rewardKernel := RewardKernel.contextIndependentOfActionLaws (Context := Unit) armLaw hprob let context : (n : Nat) -> History.FiniteRewardHistory Rat n -> Unit := fun _ _ => () MeasureTheory.integral (selectedPolicySuccessorRewardTrajMeasure model.hK (armLaw defaultAction) rewardKernel context (fun _ => measurable_const) sigma2 T delta defaultAction) (fun trajectory : RewardTrace Rat => ((pseudoRegret model (selectedPolicySuccessorGeneratedUCBRegretAction model.hK sigma2 T delta defaultAction (fun y : RewardTrace Rat => y) trajectory) T : Rat) : Real)) <= ((Finset.univ : Finset (Fin K)).filter (fun arm => 0 < (((model.gap arm : Rat) : Real)))).sum (fun arm => selectedPolicySuccessorTextbookGapBudget K sigma2 T delta (((model.gap arm : Rat) : Real)) + (((model.gap arm : Rat) : Real)) * ((T : Real) * delta))
Lean declarationBandit
Plain-English statement. For the canonical finite-arm sub-Gaussian horizon-indexed UCB family, expected pseudo-regret divided by the horizon converges to zero.
BanditRLProof.UCB.selectedPolicySuccessorFiniteArmSubgaussianExpectedPseudoRegret_nonneg_and_letheorem selectedPolicySuccessorFiniteArmSubgaussianExpectedAveragePseudoRegret_tendsto_zero {K : Nat} (model : FiniteBanditModel K) (armLaw : Fin K -> Measure Rat) (hprob : forall arm, IsProbabilityMeasure (armLaw arm)) (varianceProxy : Fin K -> NNReal) (hmean : forall arm, integral (armLaw arm) (fun reward : Rat => ((reward : Rat) : Real)) = ((model.mean arm : Rat) : Real)) (hsubG : forall arm, HasSubgaussianMGF (fun reward : Rat => (((reward - model.mean arm : Rat) : Real))) (varianceProxy arm) (armLaw arm)) (defaultAction : Fin K) : Tendsto (selectedPolicySuccessorFiniteArmSubgaussianExpectedAveragePseudoRegret model armLaw hprob varianceProxy defaultAction) atTop (nhds 0)
Lean declarationBandit
Plain-English statement. A single horizon-free telescoping-scheduled UCB policy has one all-time confidence event on one generated trajectory measure, simultaneous positive-gap pull-count bounds for all finite horizons, and an explicit finite-time expected pseudo-regret bound.
BanditRLProof.ConditionalExpectationReward.actionRewardHistoryStepKernelFamily_successorArmEmpiricalMean_simultaneous_fintype_telescopingAllTime_abs_tail_ennreal_delta_trajMeasure, BanditRLProof.UCB.meanGap_le_two_radius_of_confidenceScore_max, BanditRLProof.pseudoRegret_eq_finset_sum_gap_mul_pullCounttheorem lintegral_ofReal_pseudoRegret_selectedPolicySuccessorTelescoping_le_trajMeasure {Context : Type} {K : Nat} [MeasurableSpace Context] (model : FiniteBanditModel K) (mu0 : Measure (Prod (Fin K) Rat)) [IsProbabilityMeasure mu0] (rewardKernel : RewardKernel.MarkovRewardKernel (Prod Context (Fin K)) Rat) (context : (n : Nat) -> ((j : Finset.Iic n) -> Rat) -> Context) (mean : Context -> Fin K -> Rat) (varianceProxy : Context -> Fin K -> NNReal) (defaultAction : Fin K) (sigma2 : NNReal) (delta : Real) (T : Nat) (hcontext : forall n : Nat, Measurable (context n)) (hmean : Measurable (fun pair : Prod Context (Fin K) => mean pair.1 pair.2)) (law : RewardKernel.CenteredRewardKernelLaw rewardKernel mean varianceProxy) (hvariance : forall i : Nat, forall history : ((j : Finset.Iic i) -> Rat), varianceProxy (context i history) ((selectedPolicySuccessorTelescopingHistoryPolicy model.hK sigma2 delta defaultAction i).action (selectedPolicySuccessorTelescopingHistoryState model.hK sigma2 delta defaultAction i history)) <= sigma2) (harmMean : forall i : Nat, forall history : ((j : Finset.Iic i) -> Rat), forall arm : Fin K, mean (context i history) arm = model.mean arm) (hsigma2 : 0 < (((sigma2 : NNReal) : Real))) (hdelta : 0 < delta) : let mu := selectedPolicySuccessorTelescopingActionRewardTrajMeasure model.hK mu0 rewardKernel context hcontext sigma2 delta defaultAction let reward : (Nat -> Prod (Fin K) Rat) -> RewardTrace Rat := fun trajectory t => (trajectory t).2 let action := selectedPolicySuccessorTelescopingGeneratedUCBRegretAction model.hK sigma2 delta defaultAction reward ∫⁻ trajectory, ENNReal.ofReal (((pseudoRegret model (action trajectory) T : Rat) : Real)) ∂mu <= (Finset.univ : Finset (Fin K)).sum (fun arm => ENNReal.ofReal (((model.gap arm : Rat) : Real)) * ((selectedPolicySuccessorTelescopingPullThreshold K sigma2 T delta (((model.gap arm : Rat) : Real)) : Nat) : ENNReal) + ENNReal.ofReal (((model.gap arm : Rat) : Real)) * ((T : ENNReal) * ENNReal.ofReal delta))
Lean declarationBandit
Plain-English statement. A horizon-free generated policy uses the actual Bernoulli-KL confidence-set supremum, aligns it with its own reward history, and has a conservative finite-time expected pseudo-regret bound on the same canonical trajectory measure.
BanditRLProof.KLUCB.bernoulliKLCore_le_sq_div, BanditRLProof.KLUCB.generatedIndexAt_le_selected_of_K_le, BanditRLProof.ConditionalExpectationReward.actionRewardHistoryStepKernelFamily_successorArmEmpiricalMean_simultaneous_fintype_telescopingAllTime_abs_tail_ennreal_delta_trajMeasure, BanditRLProof.pseudoRegret_eq_finset_sum_gap_mul_pullCounttheorem lintegral_ofReal_pseudoRegret_generatedKLUCBBounded_le_trajMeasure {Context : Type} {K : Nat} [MeasurableSpace Context] (model : FiniteBanditModel K) (mu0 : Measure (Prod (Fin K) Rat)) [IsProbabilityMeasure mu0] (rewardKernel : RewardKernel.MarkovRewardKernel (Prod Context (Fin K)) Rat) (context : (n : Nat) -> ((j : Finset.Iic n) -> Rat) -> Context) (mean : Context -> Fin K -> Rat) (varianceProxy : Context -> Fin K -> NNReal) (defaultAction : Fin K) (sigma2 : NNReal) (delta margin : Real) (T : Nat) (hdelta : 0 < delta) (hmargin0 : 0 < margin) (hmarginHalf : margin <= 1 / 2) (harmMargin : forall arm : Fin K, (model.mean arm : Real) ∈ Set.Icc margin (1 - margin)) (hcontext : forall n : Nat, Measurable (context n)) (hraw : ∀ᵐ trajectory ∂(actionRewardTrajMeasure model.hK mu0 rewardKernel context hcontext sigma2 delta margin defaultAction), forall i : Nat, ((((trajectory i).2 : Rat) : Real)) ∈ Set.Icc (0 : Real) 1) (hmean : Measurable (fun pair : Prod Context (Fin K) => mean pair.1 pair.2)) (law : RewardKernel.CenteredRewardKernelLaw rewardKernel mean varianceProxy) (hvariance : forall i : Nat, forall history : ((j : Finset.Iic i) -> Rat), varianceProxy (context i history) ((historyPolicy model.hK sigma2 delta margin defaultAction i).action (historyState model.hK sigma2 delta margin defaultAction i history)) <= sigma2) (harmMean : forall i : Nat, forall history : ((j : Finset.Iic i) -> Rat), forall arm : Fin K, mean (context i history) arm = model.mean arm) (hsigma2 : 0 < (((sigma2 : NNReal) : Real))) : let mu := actionRewardTrajMeasure model.hK mu0 rewardKernel context hcontext sigma2 delta margin defaultAction let reward : (Nat -> Prod (Fin K) Rat) -> RewardTrace Rat := fun trajectory t => (trajectory t).2 let action := generatedRegretAction model.hK sigma2 delta margin defaultAction reward ∫⁻ trajectory, ENNReal.ofReal (((pseudoRegret model (action trajectory) T : Rat) : Real)) ∂mu <= (Finset.univ : Finset (Fin K)).sum (fun arm => ENNReal.ofReal (((model.gap arm : Rat) : Real)) * ((pullThreshold K sigma2 T delta margin (((model.gap arm : Rat) : Real)) : Nat) : ENNReal) + ENNReal.ofReal (((model.gap arm : Rat) : Real)) * ((T : ENNReal) * ENNReal.ofReal delta))
Complete within the ordinary-UCB Book Map scope when (i) the canonical horizon-indexed generated UCB family connects simultaneous finite-arm/time confidence to pull counts, finite-arm expected regret, and its expected-average asymptotic consumer, and (ii) one separate horizon-free scheduled policy and trajectory measure connect the telescoping all-time confidence event to a simultaneous all-horizon positive-gap pull-count theorem and a finite-time expected pseudo-regret consumer. Public imports, typed canaries, explicit initialization/positivity contracts, and a clean full gate are required. Fixed-policy expected-average consistency and upstream compatibility are separate unless proved explicitly.
The compact summary keeps the reading route visible. Open it for source-linked declarations and exact remaining gaps.
| Milestone | Status | Lean declaration | Remaining gap |
|---|---|---|---|
| Repaired parallel causal allocation and actual expected simple regret | Compiled | — | |
| Causal actual-sampling expected simple regret on a common finite alphabet | Compiled | — | |
| HOO full expected regret for arbitrary reward families | Compiled | — | |
| Finite raw-moment regret supremum and actual-law adapter | Compiled | — | |
| Finite counterexample to the printed source-policy regret coefficient | Compiled | — | |
| Clipped-prefix confidence under consumed-sample corruption | Compiled | — | |
| Corrected expected regret for source-parameter robust UCB | Compiled | — | |
| Source-schedule causal robust-UCB confidence budgets | Compiled | — | |
| Fixed-policy telescoping anytime UCB confidence and regret | Compiled | The finite-time expectation keeps the explicit T times delta failure contribution; fixed-delta expected-average consistency is not claimed. The compiled bounded KL-UCB extension is mapped separately; literal pinned-LML identity remains cross-toolchain work. | |
| Finite-arm sub-Gaussian UCB gap-sum bound | Compiled | — | |
| Finite-arm UCB expected-average consistency | Compiled | — | |
| Canonical horizon-indexed UCB confidence-to-consistency chain | Compiled | BanditRLProof.UCB.measure_selectedPolicySuccessorLargeGapEvent_generatedUCB_le_ennreal_delta_actionRewardTrajMeasure_centeredKernelBanditRLProof.UCB.measure_successorArmPullCount_selectedPolicySuccessorGeneratedUCBAction_gt_explicitPullThreshold_le_ennreal_delta_actionRewardTrajMeasure_centeredKernelBanditRLProof.UCB.selectedPolicySuccessorFiniteArmSubgaussianExpectedPseudoRegret_nonneg_and_le | This is a horizon-indexed policy family, not a single fixed-policy anytime UCB theorem. |
| Pinned LML UCB theorem-card port | Partial | Direct imported-LML symbol and toolchain identity remain cross-toolchain work; the local expected pull-count ledger is already compiled. Do not treat the upstream theorem card as a local proof term. | |
| Generated bounded-reward KL-UCB confidence and regret | Compiled | BanditRLProof.KLUCB.bernoulliKLBanditRLProof.KLUCB.indexBanditRLProof.KLUCB.historyPolicyOpen 5 more declarationsBanditRLProof.KLUCB.pairHistory_eq_finitePairHistoryOfTraceBanditRLProof.KLUCB.generatedIndexAt_le_selected_of_K_leBanditRLProof.KLUCB.measure_generatedKLAllTimeBadEvent_le_trajMeasureBanditRLProof.KLUCB.allHorizonPullCount_of_not_badEventBanditRLProof.KLUCB.lintegral_ofReal_pseudoRegret_generatedKLUCBBounded_le_trajMeasure | The finite-time conservative route assumes AE [0,1] rewards and means in [margin,1-margin], and retains T times delta. Sharp KL-Chernoff concentration, the Garivier-Cappe leading constant, and asymptotic optimality are not claimed. |
| Full triggered CUCB approximation regret with explicit analysis repairs | Compiled | — | |
| Native heterogeneous finite-node causal expected simple regret | Compiled | — | |
| Static Musical Chairs actual coordination and finite expected occupation | Compiled | — | |
| Static Musical Chairs actual finite expected coordination mean regret | Compiled | — | |
| Static unknown-N learner: actual expected visible regret | Compiled | — |