Deciphering the Definition of Adversarial Robustness for post-hoc OOD Detectors

Peter Lorenz, Mario Fernandez, Jens Müller, Ullrich Köthe · OpenReview

Abstract

Detecting out-of-distribution (OOD) inputs is critical for safely deploying deep learning models in real-world scenarios. In recent years, many OOD detectors have been developed, and even the benchmarking has been standardized, i.e. OpenOOD. The number of post-hoc detectors is growing fast and showing an option to protect a pre-trained classifier against natural distribution shifts, claiming to be ready for real-world scenarios. However, its efficacy in handling adversarial examples has been neglected in the majority of studies. This paper investigates the adversarial robustness of the 16 post-hoc detectors on several evasion attacks and discuss a roadmap towards adversarial defense in OOD detectors.

Introduction

Deep learning models are increasingly deployed in open-world environments where they must distinguish between in-distribution (ID) data and out-of-distribution (OOD) samples. Post-hoc OOD detectors have emerged as a popular solution, allowing researchers to augment pre-trained classifiers without the need for costly retraining. While these detectors demonstrate high efficacy against natural distribution shifts, their robustness against intentional adversarial perturbations remains largely unexplored.

Adversarial examples (AdEx)—inputs modified by imperceptible noise to induce misclassification—represent a significant security threat. Current benchmarks like OpenOOD primarily focus on natural shifts, leaving a critical gap in our understanding of how OOD detectors perform under adversarial pressure. This study bridges this gap by benchmarking 16 state-of-the-art detectors and redefining adversarial robustness through the lens of neural network attention shifts.

Methodology

The researchers evaluated 16 prominent post-hoc OOD detectors, including SCALE, ASH, KNN, VIM, and MDS, across a variety of architectures (ResNet-18, ResNet-50, and Swin-Transformer) and datasets (CIFAR-10, CIFAR-100, and ImageNet-1K).

Adversarial Attacks

The detectors were subjected to four types of white-box evasion attacks:

  • PGD (Projected Gradient Descent): A strong, iterative attack.
  • FGSM (Fast Gradient Sign Method): A single-step gradient-based attack.
  • DeepFool (DF): An attack designed to find the smallest perturbation needed to cross a decision boundary.
  • Masked PGD (mPGD): A variant of PGD.

Quantifying Attention Shift

A key contribution of this work is the redefinition of robustness based on "attention maps." Using Grad-CAM (Gradient-weighted Class Activation Mapping), the authors visualize where a classifier focuses its attention. They argue that an adversarial attack is a semantic manipulation that shifts this focus. To quantify this, they introduced metrics based on the L2 distance (pixel-wise difference) and SSIM (structural similarity) between the attention maps of benign and adversarial images.

L2 Norm and SSIM metrics for attention map shifts under various adversarial attacks.

Key Results

The benchmarking results reveal a significant vulnerability in current OOD detection frameworks. Against strong attacks like PGD, nearly all 16 detectors failed completely on the ImageNet-1K dataset, reaching a False Positive Rate (FPR95) of nearly 100%. This indicates that these systems are virtually unable to distinguish adversarial OOD samples from benign ID samples.

Comprehensive benchmarking of 16 OOD detectors across multiple datasets and adversarial attacks.

On the CIFAR-10 dataset, the MDS (Mahalanobis Distance) detector emerged as the most resilient, achieving an FPR95 of 47.81% against PGD, significantly outperforming common methods like MSP or ODIN, which typically exceeded 90% FPR95.

Discussion and Insights

The study highlights several critical findings:

  • Mahalanobis Resilience: Detectors utilizing Mahalanobis distance (MDS, RMDS) show superior robustness. By accounting for the covariance structure of the feature space, these methods are better equipped to handle the structured noise of adversarial perturbations.
  • The "Silent Killer": DeepFool (DF) proved to be the most deceptive attack. Despite its high success rate in fooling classifiers, it produces the smallest shifts in attention maps, making it nearly invisible to detectors relying on feature-level changes.
  • Performance Conflict: There is a clear trade-off between natural OOD detection and adversarial robustness. Methods optimized for SOTA performance on natural benchmarks often exhibit the greatest vulnerability to adversarial attacks.

Conclusion and Future Roadmap

The current state of post-hoc OOD detection is insufficient for security-critical applications. The authors propose a four-level roadmap for future research, moving from standard natural OOD evaluation toward defending against sophisticated, adaptive attacks that target the detector itself. Future work must address the threat of adaptive attacks and explore the transferability of adversarial OOD samples across different model architectures.

Summary updated

BibTeX
@inproceedings{lorenz2024deciphering,
  author = {Peter Lorenz and Mario Fernandez and Jens Müller and Ullrich Köthe},
  title = {{Deciphering the Definition of Adversarial Robustness for post-hoc OOD Detectors}},
  booktitle = {NextGenAISafety @ ICML},
  year = {2024},
  url = {https://openreview.net/forum?id=Lhmlvh7VTi},
}
Figure