Bayesian Inference with Certifiable Adversarial Robustness

Matthew Wicker, Luca Laurenti, Andrea Patane, Zhuotong Chen, Zheng Zhang, Marta Kwiatkowska

Introduction

Deep Neural Networks (DNNs) have revolutionized fields from computer vision to natural language processing, yet they remain notoriously fragile. Small, imperceptible "adversarial" perturbations to an input can cause these models to fail spectacularly. While Bayesian Neural Networks (BNNs)—which represent weights as probability distributions—are theoretically better at quantifying uncertainty, they are still easily fooled by adversarial attacks when trained using standard methods. This paper introduces a principled framework for training BNNs with certifiable adversarial robustness, providing mathematical guarantees of safety.

The Challenge of Robustness

Most existing "robust" training techniques rely on empirical attacks, such as Projected Gradient Descent (PGD), during the training phase. While this makes the model harder to hack with that specific attack, it offers no formal guarantee of safety against all possible perturbations within a certain limit. The core challenge addressed by this work is the lack of a principled Bayesian approach for certifiable robustness, where one can prove that no perturbation within an $\epsilon$-ball can change the model's prediction.

Figure 2: Robustness profiles for FashionMNIST under PGD training. While empirical robustness is improved, certified guarantees (lightly shaded regions) remain minimal compared to the proposed IBP method.

Methodology: Robust Likelihood and IBP

The authors bridge the gap between Bayesian inference and formal verification through two major innovations:

  1. The Robust Likelihood: The standard likelihood function is replaced with one that marginalizes the network's output over an $\epsilon$-ball around the input. This encourages the posterior weight distribution to reside in stable regions of the parameter space. By optimizing this robust likelihood, the BNN learns to be invariant to small input changes.
  2. Differentiable IBP Integration: To calculate the "worst-case" output efficiently, the framework utilizes Interval Bound Propagation (IBP). IBP propagates bounding boxes through the network layers to find a guaranteed lower bound on the robust likelihood. Crucially, this bound is differentiable, allowing it to be integrated into standard approximate inference algorithms like Hamiltonian Monte Carlo (HMC) and Variational Inference (VI) methods like SWAG and VOGN. This integration allows for the first time the training of BNNs that are not just empirically robust, but formally verified.

Experimental Results

The framework was evaluated on standard benchmarks: MNIST, FashionMNIST (FMNIST), and CIFAR-10. The results demonstrate a significant breakthrough in BNN safety.

Figure 3: Robustness profiles for MNIST, FMNIST, and CIFAR-10 across Standard, PGD, and IBP training regimes. The IBP training column (right) highlights the significant increase in certified robustness (lightly shaded regions) compared to standard and empirical methods.

Key Findings

  • Certified Accuracy: The method achieved the first non-trivial certified robust accuracy for BNNs. For instance, on MNIST and FashionMNIST, the models reached ~75% and ~73% certified robust accuracy ($\epsilon=0.1$), respectively. On the more complex CIFAR-10 dataset, it achieved ~50% ($\epsilon=1/255$). These figures represent a significant leap over standard BNNs, which typically show near-zero certified robustness.
  • Posterior Shaping: Robust training acts as a powerful regularizer, pushing the weight posterior away from "sharp" regions of the loss landscape where small input changes lead to large output swings. This shaping of the posterior leads to more stable and reliable predictions.
  • Safety and Calibration: A significant "dual benefit" was observed: making a BNN certifiably robust also improves its uncertainty calibration. Robust BNNs were much more successful at flagging out-of-distribution (OOD) samples (e.g., using SVHN as OOD for CIFAR-10) by assigning them higher uncertainty. This suggests that robustness and uncertainty quantification are deeply linked properties in Bayesian models.

Conclusion and Future Work

This work provides a foundational framework for building safety-critical Bayesian systems. While IBP is a powerful tool, it is known to be conservative, often underestimating true robustness. Future research may explore tighter verification methods like Linear Bound Propagation (LBP) or focus on scaling these techniques to larger architectures like ResNets and Transformers. Balancing standard accuracy with robust performance remains a key area for hyperparameter optimization.

Summary updated

Abstract

We consider adversarial training of deep neural networks through the lens of Bayesian learning and present a principled framework for adversarial training of Bayesian Neural Networks (BNNs) with certifiable guarantees. We rely on techniques from constraint relaxation of non-convex optimisation problems and modify the standard cross-entropy error model to enforce posterior robustness to worst-case perturbations in $\epsilon-$balls around input points. We illustrate how the resulting framework can be combined with methods commonly employed for approximate inference of BNNs. In an empirical investigation, we demonstrate that the presented approach enables training of certifiably robust models on MNIST, FashionMNIST, and CIFAR-10 and can also be beneficial for uncertainty calibration. Our method is the first to directly train certifiable BNNs, thus facilitating their deployment in safety-critical applications.
BibTeX
@inproceedings{wicker2021bayesian,
  author = {Matthew Wicker and Luca Laurenti and Andrea Patane and Zhuotong Chen and Zheng Zhang and Marta Kwiatkowska},
  title = {{Bayesian Inference with Certifiable Adversarial Robustness}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2021},
}
Figure