Abstract
Despite the widespread use of deep learning algorithms, vulnerability to adversarial attacks is still an issue limiting their use in critical applications. Detecting these attacks is thus crucial to build reliable algorithms and has received increasing attention in the last few years. In this paper, we introduce the HalfspAce Mass dePth dEtectoR (HAMPER), a new method to detect adversarial examples by leveraging the concept of data depths, a statistical notion that provides center-outward ordering of points with respect to (w.r.t.) a probability distribution. In particular, the halfspace-mass (HM) depth exhibits attractive properties such as computational efficiency, which makes it a natural candidate for adversarial attack detection in high-dimensional spaces. Additionally, HM is non differentiable making it harder for attackers to directly attack HAMPER via gradient based-methods. We evaluate HAMPER in the context of supervised adversarial attacks detection across four benchmark datasets. Overall, we empirically show that HAMPER consistently outperforms SOTA methods. In particular, the gains are 13.1% (29.0%) in terms of AUROC (resp. FPR) on SVHN, 14.6% (25.7%) on CIFAR10 and 22.6% (49.0%) on CIFAR100 compared to the best performing method.
Introduction
Deep learning models are notoriously fragile. A tiny, human-invisible perturbation to an image—an "adversarial attack"—can trick a state-of-the-art classifier into misclassifying an object. While researchers have developed many detection methods, most struggle with high-dimensional data and adaptive attacks where the adversary knows the detector's mechanism. This paper addresses these gaps by introducing HAMPER, a novel framework that uses statistical "data depth" to identify adversarial examples.
Methodology: Halfspace-Mass Depth
The core innovation of HAMPER is the application of Halfspace-Mass (HM) Depth. In statistics, "depth" provides a center-outward ordering of points; a point in the middle of a data cloud has high depth, while an outlier has low depth. HM depth is particularly useful because it is computationally efficient in high dimensions and non-differentiable, providing a natural defense against gradient-based adaptive attacks.
HAMPER extracts internal activations across multiple layers of a pre-trained network and calculates the HM depth for each class. As shown above, the distribution of these depth features varies significantly across classes, allowing the model to leverage class-specific signals for detection. These scores are then aggregated using a simple linear regressor trained on a small validation set of clean and attacked samples.
Experimental Results
HAMPER was evaluated against state-of-the-art (SOTA) detectors, including NSS, LID, and KD-BU, across benchmark datasets like SVHN, CIFAR10, and CIFAR100.
As illustrated in the performance comparison, HAMPER consistently outperforms SOTA methods. On the challenging CIFAR100 dataset, HAMPER achieved a 22.6% gain in AUROC and a 49.0% reduction in False Positive Rate (FPR) compared to the next best performing method. Unlike many existing methods, HAMPER’s performance does not degrade significantly as the classification task becomes more complex.
Robustness and Adaptive Attacks
A key advantage of HAMPER is its resilience to adaptive attacks. Because the HM depth function relies on indicator functions, it creates a "shattered" gradient landscape that makes it difficult for an attacker to find a path to bypass the detector using standard optimization tools. In tests against a blackbox adaptive attacker (using Square Attack), HAMPER maintained an AUROC of 64.9% even under extreme attack parameters, whereas competitors like NSS dropped to nearly random chance (3.7%).
Conclusion
HAMPER provides a robust and efficient solution for adversarial attack detection by leveraging the statistical properties of Halfspace-Mass depth. By utilizing class-conditioned feature distributions and a non-differentiable detection mechanism, it sets a new benchmark for reliability in deep learning. Future work will investigate the method's performance against "zero-day" attacks and the potential for surrogate-based proxy attacks.
Summary updated