Manuscript Offprint

arXiv:2608.26755

Safety by Design: Realized-Cost Constraints for Contextual Bandits with Continuous Actions

Spyros Dragazis, Aldo Pacchiano

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 O~(dT)\tilde{\mathcal{O}}(d\sqrt{T}) 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 τ\tau, 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 tt, the selected action generates both a reward signal rt∈Rr_t \in \mathbb{R} and a cost signal ct∈Rc_t \in \mathbb{R}. The objective is to maximize expected cumulative reward while ensuring that the expected cost remains below a known safety threshold τ\tau 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.

References (37)