Safe Linear Thompson Sampling

Ahmadreza Moradipari, Sanae Amani, Mahnoosh Alizadeh, Christos ThrampoulidisarXiv 2019

Abstract

The design and performance analysis of bandit algorithms in the presence of stage-wise safety or reliability constraints has recently garnered significant interest. In this work, we consider the linear stochastic bandit problem under additional linear safety constraints that need to be satisfied at each round. We provide a new safe algorithm based on linear Thompson Sampling (TS) for this problem and show a frequentist regret of order $\mathcal{O} (d^{3/2}\log^{1/2}d \cdot T^{1/2}\log^{3/2}T)$, which remarkably matches the results provided by (Abeille et al., 2017) for the standard linear TS algorithm in the absence of safety constraints. We compare the performance of our algorithm with UCB-based safe algorithms and highlight how the inherently randomized nature of TS leads to a superior performance in expanding the set of safe actions the algorithm has access to at each round.

Introduction

Standard stochastic bandit algorithms are designed to maximize cumulative reward by balancing exploration and exploitation. However, these frameworks typically assume that any action in the decision space can be played at any time. In real-world, safety-critical systems—such as medical trials, autonomous robotics, or power grid management—certain actions can lead to catastrophic failures. In these environments, the learner must optimize its actions while strictly adhering to unknown safety constraints at every single round.

Because the true safety boundaries are unknown, the agent must act conservatively within a known "safe seed" set. This introduces a complex exploration-exploitation-safety tradeoff: if the algorithm is too conservative, it will never explore the boundaries of the safe set to find the optimal action; if it explores too aggressively, it violates the safety constraint. This paper introduces Safe-LTS, the first Thompson Sampling algorithm for linear bandits that guarantees stage-wise safety while achieving optimal regret.

Problem Setting and Safety Constraints

In this setting, the environment is characterized by a linear reward function parameterized by an unknown vector $\theta_*$ and a linear safety constraint parameterized by an unknown vector $\mu_*$. At each time step $t$, the algorithm chooses an action $x_t$. The safety requirement dictates that the action must satisfy a linear constraint (e.g., $x_t^\top \mu_* \le C$) for some threshold $C$.

To navigate this, the algorithm receives side information in the form of noisy measurements of the safety parameter $\mu_*$. The core challenge is that the algorithm only knows an initial "safe seed" and must expand its knowledge of the safe region without ever stepping outside the true (but unknown) safety boundaries.

The Safe-LTS Algorithm

The proposed Safe Linear Thompson Sampling (Safe-LTS) algorithm operates through three primary mechanisms:

  1. Conservative Safe Set Construction: Using the side information and observations, the algorithm builds a confidence ellipsoid around the unknown safety parameter $\mu_*$. It then constructs an inner approximation of the true safe set. By selecting actions only from this restricted, provably safe subset, the algorithm ensures stage-wise safety with high probability.
  2. Modified Thompson Sampling: Standard Thompson Sampling (TS) samples a reward parameter from a posterior distribution and plays the optimal action for that sample. However, because Safe-LTS restricts actions to the inner safe set, standard TS might fail to be "optimistic" enough to drive the exploration of the safety boundaries.
  3. Inflated Anti-Concentration: To ensure the algorithm explores the safe set boundaries effectively, the authors modify the TS perturbation distribution. They require the sampled parameter to have a stronger anti-concentration property, achieved by injecting a specific amount of extra variance into the sampled parameters. This ensures the algorithm samples highly optimistic parameters frequently enough to push against the boundaries of the estimated safe set, driving its expansion naturally.

Key Insights

Randomness as an Engine for Exploration

One of the most significant findings is that the inherent randomness of Thompson Sampling is sufficient to drive safe set expansion. While UCB-based safe algorithms (like Safe-LUCB) often require a forced, "pure-exploration" initialization phase to expand the safe set before optimization can begin, Safe-LTS expands the safe set on the fly.

No Asymptotic Penalty for Safety

Remarkably, the theoretical frequentist regret bound of Safe-LTS is $\mathcal{O}(d^{3/2} \log^{1/2} d \cdot T^{1/2} \log^{3/2} T)$. This matches the state-of-the-art bounds for standard linear TS without safety constraints. This suggests that the cost of adhering to strict safety constraints only impacts the constant factors of the regret, rather than the asymptotic scaling with respect to time ($T$).

Empirical Performance

In synthetic experiments, Safe-LTS consistently outperforms "Naive Safe-LUCB" variants. UCB-based methods often suffer from linear regret by getting stuck in suboptimal safe regions because they lack the randomized mechanism to push the boundaries of the safe set without explicit exploration phases. Safe-LTS demonstrates superior robustness across various randomly generated problem instances without requiring complex hyperparameter tuning.

Limitations and Future Work

While Safe-LTS provides strong theoretical and empirical results, it currently relies on a conservative noise injection required by the mathematical proof. In practice, applying this inflated variance at all rounds is overly aggressive once the safe set is well-explored. The authors have proposed a heuristic "dynamic noise distribution" that decays the extra variance over time, which shows improved empirical performance. Future work remains to formally analyze this dynamic approach and to extend these TS-based safety mechanisms to non-linear constraints, such as those modeled by Gaussian Processes.

Summary updated

BibTeX
@misc{moradipari2019safe,
  author = {Ahmadreza Moradipari and Sanae Amani and Mahnoosh Alizadeh and Christos Thrampoulidis},
  title = {{Safe Linear Thompson Sampling}},
  year = {2019},
  eprint = {1911.02156},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1911.02156},
}
Figure