TL;DR
This paper introduces BATER, a novel framework for detecting adversarial examples by leveraging Bayesian Neural Networks (BNNs). BATER capitalizes on the inherent randomness of BNNs to better distinguish between natural and adversarial data distributions in hidden layers, outperforming existing state-of-the-art detection methods.
What Problem Does This Paper Address?
Deep Neural Networks (DNNs), despite their impressive performance, are notoriously vulnerable to adversarial attacks. These attacks involve subtly perturbing input data (e.g., images) to cause misclassification, even though the perturbed data appears normal to humans. While defenses like adversarial training exist, they are computationally expensive. An alternative approach is to detect adversarial examples rather than prevent them. Existing detection methods often rely on deterministic models and struggle to differentiate between natural and adversarial data distributions, making them susceptible to sophisticated attacks. This paper addresses the challenge of robustly detecting adversarial examples by proposing a method that exploits the distributional properties of BNNs.
Methods
The core of BATER lies in its use of Bayesian Neural Networks (BNNs). Unlike standard DNNs, BNNs model weights as probability distributions, introducing inherent randomness. This randomness allows BNNs to provide a distribution of hidden layer outputs for a given input, rather than a single deterministic output. BATER leverages this by:
- Simulating Hidden Layer Distributions: For a given input, the BNN is run multiple times (forward passes) to generate a distribution of hidden layer outputs. This is in contrast to deterministic DNNs where a single forward pass yields a single output.
- Measuring Distributional Differences: BATER quantifies the difference between the simulated hidden layer output distribution of a test sample and the pre-computed distribution of natural training samples from the predicted class. The 1-Wasserstein distance is used for this measurement.
- Layer Selection: To capture the most discriminative features, BATER employs an automated scheme to select multiple hidden layers that exhibit the largest distributional differences between natural and adversarial examples.
- Binary Classification: The calculated dispersion scores from the selected layers are fed into a simple binary classifier (a logistic regression model in this paper) to make the final decision: adversarial or natural.
Datasets
The proposed method was evaluated on the following standard image classification datasets:
- MNIST: A dataset of handwritten digits.
- CIFAR10: A dataset of 10 classes of small images.
- ImageNet-Sub: A subset of the ImageNet dataset.
The paper uses standard train/test splits for these datasets.
Key Insights and Ideas
- BNNs Enhance Detection: The inherent randomness of BNNs makes the distributional differences between natural and adversarial examples more pronounced in their hidden layer outputs compared to deterministic DNNs. This makes BNNs a more suitable choice for adversarial detection.
- Distributional Dispersion as a Signal: Adversarial examples, by definition, often lie off the natural data manifold. BATER exploits this by observing that their hidden layer outputs exhibit a different distributional dispersion than those of natural examples.
- Multiple Layers Improve Robustness: Pooling information from multiple selected hidden layers provides a more comprehensive signal for detection, making the method more resistant to various attack strategies.
- Randomness Amplifies Differences: Theoretical analysis suggests that the variance introduced by BNN parameters can enlarge the distributional differences between natural and adversarial outputs, providing a theoretical basis for BATER's effectiveness.
Key Results
- State-of-the-Art Performance: BATER consistently outperformed other state-of-the-art detection methods (KD, LID, ODD, JTLA) across MNIST, CIFAR10, and ImageNet-Sub datasets against various attacks (FGSM, PGD, C&W). AUC scores for BATER were often above 0.980, with many reaching near perfect detection.
- BNN vs. DNN Advantage: Ablation studies showed that BATER with a BNN architecture consistently achieved better detection performance than the same architecture with a deterministic DNN, highlighting the benefit of randomness.
- Robustness to Attack Variations: BATER demonstrated strong performance against attacks with different strengths (varying epsilon values) and even against transfer attacks (where the detector was trained on one attack type but tested on another).
- Adaptive Attack Resilience: While performance dropped against an adaptive white-box attack (where the attacker knows both the classifier and detector), BATER still maintained reasonable detection AUC and improved robust accuracy, indicating a degree of resilience.
- Efficiency of Forward Passes: The paper found that only a few forward passes (around 4) were sufficient to simulate the hidden layer distributions effectively, balancing performance and computational cost.
Limitations and Future Work
- Theoretical Proof for Empirical Observation: While the paper empirically shows that BNNs better separate distributions, a formal theoretical proof for this specific observation is not provided, though a theoretical analysis for the general advantage of randomness is presented.
- Adaptive Attack Performance: The performance against adaptive attacks, while reasonable, did show a drop in AUC. This suggests that further research into more robust detection mechanisms against adaptive attacks is warranted.
- Computational Cost of BNNs: While BATER's detection phase is efficient, training BNNs can still be more computationally intensive than training standard DNNs, although the paper notes it's not prohibitively so.
- Future Work: The authors suggest exploring other divergence metrics for measuring distributional differences and investigating more sophisticated layer selection strategies. Further research into adaptive attacks and the theoretical underpinnings of BNNs for detection would also be valuable.
Summary updated