Abstract
Deep Neural Networks (DNNs) are highly susceptible to adversarial attacks, where small, imperceptible perturbations lead to incorrect classifications. Traditional defenses like Adversarial Training (AT) often require full model access and incur a significant "accuracy tax" on clean data. We present Bayesian Boundary Correction (BBC), a novel post-training defense framework that transforms vulnerable, pre-trained "black-box" classifiers into robust ones without retraining. By appending a lightweight Bayesian component, BBC models the joint distribution of clean and adversarial data to correct decision boundaries. Our method achieves state-of-the-art robustness across image and human motion datasets while maintaining high clean accuracy and significantly reducing computational overhead.
Introduction
The fragility of DNNs poses a major hurdle for deployment in security-critical applications. While various defenses have been proposed, they typically face three major challenges: the accuracy-robustness trade-off, the requirement for white-box model access, and high computational costs for retraining. In many real-world scenarios, users only have black-box access to models (e.g., via APIs) and lack the resources for expensive retraining cycles.
BBC addresses these issues by acting as a "plug-and-play" defense. It keeps the original model fixed and appends a small, trainable Bayesian correction layer. This approach allows for robustification post-training, preserving the performance of the original model on clean data while providing a resilient shield against adversarial perturbations.
The BBC Framework
The core of BBC lies in its ability to model the joint probability of clean data, adversarial examples, and the classifier's predictions. The framework is built on three technical pillars:
- Joint Distribution Modeling: BBC treats adversarial samples as a "one-to-many" mapping from clean data, allowing it to explicitly model the relationship between the two.
- Energy-Based Models (EBM): By using EBMs, BBC incorporates domain-specific inductive biases to define the data manifold. For image data, it utilizes the Learned Perceptual Image Patch Similarity (LPIPS) metric; for human motion data, it enforces physical dynamics such as bone length consistency.
- Bayesian Model Averaging: Rather than relying on a single deterministic boundary, BBC employs Stochastic Gradient Adaptive Hamiltonian Monte Carlo (SGHMC) to sample an ensemble of correction models. This ensemble creates a "robustness landscape" that is significantly harder for attackers to navigate, as the expected loss gradient tends toward zero, effectively hiding the attack direction.
Experimental Evaluation
We evaluated BBC across two distinct domains: image classification (CIFAR-10, CIFAR-100, STL-10) and Skeleton-based Human Activity Recognition (S-HAR) using datasets like HDM05 and NTU120.
Image Classification Results
On CIFAR-10, BBC demonstrated a remarkable ability to maintain clean accuracy while providing robust protection. Unlike traditional Adversarial Training, which often drops clean accuracy to the mid-80s, BBC achieved 94.7% clean accuracy, nearly matching the undefended baseline.
Skeleton-based Human Activity Recognition (S-HAR)
S-HAR involves dynamic time-series data, making it a challenging domain for defense. BBC represents the first black-box defense specifically designed for this task. Across multiple architectures like ST-GCN and MS-G3D, BBC consistently outperformed existing baselines.
Key Insights
- Efficiency: BBC is 12.5% to 70% faster to deploy than full model retraining because it only requires training a tiny appended layer (often just two fully connected layers).
- Vanishing Gradients: The Bayesian ensemble naturally mitigates attacks by causing the gradient signal used by attackers to vanish, without relying on easily-broken "gradient masking" tricks.
- Domain Flexibility: By tailoring the distance functions (LPIPS for images, physical dynamics for motion), BBC stays close to the actual data manifold, minimizing the impact on clean performance.
Conclusion and Future Work
Bayesian Boundary Correction offers a powerful, efficient, and flexible solution for defending black-box classifiers. It effectively bridges the gap between accuracy and robustness, making it a viable candidate for real-world deployment. Future work will explore extending BBC to more complex data types, such as full-scale video and graph-based data, and investigating its resilience against extremely strong ensemble attacks like AutoAttack.
Summary updated