Abstract
Adversarial examples have been shown to cause neural networks to fail on a wide range of vision and language tasks, but recent work has claimed that Bayesian neural networks (BNNs) are inherently robust to adversarial perturbations. In this work, we examine this claim. To study the adversarial robustness of BNNs, we investigate whether it is possible to successfully break state-of-the-art BNN inference methods and prediction pipelines using even relatively unsophisticated attacks for three tasks: (1) label prediction under the posterior predictive mean, (2) adversarial example detection with Bayesian predictive uncertainty, and (3) semantic shift detection. We find that BNNs trained with state-of-the-art approximate inference methods, and even BNNs trained with Hamiltonian Monte Carlo, are highly susceptible to adversarial attacks. We also identify various conceptual and experimental errors in previous works that claimed inherent adversarial robustness of BNNs and conclusively demonstrate that BNNs and uncertainty-aware Bayesian prediction pipelines are not inherently robust against adversarial attacks.
Introduction
Adversarial examples—small, often imperceptible perturbations to input data—have long been a thorn in the side of deep learning. While standard deterministic neural networks are notoriously brittle, a prevailing belief in the machine learning community suggested that Bayesian Neural Networks (BNNs) might offer a solution. By representing weights as distributions rather than point estimates, BNNs provide "epistemic uncertainty." The hope was that while an attack might change a prediction, it would simultaneously trigger a spike in uncertainty, allowing the system to detect and reject the malicious input.
This paper performs a rigorous security audit of these claims. By re-evaluating previous studies and testing state-of-the-art BNNs against sophisticated attacks, the authors demonstrate that the perceived robustness of BNNs is largely an artifact of implementation errors rather than a fundamental property of Bayesian inference.
Uncovering Implementation Artifacts
The authors began by conducting "code forensics" on previous research that claimed BNN robustness. They discovered a critical flaw dubbed the "double softmax" problem. In several influential papers, the softmax function was inadvertently applied twice during the calculation of gradients for adversarial attacks. This error squashes gradients to near-zero, effectively "blinding" the attacker's optimization process.
When these implementation errors are corrected, the apparent robustness vanishes. As shown in the table below, re-evaluating these models with standard attack protocols reveals a massive drop in accuracy compared to the originally reported figures.
A Systematic Security Audit
To provide a definitive answer, the authors evaluated four major BNN inference methods:
- Hamiltonian Monte Carlo (HMC): Often considered the "gold standard" for Bayesian inference.
- Function-Space Variational Inference (FSVI): A modern, state-of-the-art approximate method.
- PSVI & Monte Carlo Dropout (MCD): Widely used approximate methods in practical applications.
These models were tested on standard benchmarks like MNIST, FashionMNIST, and CIFAR-10. Beyond standard attacks like FGSM and PGD, the authors introduced PGD+, a two-stage attack specifically designed to fool BNNs. PGD+ doesn't just aim to change the label; it simultaneously optimizes the input to minimize the model's uncertainty, forcing it to be "confidently wrong."
Results: Confident but Wrong
The results across all tasks—label prediction, adversarial detection, and semantic shift detection—were stark. While BNNs maintain high accuracy on clean data, their performance collapses under adversarial pressure.
Key findings include:
- Label Prediction: Accuracy on MNIST plummeted from ~99% on clean data to below 1% under PGD attacks.
- Uncertainty as an Attack Surface: Epistemic uncertainty is not a magic shield. Attackers can optimize inputs to keep uncertainty low while changing the predicted class.
- HMC Vulnerability: Even HMC, which provides the most accurate posterior distributions, failed completely. This suggests that vulnerability is a fundamental trait of the underlying neural network architecture, which Bayesian averaging alone cannot fix.
Conclusion
This research conclusively dismantles the myth of inherent BNN robustness. The perceived safety of BNNs in earlier literature was primarily due to gradient masking from implementation bugs. The authors conclude that for BNNs to be truly robust, they cannot rely on their Bayesian nature alone; they must incorporate Bayesian Adversarial Training. Future work should focus on developing training regimes that are mathematically consistent with Bayesian principles while explicitly accounting for adversarial distributions.
Summary updated