Linear Bandits: LinUCB & OFUL
Confidence ellipsoids, the elliptical potential lemma and √T regret in d dimensions.
When rewards are linear in known features, a bandit with millions of arms has only unknowns. Optimism then needs a confidence set for a vector, and the right one is an ellipsoid shaped by the data, with a radius from a self-normalized martingale bound. This lesson builds that ellipsoid, proves the elliptical potential lemma that turns it into regret of order , shows that some action sets force that much regret on every algorithm, and asks what happens to Thompson sampling and to the guarantees when the model is only approximately linear.
What you’ll learn
- State the stochastic linear bandit, and show that the ridge estimator's error is controlled by a self-normalized martingale, which makes the confidence set an ellipsoid.
- State the confidence-ellipsoid theorem of Abbasi-Yadkori, Pál and Szepesvári with its assumptions.
- Prove the elliptical potential lemma and derive OFUL's regret of order .
- Contrast with for actions per round, and state the matching lower bounds.
- Explain linear Thompson sampling's extra and the price of misspecification.
The model, and why the confidence set is an ellipsoid
In round the learner receives an action set , possibly different every round, chooses , and receives . This is the stochastic linear bandit. A contextual bandit with features is the case ; LinUCB's disjoint model stacks one block of coordinates per arm.
Assume that the noise is conditionally -sub-Gaussian given the past (bounded or Gaussian noise qualifies), that and that for every action. The regret is .
With , the ridge estimate is . Substitute the model and write for the noise accumulated along the chosen actions:
Measure the error in the norm . Since and :
So lies in an ellipsoid around , stretched along directions the actions have rarely explored, once the noise term is controlled. That term is a self-normalized martingale: the noise sum, measured by the very matrix the actions built. The actions depend on past noise, so fixed-design regression bounds do not apply.
Take , , and , and bound the determinant by . What is the radius ?
Show the answer
9.8
The log term is , so . A one-dimensional Hoeffding width at the same is : the factor of about 3 is the price of covering ten directions, and all times at once.
OFUL and the elliptical potential lemma
OFUL (optimism in the face of uncertainty for linear bandits) plays the action with the highest plausible reward over the confidence set . By Cauchy–Schwarz in the norm the inner maximum has a closed form, and LinUCB's index appears:
Optimism. On the event of the theorem, let attain the inner maximum and be the best action in . Then , and both and lie in , so the round's regret is at most twice the width:
If mean rewards lie in , also , and with the two combine into . The elliptical potential lemma. Each action multiplies the determinant of the design matrix by one plus its squared width, by the matrix determinant lemma:
Since for , the squared widths telescope into a log-determinant, which the AM–GM bound caps:
Cauchy–Schwarz over the rounds finishes the proof, with of order :
The elliptical potential lemma has a vivid reading: only about rounds can have a large width. With , and , the sum of over all 10,000 rounds is at most ; most actions, by then, point in directions the data already cover. The same quadratic form is the elliptical exploration bonus of E3B in Exploration Bonuses at Scale.
How good is d√T?
Two lower bounds frame the result. For general action sets, cannot be improved: Dani, Hayes and Kakade (2008) showed that the minimax regret over some compact action sets in is of order up to logarithmic factors, and Lattimore and Szepesvári (ch. 24) give clean constructions for the hypercube and the unit ball. With actions per round the picture changes: Chu, Li, Reyzin and Schapire (2011) proved regret with probability for an algorithm called SupLinUCB, and a lower bound .
| Setting | Upper bound | Lower bound |
|---|---|---|
| Large or infinite action sets in | OFUL: | for some sets, such as the hypercube and the ball |
| actions per round, features in | SupLinUCB: | |
| unrelated arms (one-hot features, ) | UCB-type: |
Why does OFUL pay the extra ? Its analysis needs the confidence set to hold for whatever action the algorithm picks, and those actions depend on the same noise that built the estimate, so it must cover every direction at once, hence . SupLinUCB arranges, by a layered elimination, that the rewards used in each estimate are independent of the choices made with it, which allows a union bound over just actions. LinUCB itself, the version used in practice, has no proof of this rate. Computation matters too: for actions the OFUL index costs per round, but maximizing , a convex function of , over a general convex set is a hard nonconvex problem, NP-hard for some sets such as the hypercube, and Dani et al.'s efficient variant for polytopes loses a factor .
Each round offers actions described by features, and the best action changes with the context. Which worst-case regret rate is achievable against the best linear policy, up to logarithmic factors?
- , as for any linear bandit
- , by ignoring the features
- , because there are only actions per round
Show the answer
C. , because there are only actions per round
With finitely many actions, a union bound over replaces the cost of covering all directions, so SupLinUCB attains , and the lower bound shows that this is optimal up to logarithms. Ignoring the features would compete only with the best fixed action, not with the best policy.
Thompson sampling, misspecification and beyond
Linear Thompson sampling draws and plays . Its Bayesian regret is , by the confidence-ellipsoid route or the information ratio (Regret Bounds for Thompson Sampling). Frequentist analyses ask for more: a sample must be optimistic, ranking the best action at or above its true value, with probability bounded away from zero. The true parameter can sit about posterior standard deviations from the estimate along the best action's direction, while a plain posterior sample deviates by about one standard deviation along any fixed direction, so it would rarely be optimistic. Inflating the spread to of order fixes this at a price of : regret (Agrawal & Goyal, 2013; Abeille & Lazaric, 2017). Hamidi and Bayati (2020) argue that this is not an artifact of the proofs: they prove the inflation fundamental, showing that without it linear Thompson sampling can suffer linear regret.
Misspecification. Real rewards are only approximately linear: with . The ellipsoid then surrounds the wrong point. Lattimore, Szepesvári and Weisz (2020) prove regret of order with actions, and show that a learner can always find an action within of the best; a lower-bound construction of Du, Kakade, Wang and Yang (2020) shows that with very many actions this amplification by cannot be avoided in general. Richer features reduce but raise .
Beyond linear. Generalized linear models with a link function (GLM-UCB; Filippi, Cappé, Garivier & Szepesvári, 2010) handle click probabilities, and kernel methods (GP-UCB; Srinivas, Krause, Kakade & Seeger, 2010) handle smooth reward functions, with an information-gain quantity in place of . With neural networks, the norm in practice, guarantees of this kind hold at best for linearizations, and the exploration rules in use, ε-greedy, ensembles and the regression-oracle methods of Oracle-Efficient Contextual Bandits, are justified mostly empirically.
Key takeaways
- In a linear bandit the ridge error is a self-normalized martingale plus a bias of at most . With probability , lies for all at once in an ellipsoid around , of radius , of order .
- OFUL and LinUCB play . Each round's regret is at most , and the elliptical potential lemma caps by , giving regret .
- Some action sets force on every algorithm; with actions per round, regret of order up to logarithms is achievable (SupLinUCB) and optimal.
- Linear Thompson sampling has Bayesian regret , but frequentist proofs inflate the posterior and lose , an inflation shown necessary in the worst case. Misspecification by costs about .
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Why is OFUL's confidence set an ellipsoid shaped by rather than a ball?
- Because the noise is Gaussian
- Because the reward is linear in the action
- Because the estimate is precise in directions the actions have explored and imprecise in others, and records how much each direction was explored
- Because an ellipsoid is easier to optimize over than a ball
Show the answer
C. Because the estimate is precise in directions the actions have explored and imprecise in others, and records how much each direction was explored
The error bound measures the error with : along a direction sampled often, is large and the allowed error small. A ball would have to be as wide as the least-explored direction allows, wasting exploration on well-understood directions.
What does the elliptical potential lemma state?
- : only about rounds can have a large width
- The confidence radius grows like
- Every action's width shrinks like
- The regret of any algorithm is at least
Show the answer
A. : only about rounds can have a large width
Each action multiplies by , and is at most , so the widths cannot be large often. Note that it bounds a sum over rounds: individual widths need not shrink at any rate, since the learner may keep choosing new directions, but it cannot do so for long.
Why do frequentist analyses of linear Thompson sampling inflate the posterior's spread by a factor of about ?
- To speed up the computation of the samples
- Because the noise variance is unknown
- To make the regret bound independent of
- So that each sample is optimistic with probability bounded away from zero: the true parameter can lie about posterior standard deviations from the estimate along the best action's direction, while a plain sample moves about one
Show the answer
D. So that each sample is optimistic with probability bounded away from zero: the true parameter can lie about posterior standard deviations from the estimate along the best action's direction, while a plain sample moves about one
The confidence radius grows like in units of the posterior's spread, but along any fixed direction a Gaussian sample deviates by about one standard deviation, so it would rarely rank the best action above its true value. Inflating by restores a constant probability of optimism and costs a factor : . Hamidi and Bayati argue that the inflation is necessary in the worst case.
Mean rewards are within of a linear function of features. What does the misspecification cost, at best, over rounds?
- Nothing, as long as is small
- An extra term of order : the approximation error is amplified by
- An extra term of order
- An extra term of order , since more features average out the error
Show the answer
B. An extra term of order : the approximation error is amplified by
Lattimore, Szepesvári and Weisz prove regret of order , and a learner can always find an action within of optimal; lower-bound constructions show that the cannot be removed in general. Adding features lowers but raises .
Further reading
- Y. Abbasi-Yadkori, D. Pál & Cs. Szepesvári, "Improved algorithms for linear stochastic bandits," Advances in Neural Information Processing Systems 24 (2011).
- W. Chu, L. Li, L. Reyzin & R. E. Schapire, "Contextual bandits with linear payoff functions," International Conference on Artificial Intelligence and Statistics (2011).
- V. Dani, T. P. Hayes & S. M. Kakade, "Stochastic linear optimization under bandit feedback," Conference on Learning Theory (2008).
- T. Lattimore, Cs. Szepesvári & G. Weisz, "Learning with good feature representations in bandits and in RL with a generative model," International Conference on Machine Learning (2020).
- T. Lattimore & C. Szepesvári, Bandit Algorithms, ch. 19–20 and 24 (Cambridge University Press, 2020).