Abstract
Bayesian Neural Networks (BNNs) provide valuable uncertainty estimates but often fail to incorporate domain-specific functional constraints, leading to physically impossible or unsafe predictions. We present Output-Constrained Bayesian Neural Networks (OC-BNNs), a framework that allows experts to encode knowledge directly into the function space via "Constraint Priors." By defining positive regions where a function should exist and negative regions where it cannot, OC-BNNs significantly improve safety and reliability in high-stakes domains like healthcare and robotics. Our results demonstrate that OC-BNNs can eliminate infeasible predictions in human motion tasks and reduce clinical constraint violations by a factor of three, all while maintaining competitive predictive performance.
1. Introduction
In high-stakes fields such as healthcare and robotics, predictive models must not only be accurate but also adhere to known physical or clinical constraints. While Bayesian Neural Networks (BNNs) provide a framework for uncertainty, their priors are typically defined in the weight space. Because the mapping from weights to outputs is highly non-linear and non-intuitive, experts cannot easily encode knowledge like "a human joint has a limited range of motion" into the model.
This limitation leads to "overconfident" predictions in out-of-distribution regions that may violate fundamental domain principles. OC-BNNs address this by allowing constraints to be defined in the function space (input-output relationships), ensuring that the model's posterior distribution respects expert-defined boundaries.
2. Methodology: Constraint Priors
The core of the OC-BNN framework is the Constraint Prior. Rather than relying solely on a standard weight prior $p(W)$, we define a modified prior: $$p_C(W) \propto p(W)g(W|C)$$ where $g(W|C)$ is a term that quantifies the adherence of the network's output to a set of constraints $C$.
The framework supports two primary types of constraints:
- Positive Constraints: These define regions where the function is expected to reside. For regression, these are modeled as Gaussian distributions; for classification, Dirichlet distributions are used.
- Negative Constraints: These define "forbidden" zones where the function should not exist. These are implemented using soft indicator functions that penalize the model for predicting values within these regions.
This approach is compatible with standard BNN inference techniques, such as Hamiltonian Monte Carlo (HMC) and Stein Variational Gradient Descent (SVGD), by incorporating the constraint term into the potential energy or gradient calculations.
3. Experimental Setup
The authors evaluated the OC-BNN framework across three distinct domains:
- Synthetic Tasks: 1D regression and 2D classification tasks were used to visualize how models handle forbidden zones and out-of-distribution data.
- Clinical Decision Support (MIMIC-III): Using a large-scale clinical database, the model predicted interventions (vasopressors vs. IV fluids) for hypotension. A positive constraint was applied to ensure that some action is taken when blood pressure is critically low.
- Robotics (Human Motion Prediction): The model predicted upper-body joint angles during reaching tasks. Constraints were derived from anatomical limits of the human shoulder and elbow.
4. Results and Discussion
4.1 Safety and Robustness
In the MIMIC-III healthcare task, OC-BNNs reduced the rate of constraint violations by a factor of three compared to standard BNNs, particularly in regions where training data was sparse. In the human motion task, the standard BNN produced physically impossible joint positions in 18.4% of test cases. In contrast, the OC-BNN reduced the violation rate to 0.0% while maintaining the same level of predictive accuracy (RMSE).
4.2 Multimodality and Interpretability
A key finding is that negative constraints can induce multimodality in the posterior. When a forbidden region is placed in the center of the output space, the OC-BNN learns that the function must pass either above or below it, capturing a more realistic set of possibilities than a unimodal model.
Furthermore, by moving the prior from abstract weights to tangible input-output constraints, the model becomes more interpretable for domain experts. Doctors or engineers can directly inspect and modify the constraints to align the model with established safety protocols.
5. Conclusion and Future Work
OC-BNNs provide a robust method for integrating expert knowledge into deep learning. By enforcing functional constraints, these models significantly reduce unsafe predictions in critical applications. While the current implementation introduces some computational overhead due to additional forward passes, future work could optimize this process or apply the framework to Safe Reinforcement Learning, where preventing catastrophic failures during exploration is paramount.
Summary updated