Manuscript Offprint
arXiv:2611.21880Cancellation-Free Constrained SquareCB for Safe Controller Selection
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
We study constrained contextual bandits, in which a learner chooses one of actions in each round to minimize loss while keeping the expected cost of its play below a budget. Existing reductions to online regression weight the cost by a Lagrange multiplier learned from past constraint residuals, so slack in some rounds can offset violations in others. We instead run SquareCB proposed in (Foster and Rakhlin, 2020) with a rectified weight on the cost: it is zero when the estimated cost is within the budget, and otherwise just large enough to bring it back to the budget. Under realizability and Slater’s condition with margin , the algorithm attains regret and cancellation-free violation , where is the error of the regression oracle. The same bounds hold when the budget must be met in every context, potentially adversarially chosen contexts. In controller selection for a safe-control-gym quadrotor and a BOPTEST building, the violation is 6 to 9 times lower than that of primal-dual and virtual-queue baselines, with a lower or comparable regret.
keywords
contextual bandits, constrained optimization, online regression oracles, safe learning
Controller selection.
CCBs arise naturally in control when a supervisor selects among a library of pre-designed controllers (Ayala-Romero et al., 2024; Pacchiano et al., 2020). Before each episode, the supervisor observes the operating conditions (a payload, a start state, a weather forecast), selects a controller, runs it for the episode, and observes a performance loss and a safety or comfort cost. The supervisor has to learn which controller to use in which conditions while keeping the cost within a budget, and it should not repeatedly exceed the budget early in the run and compensate later.
Regression oracles and signed guarantees.
Foster and Rakhlin (2020) reduced contextual bandits to online square-loss regression: SquareCB plays inverse-gap weighting on the predictions of any online regression oracle, and its regret depends on the class only through the oracle’s error. For constraints, Slivkins et al. (2023) combine SquareCB with a Lagrange multiplier updated by online learning, and Sarkar and Sinha (2026b) replace the multiplier with a virtual queue and a Lyapunov function, which also handles adversarial contexts. In both, the weight on the cost is driven by the signed residual , and the long-term guarantee bounds the signed sum . This sum allows cancellation: slack banked in rounds below the budget offsets violations in later rounds. If alternates between and , the sum is at most , while the budget is exceeded in half of the rounds. On the other hand, cancellation-free bound is , and thus, it is a stronger metric. Further, they did not consider the cancellation free regret bound , hence, the regret can be made small by playing infeasible but high reward policies.
Our approach.
We keep SquareCB and change only how the cost weight is chosen. In each round, the weight is the smallest value for which the estimated cost of the inverse-gap-weighted distribution on the scores is at most , found by bisection; if the estimated cost jumps over , the learner mixes the two neighbouring distributions so that it equals . The weight is therefore a function of the current estimates alone. In every round, either the weight is and the estimated cost is below the budget, or the estimated cost equals the budget, or the weight is at its cap . This per-round complementary slackness, combined with an exact-penalty saddle inequality, turns the SquareCB analysis into a bound on the one-sided violation. Using the one-sided violation, we also bound the cancellation-free regret. To our knowledge, the cancellation-free regret has not been bounded before for constrained contextual bandits with regression oracles, and the cancellation-free violation appears only in concurrent work.
Contributions: Our major contributions are listed below
- We develop a novel algorithm for constrained contextual bandits with general online regression oracles, which adds a bisection on a single scalar per round to SquareCB and has no dual-ascent loop (Section 2–Proposition 7). Under realizability and Slater’s condition with margin , and with : regret and cancellation-free violation , which does not depend on (Theorems 13 and 14). The cancellation-free regret is also (Corollary 15).
- The same rates apply when the budget must hold in every context, for arbitrary, possibly adversarial, context sequences (Theorem 17).
- Experiments on controller selection for a safe-control-gym quadrotor and a BOPTEST building, in which the violation is 6 to 9 times lower than that of primal-dual and virtual-queue baselines, with lower regret (Section 8).
1.1 Related Work
Contextual bandits have been studied with linear (Chu et al., 2011; Abbasi-Yadkori et al., 2011; Agrawal and Goyal, 2013) and neural (Zahavy and Mannor, 2019; Zhou et al., 2020; Zhang et al., 2020) function classes using optimism on the face of uncertainty principle. An alternative to optimism is to design algorithms for specific function classes by reducing contextual bandit learning to online regression. In particular, the Inverse Gap Weighting (IGW) principle (Abe and Long, 1999; Abe et al., 2003) underlies general regression-oracle-based reductions developed by (Foster and Rakhlin, 2020; Foster et al., 2018) (e.g., Square-CB) which decouple exploration from the choice of function approximator. Deb et al. (2025) apply this to conservative bandits, which require performance relative to a baseline policy rather than a cost budget.
Unlike conservative contextual bandits, which ensure performance relative to a baseline policy, constrained contextual bandits explicitly optimize a reward objective subject to a cost budget. For constrained contextual bandits with regression oracles, Slivkins et al. (2023) use Lagrange multipliers and Sarkar and Sinha (2026b) use virtual queues, which also handle adversarial contexts. Both drive the cost weight by the signed residual and bound the signed violation, in which rounds below the budget offset rounds above it. Applying them to the clipped cost removes the cancellation but bounds but bounds , a different pessimistic constraint. Positive-part guarantees have been studied in constrained MDPs (Efroni et al., 2020; Guo et al., 2022; Müller et al., 2024; Stradi et al., 2024) only for finite state-space; we obtain them for contextual bandits with general regression oracles. Safe bandits enforce the constraint in every round with high probability and achieve zero violation (Amani et al., 2019; Pacchiano et al., 2025), but they rely on a known safe action and confidence sets for a linear cost model, which a general regression oracle does not provide.
2 Problem Setup
Protocol.
Let be a context space and a finite set of actions. In each round :
- nature draws a context independently from a fixed distribution and reveals it;
- the learner chooses a distribution and samples an action ;
- the learner observes a loss and a cost for the chosen action only.
We write for the history up to the end of round , that is, the contexts, actions, losses and costs of rounds . The learner can evaluate expectations under ; in our benchmarks, is the uniform distribution over a known finite set of start states or days. Remark 16 discusses unknown , and Section 6 gives a version of the algorithm and its guarantees that does not use at all and allows adversarial contexts.
Mean loss and cost.
The loss and cost are noisy, with conditional means
The learner does not know or .
Policies and values.
A (randomized) policy maps each context to a distribution ; denotes the policy played in round . The expected loss and the expected cost of a policy are
both linear in . Given a budget , the benchmark is the best policy that meets the budget on average over contexts,
We assume the minimum is attained, which holds for instance when is finite, as in our benchmarks (the problem is then a finite linear program). The budget is on the average cost, not on every context: may exceed at some contexts if it stays below at others. We consider the constraint on every context in Section 6.
Performance measures.
We measure the regret and the constraint violation
where . The violation adds up only the rounds in which the played policy exceeds the budget, so rounds below the budget cannot offset rounds above it. We call it cancellation-free, in contrast to the signed sum that Lagrangian methods control. Within a round, is an average over contexts, so a policy may still exceed at some contexts and stay below it at others; Section 6 removes this as well.
Regression oracles.
The learner has access to two online regression oracles, for the loss and for the cost. At the start of round they output estimates , computed from , and after the round they are updated with and . For a policy , we write for its estimated cost.
We assume the followings:
Assumption 1 (Realizability).
and for known classes .
Assumption 2 (Online regression oracles).
With probability at least ,
For finite classes both bounds are (Foster and Rakhlin, 2020).
We write
for the combined oracle error; it appears only in the forms of the bounds.
Assumption 3 (Slater).
There exist a policy and with .
The Slater margin measures how far below the budget some policy can stay. The above assumptions are reasonable and have been used in many constrained optimization work such as (Ghosh et al., 2022; Efroni et al., 2020; Sarkar and Sinha, 2026b). We can relax this assumption to some upper bound of which ensures the admittance of a feasible solution.
Lemma 4 (Consequences of the oracle bounds).
With probability at least , for ,
The detailed proof of Lemma 4 is given in Section D (Supplementary material)
Parameters.
We clip the rectified weight at and use the SquareCB learning rate (Foster and Rakhlin, 2020).
3 The Algorithm
The algorithm is SquareCB run on the composite score . The only new element is the rectified weight , chosen so that the estimated cost of the played policy meets the budget. It depends only on the current oracle estimates, so it is available before the learner acts.
3.1 The score-to-distribution map
For a weight and a context , SquareCB maps the score vector to a distribution exactly as in Algorithm 1 of (Foster and Rakhlin, 2020):
where the leader is a minimizer of ; among tied minimizers it is the one with the smallest . Write for the estimated cost of the resulting policy.
Lemma 5 (Shape of ).
is nonincreasing and right-continuous on , and all its discontinuities are downward jumps.
The complete proof has been given in Section E (Supplementary material). This will ensure that we can apply a binary search to find a suitable (Proposition 7).
3.2 The rectified weight
In the definition of (just after (1)), we take the tied action with the smallest estimated cost . We also need the distribution that takes the tied action with the largest estimated cost: we write for it. Without a tie, . With a tie, as increases, is the distribution played just before the leader switches, and the one played just after.
Definition 6 (Rectified weight and played policy).
At round :
- if , set and ;
- if , set and ;
- otherwise, let and play , with chosen so that .
In the third case, the mixture is needed because can jump over at (Lemma 5): then has estimated cost strictly below , has estimated cost above , and no single weight gives exactly . Mixing the two gives exactly , which the analysis uses (Lemma 10). If is continuous at , the two distributions have the same estimated cost and the mixture plays no role.
Proposition 7 (Existence, computability).
The policy of Definition 6 is well defined, and in the third case . It can be computed by bisection on . In every case is, for each , a convex combination of inverse-gap-weighted distributions for the score vector , each with a minimizer of as the leader. Finally, and depend only on , hence are -measurable; in particular they do not depend on the realized action .
Proof for Proposition 7 is given in Section E.2 (Supplementary material)
Algorithm: Cancellation-Free Constrained SquareCB. Parameters , , budget ; oracles . For : 1. Receive . 2. Compute and (Definition 6) by bisection on , mixing the two policies at the end of the bisection. 3. Sample ; observe ; update both oracles.
4 The SquareCB Guarantee
Lemma 8 (IGW inequality (Foster and Rakhlin, 2020)).
Let be inverse-gap weighting for a score vector , with any minimizer of as the leader. Then for every ,
Foster and Rakhlin (2020, Lemma 3) state it for vectors in ; the proof uses no range assumption (Appendix F), so it applies to our composite scores in . Both sides are linear in for fixed , so it also holds for the mixtures of Definition 6.
Lemma 9 (Composite regret).
For any fixed comparator policy , with probability at least ,
With , .
The proof is given in Section F in Supplimentary file.
5 Master Inequality and the Two Bounds
Before stating and proving the main results, we state two important results. Throughout write ; by Cauchy–Schwarz and Lemma 4, .
Lemma 10 (Rectified extraction).
With and from Definition 6,
The proof is given in Section G (in Supplementary material)
Remark 11 (Approximate matching).
The third case of Definition 6 asks for exactly. Suppose instead that only holds there, for example because of a bisection tolerance. If , then and the left side is at least ; if , then and . In both cases the per-round inequality in the proof of Lemma 10 holds with an extra , so (4) holds with added to its right side. Following this through, the violation bound of Theorem 13 increases by and the regret bound of Theorem 14 by , so any tolerance with , such as , keeps both rates.
Lemma 12 (Master inequality).
On the event of Lemma 9 with ,
Proof.
Apply (3) with comparator . Since and , , so
Substituting the extraction (4) in Lemma 10 gives (5). ∎
Now, we are ready to state and prove the main results:
Theorem 13 (Cancellation-free violation).
Under Assumptions 1–3, with , with probability at least ,
Proof.
By Lemma 24, . Substituting into (5) in Lemma 12, . Since and , , so . Finally and . ∎
Theorem 14 (Reward regret).
Under the same assumptions, with probability at least ,
Proof.
From (6), , and by (4), . ∎
Corollary 15 (Cancellation-free regret).
On the event of Theorems 13 and 14,
Proof.
Write , so . By Lemma 24, , and the right side is nonnegative, so . Summing and using gives ; Theorems 13 and 14 give the rate. ∎
In words, the played policy can beat only in rounds where it exceeds the budget, and by at most times the excess, so negative-regret rounds cannot hide more than ; the same argument with applies per context (Section 6). The factor in the regret is common in constrained learning, where Slater’s condition bounds the optimal multiplier (Slivkins et al., 2023; Ghosh et al., 2022); the violation bound does not depend on . For comparison, (Sarkar and Sinha, 2026b) obtain regret and signed violation against the same feasible-in-expectation benchmark with adversarial contexts, and regret only for the deterministic action space (no randomization over the actions are permitted) (Sarkar and Sinha, 2026b, Theorem 9).
Remark 16 (Unknown context distribution).
If is unknown, can be computed with the empirical distribution of . The analysis then needs an extra term for the difference between under the empirical and the true distribution, uniformly over the policies the algorithm can play; we do not pursue this here.
6 Per-Context Constraints
We extend our proofs to per context guarantees. Let the contexts be arbitrary, possibly chosen by an adaptive adversary, and replace the benchmark and measures by
where . Assume per-context Slater: for every some has . The algorithm is unchanged except that specific to one context
Theorem 17 (Per-context guarantees).
Under Assumptions 1–2 and per-context Slater, with , with probability at least ,
with and ; that is, and .
Proof.
Repeat the proofs above with replaced by , by the per-context optimum and by the per-context multiplier . Lemma 9 is applied at and needs no conversion to an expectation over , so the Azuma term disappears. The estimation error is by Jensen, so by Cauchy–Schwarz and the first bound of Lemma 4. The comparator step of Lemma 12 uses , which holds because the benchmark is per-context. ∎
The average version needs only average Slater and compares with a stronger benchmark, but needs i.i.d. contexts and access to , and lets the policy exceed in some contexts. The per-context version needs a policy that is safe in every context, which in control is usually a known safe fallback controller, and in return holds for arbitrary context sequences and bounds the violation in every episode.
7 Experiments
We evaluate our method on two control benchmarks, the 2D quadrotor of safe-control-gym and the BOPTEST building, and compare it with primal-dual and with the CCB reduction scheme of (Sarkar and Sinha, 2026b). Note although (Deb et al., 2025) has some notion of safety and uses IGW over an online regression oracle, the formulation is not explicitly modelled to work for constrained bandit setup. Further theoretical guarantees also differs from our objective in this work. Hence, we do not compare with that setup. We rather compare with (Sarkar and Sinha, 2026b) which is more aligned to our objective. In both benchmarks, each round is one episode: the learner chooses a controller at the start of the episode, the controller runs for the whole episode, and the loss and the constraint cost are observed at its end.
Quadrotor.
We use the 2D quadrotor of safe-control-gym (Yuan et al., 2022). In each episode, the learner observes the drone’s start state and payload mass, drawn from 600 start states, and chooses one of six LQR controllers to bring it to a height of 1 m, while random disturbance forces act on it. Fast controllers track well but overshoot the target, and slow ones overshoot little but track worse. The loss is the tracking error, the cost is the overshoot (how far the drone rises above the target), and the budget is an average overshoot of 1.75 cm.
Building.
We use the bestest_air test case of BOPTEST (Blum et al., 2021), a single zone with a fan-coil unit. Each day, drawn from 180 days of the year, the learner observes the weather forecast and chooses one of eight thermostat schedules. The building’s thermal state at the start of the day is random and not observed. Energy-saving schedules use less heating and cooling but let the temperature leave the comfort band, while comfortable schedules use more energy. The loss is the energy use, the cost is the thermal discomfort (Kelvin-hours outside 21–25.5 ∘C), and the budget is 10 Kh per day.
8 Results
Figures 1 and 2 show that for each benchmark, the cumulative regret (left) and the cumulative constraint violation (right) as functions of the number of episodes. Each curve is the average over ten runs, and the shaded band shows standard errors. For regret we plot (the cancellation-free bound) and the violation is also cancellation-free .
Quadrotor.
On the quadrotor (Figure 1), the left plot shows the regret. The baselines have lower regret at the start, while they exceed the budget, but their regret keeps growing, and at the final episode our method has the lowest regret (57, against 94 for primal-dual and 88 for the CCB scheme). The right plot of Figure 1 shows the violation. Both baselines have significantly larger violations compared to our method. Our method achieves sub-linear regret and violation bound confirming the theoretical insights, and achieve a better regret without sacrificing feasibility.


Figure 1: Quadrotor:cumulative regret and violation (both cancellation-free) averaged over 10 runs.
Building.
On the building, the three methods have similar regret at the start (left of Figure 2), and from about 7,000 episodes on our method has the lowest regret showing that our approach can track the optimal policy better compared to the baselines similar to the Quadrotor. For the violation (right of Figure 1), the difference is more pronounced and ours achieve significantly lower violation indicating that we achieve a better regret without sacrificing feasibility.


Figure 2: Building:cumulative regret and violation (left and right, respectively) averaged over 10 runs.
Why our method does better.
The baselines set their cost weight from accumulated signed residuals, and with , whereas our weight depends only on the current estimates. Their weight starts at zero, so they first exceed the budget, which keeps their early regret low (a policy can beat only by exceeding the budget, Lemma 24). On the quadrotor, it takes about 10,000 episodes to settle, a phase that accounts for more than half of their violation; ours settles within 1,000. Afterwards their weight swings with about three times the spread of ours, and their policy crosses the budget about 4 times (quadrotor) and 9 times (building) as often: swings up make the policy too conservative and add to the regret, swings down add to the violation. Our mechanism tries to find the policy with the right balance from the first episode onwards, therefore gives both a lower violation and a lower regret.
9 Conclusion
We studied constrained contextual bandits with general online regression oracles and proposed a constrained version of SquareCB whose cost weight is rectified: it is zero when the estimated cost is within the budget, and otherwise just large enough to bring it back to the budget. Because the weight depends only on the current estimates, slack from past rounds is never carried over, and the algorithm attains regret and cancellation-free violation , both for budgets on average over contexts and, with adversarial contexts, for budgets in every context. On controller selection for a quadrotor and a building, it exceeds the budget far less than primal-dual and virtual-queue methods, with lower regret. The algorithm requires a known bound on the optimal multiplier, which a safe fallback controller provides through its margin ; removing this requirement without delaying enforcement of the budget, and extending the method to multiple constraints, are directions for future work. Extending the approach to the Reinforcement Learning setting and more long-horizon control tasks is also left for the future.
Generative AI Use
LLMs were used for spel-check and improving the quality of writing. The authors reviewed and verified all AI-assisted content and take responsibility for the final content of the paper.
References
Yasin Abbasi-Yadkori, Dávid Pál, and Csaba Szepesvári. Improved algorithms for linear stochastic bandits. Advances in neural information processing systems, 24, 2011.
Naoki Abe and Philip M Long. Associative reinforcement learning using linear probabilistic concepts. In ICML, pages 3–11, 1999.
Naoki Abe, Alan W Biermann, and Philip M Long. Reinforcement learning with immediate rewards and linear hypotheses. Algorithmica, 37(4):263–293, 2003.
Shipra Agrawal and Navin Goyal. Thompson sampling for contextual bandits with linear payoffs. In International conference on machine learning, pages 127–135. PMLR, 2013.
Sanae Amani, Mahnoosh Alizadeh, and Christos Thrampoulidis. Linear stochastic bandits under safety constraints. In Advances in Neural Information Processing Systems, 2019.
Jose A Ayala-Romero, Andres Garcia-Saavedra, and Xavier Costa-Perez. Risk-aware continuous control with neural contextual bandits. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pages 20930–20938, 2024.
David Blum, Javier Arroyo, Sen Huang, Ján Drgoňa, Filip Jorissen, Harald Taxt Walnum, Yan Chen, Kyle Benne, Draguna Vrabie, Michael Wetter, et al. Building optimization testing framework (boptest) for simulation-based benchmarking of control strategies in buildings. Journal of Building Performance Simulation, 14(5):586–610, 2021.
Wei Chu, Lihong Li, Lev Reyzin, and Robert Schapire. Contextual bandits with linear payoff functions. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pages 208–214. JMLR Workshop and Conference Proceedings, 2011.
Rohan Deb, Mohammad Ghavamzadeh, and Arindam Banerjee. Conservative contextual bandits: Beyond linear representations. In International Conference on Learning Representations, 2025.
Yonathan Efroni, Shie Mannor, and Matteo Pirotta. Exploration-exploitation in constrained MDPs. arXiv preprint arXiv:2003.02189, 2020.
Dylan Foster and Alexander Rakhlin. Beyond ucb: Optimal and efficient contextual bandits with regression oracles. In International conference on machine learning, pages 3199–3210. PMLR, 2020.
Dylan Foster, Alekh Agarwal, Miroslav Dudík, Haipeng Luo, and Robert Schapire. Practical contextual bandits with regression oracles. In International Conference on Machine Learning, pages 1539–1548. PMLR, 2018.
Arnob Ghosh, Xingyu Zhou, and Ness Shroff. Provably efficient model-free constrained rl with linear function approximation. Advances in Neural Information Processing Systems, 35:13303–13315, 2022.
Hengquan Guo and Xin Liu. Stochastic constrained contextual bandits via lyapunov optimization based estimation to decision framework. In Proceedings of the Thirty Seventh Conference on Learning Theory, volume 247 of Proceedings of Machine Learning Research, pages 2204–2231. PMLR, 2024.
Hengquan Guo, Xin Liu, Honghao Wei, and Lei Ying. Online convex optimization with hard constraints: Towards the best of two worlds and beyond. In Advances in Neural Information Processing Systems (NeurIPS), volume 35, 2022.
John Langford and Tong Zhang. The epoch-greedy algorithm for multi-armed bandits with side information. In Advances in Neural Information Processing Systems, pages 817–824, 2007.
Tor Lattimore and Csaba Szepesvári. Bandit Algorithms. Cambridge University Press, 2020.
Lihong Li, Wei Chu, John Langford, and Robert E. Schapire. A contextual-bandit approach to personalized news article recommendation. In Proceedings of the 19th International Conference on World Wide Web, pages 661–670. ACM, 2010. 10.1145/1772690.1772758.
Adrian Müller, Pragnya Alatur, Volkan Cevher, Giorgia Ramponi, and Niao He. Truly no-regret learning in constrained MDPs. In International Conference on Machine Learning (ICML), 2024.
Sabrina Klos Müller, Cem Tekin, Mihaela van der Schaar, and Anja Klein. Context-aware hierarchical online learning for performance maximization in mobile crowdsourcing. IEEE/ACM Transactions on Networking, 26(3):1334–1347, 2018. 10.1109/TNET.2018.2828415.
Aldo Pacchiano, My Phan, Yasin Abbasi Yadkori, Anup Rao, Julian Zimmert, Tor Lattimore, and Csaba Szepesvari. Model selection in contextual stochastic bandit problems. Advances in Neural Information Processing Systems, 33:10328–10337, 2020.
Aldo Pacchiano, Mohammad Ghavamzadeh, and Peter Bartlett. Contextual bandits with stage-wise constraints. Journal of machine learning research, 26(170):1–57, 2025.
Dhruv Sarkar and Abhishek Sinha. Constrained contextual bandits with adversarial contexts. arXiv preprint arXiv:2605.06190, 2026a.
Dhruv Sarkar and Abhishek Sinha. A simple reduction scheme for constrained contextual bandits with adversarial contexts via regression. arXiv preprint arXiv:2602.05019, 2026b.
Aleksandrs Slivkins, Karthik Abinav Sankararaman, and Dylan J Foster. Contextual bandits with packing and covering constraints: A modular lagrangian approach via regression. In The Thirty Sixth Annual Conference on Learning Theory, pages 4633–4656. PMLR, 2023.
Francesco Emanuele Stradi, Matteo Castiglioni, Alberto Marchesi, and Nicola Gatti. Optimal strong regret and violation in constrained MDPs via policy optimization. arXiv preprint arXiv:2410.02275, 2024.
Ambuj Tewari and Susan A. Murphy. From ads to interventions: Contextual bandits in mobile health. In James M. Rehg, Susan A. Murphy, and Santosh Kumar, editors, Mobile Health: Sensors, Analytic Methods, and Applications, pages 495–517. Springer, 2017. 10.1007/978-3-319-51394-2_25.
Zhaocong Yuan, Adam W Hall, Siqi Zhou, Lukas Brunke, Melissa Greeff, Jacopo Panerati, and Angela P Schoellig. Safe-control-gym: A unified benchmark suite for safe learning-based control and reinforcement learning in robotics. IEEE Robotics and Automation Letters, 7(4):11142–11149, 2022.
Tom Zahavy and Shie Mannor. Deep neural linear bandits: Overcoming catastrophic forgetting through likelihood matching. arXiv preprint arXiv:1901.08612, 2019.
Weitong Zhang, Dongruo Zhou, Lihong Li, and Quanquan Gu. Neural thompson sampling. arXiv preprint arXiv:2010.00827, 2020.
Dongruo Zhou, Lihong Li, and Quanquan Gu. Neural contextual bandits with ucb-based exploration. In International conference on machine learning, pages 11492–11502. PMLR, 2020.
Appendix
| Result | Statement |
|---|---|
| Lem. 4 | oracle bounds policy-value error |
| Lem. 5, Prop. 7 | monotone with downward jumps; rectified weight exists, computable |
| Lem. 9 | composite SquareCB: |
| Lem. 24 | saddle: |
| Lem. 10 | |
| Lem. 12 | |
| Thm. 13 | , cancellation-free |
| Thm. 14 | |
| Thm. 17 | same rates per context, for adversarial contexts |
Appendix A Summary of Results
Summary of Results is in Table
Appendix B Effect of the Budget
To study how our method responds to the budget, we run it with its hyperparameters fixed at the tuned values and vary only the budget (fig:budget-quad,fig:budget-bld).
In Quadrotor:
the range of meaningful budgets is set by the design of the task, namely the set of controllers and the distribution of initial states and payloads. Choosing, in every context, the controller with the smallest expected overshoot gives cm, so Assumption 3 holds for every cm; the loss-minimising policy, which ignores the constraint, overshoots by about cm on average, so the constraint is active for every cm. The main budget cm lies inside this range. To check that our conclusions do not hinge on this choice, we run our method at cm, from nearly infeasible to nearly inactive. The exploration constant keeps the value tuned for cm, and only the clip level changes with , as the method prescribes (, five runs).
\subfigure
[Rectified SquareCB (ours)]
Figure shows that for cm the average overshoot settles at the budget within a few thousand rounds and the loss converges to that of , without any retuning, in line with Theorems 13 and 14. Tightening the budget raises the optimal loss, from at cm to at cm, and the multiplier with it, from to ; at every budget stays well below , as Lemma 23 predicts, so the default is always large enough without knowledge of . The regret at grows as the budget tightens, from at cm to at cm, together with , consistent with the reward bound of Theorem 14, which grows linearly in . At the tightest budget, cm, where is smallest (), convergence is slower: at the average overshoot is within cm of .
In Building:
the range of meaningful budgets is set by the design of the task. Choosing, in every context, the controller with the smallest expected discomfort gives Kh/day, so Assumption 3 holds for essentially every ; the loss-minimising policy, which ignores the constraint, incurs about Kh/day, so the constraint is active for every Kh/day. Around the main budget Kh/day we run our method at Kh/day, from tight to loose, with kept at its tuned value and only changing with (, five runs).
\subfigure
[Rectified SquareCB (ours)]
Figure shows that the average discomfort first exceeds the budget while the costs of the controllers are being learned and then settles at , without any retuning: within about and rounds for and Kh/day, and more slowly for the tight budget Kh/day, where the early excess is large relative to . At all three runs are within of their budget, in line with Theorem 13. The loss stays within of that of and the gap is still shrinking, in line with Theorem 14. Tightening the budget raises the optimal loss, from at to at Kh/day, and with it, from to ; at every budget stays well below , as Lemma 23 predicts, so the default is large enough without knowledge of .
Appendix C Ablation study on
The clip level is the upper end of the interval in which the rectified weight is chosen (Definition 6). Our method does not tune it: it is fixed to , which is larger than because (Lemma 23). The analysis uses in two places. The violation bound of Theorem 13 needs : its proof divides by . The regret bound of Theorem 14, , grows with . To see both effects, we repeat the main runs (same budgets, tuned , , five runs) and change only the clip level, , with scaled with as in Algorithm 1 so that recovers the tuned run. Figure 3 shows the running averages of the loss and of the cost.
Building ( Kh/day, ).
With the weight stays at the clip and the discomfort stays near Kh/day, almost three times the budget, for the whole run; the loss () is below that of () only because the comfort constraint is ignored. With and the two runs coincide: the discomfort settles very close to budget within about rounds and the loss () is close to that of . With the discomfort also stays close to budget, but the loss is slightly higher (), because the larger gives a smaller and hence more exploration.
Quadrotor ( cm, ).
With the weight stays at the clip and the average overshoot stays near cm, above the budget; the loss () is again below that of () only because the constraint is ignored. The runs with , and coincide: the overshoot approaches the budget ( cm at the end) and the loss approaches that of ().
Relation to the theory.
The runs with show what happens when the condition used in the proof of Theorem 13 fails: the cost stays above the budget on both benchmarks. Their low loss also illustrates the point of Section 1 that a small regret alone is not a meaningful guarantee, since it can be obtained by violating the constraint. For every , which exceeds on both benchmarks, the cost settles at the budget and the results hardly depend on , so need not be tuned. A very large remains safe for the constraint but may cost some loss, as on the building at , in line with Theorem 14, whose regret bound grows with . The default ( for the building, for the quadrotor) lies in the region where the method works well, and by Lemma 23 choosing it requires no knowledge of .
Figure 3: Running average of the expected loss (left) and cost (right) of our method for , on the building with Kh/day (top) and the quadrotor with cm (bottom). Dashed lines: loss of and budget . Overlapping curves are drawn thinner on top. Mean s.e. over 5 runs.
Appendix D Missing proofs for Lemma in Section 2
D.1 Restatement and proof of Lemma 4
Lemma 18 ((Restatement of Lemma 4)Consequences of the oracle bounds).
With probability at least , for ,
Proof.
We use the following fact.
Let be a filtration and be -measurable.
so is a supermartingale with mean at most , and Markov’s inequality gives, with probability at least ,
For the first bound, let and , which is -measurable with ; combine (7) with Assumption 2. For the second bound, Jensen’s inequality gives . This is for , because is independent of and , are -measurable; apply (7) with and then the first bound. The four events (oracle, and (7) three times) fail with total probability at most . ∎
Appendix E Proofs for Lemmas in Section 3
E.1 Restatement and Proof for Lemma 5
Lemma 19 ((Restatement of Lemma 5) Shape of ).
is nonincreasing and right-continuous on , and all its discontinuities are downward jumps.
Proof.
Fix a context and write , , and for the predicted cost at .
Each score is a line in with slope , and the leader is the lowest line. Since there are finitely many lines, splits into finitely many intervals on which the leader is fixed, separated by points where two or more lines cross at the bottom.
Step 1: is non-increasing while the leader is fixed. The leader’s probability is , so . The gap has derivative , so has derivative , and
In words, increasing moves probability from actions that cost more than the leader to the leader, and from the leader to actions that cost less; both lower the cost.
Step 2: what happens where the leader changes. Let be a point where the leader changes, from just below to just above. Both lines are lowest at , and was below before, so ’s line is steeper: . At itself the two scores are equal, so either could be called the leader; the tie-break picks the one with the smaller cost, , which is also the leader just above . Hence : is right-continuous.
Step 3: the jump is downward. Compare the distributions just below and at . They are inverse-gap weighting for the same scores (in the limit), differing only in which of the tied actions is called the leader. Every action other than has the same gap, hence the same probability, in both. The tied action that is not the leader has gap , hence probability . The leader gets the remaining mass , which is the same in both. So just below , has probability and has ; at these are swapped, and
because , and since each of the non-leaders has probability at most . If more than two actions tie, the same computation applies with the extra tied actions at probability on both sides.
Averaging over contexts. Steps 1–3 show that is nonincreasing and right-continuous for each . Both properties are preserved by averaging over (for right-continuity, by bounded convergence), and a nonincreasing function can only jump downward. ∎
E.2 Proof for Proposition 7
Proposition 20 ((Restatement of Proposition 7) Existence, computability).
The policy of Definition 6 is well defined, and in the third case . It can be computed by bisection on . In every case is, for each , a convex combination of inverse-gap-weighted distributions for the score vector , each with a minimizer of as the leader. Finally, and depend only on , hence are -measurable; in particular they do not depend on the realized action .
Proof.
In the third case , so exists. By Lemma 5, (right-continuity) and (Step 3 of Lemma 5 and the definition of the infimum), so a with exists. Bisection keeps a point with and a point with and mixes the two policies; after steps , and every bound below holds up to an additive . Both and are inverse-gap weighting for with a minimizer as the leader. Everything in is a function of , which are determined by data from rounds . ∎
Appendix F Missing proofs for Lemmas in Section 4
Proof of Lemma 8:
Proof.
Let be the leader, and . Then
Maximizing and over bounds the first two terms, minus , by . Next, . If , then ; if , then and . In both cases the total is at most . ∎
Lemma 21 ((Restatement of Lemma 9) Composite regret).
For any fixed comparator policy , with probability at least ,
With , .
Proof.
At round let , the conditional mean of the composite loss ; it is linear in the observable means, so there is no Jensen gap, and is its estimate. Apply (2) at the realized context , with ; this is valid even though changes with . Since , summing and using Lemma 4 gives
for our . Since and are -measurable and is independent of , the conditional mean of the -th summand is . The differences lie in , and the Azuma–Hoeffding inequality gives the last term. ∎
Appendix G Missing proofs in Section 5
Lemma 22 ((Restatement of Lemma 10) Rectified extraction).
With and from Definition 6,
Proof.
Fix and let . We show in each case of Definition 6.
Case (). The left side is . Since , , so .
Case with . The left side is , which differs from by , since .
Third case (, ). Then , so the left side is at least , while .
Summing over and using gives (9). ∎
Appendix H The Exact-Penalty Saddle Inequality
Lemma 23 (Bounded optimal multiplier).
Under Assumption 3 there is an optimal Lagrange multiplier for with , satisfying for all randomized and .
Proof.
are linear over the convex set of randomized policies and is strictly feasible, so strong duality holds and an optimal exists with the stated optimality and complementary slackness. Evaluating Lagrangian optimality at : , so (values in ). ∎
Lemma 24 (Quantitative saddle).
For every randomized ,
Proof.
By Lemma 23, . Since and , . ∎
Appendix I Hyperparameters and Primal-Dual Square CB
| Parameter | Description | Tuning grid | Quadrotor | Building |
|---|---|---|---|---|
| clip level, | — (not tuned) | 30 | 18 | |
| horizon (number of episodes) | — | |||
| number of actions | — | 6 | 8 | |
| budget | — | 1.75 cm | 10 Kh/day | |
| Slater margin, | — | 0.0667 | 0.1111 | |
| ours: exploration | ||||
| primal-dual: exploration | ||||
| primal-dual: dual step | ||||
| CCB method: queue scale | ||||
| CCB method: exploration scale | ||||
Algorithm: Primal-dual SquareCB (baseline). Parameters , step size , budget ; oracles ; . For : 1. Receive ; obtain . 2. Form scores and the SquareCB distribution via (1). 3. Compute the estimated cost . 4. Update . 5. Sample ; observe ; update both oracles.