Statistical Guarantees for the Robustness of Bayesian Neural Networks

Luca Cardelli, Marta Kwiatkowska, Luca Laurenti, Nicola Paoletti, Andrea Patane, Matthew Wicker

Abstract

We introduce a probabilistic robustness measure for Bayesian Neural Networks (BNNs), defined as the probability that, given a test point, there exists a point within a bounded set such that the BNN prediction differs between the two. Such a measure can be used, for instance, to quantify the probability of the existence of adversarial examples. Building on statistical verification techniques for probabilistic models, we develop a framework that allows us to estimate probabilistic robustness for a BNN with statistical guarantees, i.e., with a priori error and confidence bounds. We provide experimental comparison for several approximate BNN inference techniques on image classification tasks associated to MNIST and a two-class subset of the GTSRB dataset. Our results enable quantification of uncertainty of BNN predictions in adversarial settings.

Introduction

Deep learning models are notoriously fragile; small, imperceptible perturbations, known as adversarial examples, can cause them to fail spectacularly. Bayesian Neural Networks (BNNs) are often proposed as a solution because they represent weights as distributions rather than fixed points, allowing the model to capture epistemic uncertainty. However, while tools exist to verify the robustness of deterministic networks, providing rigorous guarantees for the probabilistic nature of BNNs remains a challenge. Previous methods typically focused on point-wise uncertainty. This work addresses this gap by introducing a statistical framework to calculate the probability that an adversarial example exists within a specific neighborhood of a test point, providing formal guarantees with provable error and confidence limits.

Methodology

The proposed framework treats BNN robustness as a statistical estimation problem. The approach follows three primary stages:

  1. Sampling and Realization: Weights are sampled from the BNN's posterior distribution. Each sample effectively "collapses" the BNN into a standard deterministic neural network.
  2. Deterministic Verification: Existing formal verification tools, such as reachability analysis, are employed to check if a specific deterministic network realization is robust within a bounded region $T$ around an input $x^*$.
  3. Sequential Statistical Estimation: To maintain computational efficiency, a sequential scheme based on Massart and Chernoff bounds is used. This allows the algorithm to terminate sampling once sufficient evidence is gathered to meet a pre-defined error bound ($\theta$) and confidence level ($\gamma$).

The framework defines two types of robustness: Model Uncertainty, which checks if output likelihoods stay within a threshold, and Total Uncertainty, which checks if the predicted class label remains invariant.

Experimental Evaluation

The framework was evaluated on two benchmarks: MNIST (handwritten digits) and a two-class subset of the German Traffic Sign Recognition Benchmark (GTSRB). The study compared three common approximate Bayesian inference techniques: Hamiltonian Monte Carlo (HMC), Variational Inference (VI), and Monte Carlo Dropout (MCD).

Results and Discussion

A key finding is the significant impact of the inference method on the resulting robustness profile. HMC provides the most "honest" and smooth robustness profiles, reflecting a more accurate representation of the posterior. In contrast, MCD often behaves almost deterministically, exhibiting "all-or-nothing" robustness. This suggests that MCD may dangerously underestimate model uncertainty in adversarial settings.

Robustness profiles for HMC, VI, and MCD on MNIST digits. The heatmaps and 3D plots illustrate the probability of robustness across varying epsilon and delta parameters.

The authors also observed a clear trade-off between robustness and accuracy. While HMC-trained models occasionally showed slightly lower raw accuracy than MCD or VI on clean data, they displayed superior probabilistic safety across all adversarial tests. Under strong gradient-based attacks, the robustness of MCD-trained networks dropped sharply to zero, whereas HMC maintained a non-zero probability of being robust.

Robustness degradation as a function of perturbation magnitude (Epsilon) for different inference methods on MNIST. HMC maintains higher robustness at larger epsilon values compared to VI and MCD.

Furthermore, the sequential testing approach proved efficient. The statistical verification of an image averaged approximately 120 seconds, making it a viable tool for offline safety auditing. By using Massart bounds, the algorithm can stop early if a model is clearly robust or fragile, significantly reducing the required number of samples.

Conclusion

This work provides the first statistical framework for formal robustness guarantees in BNNs. By combining weight sampling with state-of-the-art verification and sequential statistical bounds, it enables the quantification of safety in probabilistic models. While the statistical wrapper is efficient, the overall scalability is currently limited by the underlying deterministic verifiers. Future research should focus on integrating more efficient deterministic verification techniques and extending the framework to regression and reinforcement learning tasks.

Summary updated

Abstract

We introduce a probabilistic robustness measure for Bayesian Neural Networks (BNNs), defined as the probability that, given a test point, there exists a point within a bounded set such that the BNN prediction differs between the two. Such a measure can be used, for instance, to quantify the probability of the existence of adversarial examples. Building on statistical verification techniques for probabilistic models, we develop a framework that allows us to estimate probabilistic robustness for a BNN with statistical guarantees, i.e., with a priori error and confidence bounds. We provide experimental comparison for several approximate BNN inference techniques on image classification tasks associated to MNIST and a two-class subset of the GTSRB dataset. Our results enable quantification of uncertainty of BNN predictions in adversarial settings.
BibTeX
@inproceedings{cardelli2019statistical,
  author = {Luca Cardelli and Marta Kwiatkowska and Luca Laurenti and Nicola Paoletti and Andrea Patane and Matthew Wicker},
  title = {{Statistical Guarantees for the Robustness of Bayesian Neural Networks}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.24963/ijcai.2019/789},
}
Figure