Manuscript Offprint
arXiv:2608.26755Safety by Design: Realized-Cost Constraints for Contextual Bandits with Continuous Actions
Abstract
Contextual bandits are a standard framework for sequential decision-making under uncertainty, with applications in clinical trials, dosage selection, recommendation systems, and autonomous systems. Safety is central in many of these applications, since a single unsafe decision in settings such as dosage selection or autonomous driving can have catastrophic consequences. A common way to model safety in bandit problems is to associate each action with both a reward signal and a cost signal, and to optimize reward subject to constraints on cost. Most existing safety-constrained bandit models enforce safety by requiring the expected cost of each action to remain below a prescribed threshold. However, this may be insufficient in heteroscedastic settings, where the chosen action affects not only the expected reward and cost, but also the variability of the observed outcomes. We study contextual bandits with one-dimensional continuous actions and stage-wise high-probability constraints on the realized cost. We propose High-Probability Constrained UCB, an optimistic-pessimistic algorithm that explores for reward while conservatively estimating the safe action set. For linear reward and cost models, we prove a tight regret bound, and we extend the analysis to general function classes using the eluder dimension. Experiments show that enforcing realized-cost safety substantially reduces violations compared with expected-cost constrained baselines.
1 Introduction
Bandit algorithms [33, 3, 19] have been applied across a wide range of domains, including reinforcement learning with human feedback (RLHF) [11, 40], clinical trials [23, 21, 4, 35, 7], recommendation systems [38], dynamic pricing [25], large language models [8], and fair allocation [29]; see [9] for a broader overview. In these domains, a learner interacts sequentially with an unknown environment, aiming to learn from observations while maximizing cumulative reward through its decisions. Recently, there has been increasing interest in contextual bandits [13, 19], where the learner observes a context before selecting an action from a potentially large or continuous action space.
Within this general framework, constrained bandit algorithms are particularly relevant when applications involve resource limitations or safety requirements [12, 36]. Such constraints can take different forms, including budget-type constraints as in knapsack bandits [5], fairness constraints [16], and models with simultaneous reward and cost signals [2, 27, 28]. The latter formulation is especially natural in applications such as advertising and drug administration, where decisions must balance utility against risk. In drug dosage problems, for example, treatments generate an efficacy signal, interpreted as reward, and a toxicity signal, interpreted as cost; the goal is to maximize therapeutic benefit while ensuring that toxicity remains below a prescribed threshold , as in Phase II clinical trials. For example, related work by [21] considers a binary reward-cost model that enforces constraints on the average cost over time.
While cumulative or averaged cost control is sufficient in some applications, many safety-critical settings require stage-wise constraints, namely control of the cost at each time step. To address this requirement, researchers have studied the well-established safe linear bandit problem [15, 28, 24], in which, at each round , the selected action generates both a reward signal and a cost signal . The objective is to maximize expected cumulative reward while ensuring that the expected cost remains below a known safety threshold at every round, with this constraint holding with high probability.
Guarantees on the expected value of the cost signal are natural in homoscedastic models, where the level of noise is not affected by the chosen action. However, in applications such as autonomous driving, robotic control, and drug treatment, the variability of the outcome may itself depend on the action level. For example, a faster robotic motion may lead to a wider distribution of possible next positions due to friction or sensor noise, a larger velocity in autonomous driving may be less predictable than a smaller one, and the effect of a drug may vary across dosage levels [18]. In such heteroscedastic settings, satisfying a constraint only in expectation does not preclude catastrophic outcomes at individual rounds. This motivates algorithms that control the realized cost signal itself at each time step, rather than only its expectation. With this motivation, we consider the following question.
To achieve this objective, we propose a UCB-like algorithm termed High Probability Constrained UCB. Our method is based on the Optimism in the Face of Uncertainty (OFUL) principle [3, 1] and does not require prior knowledge of an initial safe action, in contrast to several existing approaches [28]. The algorithm applies in both stochastic and adversarial contextual settings, under the standard assumption of sub-Gaussian noise for both reward and cost signals. Under this assumption, we construct a high-probability constraint event that ensures the realized cost remains below the safety threshold at every round.
We show that the proposed algorithm achieves a T-round regret bound of order , which is minimax optimal in its dependence on both the dimension d and the time horizon T for linear bandits [19]. In addition, we empirically validate the performance of our approach on both synthetic and real-world datasets. Finally, we extend our analysis to settings with non-linear reward and cost functions, characterizing the regret in terms of the eluder dimension [31], a complexity measure for general function classes.
The main contributions of this work are as follows:
-
We introduce a safety framework for reward-cost constrained bandits in a heteroscedastic setting with one-dimensional continuous actions.
-
We derive algorithms with tight regret guarantees for both linear and non-linear reward and cost models.
-
We validate our method on both synthetic and real-world datasets, showing the importance of high-probability realized-cost guarantees in heteroscedastic settings.
2 Model and Problem Formulation
Notation. We use the following notation throughout the paper. For vectors , we write and for the standard and weighted inner products, respectively, where is positive definite. Similarly, we define and as the and weighted norms of . We denote the indicator function by . Upper-case letters denote random variables, e.g., , and lower-case letters denote their realizations, e.g., . We write . Finally, denotes big- notation up to logarithmic factors.
Inspired by bandit algorithms for adaptive dosage allocation [23, 21, 4], we consider the following formulation of actions, rewards, and costs. At each round , the learner observes a -dimensional context vector , which may represent structured measurements, such as medical test results, or an embedding of unstructured information, such as text descriptions generated by a language model [6]. We impose no distributional assumptions on ; the contexts may be generated either stochastically or adversarially. The learner then selects a one-dimensional continuous action [22], which can be viewed as a continuous generalization of a finite set of dosage levels. The environment generates reward and cost signals according to
where and are sub-Gaussian noise terms, and and denote the underlying reward and cost functions. The function is known and strictly increasing, with and . In dosage applications, can be interpreted as a covariate-independent dose-response curve, such as a population-level efficacy or toxicity profile that can be estimated from prior studies. The normalization is without loss of generality, since any constant scale can be absorbed into the reward and cost functions. This formulation allows for nearly flat regions that model saturation or diminishing returns, while preserving invertibility. In dosage-like applications, efficacy and toxicity are commonly assumed to increase with the dosage level; see [4, 21, 20] and references therein. In the linear setting, we assume and for unknown parameters . In more general settings, we require only that and are bounded. The interaction protocol is summarized in Figure 1.
To illustrate the linear case, consider a medical treatment scenario in which the context represents a patient feature vector encoding medical attributes such as blood pressure, oxygen saturation, or laboratory test results. In this model, there exist unknown parameters such that
The vector characterizes how patient-specific features influence treatment efficacy: a positive inner product indicates high expected benefit from treatment. Similarly, the vector captures how the same features relate to adverse effects or toxicity, with larger values of indicating increased risk of side effects. The noise terms and represent stochastic variability not captured by the linear model, such as unobserved physiological factors or measurement errors.
The action represents the administered dosage level. Through the known response function , the dosage scales both the reward and cost signals, allowing the learner to trade off efficacy against toxicity. For instance, a patient with elevated inflammatory markers, corresponding to a high value of , may benefit substantially from treatment. However, if the same patient exhibits impaired kidney function, corresponding to a high value of , a reduced dosage may be preferable to
A natural extension is to allow distinct dosage-response functions for the reward and cost, denoted by and , respectively. While this extension is practically relevant, it introduces no additional theoretical difficulty, so we use a common function to simplify the notation.
Safe Bandit protocol
Input: Horizon T
For rounds :
Figure 1: Safe Bandit protocol.
mitigate adverse outcomes. This formulation is consistent with standard monotonicity assumptions on efficacy-toxicity dose-response curves [37, 20], whereby increasing the dose tends to increase both therapeutic and toxic effects.
The same action-dependent scaling also makes the model heteroscedastic. Indeed, the variability of the observed reward and cost depends on the selected dosage through . This captures the fact that aggressive treatments may lead to less predictable responses [30]. In this sense, the model allows for stochastic departures from deterministic monotonicity, such as saturation or instability in biological responses.
As a result, the learner must select actions not only to maximize expected cumulative reward, but also to control the variability induced by the treatment. Our model belongs to the broader class of heteroscedastic bandits [41, 26, 39, 14], in which the noise distribution may depend on both the current context and the chosen action. In more general formulations, the noise variance or sub-Gaussian parameter may scale as a quadratic form , where denotes a joint context–action embedding and is an unknown positive definite matrix. While our model adopts a simpler structure, it captures monotone dose-response behavior commonly observed in reward–cost systems and remains interpretable, a property that is particularly valuable in medical decision-making contexts.
2.1 Assumptions
Before presenting our analysis and results, we state the assumptions used throughout the paper. These assumptions are standard in the literature on constrained contextual bandits; see [15, 28, 24] and references therein.
Assumption 2.1 (Sub-Gaussian noise). For all , the reward and cost noise random variables and are conditionally sub-Gaussian. That is, for all , there exist constants such that
where . is the filtration containing the history up to the end of round .
Assumption 2.2 (Bounded parameters). There exists a known constant such that and .
Assumption 2.3 (Bounded contexts). The -norms of all contexts are bounded by a known constant , i.e.,
Assumption 2.4 (Positive toxicity threshold). The toxicity threshold satisfies .
2.2 Constraint Formulation
The learner's goal is to maximize expected cumulative reward over T rounds,
while ensuring that the realized cost remains below a known safety threshold with high probability. Our algorithm takes as input a confidence level , which controls the probability of violating the constraint due to stochastic fluctuations in the cost signal. Thus, unlike formulations that constrain only the expected cost, our safety requirement depends explicitly on the tail behavior of the realized cost.
If the noise distribution were fully known, for instance Gaussian with known variance, one could potentially enforce the constraint directly using the corresponding quantiles. In our setting, however, the noise distribution is unknown and we assume only a sub-Gaussian upper bound. We therefore rely on distribution-free high-probability bounds and formulate the following sufficient condition.
Lemma 1. If the selected action satisfies
then .
The proof is provided in Section A.1 and follows directly from a concentration inequality for sub-Gaussian random variables; see [19], Chapter 5, or [34], Chapter 2.
The key difference from standard expected-cost formulations is conceptual rather than merely algebraic: the constraint is imposed on the realized cost, and the confidence parameter specifies the tolerated probability of an unsafe realization. In our action-scaled heteroscedastic model, the selected action controls both the mean cost and the magnitude of the cost fluctuations, making this realized-cost requirement a meaningful decision constraint.
Accordingly, we define the feasible action set at round t as
Any action ensures that .
Given the feasible action set, let
denote an optimal feasible action at round We measure the learner’s performance through the T-round constrained pseudo-regret
Our algorithm guarantees that the selected action belongs to an estimated subset of with probability at least , where is the confidence level associated with estimating . We keep
In prior work on contextual bandits with stage-wise safety constraints [28, 2], the learner’s performance is typically measured relative to the optimal safe action. This choice of comparator reflects the requirement that the safety constraint be satisfied at every round with high probability; accordingly, the resulting regret guarantees are also stated with high probability.
and separate to distinguish two sources of uncertainty: the randomness of the realized cost, governed by the noise , and the statistical uncertainty in the estimate of , governed by the observed history . One may combine these events by a union bound, but we state them separately to make the two roles explicit.
We now address safety in the initial round, where no observations are available to estimate or . In contrast to prior work [28, 24], our model does not require prior knowledge of an initially safe action. Because and , the zero action is always safe. Moreover, using the boundedness assumptions on and , we can characterize a nontrivial initial safe interval. Specifically, since by Cauchy–Schwarz, any action satisfying
is safe. Equivalently, since g is strictly increasing, an initial safe interval is given by
3 Proposed Algorithm
Our algorithm follows the principle of optimism in the face of uncertainty for the reward signal, while using pessimistic estimates for the cost signal. This asymmetric treatment encourages exploration for reward maximization while maintaining conservative estimates of the safe action set.
At each round, we construct two regularized least-squares estimators, one for and one for . For a regularization parameter , define the regularized covariance matrix at round as
Our theoretical analysis holds for any fixed constant ; in our experiments, we set . Using Equation (6), we define
Since
the transformed observations follow the standard linear regression model whenever . Rounds with provide no information about the unknown parameters and are therefore excluded.
To construct a UCB-style algorithm, we define high-probability confidence sets centered at and . These sets bound the estimation error with respect to the true parameters and and follow from standard self-normalized concentration inequalities. Let
denote the number of informative samples collected before round t.
Theorem 1 (Theorem 2 in 1). For fixed , define
Then, with probability at least ,
We use Theorem 1 to define the confidence ellipsoids
(8)
When clear from context, we omit the dependence of and on and . By a union bound, the events and hold with probability at least .
We choose an optimistic estimate of the reward parameter by solving
This is a linear optimization problem over an ellipsoid and admits a closed-form solution from the KKT conditions [10]; see Section C for details.
For the cost parameter, we take the opposite approach. We select a pessimistic estimate that yields a conservative estimate of the feasible action set. Since the feasible set is an interval in , this amounts to choosing the parameter in the confidence set that makes the upper endpoint of the safe interval as small as possible. This optimistic–pessimistic principle underlies Algorithm 1.
We have stated the algorithm using the sub-Gaussian parameters and . If these parameters are unknown, they can be replaced by valid upper confidence estimates or upper bounds using standard techniques. In particular, the confidence intervals of [17] can be incorporated without changing the structure of the algorithm. Moreover, when reward and cost observations are almost surely bounded, a sub-Gaussian upper bound follows directly from standard concentration results [34].
Algorithm 1 High Probability Constrained UCB
Require: Constraint threshold , safety parameter , confidence parameter , sub-Gaussianity constants
1:
2: Select action and store
3: for do
4: Compute according to (7).
5: Use to solve (10) and compute using (12).
6: Use to solve (9) and compute .
7: Compute .
8: Select action .
9: if then
10: Store .
11: end if
12: end for
3.1 Construction of the Estimated Feasible Set
The estimated feasible set is constructed from a pessimistic estimate of the cost parameter. First, we compute the least-squares estimator , which defines a confidence ellipsoid that contains with high probability. Among all parameters in this ellipsoid, we choose the one that makes the safe action set most conservative.
More precisely, we construct a surrogate feasible set such that
for all . We compute according to (7) and solve the following optimization problem:
The last constraint ensures that the denominator defining the safe upper endpoint is nonnegative. Let
If , let
We then define the estimated feasible set as
\hat{\mathcal{A}}_{t}^{f}(\delta)=\begin{cases}\left[0,1\right],&\text{if }\mathcal{K}\left(\hat{\mu}_{t}\right)_{t}=\emptyset,\\\left[0,g^{-1}\left(\min\left\{1,\frac{\tau}{\langle X_{t},\tilde{\mu}_{t}\rangle+\kappa_{2}\sqrt{2\log\left(\frac{1}{\delta}\right)}\right\}\right)\right],&\text{if }\mathcal{K}\left(\hat{\mu}_{t}\right)_{t}\neq\emptyset.\end{cases} \tag{12}Combining Theorem 1 with the pessimistic construction above yields the following guarantee; its proof is provided in the supplementary material.
Lemma 2. For all ,
4 The “Good Event”
A common analysis technique in multi-armed bandit algorithms is to condition on a high-probability “good event.” We define this event as the conjunction of the concentration and feasibility guarantees required by our algorithm. Specifically, let denote the intersection of the following sub-events:
• .
• .
• .
The first two events ensure that the confidence sets for and contain the true parameters, as established in Theorem 1. The third event ensures that the estimated feasible action set is contained in the true feasible action set at every round.
Lemma 3. Let . Then,
5 Regret Analysis – Linear Case
We remind the definition of the T-round constrained pseudo-regret as defined in Equation (4). In the linear setting, the expected reward obtained by action is . We therefore define
where
denotes the optimal feasible reward at round t, and
is the expected reward obtained by the algorithm.
Since is strictly increasing, the optimal feasible action depends on the sign of . If , the optimal action is the largest feasible action. If , the optimal action is . Let denote an optimal feasible action at round .
Then
(14)
We adopt a regret decomposition similar to those commonly used in the literature on constrained linear bandits [2, 27, 28]. Define the auxiliary feasible action
where is the optimistic reward parameter defined in Equation (9). Using this definition, we decompose the regret as
(16)
5.1 Analysis of the Regret
Lemma 4. For all , on the event , the first term in the regret decomposition satisfies
The proof is provided in the supplementary material. This bound is the analogue of the standard optimism argument for linear bandits [1], applied to the transformed action value . The main additional step is to control the second term, which captures the loss due to using a conservative estimate of the feasible action set.
Lemma 5. For all , on the event , the second term in the regret decomposition satisfies
By combining Lemma 4 and Lemma 5 with the regret decomposition in Equation (16), we obtain the following bound.
Theorem 2. With probability at least , the regret of the High Probability Constrained UCB algorithm satisfies
All proofs are deferred to the supplementary material. Notably, the bound does not depend on , since the benchmark is the clairvoyant policy that knows and but must satisfy the same realized-cost constraint as the learner.
6 Non-linear Rewards and Costs
We now extend the analysis beyond linear reward and cost models. Instead of assuming that the reward and cost functions are linear in unknown parameters, we consider general function classes and express the regret bound in terms of the eluder dimension [31].
At each round , the learner observes a context and selects an action . The reward and cost signals are given by
where and are the unknown mean reward and cost functions, respectively. The function classes and are known to the learner. We assume that all functions in these classes are bounded in . This relaxes the common normalization to ; the important property for the analysis is boundedness. As in the linear case, the noise variables and are conditionally sub-Gaussian.
The realized-cost feasible action set at round t is
The agent selects actions from an estimated subset of this feasible set.
For a subset , we define its width at a context as
This quantity measures the uncertainty of the function class at the current context and plays the same role as confidence widths in the linear analysis.
The T-round constrained pseudo-regret is
where
is the optimal feasible action at round t.
We define the dataset available at the beginning of round t as
Thus, whenever ,
Rounds with provide no information about the unknown functions and are excluded. For any function , let
denote the empirical norm induced by the observed contexts.
At each round, we construct least-squares estimates and over the classes and using the transformed observations in . We then define the confidence sets
For finite function classes, one may take
More generally, the regret bound below is stated in terms of the corresponding confidence radii and eluder dimensions.
To construct the estimated feasible action set, we choose the most conservative cost function in the confidence set at the current context. Specifically, we solve
If this optimization problem has no feasible solution, we set
Otherwise, let denote a solution of (22). The estimated feasible set is then
For the reward function, we use optimism and select
The action is then chosen as
Since is strictly increasing, this optimization reduces to selecting the largest action in whenever , and selecting otherwise.
Algorithm 2 Non-Linear High Probability Constrained UCB
Require: Constraint threshold , safety parameter , confidence parameter , sub-Gaussianity constants
1:
2: Select action and store
3: for do
4: Compute using least-squares estimators over and .
5: Construct and using (20).
6: Compute using (22) and (23).
7: Compute .
8: Compute
.
9: Select action .
10: if then
11: Store .
12: end if
13: end for
Let and denote the eluder dimensions of the reward and cost function classes, respectively. The following theorem gives the regret guarantee for the non-linear setting.
Theorem 3. With probability at least , the regret of the Non-Linear High Probability Constrained UCB algorithm satisfies
7 Experimental Results
We evaluate the performance of Algorithm 1 on both synthetic and real-world datasets. A natural application of our algorithm is dosage selection, where the action corresponds to the administered treatment level. However, access to large-scale medical datasets with rich patient context is limited, and we leave a thorough empirical study in clinical settings for future work. Instead, we assess the performance of our method on the NASA Li-ion Battery Aging Datasets. In this setting, we interpret the current level as the dosage, the voltage change as the reward, and the temperature as the cost.
We first report in Table 1 the violation ratio of HPUCB and compare it with a baseline algorithm that enforces the cost constraint only in expectation, as in [28]. We observe that HPUCB achieves a violation ratio of 0.02%, whereas the expected-cost baseline exhibits violation rates between 12% and 23%. Such violation rates are undesirable in safety-critical applications, where individual unsafe outcomes may be unacceptable.
We begin with synthetic experiments. We generate and by sampling from a d-dimensional standard normal distribution and normalizing them to unit norm. Contexts are generated similarly from a multivariate normal distribution and normalized. We consider dimensions and multiple threshold values , and run each configuration for rounds over 5 random seeds. In the linear case, we use the closed-form solutions derived for Equations (9) and (10), avoiding the need to solve convex programs at each round. The total running time across all seeds is below two minutes for all thresholds. All experiments were run on a MacBook Air with an Apple M3 chip and 24 GB RAM.
using the JAX framework. The dominant computational cost comes from Cholesky decompositions, which scale as . JAX substantially accelerates these linear algebra operations, especially when executed on a GPU. This becomes particularly relevant in the real-world experiment, where the feature dimension is 2048.
Table 1: Comparison of HP-UCB and On-Expectation across different values of , with confidence intervals.
| τ | HP-UCB (95% CI) | On-Expectation (95% CI) |
|---|---|---|
| 0.1 | 0.0002, [0.0001, 0.0002] | 0.2392, [0.2354, 0.2430] |
| 0.2 | 0.0002, [0.0001, 0.0002] | 0.2313, [0.2272, 0.2355] |
| 0.3 | 0.0002, [0.0001, 0.0002] | 0.2224, [0.2179, 0.2269] |
| 0.4 | 0.0002, [0.0001, 0.0002] | 0.2126, [0.2077, 0.2176] |
| 0.5 | 0.0002, [0.0001, 0.0002] | 0.2016, [0.1964, 0.2067] |
| 0.6 | 0.0002, [0.0001, 0.0002] | 0.1890, [0.1834, 0.1946] |
| 0.7 | 0.0002, [0.0001, 0.0002] | 0.1763, [0.1705, 0.1821] |
| 0.8 | 0.0002, [0.0001, 0.0002] | 0.1621, [0.1563, 0.1678] |
| 0.9 | 0.0002, [0.0001, 0.0002] | 0.1472, [0.1419, 0.1525] |
| 1.0 | 0.0002, [0.0001, 0.0002] | 0.1324, [0.1274, 0.1374] |
In Figure 2, we report representative learning curves for with threshold . We compare our algorithm with a variant of -Greedy that plays the safe action , as defined in Equation (5), with probability , and otherwise follows the policy of Algorithm 1. The main advantage of this variant is its lower computational cost, especially in higher dimensions, while still collecting approximately informative samples that help tighten its confidence intervals. Empirically, we find that provides a favorable trade-off between computational efficiency and statistical performance, achieving comparable regret while avoiding dependence on in the parameter tuning.
A direct comparison with the method of [28] is not entirely appropriate, as their algorithm enforces the cost constraint only in expectation, whereas our setting requires high-probability constraint satisfaction for the realized cost. As shown in Table 1, this difference leads to substantially higher violation rates for the expected-cost baseline.

(a)

(b)
Figure 2: Synthetic experiments comparing HPUCB and -Greedy for .
We now describe the experimental setup for the NASA Li-ion Battery Aging Datasets. The dataset contains measurements from four types of batteries (RW9, RW10, RW11, RW12) operating under both charging and discharging modes, across a range of current levels. For each cycle, the dataset records the voltage change, temperature, textual metadata describing the operating conditions, and a time series corresponding to the duration of the cycle.
To construct contextual features, we use embeddings generated by the language model Gemma [32]. At each round, the input to the language model consists of all available information from the previous five time steps, formatted as a JSON object. The resulting embedding vector has dimension 2048 and serves as the context .
To satisfy the realizability assumption and obtain ground-truth parameters and , we split the dataset into four parts and use approximately half of the data, about 100k samples with dimension , to perform a least-squares fit. The fitted parameters are then treated as the true underlying model, and we evaluate the performance of Algorithm 1 on the remaining portion of the dataset.
Due to the high dimensionality of the problem, all real-world experiments were conducted on a compute cluster equipped with an NVIDIA L40 GPU. The total running time was approximately 30 minutes for HPUCB and about two minutes for the baseline algorithm, which has access to the true reward and cost parameters. We report the cumulative regret of HPUCB and -Greedy for threshold values .
Regret -

(a)
Regret -

(b)
Figure 3: NASA Li-ion Battery Aging Dataset experiments for different safety thresholds.
Finally, we note that the guarantees of our algorithm hold for arbitrary context sequences , including both stochastic and adversarial settings. This property makes the proposed approach particularly appealing for applications such as battery charging and control problems, where an explicit dynamical model of the system may be unavailable or difficult to specify. In such scenarios, our algorithm provides a principled way to perform safe decision-making directly from observed data.
8 Conclusions
We studied contextual bandits with continuous actions under stage-wise high-probability constraints on the realized cost, motivated by applications in which the variability of the outcome depends on the selected action. We introduced an optimistic–pessimistic algorithm that balances reward exploration with conservative estimation of the feasible action set, and established regret guarantees for both linear and general reward–cost models. Our experimental results further illustrate the importance of accounting for heteroscedasticity when safety is imposed on realized, rather than expected, costs.
Several directions remain open. An important extension is to consider more general forms of heteroscedasticity beyond the action-scaled structure studied here, as well as Bayesian approaches to the same realized-cost constrained problem. Another promising direction is a more extensive empirical evaluation in safety-critical real-world applications, particularly adaptive clinical dosage selection.
References
[1] 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. 2, 7, and 10
[2] Sanae Amani, Mahnoosh Alizadeh, and Christos Thrampoulidis. Linear stochastic bandits under safety constraints. Advances in Neural Information Processing Systems, 32, 2019. 1, 2, 5, and 10
[3] Peter Auer. Using confidence bounds for exploitation-exploration trade-offs. Journal of Machine Learning Research, 3(Nov):397–422, 2002. 1 and 2
[4] Maryam Aziz, Emilie Kaufmann, and Marie-Karelle Riviere. On multi-armed bandit designs for dose-finding trials. Journal of Machine Learning Research, 22(14):1–38, 2021. 1 and 3
[5] Ashwinkumar Badanidiyuru, Robert Kleinberg, and Aleksandrs Slivkins. Bandits with knapsacks. Journal of the ACM (JACM), 65(3):1–55, 2018. 1
[6] Ali Baheri and Cecilia O Alm. Llms-augmented contextual bandit. arXiv preprint arXiv:2311.02268, 2023. 3
[7] Hamsa Bastani and Mohsen Bayati. Online decision making with high-dimensional covariates. Operations Research, 68(1):276–294, 2020. 1
[8] Djallel Bouneffouf and Raphaël Féraud. A tutorial on multi-armed bandit applications for large language models. In Proceedings of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pages 6412–6413, 2024. 1
[9] Djallel Bouneffouf and Irina Rish. A survey on practical applications of multi-armed and contextual bandits. arXiv preprint arXiv:1904.10040, 2019. 1
[10] Stephen P Boyd and Lieven Vandenberghe. Convex optimization. Cambridge university press, 2004. 7 and 22
[11] Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. Advances in neural information processing systems, 30, 2017. 1
[12] Josef Dai, Xuehai Pan, Ruiyang Sun, Jiaming Ji, Xinbo Xu, Mickel Liu, Yizhou Wang, and Yaodong Yang. Safe rlhf: Safe reinforcement learning from human feedback. arXiv preprint arXiv:2310.12773, 2023. 1
[13] Dylan J Foster and Alexander Rakhlin. Foundations of reinforcement learning and interactive decision making. arXiv preprint arXiv:2312.16730, 2023. 1
[14] Ping-Chun Hsieh, Xi Liu, Anirban Bhattacharya, and PR Kumar. Stay with me: Lifetime maximization through heteroscedastic linear bandits with reneging. In International Conference on Machine Learning, pages 2800–2809. PMLR, 2019. 4
[15] Spencer Hutchinson, Berkay Turan, and Mahnoosh Alizadeh. Directional optimism for safe linear bandits. In International Conference on Artificial Intelligence and Statistics, pages 658–666. PMLR, 2024. 2 and 4
[16] Matthew Joseph, Michael Kearns, Jamie H Morgenstern, and Aaron Roth. Fairness in learning: Classic and contextual bandits. Advances in neural information processing systems, 29, 2016. 1
[17] Kwang-Sung Jun and Jungtaek Kim. Noise-adaptive confidence sets for linear bandits and application to bayesian optimization. arXiv preprint arXiv:2402.07341, 2024. 7
[18] Emmanuel Dodzi Kpeglo, Michael Jackson Adjabui, and Jakperik Dioggban. Identification of minimum effective dose based on ratio of a normally distributed data under heteroscedasticity. Afrika Statistika, 16(2):2719–2731, 2021. 2
[19] Tor Lattimore and Csaba Szepesvári. Bandit algorithms. Cambridge University Press, 2020. 1, 2, 5, and 20
[20] Christophe Le Tourneau, J Jack Lee, and Lillian L Siu. Dose escalation methods in phase i cancer clinical trials. JNCI: Journal of the National Cancer Institute, 101(10):708–720, 2009. 3 and 4
[21] Hyun-Suk Lee, Cong Shen, James Jordon, and Mihaela Schaar. Contextual constrained learning for dose-finding clinical trials. In International Conference on Artificial Intelligence and Statistics, pages 2645–2654. PMLR, 2020. 1 and 3
[22] Maryam Majzoubi, Chicheng Zhang, Rajan Chari, Akshay Krishnamurthy, John Langford, and Aleksandrs Slivkins. Efficient contextual bandits with continuous actions. Advances in Neural Information Processing Systems, 33:349–360, 2020. 2 and 3
[23] Kentaro Matsuura, Junya Honda, Imad El Hanafi, Takashi Sozu, and Kentaro Sakamaki. Optimal adaptive allocation using deep reinforcement learning in a dose-response study. Statistics in Medicine, 41(7):1157–1171, 2022. 1 and 3
[24] Ahmadreza Moradipari, Sanae Amani, Mahnoosh Alizadeh, and Christos Thrampoulidis. Safe linear thompson sampling. arXiv preprint arXiv:1911.02156, 2019. 2, 4, and 6
[25] Jonas W Mueller, Vasilis Syrgkanis, and Matt Taddy. Low-rank bandit methods for high-dimensional dynamic pricing. Advances in Neural Information Processing Systems, 32, 2019. 1
[26] Subhojyoti Mukherjee, Qiaomin Xie, Josiah P Hanna, and Robert Nowak. Speed: Experimental design for policy evaluation in linear heteroscedastic bandits. In International Conference on Artificial Intelligence and Statistics, pages 2962–2970. PMLR, 2024. 4
[27] Aldo Pacchiano, Mohammad Ghavamzadeh, Peter Bartlett, and Heinrich Jiang. Stochastic bandits with linear constraints. In International conference on artificial intelligence and statistics, pages 2827–2835. PMLR, 2021. 1 and 10
[28] Aldo Pacchiano, Mohammad Ghavamzadeh, and Peter Bartlett. Contextual bandits with stage-wise constraints. arXiv preprint arXiv:2401.08016, 2024. 1, 2, 4, 5, 6, 10, 13, and 14
[29] Ariel D Procaccia, Benjamin Schiffer, and Shirley Zhang. Honor among bandits: No-regret learning for online fair division. arXiv preprint arXiv:2407.01795, 2024. 1
[30] Michael D Rawlins. Variability in response to drugs. Br Med J, 4(5936):91–94, 1974. 4
[31] Daniel Russo and Benjamin Van Roy. Eluder dimension and the sample complexity of optimistic exploration. Advances in Neural Information Processing Systems, 26, 2013. 2 and 10
[32] Gemma Team, Thomas Mesnard, Cassidy Hardin, Robert Dadashi, Surya Bhupatiraju, Shreya Pathak, Laurent Sifre, Morgane Rivière, Mihir Sanjay Kale, Juliette Love, et al. Gemma: Open models based on gemini research and technology. arXiv preprint arXiv:2403.08295, 2024. 15
[33] William R Thompson. On the likelihood that one unknown probability exceeds another in view of the evidence of two samples. Biometrika, 25(3-4):285–294, 1933. 1
[34] Roman Vershynin. High-dimensional probability: An introduction with applications in data science, volume 47. Cambridge university press, 2018. 5 and 7
[35] Sofia S Villar, Jack Bowden, and James Wason. Multi-armed bandit models for the optimal design of clinical trials: benefits and challenges. Statistical science: a review journal of the Institute of Mathematical Statistics, 30(2):199, 2015. 1
[36] Akifumi Wachi and Yanan Sui. Safe reinforcement learning in constrained markov decision processes. In International Conference on Machine Learning, pages 9797–9806. PMLR, 2020. 1
[37] Nolan A Wages, Mark R Conaway, and John O'Quigley. Dose-finding design for multi-drug combinations. Clinical Trials, 8(4):380–389, 2011. 4
[38] Hao Wang, Yifei Ma, Hao Ding, and Yuyang Wang. Context uncertainty in contextual bandits with applications to recommender systems. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pages 8539–8547, 2022. 1
[39] Justin Weltz, Tanner Fiez, Alexander Volfovsky, Eric Laber, Blake Mason, Lalit Jain, et al. Experimental designs for heteroskedastic variance. Advances in Neural Information Processing Systems, 36:65967–66005, 2023. 4
[40] Tengyang Xie, Dylan J Foster, Akshay Krishnamurthy, Corby Rosset, Ahmed Awadallah, and Alexander Rakhlin. Exploratory preference optimization: Harnessing implicit q*-approximation for sample-efficient rlhf. arXiv preprint arXiv:2405.21046, 2024. 1
[41] Ruitu Xu, Yifei Min, and Tianhao Wang. Noise-adaptive thompson sampling for linear contextual bandits. Advances in Neural Information Processing Systems, 36:23630–23657, 2023. 4
Appendix
Contents
1 Introduction 1
2 Model and Problem Formulation 3
2.1 Assumptions 4
2.2 Constraint Formulation 5
3 Proposed Algorithm 6
3.1 Construction of the Estimated Feasible Set 8
4 The “Good Event” 9
5 Regret Analysis – Linear Case 9
5.1 Analysis of the Regret 10
6 Non-linear Rewards and Costs 10
7 Experimental Results 13
8 Conclusions 15
Supplementary Material 19
A Constraint Formulation 20
A.1 Proof of Lemma 1 20
A.2 Proof of Lemma 2 20
B Good Event 21
B.1 Proof of Lemma 3 21
C Analytical Solutions to Equations (9) and (10) 22
D Regret Analysis – Linear Case 23
D.1 Proof of Lemma 4 23
D.2 Proof of Lemma 5 24
D.3 Proof of Theorem 2 25
E Non-linear Rewards and Costs 26
E.1 Concentration for Non-linear Least Squares 26
E.2 Non-linear Regret Analysis 28
E.3 Proof of Theorem 3 30
A Constraint Formulation
A.1 Proof of Lemma 1
By Assumption 2.1, the cost noise is conditionally -sub-Gaussian given the history . Let . If , then , and since the constraint is satisfied trivially. We therefore consider the case .
Theorem 4 (Sub-Gaussian concentration bounds – Theorem 5.3 in [19]). If X is -sub-Gaussian, then for any ,
Lemma 1. If the selected action satisfies
then .
Proof. Since
we have
Thus, conditional on ,
where the last step follows from Theorem 4. Therefore, it is sufficient to require
which is equivalent to
Under this condition, .
A.2 Proof of Lemma 2
Lemma 2. For all ,
Proof. Let
On the event , which holds with probability at least by Theorem 1, we show that
We consider two cases.
Case 1: . Since , the only way the feasible set of Equation (10) can be empty is if
Then for every ,
Hence . By construction, as well, so the inclusion holds.
Case 2: . Let be the solution of Equation (10). If , then again , and the inclusion is immediate.
It remains to consider the case . Since and maximizes over , we have
and therefore
Now take any . By definition,
Since and , it follows that
Thus . Therefore,
Conditioning on gives the desired probability bound.
B Good Event
B.1 Proof of Lemma 3
Lemma 3. Let . Then,
Proof. We prove that each component of the good event holds with probability at least , and then apply a union bound. By Theorem 1,
Moreover, Lemma 2 gives
Therefore,
as claimed.
C Analytical Solutions to Equations (9) and (10)
In this section, we derive closed-form solutions to Equations (9) and (10) in the linear case using the Karush–Kuhn–Tucker (KKT) conditions [10]. This avoids solving a convex program at each round and substantially reduces the computational cost of the algorithm.
Lemma 6 (Linear maximization over an ellipsoid). Let with , let be symmetric positive definite, and let . Consider
Then the unique optimal solution is
and the optimal value is
Proof. Since , the feasible set is nonempty, compact, and convex. The objective is continuous and linear, so an optimum exists. The KKT conditions are necessary and sufficient because Slater's condition holds. The Lagrangian is
Stationarity gives
Since , the optimum lies on the boundary, so . Substituting the expression for gives
Thus
Substituting back yields
The optimal value follows immediately. Uniqueness follows from strict convexity of the ellipsoid boundary in the direction of the nonzero linear functional.
Proposition 1 (Closed form for ). The solution of Equation (9) is uniquely given by
Moreover,
Proof. Apply Lemma 6 with and .
Proposition 2 (Closed form for ). The solution of
is uniquely given by
Moreover,
Proof. Apply Lemma 6 with and .
Lemma 7 (Feasibility of the pessimistic cost program). Let
and define
Consider
Let
Then the program is infeasible if and only if . If , then the unconstrained maximizer over is feasible and is also the optimizer of the constrained problem.
Proof. If , then for every ,
Thus the constraint cannot be satisfied, and the program is infeasible.
If , then the unconstrained maximizer satisfies the additional constraint. Since it already maximizes over the larger set , it also maximizes the same objective over the constrained feasible subset.
D Regret Analysis – Linear Case
As shown in Section 5, we decompose the regret into two terms: the cost of estimating and the cost of estimating . We now bound these terms in terms of the problem parameters.
D.1 Proof of Lemma 4
Lemma 4. For all , on the event , the first term in the regret decomposition satisfies
Proof. Condition on the event , so that for all . Since , we have
Therefore,
D.2 Proof of Lemma 5
Lemma 5. For all , on the event , the second term in the regret decomposition satisfies
Proof. Let
On the event , the pessimistic construction gives
whenever . If , then the true feasible set is all of .
Since g is strictly increasing, maximizing
over an interval is equivalent to choosing the largest feasible action when , and choosing otherwise. If , then both and are zero, and the claim is immediate.
Assume now that . Define the effective actions
The true and estimated feasible sets in the effective action variable are intervals with upper endpoints
and
Thus,
We claim that
If , then . If , the claim is trivial. Otherwise, , which implies . Then
where we used and .
If , then by pessimism . If either upper endpoint equals 1, the desired inequality is immediate. Otherwise,
In this subcase both upper endpoints are strictly below 1, hence and . Therefore,
Combining the cases gives
By Cauchy–Schwarz and Assumptions 2.2 and 2.3,
Thus,
D.3 Proof of Theorem 2
As usual in linear bandit analysis, we use the elliptic potential lemma. The only difference is that our algorithm collects informative samples only in rounds for which . Since the number of such rounds is at most , the standard bound applies.
Lemma 8 (Elliptic potential lemma). Let be the contexts collected by Algorithm 1 in rounds with . For any regularization parameter ,
By Cauchy–Schwarz,
Theorem 2. With probability at least , the regret of the High Probability Constrained UCB algorithm satisfies
Proof. On the good event,
In the third inequality, we used and the fact that both and lie in their corresponding confidence sets.
E Non-linear Rewards and Costs
E.1 Concentration for Non-linear Least Squares
For the non-linear case, define the informative set
The least-squares estimators are
and
Whenever ,
Thus, after normalization by , the regression observations have the same conditionally sub-Gaussian noise as in the original model.
For any function , define
The confidence sets are
For finite function classes, we take
Lemma 9. For any sequence of real-valued random variables adapted to a filtration , it holds with probability at least that, for all ,
where .
Proof. Define
Then is a nonnegative martingale with . Ville's inequality gives
Taking logarithms and complements yields the claim.
Proposition 3. For any fixed , with probability at least , for all and all ,
Similarly, with probability at least , for all and all ,
Proof. Fix and apply Lemma 9 with
By conditional sub-Gaussianity,
Thus, for this fixed , the desired inequality holds with probability at least . A union bound over gives the stated reward result. The cost result is identical, replacing by and by .
Lemma 10 (Concentration for non-linear rewards and costs). Let . With probability at least , for all ,
Proof. We prove the reward statement; the cost statement is identical. By the definition of as a least-squares estimator,
Since
this implies
Applying Proposition 3 with and choosing yields
Thus . The same argument gives . A union bound gives probability at least .
E.2 Non-linear Regret Analysis
Define the nonlinear good event
By the preceding concentration result and the same feasible-set argument as in Lemma 2,
For a subset , recall the confidence width
Lemma 11. Under the nonlinear good event ,
Proof. For each , since and ,
Therefore,
Since and both ,
Summing over t proves the claim.
Lemma 12. Under the nonlinear good event ,
Proof. Fix a round t and define
By construction of the pessimistic cost estimate and on the good event,
whenever .
If the optimistic reward estimate at is negative, then both and are zero, and the contribution to regret is nonpositive. We therefore consider the case where the optimistic reward estimate is nonnegative. Since is strictly increasing, the selected actions correspond to the largest feasible effective actions.
Let
The true and estimated safe effective-action upper endpoints are
and
Thus,
The same endpoint calculation as in Lemma 5 gives
Since by boundedness,
Finally, both and belong to on the good event, so
Summing over t gives the result.
Lemma 13 (Eluder-dimension width bound). Let be a function class with eluder dimension , and let be confidence sets with radius . Then
E.3 Proof of Theorem 3
Theorem 3. With probability at least the regret of the Non-Linear High Probability Constrained UCB algorithm satisfies
Proof. Using Lemmas 11 and 12, we have
Applying Lemma 13 to the reward and cost confidence classes gives
and
Therefore,