Can a Bayesian Oracle Prevent Harm from an Agent?

Yoshua Bengio, Michael K. Cohen, Nikolay Malkin, Matt MacDermott, Damiano Fornasiere, Pietro Greiner, Younesse Kaddar

Abstract

This paper introduces a "safe-by-design" framework for AI agents using Bayesian inference to construct run-time guardrails. By maintaining a posterior distribution over world models and identifying a "plausible set" of theories, the proposed Bayesian Oracle can provide probabilistic safety guarantees. We demonstrate that prioritizing the most "cautious but plausible" hypotheses allows for effective harm prevention even when the true environment model is unknown.

Introduction

Traditional AI safety relies heavily on governance and post-hoc evaluations. However, testing is inherently limited by the contexts encountered during the evaluation phase. If a safety test fails to anticipate a specific hazard, the system remains vulnerable. This paper advocates for a safe-by-design paradigm, where safety is integrated into the agent's decision-making process via a Bayesian verifier.

The fundamental challenge in this approach is epistemic uncertainty. An agent typically operates without knowing the "true" model of the world ($\tau^*$). If an AI relies on a single point-estimate model, it may underestimate risks due to modeling errors. To achieve robust safety, the agent must account for all theories consistent with observed data and block actions if any reasonably likely theory predicts a high probability of harm.

Methodology: The Bayesian Oracle

The authors frame safety as a rejection sampling problem. An agent proposes an action, and a "Bayesian Oracle" (the verifier) determines whether to permit it based on a safety specification.

Bayesian World Models and Plausible Sets

The system maintains a posterior distribution over a set of theories $\mathcal{M}$. As the agent interacts with the environment and collects data $D$, it updates its beliefs. The authors prove that the true theory will eventually dominate the posterior or remain within a predictable "plausible" set.

To handle the non-i.i.d. nature of interactive environments—where an agent's actions influence future data—the framework utilizes martingale inequalities (specifically Ville’s inequality). This ensures that the posterior probability of the true theory is unlikely to drop below a critical threshold, providing a foundation for safety bounds.

The "Paranoid" Guardrail

A key insight of the paper is that safety requires pessimism. Rather than calculating the average risk across all theories (the posterior predictive), the Oracle identifies the "worst-case" risk among plausible theories.

  • i.i.d. Case: The Oracle identifies a theory $\tilde{\tau}$ that maximizes the product of the posterior probability and predicted harm.
  • Non-i.i.d. Case: The Oracle defines a set of "plausible" theories $M^\alpha$—those not significantly less likely than the best-fitting theory—and rejects actions if any theory in this set predicts harm above a threshold.

Experimental Evaluation: The Exploding Bandit

The framework was tested in a synthetic "Exploding Bandit" environment. This setup involves a multi-armed bandit where each arm has a 10-dimensional feature vector. "Harm" is defined as an "explosion" occurring if the reward exceeds a specific threshold $E$. If the agent "dies," the episode ends.

The experiments compared the proposed Bayesian guardrails against "cheating" guardrails (which have ground-truth knowledge) and standard "posterior predictive" guardrails. The results indicated:

  1. Superior Safety: The "cautious" guardrails significantly outperformed simple averaging, which often underestimated risk during early learning phases.
  2. Safety-Utility Trade-off: While the guardrails reduced "deaths" to near zero, they introduced a degree of over-caution. For very conservative parameters, the agent became "scared" of potential harm and refused productive actions, leading to lower total rewards.

Discussion and Future Work

The Bayesian Oracle provides a mathematically sound path toward provable safety, but several hurdles remain for real-world deployment.

  • Tractability: Computing a full Bayesian posterior is computationally prohibitive for complex models like Large Language Models. The authors suggest using amortized inference—approximating the posterior with neural networks—as a potential solution.
  • Defining Harm: The current model assumes harm is a binary variable. Translating nuanced human values and safety requirements (e.g., "avoid manipulation") into formal mathematical variables remains a significant challenge.
  • The Need for Mentorship: To mitigate extreme over-caution, the authors propose that agents might require a "mentor" to provide examples of safe behavior, helping the agent narrow down its plausible set of theories more efficiently.

Conclusion

By shifting from empirical testing to a Bayesian "safe-by-design" framework, we can provide theoretical guarantees against harm. While the trade-off between safety and utility is inherent, the use of "paranoid" world models ensures that uncertainty is treated as a reason for caution rather than an excuse for risk.

Summary updated

BibTeX
@inproceedings{bengio2025can,
  author = {Yoshua Bengio and Michael K. Cohen and Nikolay Malkin and Matt MacDermott and Damiano Fornasiere and Pietro Greiner and Younesse Kaddar},
  title = {{Can a Bayesian Oracle Prevent Harm from an Agent?}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2025},
}
Figure