[Paper Review] Adversarial Examples Detection with Bayesian Neural Network
This paper proposes BATer, a Bayesian neural network-based adversarial example detector that leverages the stochasticity of BNNs to model hidden layer output distributions and detect adversarial examples via distributional discrepancies. It outperforms state-of-the-art detectors on MNIST, CIFAR10, and ImageNet-Sub under diverse attacks, including high-confidence and customized white-box attacks.
In this paper, we propose a new framework to detect adversarial examples motivated by the observations that random components can improve the smoothness of predictors and make it easier to simulate the output distribution of a deep neural network. With these observations, we propose a novel Bayesian adversarial example detector, short for BATer, to improve the performance of adversarial example detection. Specifically, we study the distributional difference of hidden layer output between natural and adversarial examples, and propose to use the randomness of the Bayesian neural network to simulate hidden layer output distribution and leverage the distribution dispersion to detect adversarial examples. The advantage of a Bayesian neural network is that the output is stochastic while a deep neural network without random components does not have such characteristics. Empirical results on several benchmark datasets against popular attacks show that the proposed BATer outperforms the state-of-the-art detectors in adversarial example detection.
Motivation & Objective
- To address the vulnerability of deterministic deep neural networks to adversarial examples in safety-critical applications.
- To improve adversarial example detection by exploiting distributional differences in hidden layer outputs between natural and adversarial data.
- To leverage the inherent stochasticity of Bayesian neural networks (BNNs) to enhance detection robustness and smoothness of predictors.
- To evaluate detection performance under both gray-box and white-box attack settings, including customized strong attacks.
- To demonstrate that BNN-based detection is more effective than deterministic counterparts under the same detection framework.
Proposed method
- BATer uses Bayesian neural networks (BNNs) to generate stochastic hidden layer outputs, enabling probabilistic modeling of feature distributions.
- It computes distributional differences—specifically, Wasserstein distance—between hidden layer outputs of natural and adversarial examples across selected layers.
- The method selects key hidden layers (via index set 𝒮) where distributional divergence is most pronounced for detection.
- The framework exploits the fact that adversarial examples induce higher standard deviation in hidden layer outputs compared to natural data, especially in deeper layers.
- A customized white-box attack, Restricted-PGD, is developed to test robustness by minimizing output variance in final layers while maintaining adversarial success.
- Detection is performed by comparing the dispersion (e.g., standard deviation) of BNN outputs across multiple forward passes, using distributional divergence as a detection signal.

Experimental results
Research questions
- RQ1Can the stochasticity of Bayesian neural networks improve the detection of adversarial examples by modeling hidden layer output distributions?
- RQ2How does the distributional difference in BNN hidden representations between natural and adversarial examples enhance detection performance?
- RQ3Does BATer maintain strong detection performance under high-confidence adversarial examples, where standard detectors often fail?
- RQ4Can a customized white-box attack that manipulates hidden layer variance bypass BATer, and how robust is BATer to such attacks?
- RQ5Is the BNN-based detection framework more effective than deterministic counterparts under identical detection schemes?
Key findings
- BATer outperforms state-of-the-art adversarial detection methods on MNIST, CIFAR10, and ImageNet-Sub across multiple attack types, including PGD, FGSM, and C&W.
- The method maintains strong detection performance on high-confidence adversarial examples (confidence 10 and 20), where prior detectors often fail.
- Ablation studies confirm that BNNs significantly improve detection over deterministic networks under the same detection pipeline.
- The customized Restricted-PGD attack reduces detection performance but does not fully break BATer, especially on MNIST and ImageNet-Sub, indicating robustness.
- Hidden layer output standard deviations are consistently higher for adversarial examples than for natural data, particularly in deeper layers, providing a key detection signal.
- The detection framework is effective even when the attacker has full knowledge of the classifier and detector (white-box), demonstrating resilience to sophisticated attacks.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.