Infinite Time Horizon Safety of Bayesian Neural Networks

Mathias Lechner, Dorde Zikelic, Krishnendu Chatterjee, Thomas A. Henzinger

Introduction

Bayesian Neural Networks (BNNs) have emerged as a powerful tool for safety-critical applications, such as autonomous driving and medical robotics, due to their inherent ability to model uncertainty. Unlike deterministic networks, BNNs provide a distribution over predictions, allowing systems to "know what they don't know." However, a significant theoretical hurdle prevents their widespread deployment in high-stakes environments: BNNs are typically unsafe by default.

This safety gap arises from the standard use of weight priors with unbounded support, such as Gaussian distributions. Because these distributions extend to infinity, there is always a non-zero probability of sampling extreme weights that could lead to catastrophic system failure. While existing verification methods offer statistical guarantees (e.g., 99.9% safety), they often fail to address the infinite-time horizon—the requirement that a system remains safe forever, not just for a few seconds of simulation.

Guaranteeing Safety via Rejection Sampling

To address the risk posed by the "tails" of weight distributions, this research proposes a method to achieve sure safety (100% guarantee) over an infinite time horizon. The core idea is to identify a safe weight set—a bounded hyperrectangle centered around the BNN's mean weights.

By restricting the BNN to sample only from this verified set during deployment—a process known as rejection sampling—the system can eliminate the possibility of executing dangerous actions caused by outlier weights. This approach allows the system to retain the benefits of uncertainty modeling within a controlled, safe regime.

The top row illustrates how standard BNNs can sample weights from the tails of a distribution, leading to an unsafe posterior. The bottom row shows how restricting weights to a "safe set" (green) and using rejection sampling ensures the posterior remains within safe bounds.

Methodology: The CEGIS Framework

Proving that a specific weight set is safe for all time requires more than simple testing; it requires formal verification. The authors utilize a Counterexample-Guided Inductive Synthesis (CEGIS) loop to find and verify a "safe positive invariant." In control theory, an invariant is a region of the state space that the system, once inside, can never leave. If this region excludes all unsafe states, the system is guaranteed safe forever.

The framework consists of three main components:

  1. The Learner: A deterministic neural network trained to represent the boundary of the safe invariant region.
  2. The Verifier: A formal constraint solver (using Mixed-Integer Linear Programming or Satisfiability Modulo Theories) that mathematically checks if the learned boundary holds for every possible weight combination within the safe set.
  3. The Loop: If the verifier finds a state where the system could escape the safe region, it generates a counterexample. This data point is used to retrain the learner, refining the invariant until the verifier can provide a formal proof of safety.

Experimental Evaluation

The proposed method was evaluated on three distinct dynamical systems designed to test different aspects of control:

  • Unstable Linear Dynamical System (LDS): A baseline stabilization task.
  • Inverted Pendulum: A non-linear control problem modified for compatibility with formal solvers.
  • Collision Avoidance: A complex scenario where an agent must avoid a moving intruder, requiring a non-stabilizing safety specification.

Key Results

The algorithm successfully identified and verified safe weight sets for all benchmarks. Notably, the method was able to verify weight bounds extending 1.5σ to 2σ (standard deviations) from the mean. This indicates that the BNN can still exhibit significant variance and capture meaningful uncertainty while remaining strictly safe.

Ablation studies highlighted the necessity of the CEGIS loop; without the feedback of counterexamples from the formal verifier, the learner failed to find valid invariants for the more complex Pendulum and Collision Avoidance tasks. Furthermore, the researchers found that bootstrapping the initial training with Monte-Carlo simulations significantly improved computational efficiency, reducing verification time on the Pendulum task by nearly 50%.

Limitations and Future Directions

While this work provides a rigorous foundation for BNN safety, several challenges remain. The current use of hyperrectangles for safe weight sets is relatively restrictive; future research may explore more flexible geometric shapes to capture larger portions of the weight distribution. Additionally, scaling formal verification to high-dimensional deep networks remains a significant computational hurdle. Finally, extending these proofs to environments with stochastic (random) dynamics will be essential for real-world deployment in unpredictable settings.

Summary updated

BibTeX
@inproceedings{lechner2021infinite,
  author = {Mathias Lechner and Dorde Zikelic and Krishnendu Chatterjee and Thomas A. Henzinger},
  title = {{Infinite Time Horizon Safety of Bayesian Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=mvcIGGWXPOV},
}
Figure