Adversarially Robust Out-of-Distribution Detection Using Lyapunov-Stabilized Embeddings

## Abstract

Abstract Despite significant advancements in out-of-distribution (OOD) detection, existing methods still struggle to maintain robustness against adversarial attacks, compromising their reliability in critical real-world applications. Previous studies have attempted to address this challenge by exposing detectors to auxiliary OOD datasets alongside adversarial training. However, the increased data complexity inherent in adversarial training, and the myriad of ways that OOD samples can arise during testing, often prevent these approaches from establishing robust decision boundaries. To address these limitations, we propose AROS, a novel approach leveraging neural ordinary differential equations (NODEs) with Lyapunov stability theorem in order to obtain robust embeddings for OOD detection.
By incorporating a tailored loss function, we apply Lyapunov stability theory to ensure that both in-distribution (ID) and OOD data converge to stable equilibrium points within the dynamical system.
This approach encourages any perturbed input to return to its stable equilibrium, thereby enhancing the model’s robustness against adversarial perturbations.
To not use additional data, we generate fake OOD embeddings by sampling from low-likelihood regions of the ID data feature space, approximating the boundaries where OOD data are likely to reside. To then further enhance robustness, we propose the use of an orthogonal binary layer following the stable feature space, which maximizes the separation between the equilibrium points of ID and OOD samples. We validate our method through extensive experiments across several benchmarks, demonstrating superior performance, particularly under adversarial attacks. Notably, our approach improves robust detection performance from 37.8% to 80.1% on CIFAR-10 vs. CIFAR-100 and from 29.0% to 67.0% on CIFAR-100 vs. CIFAR-10. Code and pre-trained models are available at https://github.com/AdaptiveMotorControlLab/AROS .

## 1 Introduction

Deep neural networks have demonstrated remarkable success in computer vision, achieving significant results across a wide range of tasks. However, these models are vulnerable to adversarial examples—subtly altered inputs that can lead to incorrect predictions (; ; ). As a result, designing a defense mechanism has emerged as a critical task. Various strategies have been proposed, and adversarial training has become one of the most widely adopted approaches (; ; ). Recently, Neural Ordinary Differential Equations (NODEs) have attracted attention as a defense strategy by leveraging principles from control theory. By leveraging the dynamical system properties of NODEs, and imposing stability constraints, these methods aim to enhance robustness with theoretical guarantees. However, they have been predominantly studied in the context of classification tasks (; ; ; ; ; ; ; ; ), and not in out-of-distribution (OOD) detection.

OOD detection is a safety-critical task that is crucial for deploying models in the real world. In this task, training is limited to in-distribution (ID) data, while the inference task involves identifying OOD samples, i.e., samples that deviate from the ID data (; ). Recent advancements have demonstrated impressive performance gains across various detection benchmarks (; ; ; ). However, a significant challenge arises concerning the robustness of OOD detectors against adversarial attacks. An adversarial attack on a detector involves introducing minor perturbations to test samples, causing the detector to predict OOD as ID samples or vice versa. Yet, a robust OOD detector is imperative, especially in scenarios like medical diagnostics and autonomous driving (; ; ; ; ).

Recently, several approaches have sought to address this challenge by first demonstrating that relying solely on ID data is insufficient for building adversarially robust detectors (; ; ; ; ; ; ; ; ; ; ; ; ; ). Consequently, new methods propose incorporating copious amounts of auxiliary OOD data in conjunction with adversarial training to improve the detector’s robustness. While effective, a significant gap remains between detector performance on clean data and their robustness against adversarial attacks (see Figure 1, Tables 1, 2(a), and 2(b)).

This performance gap primarily arises from the wide variety of potential OOD samples encountered during testing. Relying exclusively on an auxiliary dataset to generate perturbed OOD data can bias the model toward specific OOD instances, thereby compromising the detector’s ability to generalize to unseen OOD data during inference (; ; ; ; ; ). This limitation is particularly pronounced in adversarial settings, where adversarial training demands a higher level of data complexity compared to standard training (; ; ; ; ). Additionally, the collection of auxiliary OOD data is a costly process, as it must be carefully curated to avoid overlap with ID semantics to ensure that the detector is not confused by data ambiguities (; ). Finally, as our empirical analysis reveals, existing OOD detection methods are vulnerable even to non-adversarial perturbations – a concerning issue for open-world applications, where natural factors such as lighting conditions or sensor noise can introduce significant variability () (see Table 3).

Our Contribution: To address these challenges, we propose AROS (Adversarially Robust OOD Detection through Stability), a novel approach that leverages NODEs with the Lyapunov stability theorem (Figure 2). This constraint asserts that small perturbations near stable equilibrium points decay over time, allowing the system state to converge back to equilibrium. By ensuring that both ID and OOD data are stable equilibrium points of the detector, the system’s dynamics mitigate the effects of perturbations by guiding the state back to its equilibrium. Instead of using extra OOD image data, we craft fake OOD samples in the embedding space by estimating the ID boundary. Additionally, we show that adding an orthogonal binary layer increases the separation between ID and OOD equilibrium points, enhancing robustness. We evaluate AROS under both adversarial and clean setups across various datasets, including large-scale datasets such as ImageNet () and real-world medical imaging data (i.e., ADNI ()), and compare it to previous state-of-the-art methods. Under adversarial scenarios, we apply strong attacks, including $\text{PGD}^{1000}$ (), AutoAttack (), and Adaptive AutoAttack ().

Figure: Figure 1: OOD detection performance for various models under different perturbation magnitudes. The perturbations are generated using $\text{PGD}^{1000}$ ($\ell_{\infty}$) attack targeting both test ID and OOD samples. (A) ImageNet is used as the ID dataset, while the Texture dataset is used as the OOD during test time. (B) CIFAR-10 is utilized as the ID, with CIFAR-100 as the OOD. (C) CIFAR-100 is used as the ID, with CIFAR-10 as the OOD. A perfect detector achieves an AUROC of 100%, a random detector scores 50%, and a fully compromised detector under attack scores 0%. Notably, no other model achieves detection performance above random (i.e., greater than 50% AUROC) at $\epsilon=\frac{8}{255}$.
Refer to caption: x1.png

## 2 Preliminaries

Out-of-Distribution Detection. In an OOD detection setup, it is assumed that there are two sets: an ID dataset and an OOD dataset. We denote the ID dataset as $\mathcal{D}^{\text{in}}$, which consists of pairs $(\mathbf{x}^{\text{in}},y^{\text{in}})$, where $\mathbf{x}^{\text{in}}$ represents the ID data, and $y^{\text{in}}\in\mathcal{Y}^{\text{in}}:=\{1,\dots,K\}$ denotes the class label. Let $\mathcal{D}^{\text{out}}$ represent the OOD dataset, containing pairs $(\mathbf{x}^{\text{out}},y^{\text{out}})$, where $y^{\text{out}}\in\mathcal{Y}^{\text{out}}:=\{K+1,\dots,K+O\}$, and $\mathcal{Y}^{\text{out}}\cap\mathcal{Y}^{\text{in}}=\emptyset$ (; ). In practice, different datasets are often used for $\mathcal{D}^{\text{in}}$ and $\mathcal{D}^{\text{out}}$. Alternatively, another scenario is called open-set recognition, where a subset of classes within a dataset is considered as ID, while the remaining classes are considered as OOD (; ; ; ). A trained model $\mathcal{F}$ assigns an OOD score $S_{\mathcal{F}}$ to each test input, with higher scores indicating a greater likelihood of being OOD.

Adversarial Attack on OOD Detectors.
Adversarial attacks involve perturbing an input sample $x$ to generate an adversarial example $x^{*}$ that maximizes the loss function $\ell(x^{*};y)$. The perturbation magnitude is constrained by $\epsilon$ to ensure that the alteration remains imperceptible. Formally, the adversarial example is defined as $x^{*}=\arg\max_{x^{\prime}}\ell(x^{\prime};y)$, subject to $\|x-x^{*}\|_{p}\leq\epsilon$, where $p$ denotes the norm (e.g., $p=2$, $\infty$) (; ; ). A widely used attack method is Projected Gradient Descent (PGD) (), which iteratively maximizes the loss by following the gradient sign of $\ell(x^{*};y)$ with a step size $\alpha$. For adversarial evaluation (; ; ), we adapt this approach by targeting the OOD score $S_{\mathcal{F}}(x)$. Specifically, the adversarial attack aims to mislead the detector by increasing the OOD score for ID samples and decreasing it for OOD samples, causing misprediction:
$x_{0}^{*}=x,\quad x_{t+1}^{*}=x_{t}^{*}+\alpha\cdot\operatorname{sign}\left(
\mathbb{I}(y)\cdot\nabla_{x}S_{\mathcal{F}}(x_{t}^{*})\right),\quad x^{*}=x_{n
}^{*},$
where $n$ is the number of steps, and $\mathbb{I}(y)=+1$ if $y\in\mathcal{Y}^{\text{in}}$ and $-1$ if $y\in\mathcal{Y}^{\text{out}}$. This approach is consistently applied across all attacks considered in our study.

Neural ODE and Stability. In the NODE framework, the input and output are treated as two distinct states of a continuous dynamical system, whose evolution is described by trainable layers parameterized by weights $\phi$ and denoted as $h_{\phi}$. The state of the neural ODE, represented by $Z$, evolves over time according to these dynamics, establishing a continuous mapping between the input and output (; ; ). The relationship between the input and output states is governed by the following differential equations:
$\quad\quad\frac{dz(t)}{dt}=h_{\phi}(z(t),t),\quad z(0)=z_{\text{input}},\quad z
(T)=z_{\text{output}}.$

## 3 Related Work

OOD Detection Methods. Existing OOD detection methods can be broadly categorized into post-hoc and training-based approaches.
Post-hoc methods involve training a classifier on ID data and subsequently using statistics from the classifier’s outputs or intermediate representations to identify OOD samples.
For instance, Hendrycks et al. () propose using the maximum softmax probability distributions (MSP) as a metric. The MD method () leverages the Mahalanobis Distance in the feature space, and OpenMax () recalibrates classification probabilities to improve OOD detection.
Training-based methods, on the other hand, modify the training process to enhance OOD detection capabilities. Such modifications can include defining additional loss functions, employing data augmentation techniques, or incorporating auxiliary networks. Examples of training-based methods designed for standard OOD detection include VOS (), DHM (), CATEX (), and CSI (). On the other hand, ATOM (), ALOE (), ATD (), and RODEO () have been developed specifically for robust OOD detection. For detailed descriptions of these methods, please refer to Appendix A1.

Stable NODE for Robustness.
TiSODE () introduces a time-invariant steady NODE to constrain trajectory evolution by keeping the integrand close to zero. Recent works employ Lyapunov stability theory to develop provable safety certificates for neural network systems, particularly in classification tasks. PeerNets () was among the first to use control theory and dynamical systems to improve robustness. Kolter et al. () designed a Lyapunov function using neural network architectures to stabilize a base dynamics model’s equilibrium. ASODE () uses non-autonomous NODEs with Lyapunov stability constraints to mitigate adversarial perturbations in slowly time-varying systems. LyaDEQ () introduces a new module based on ICNN () into its pipeline, leveraging deep equilibrium models and learning a Lyapunov function to enhance stability. SODEF () enhances robustness against adversarial attacks by applying regularizers to stabilize the behavior of NODE under the time-invariant assumption. In Table 4.3, we analyze these stability-based classifiers as OOD detectors and highlight the potential of Lyapunov’s theorem as a framework for robust OOD detection, and show our method’s ability to improve performance over these excellent baselines.

Figure: Figure 2: An illustration of AROS. (A) To obtain robust initial features for OOD detection, we perform adversarial training on a classifier using only ID samples. (B) We estimate the ID distribution within the embedding space and generate fake OOD embeddings as a proxy for real OOD data. This enables the creation of two balanced classes of samples: ID and fake OOD. (C) The model incorporates a NODE layer $h_{\phi}$ and an Orthogonal Binary Layer $B_{\eta}$. Using these two classes, we train the pipeline with the loss function $\mathcal{L}_{\text{SL}}$ to stabilize the system dynamics. (D) During inference, an input passes through the feature extractor $f_{\theta}$, NODE $h_{\phi}$, and Orthogonal Binary Layer $B_{\eta}$, and the resulting likelihood from $B_{\eta}$ serves as the OOD score. The complete algorithmic workflow of AROS can be found in Appendix A2.
Refer to caption: extracted/5926083/Figures/Figure2.jpg

## 4 Proposed Method

Motivation. A robust detector should be resistant to shifting ID test samples to OOD, and vice versa, under adversarial attack. A common approach for developing robust OOD detectors involves employing adversarial training on ID data, combined with an auxiliary real OOD dataset, to expose the detector to potential vulnerable perturbations. The core intuition is that adversarial training on ID data alone, without an accompanying OOD dataset, leaves the detector susceptible to perturbations that alter the boundary between ID and OOD data during testing (; ; ; ; ; ; ; ; ; ; ). Beyond the unsatisfactory performance of the prior approach, there are further challenges with this strategy. A key issue is the cost of preparing an auxiliary dataset disjoint from the ID data, along with ensuring that the selected OOD images adequately cover the boundary between ID and OOD samples—a critical factor for such frameworks (; ; ; ). Moreover, adversarial training of neural networks is notably more data-intensive than standard setups, further increasing complexity (; ; ; ). There is also the concern that exclusively relying on perturbed OOD data may introduce biases toward specific OOD examples (; ). To address these challenges, we propose AROS, which utilizes provable stability theorems in the embedding space to develop a robust OOD detector without requiring exposure to perturbed OOD image data.

Overview of AROS. AROS ensures that perturbed input samples remain close to their non-perturbed counterparts in the feature space by leveraging the Lyapunov stability theorem (; ; ; ). By using a NODE, we consider the model as a dynamical system and design it so that ID and OOD samples converge to distinct stable equilibrium points of that system. This approach prevents significant deviations in the output when adversarial perturbations are applied. However, since OOD data is unavailable, we craft fake OOD samples in the embedding space by estimating the boundaries of the ID distribution and sampling from the corresponding low-likelihood regimes. To further avoid any misprediction between OOD and ID data caused by perturbations, we maximize the distance between their equilibrium points by leveraging an orthogonal binary layer for classification. In the following sections, we will thoroughly explain each proposed component, highlighting the benefits of our approach.

### 4.1 Fake Embedding Crafting Strategy

There have been efforts to utilize synthetic features, primarily under clean scenarios (; ; ; ). However, for adversarial settings, prior work has often relied on a large pre-trained model and additional data. In contrast, our approach limits information to ID samples, proposing to craft OOD data from ID data in the embedding space. These generated OOD samples are subsequently utilized in the training step.

We employ a well-trained encoder to transform ID training data into robust embedding spaces. To achieve these embeddings, we first adversarially train a classifier on ID training samples using cross-entropy loss $\mathcal{L}_{\text{CE}}$ and the $\text{PGD}^{10}$($l_{\infty}$) attack. By removing the last fully connected layer from the classifier, we utilize the remaining encoder, denoted as $f_{\theta}$, to extract ID embeddings $r$, where $r=f_{\theta}(x)$ from an ID training sample $x$ (Figure 2A). Specifically, by considering $\mathcal{D}_{\text{train}}^{\text{in}}$ with $K$ classes, we estimate their distribution as a $K$ class-conditional Gaussian distribution, a well-known approach in the detection literature (; ; ; ; ; ).

We then select fake embeddings $r$ from the feature space corresponding to class $j$, where $j=1,\dots,K$, such that $r\sim\mathcal{N}(\hat{\mu}_{j},\hat{\Sigma}_{j})$ satisfies:

$\quad\quad\quad\quad\quad\quad p(r\mid y=j)=\frac{1}{(2\pi)^{d/2}|\hat{\Sigma}
_{j}|^{1/2}}\exp\left(-\frac{1}{2}(r-\hat{\mu}_{j})^{T}\hat{\Sigma}_{j}^{-1}(r
-\hat{\mu}_{j})\right)<\beta,\quad\quad\quad\quad(1)$

where we choose $\beta$ to be very small (e.g., 0.001) (Figure 2B); we also conduct an ablation study for different values of $\beta$ (see Appendix A3). Here, $d$ is the dimensionality of the feature vectors $r$, and $j=1,\dots,K$. The terms $\hat{\mu}_{j}$ and $\hat{\Sigma}_{j}$ represent the mean vector and covariance matrix of the $j$-th class of ID training samples in feature space, respectively:

$\quad\quad\quad\quad\quad\hat{\mu}_{j}=\frac{1}{n_{j}}\sum_{i:y_{i}=j}f_{
\theta}(x_{i}),\quad\hat{\Sigma}_{j}=\frac{1}{n_{j}-1}\sum_{i:y_{i}=j}(f_{
\theta}(x_{i})-\hat{\mu}_{j})(f_{\theta}(x_{i})-\hat{\mu}_{j})^{T},\quad\quad(2)$

where $n_{j}$ is the number of samples in class $j$. By sampling equally across each class of $\mathcal{D}^{\text{in}}_{\text{train}}$, we generate a set of synthetic, “fake” OOD embeddings (Figure 2C), denoted as $r_{\text{OOD}}$. We then construct a balanced training set by taking the union of the embeddings of ID samples and the OOD embeddings, defining it as:
$X_{\text{train}}=\left\{f_{\theta}(\mathcal{D}^{\text{in}}_{\text{train}})\cup
r
_{\text{OOD}}\right\}.$
We define the labels $y$ for this set as 0 for ID and 1 for fake OOD embeddings.
Lastly, at test-time we use this system to then predict the OOD score (Figure 2D).

### 4.2 Lyapunov Stability for Robust OOD Detection

As mentioned, several approaches have been proposed to apply Lyapunov’s theorem to deep networks in practice, including methods such as LyaDEQ (), ASODE (), and SODEF (). Here, we utilize their framework to define the objective function and also benchmark our approach to these baselines. Amongst them, SODEF adopts a time-invariant (; ) assumption, which makes stability analysis more practical, as the behavior of the neural ODE depends solely on the state $z(t)$, independent of the specific time that the state is reached. This assumption implies that the equilibrium points of the NODE remain constant over time, facilitating a more tractable analysis of how perturbations evolve around these points (; ; ). This is supported by our experiments in Table 4.3, which highlight SODEF’s superior robustness. Consequently, we adopt the time-invariant framework and use their approach to define the loss function. In order to gain intuition for our approach, we provide the basic mathematical overview of how we leverage the Lyapunov theorems. In this study, as a practical consideration, we assume that the networks utilized have continuous first derivatives with respect to the input $z(0)$, which has been shown to be a reasonable assumption ().

For a given dynamic system $\frac{dz(t)}{dt}=h_{\phi}(z(t))$, a state $z^{\star}$ is an equilibrium point of system if $z^{\star}$ satisfies $h(z^{\star})=0$. An equilibrium point is stable if the trajectories starting near $z^{\star}$ remain around it all the time. More formally:

Definition 1: (Lyapunov stability ()). An equilibrium $z^{\star}$ is said to be stable in the sense of Lyapunov if, for every $\varepsilon>0$, there exists $\delta>0$ such that, if $\|z(0)-z^{\star}\|<\delta$, then $\|z(t)-z^{\star}\|<\varepsilon$ for all $t\geq 0$. If $z^{\star}$ is stable, and
$\lim_{t\to\infty}\|z(t)-z^{\star}\|=0,$
$z^{\star}$ is said to be asymptotically stable.

Theorem 1: (Hartman–Grobman Theorem ()). Consider a time-invariant system with continuous first derivatives, represented by $\frac{d\mathbf{z}(t)}{dt}=h(\mathbf{z}(t))$.
For a fixed point $\mathbf{z}^{*}$, if the Jacobian matrix $\nabla h$ evaluated at $\mathbf{z}^{*}$ has no eigenvalues with a real part equal to zero, the behavior of the original nonlinear dynamical system can be analyzed by studying the linearization of the system around this fixed point. The linearized system is given by $\frac{d\mathbf{z}^{\prime}(t)}{dt}=\mathbf{A}\mathbf{z}^{\prime}(t),$
where $\mathbf{A}$ is the Jacobian matrix evaluated at $\mathbf{z}^{*}$. This allows for a simplified analysis of the local dynamics in the vicinity of $\mathbf{z}^{*}$.

Theorem 2: (Lyapunov Stability Theorem ()) The equation
$\frac{d\mathbf{z}^{\prime}(t)}{dt}=\mathbf{A}\mathbf{z}^{\prime}(t),$
is asymptotically stable if and only if all eigenvalues of $\mathbf{A}$ have negative real parts.

Theorem 3: (Levy–Desplanques Theorem ()) Let $A=[a_{ij}]$ be an $n$-dimensional square matrix and suppose it is strictly diagonally dominant, i.e., $|a_{ii}|\geq\sum_{i\neq j}|a_{ij}|\ \text{and}\ a_{ii}\leq 0$ for all $i$. Then every eigenvalue of $A$ has a negative real part.

Definition 1 introduces the concept of asymptotic stability. Building on this, Theorem 1 demonstrates that the behavior of a nonlinear, time-invariant system near a fixed point can be effectively analyzed through its linearization. Theorem 2 then establishes a key condition for the asymptotic stability of linear systems: all eigenvalues of the system matrix must have negative real parts. To facilitate the verification of this stability condition, Theorem 3 provides a practical criterion based on the matrix’s eigenvalues. In the subsequent section, we will introduce an objective function designed to adhere to these stability criteria.

### 4.3 Orthogonal Binary Layer and Training Step

We propose incorporating an orthogonal binary layer () denoted as $B_{\eta}$ after the NODE $h_{\phi}$ in our pipeline to maximize the distance between the equilibrium points of ID and OOD data. Intuitively, this layer prevents the misalignment of convergence between perturbed OOD data and ID data by maximizing the distance between their equilibrium points. Given the output $z$ from the $h_{\phi}$, the orthogonal binary layer $B_{\eta}$ applies a transformation using weights $w$ such that $w^{T}w=I$, ensuring orthogonality. Although Lyapunov stability encourages perturbed inputs to converge to neighborhoods of their unperturbed counterparts, the infinite-depth nature of NODE () makes them susceptible to degraded activations due to exploding or vanishing gradients (). The introduction of an orthogonal layer mitigates this risk. Moreover, encouraging orthogonality within neural networks has demonstrated multiple benefits, such as preserving gradient norms and enforcing low Lipschitz constants—both of which contribute to enhanced robustness (; ; ).

To satisfy the aforementioned conditions, we optimize the following empirical Lagrangian $\mathcal{L}_{\text{SL}}$ with training data $(X_{\text{train}},y)$:

$$ $\displaystyle\mathcal{L}_{\text{SL}}=\min_{\phi,\eta}\frac{1}{\left|X_{\text{ train}}\right|}\Bigg{(}$ $\displaystyle\ell_{\text{CE}}(B_{\eta}(h_{\phi}(X_{\text{train}})),y)+\gamma_{ 1}\|h_{\phi}(X_{\text{train}})\|_{2}+\gamma_{2}\text{exp}\left(-\sum_{i=1}^{n} [\nabla h_{\phi}(X_{\text{train}})]_{ii}\right)$ $\displaystyle+\gamma_{3}\text{exp}\left(\sum_{i=1}^{n}\left(-|[\nabla h_{\phi} (X_{\text{train}})]_{ii}|+\sum_{j\neq i}|[\nabla h_{\phi}(X_{\text{train}})]_{ ij}|\right)\right)\Bigg{)}$ (3) $$

Note that here, $X_{\text{train}}$ serves as the initial hidden state, i.e., $z(0)$, for the NODE layer. The first term, $\ell_{\text{CE}}$, is a cross-entropy loss function. The second term forces $z(0)$ to be near the equilibrium points, while the remaining terms ensure strictly diagonally dominant derivatives, as described in Theorem 3. The $\text{exp}(.)$ function is selected as a monotonically increasing function with a minimum bound to limit the unbounded influence of the two regularizers, preventing them from dominating the loss. We choose the hyperparameters as $\gamma_{1}=1$ and $\gamma_{2}=\gamma_{3}=0.05$, and we discuss the ablation study on these hyperparameters, as well as other training step details, in Appendix A4. By optimizing this objective function, the model learns Lyapunov-stable representations where ID and OOD equilibrium points are well-separated in the feature space after the NODE. The $B_{\eta}$ captures the probability distribution over the binary classes (ID vs. fake OOD), and for the OOD score of an input $x$, we use its probability assigned to the OOD class.

**Table 1: Table 1. Performance of OOD detection methods under clean evaluation, random corruption (Gaussian noise), and PGD ($l_{\infty}$) adversarial attack with 1000 steps and $\frac{8}{255}$, as well as AutoAttack and Adaptive AutoAttack (AA), measured by AUROC (%). A clean evaluation is one where no attack is made on the data. For corruption evaluation, Gaussian noise from the ImageNet-C () benchmark was used. The best results are highlighted in bold, and the second-best results are underlined in each row.**
| Dataset<br>Attack<br>Method<br>$\mathcal{D}_{in}$<br>$\mathcal{D}_{out}$<br>VOS<br>DHM<br>CATEX^∗<br>CSI<br>ATOM${}^{\text{\textdagger}}$<br>ALOE${}^{\text{\textdagger}}$<br>ATD${}^{\text{\textdagger}*}$<br>RODEO${}^{\text{\textdagger}*}$<br>AROS<br>(ResNet)<br>(WideResNet)<br>(CLIP)<br>(ResNet)<br>(DenseNet)<br>(WideResNet)<br>(WideResNet)<br>(CLIP)<br>(WideResNet)<br>CIFAR10<br>CIFAR100<br>Clean<br>87.9<br>100.0<br>88.3<br>92.2<br>94.2<br>78.8<br>82.0<br>75.6<br>88.2<br>Corruption<br>56.2<br>57.7<br>60.4<br>54.7<br>57.3<br>54.5<br>59.2<br>58.6<br>84.3<br>${\text{PGD}}^{1000}$<br>4.2<br>1.8<br>0.8<br>3.6<br>1.6<br>16.1<br>37.1<br>37.8<br>80.1<br>AutoAttack<br>0.0<br>1.2<br>0.0<br>0.4<br>0.5<br>14.8<br>36.2<br>35.9<br>78.9<br>AdaptiveAA<br>0.0<br>0.0<br>1.7<br>0.0<br>0.0<br>11.5<br>34.8<br>32.3<br>76.4<br>CIFAR100<br>CIFAR10<br>Clean<br>71.3<br>100.0<br>85.1<br>53.2<br>87.5<br>43.6<br>57.5<br>61.5<br>74.3<br>Corruption<br>53.8<br>58.2<br>57.4<br>50.1<br>55.3<br>56.1<br>56.0<br>54.9<br>71.8<br>${\text{PGD}}^{1000}$<br>5.4<br>0.0<br>4.0<br>2.8<br>2.0<br>1.3<br>12.1<br>29.0<br>67.0<br>AutoAttack<br>2.6<br>0.0<br>0.3<br>0.9<br>0.0<br>0.0<br>10.5<br>28.3<br>66.5<br>AdaptiveAA<br>0.0<br>1.4<br>0.0<br>0.0<br>0.0<br>0.2<br>9.4<br>26.7<br>65.2 |
| --- |

**(a) Table 2a. Performance of OOD detection methods under clean evaluation and $\text{PGD}^{1000}(l_{\infty})$ measured by AUROC (%). The perturbation budget $\epsilon$ is set to $\frac{8}{255}$ for low-resolution datasets and $\frac{4}{255}$ for high-resolution datasets. The table cells denote results in the ‘ Clean/$\text{PGD}^{1000}$ ’ format.**
|  |
| --- |
|  |

**Table 3: Table 3. Performance of OOD detection methods under various types of non-adversarial perturbations, referred to as image corruptions, as introduced in the CIFAR-10-C and CIFAR-100-C datasets (), measured by AUROC (%). Specifically, test inputs, including both ID and OOD, are perturbed with a particular corruption in each experiment.**
| Dataset<br>Methods<br>Corruption<br>Mean<br>$\mathcal{D}_{in}$<br>$\mathcal{D}_{out}$<br>Gauss.<br>Shot<br>Impulse<br>Defocus<br>Glass<br>Motion<br>Zoom<br>Snow<br>Frost<br>Fog<br>Bright<br>Contrast<br>Elastic<br>Pixel<br>JPEG<br>CIFAR-10-C<br>CIFAR-100-C<br>VOS<br>56.2<br>67.5<br>76.5<br>77.7<br>73.9<br>78.7<br>76.3<br>72.0<br>54.1<br>77.0<br>58.5<br>79.1<br>81.2<br>83.6<br>74.4<br>72.5<br>DHM<br>57.7<br>78.7<br>72.4<br>75.4<br>75.6<br>73.9<br>77.5<br>75.8<br>70.8<br>56.8<br>74.5<br>58.0<br>77.4<br>78.4<br>80.6<br>72.2<br>CATEX<br>62.4<br>80.9<br>73.0<br>78.4<br>76.3<br>78.6<br>81.3<br>79.9<br>78.9<br>58.3<br>80.0<br>54.0<br>79.0<br>80.5<br>82.4<br>74.9<br>CSI<br>54.7<br>58.0<br>58.7<br>62.9<br>61.7<br>69.0<br>65.9<br>77.2<br>69.2<br>74.8<br>91.9<br>65.8<br>74.2<br>62.6<br>74.9<br>68.1<br>ATOM<br>57.3<br>75.5<br>63.6<br>70.7<br>72.2<br>69.9<br>74.6<br>77.2<br>76.5<br>55.3<br>80.5<br>54.1<br>74.7<br>77.4<br>80.8<br>70.7<br>ALOE<br>54.5<br>76.4<br>64.0<br>71.5<br>73.0<br>70.9<br>75.5<br>78.2<br>77.9<br>56.3<br>81.5<br>54.0<br>76.9<br>79.3<br>82.1<br>71.5<br>ATD<br>59.2<br>79.2<br>71.0<br>76.7<br>76.9<br>75.6<br>79.5<br>78.2<br>74.9<br>59.5<br>77.8<br>59.5<br>79.0<br>80.8<br>82.9<br>73.7<br>RODEO<br>58.6<br>76.0<br>68.5<br>73.5<br>73.8<br>72.1<br>75.5<br>74.5<br>70.9<br>57.8<br>74.5<br>57.7<br>75.3<br>76.8<br>79.5<br>71.0<br>AROS<br>84.3<br>76.5<br>79.2<br>83.8<br>77.3<br>82.0<br>81.3<br>83.4<br>84.0<br>84.0<br>84.7<br>83.3<br>80.7<br>79.6<br>82.5<br>81.8<br>CIFAR-100-C<br>CIFAR-10-C<br>VOS<br>53.8<br>55.7<br>65.6<br>58.2<br>47.1<br>51.4<br>57.6<br>53.9<br>59.0<br>57.2<br>56.5<br>54.8<br>48.2<br>59.4<br>51.1<br>55.3<br>DHM<br>58.2<br>59.9<br>64.0<br>57.7<br>48.9<br>58.0<br>57.4<br>57.6<br>58.5<br>57.9<br>58.1<br>58.3<br>49.8<br>55.6<br>56.7<br>57.1<br>CATEX<br>57.4<br>60.2<br>65.7<br>59.6<br>64.9<br>62.9<br>59.3<br>67.5<br>61.4<br>59.8<br>60.0<br>64.2<br>56.8<br>57.5<br>58.6<br>61.0<br>CSI<br>50.1<br>48.8<br>50.6<br>47.8<br>47.5<br>46.9<br>46.8<br>50.6<br>50.3<br>51.8<br>49.9<br>52.2<br>42.9<br>48.0<br>47.7<br>48.8<br>ATOM<br>55.3<br>51.2<br>53.1<br>50.2<br>49.9<br>49.2<br>49.6<br>53.1<br>52.8<br>54.4<br>52.4<br>54.8<br>45.0<br>50.4<br>50.8<br>51.5<br>ALOE<br>56.1<br>53.4<br>62.8<br>54.5<br>51.8<br>54.9<br>54.1<br>54.4<br>55.6<br>54.8<br>52.7<br>56.4<br>47.8<br>51.7<br>53.2<br>54.3<br>ATD<br>56.0<br>57.4<br>61.5<br>57.5<br>44.8<br>57.1<br>54.2<br>56.9<br>58.3<br>55.2<br>53.7<br>57.5<br>49.3<br>50.8<br>56.0<br>55.1<br>RODEO<br>54.9<br>58.1<br>60.6<br>56.4<br>51.0<br>60.5<br>58.9<br>58.4<br>57.9<br>54.6<br>57.4<br>52.3<br>52.7<br>53.5<br>51.2<br>55.9<br>AROS<br>71.8<br>74.8<br>67.7<br>59.6<br>72.6<br>73.9<br>65.7<br>68.5<br>64.4<br>59.8<br>75.0<br>64.2<br>72.8<br>69.5<br>58.6<br>67.9 |
| --- |

**(a) Table 4a. Comparison of post-hoc OOD detection methods using different classifiers trained with various strategies and evaluated with multiple scoring functions. The comparison ( Clean/$\text{PGD}^{1000}$) is conducted under clean and $\text{PGD}^{1000}$ conditions, measured by AUROC (%).**
| Classifier | Posthoc | CIFAR-10 | CIFAR-100 |  |  |
| --- | --- | --- | --- | --- | --- |
| Method | CIFAR-100 | SVHN | CIFAR-10 | SVHN |  |
| MSP | 87.9/0.0 | 91.8/1.4 | 75.4/0.2 | 71.4/3.6 |  |
| Standard | MD | 88.5/4.3 | 99.1/0.6 | 75.0/1.9 | 98.4/0.6 |
|  | OpenMax | 86.4/0.0 | 94.7/2.8 | 77.6/0.0 | 93.9/4.2 |
|  | MSP | 79.3/16.0 | 85.1/19.7 | 67.2/10.7 | 74.6/11.3 |
| AT | MD | 81.4/25.6 | 88.2/27.5 | 71.8/15.0 | 81.5/19.7 |
|  | OpenMax | 82.4/27.8 | 86.5/26.9 | 80.0/16.4 | 75.4/22.9 |
|  | MSP | 84.2/10.6 | 89.3/15.4 | 69.7/12.5 | 76.1/23.8 |
| ODENet | MD | 80.7/9.1 | 84.6/13.0 | 66.4/14.8 | 72.9/16.4 |
|  | OpenMax | 83.8/14.2 | 87.4/20.9 | 70.3/15.6 | 75.6/18.2 |
|  | MSP | 77.5/56.5 | 83.7/58.5 | 69.1/48.0 | 69.4/53.3 |
| LyaDEQ | MD | 79.1/56.9 | 82.0/56.5 | 60.3/ 53.4 | 69.3/54.2 |
|  | OpenMax | 76.0/47.4 | 77.5/56.5 | 67.8/57.1 | 73.3/ 58.0 |
|  | MSP | 76.3/56.3 | 80.5/62.5 | 64.6/44.9 | 64.6/58.9 |
| ASODE | MD | 74.9/49.5 | 76.1/54.4 | 59.3/ 52.0 | 72.1/55.1 |
|  | OpenMax | 72.6/44.2 | 75.9/57.9 | 66.1/52.1 | 80.5/ 50.4 |
|  | MSP | 83.5/61.9 | 86.4/65.3 | 67.2/53.1 | 73.7/60.4 |
| SODEF | MD | 75.4/57.7 | 81.9/64.2 | 65.8/58.4 | 71.8/62.5 |
|  | OpenMax | 82.8/65.3 | 86.4/69.1 | 66.3/56.6 | 75.2/64.9 |
| \cdashline1-6<br>AROS | N/A | 88.2/80.1 | 93.0/86.4 | 74.3/67.0 | 82.5/70.6 |

## 5 Experiments

Here we present empirical evidence to validate the effectiveness of our method under various setups, including adversarial attacks, corrupted inputs (non-adversarial perturbations), and clean inputs (non-perturbed scenarios).

First, we adversarially train a classifier on ID data and then use it to map the data into a robust embedding space. A Gaussian distribution is fitted around these embeddings, and low-likelihood regions of the distribution are sampled to create fake OOD data as a proxy for OOD test samples. We then demonstrate that time invariance, which establishes that the NODE’s behavior does not explicitly depend on time, leads to more stable behavior of the detector under adversarial attacks (see Section 5). Consequently, we leverage Lyapunov stability regularization under a time-invariant assumption for training. However, a potential challenge arises when ID and OOD equilibrium points are located near each other. As a remedy, we introduce an orthogonal binary layer (; ; ) that increases the separation between ID and OOD equilibrium points, thereby expanding the stability region around each point. This enhances the model’s robustness against shifting adversarial samples from OOD to ID and vice versa. Finally, we use the orthogonal binary layer’s confidence output as the OOD score during inference.

Experimental Setup & Datasets. We evaluated OOD detection methods under both adversarial and clean scenarios (see Tables 1 and 2(a)). Each experiment utilized two disjoint datasets: one as the ID dataset and the other as the OOD test set. For Table 1, CIFAR-10 or CIFAR-100 () served as the ID datasets. Table 2(a) extends the evaluation to ImageNet-1k as the ID dataset, with OOD datasets being comprised of Texture (), SVHN (), iNaturalist (), Places365 (), LSUN (), and iSUN () – all sourced from disjoint categories ().

An OSR () setup was also tested, in which each experiment involved a single dataset that was randomly split into ID (60%) and OOD (40%) subclasses, with results averaged over 10 trials. Datasets used for OSR included CIFAR-10, CIFAR-100, ImageNet-1k, MNIST (), FMNIST (), and Imagenette () (Table 2(b)). Additionally, models were evaluated on corrupted data using the CIFAR-10-C and CIFAR-100-C benchmarks () (see Table 3). Specifically, both the ID and OOD data were perturbed with corruptions that did not alter semantics but introduced slight distributional shifts during testing. Further details on the datasets are provided in Appendix A5.

Evaluation Details. For adversarial evaluation, all ID and OOD test data were perturbed by using a fully end-to-end PGD ($l_{\infty}$) attack targeting their OOD scores (as described in Section 2). We used $\epsilon=\frac{8}{255}$ for low-resolution images and $\epsilon=\frac{4}{255}$ for high-resolution images. The PGD attack steps denoted as $M$ were set to 1000, with 10 random initializations sampled from the interval $(-\epsilon,\epsilon)$. The step size for the attack was set to $\alpha=2.5\times\frac{\epsilon}{M}$ (). Additionally, we considered AutoAttack and Adaptive AutoAttack (Table 1). Details on how these attacks are tailored for the detection task can be found in Appendix A4. As the primary evaluation metric, we used AUROC, representing the area under the receiver operating characteristic curve. Additionally, we used AUPR and FPR95 as supplementary metrics, with results presented in Table 4.3. AUPR represents the area under the precision-recall curve, while FPR95 measures the false positive rate when the model correctly identifies 95% of the true positives.

Reported and Re-Evaluated Results. Some methods may show different results here compared to those reported in their original papers (; ) due to our use of stronger attacks we incorporated for evaluation, or the more challenging benchmarks used. For example, ALOE () considered a lower perturbation budget for evaluation (i.e.,$\frac{1}{255}$), and the ATD () and RODEO () benchmarks used CIFAR-10 vs. a union of several datasets, rather than CIFAR-10 vs. CIFAR-100. The union set included datasets such as MNIST, which is significantly different from CIFAR-10, leading to a higher reported robust performance.

Results Analysis.
Without relying on additional datasets or pretrained models, AROS significantly outperforms existing methods in adversarial settings, achieving up to a 40% improvement in AUROC and demonstrating competitive results under clean setups (see Table 2(b)). Specifically, AROS also exhibits greater robustness under various corruptions, further underscoring its effectiveness in OOD detection. We further verify our approach through an extensive ablation study of various components in AROS (see Section 6).

We note the superiority of AROS compared to representative methods in terms of robust OOD detection. Notably, AROS, without relying on pre-trained models or extra datasets, improves adversarial robust OOD detection performance from 45.9% to 74.0%. In the OSR setup, the results increased from 52.1% to 69.3%. Similar gains are observed in robustness against corruptions, as shown in Table 3.

For instance, performance improved from 72.5% to 81.8% on the CIFAR-10-C vs. CIFAR-100-C setup, and from 61.0% to 67.9% on the CIFAR-100-C vs. CIFAR-10-C benchmark. Meanwhile, AROS achieves competitive results in clean scenarios (82.0%) compared to state-of-the-art methods like DHM (93.4%), though it should be noted that DHM performs near zero under adversarial attacks. The trade-off between robustness and clean performance is well-known in the field (; ; ), and AROS offers the best overall balance among existing methods. Furthermore, we demonstrate that by using pre-trained models or auxiliary data, AROS’s clean performance can be further improved (see Appendix A3). Moreover, we provide additional experiments in Appendix A3 to support our claims.

Classifier Training Strategies for Robust OOD Detection.
We assessed the impact of different training strategies on the robust OOD detection performance of various classifiers, including those trained with standard training, adversarial training (AT), and NODE-based methods such as ODENet, LyaDEQ, SODEF, and ASODE. To utilize these classifiers as OOD detectors, various post-hoc score functions were applied, as described in Section 3. The results are presented in Table 4.3. In brief, adversarially trained classifiers exhibit enhanced robustness compared to standard training but still fall short of optimal performance. Furthermore, the time-invariance assumption in SODEF leads to improved robust performance relative to ODENet, LyaDEQ, and ASODE by effectively constraining the divergence between output states, which motivated us to explore similar frameworks. Notably, AROS demonstrates superior performance compared to all these approaches.

Implementation details.
We use a WideResNet-70-16 model as $f_{\theta}$ () and train it for 200 epochs on classification using ${\text{PGD}}^{10}$. For the integration of $h_{\phi}$, an integration time of $T=5$ is applied. To implement the orthogonal layer $B_{\eta}$, we utilize the geotorch.orthogonal library. Training with the loss $\mathcal{L}_{\text{SL}}$ is performed over 100 epochs. We used SGD as the optimizer, employing a cosine learning rate decay schedule with an initial learning rate of 0.05 and a batch size of 128. See Appendix  A3 for more details and additional ablation studies on different components of AROS.

## 6 Ablation Study

AROS Components. To verify the effectiveness of AROS, we conducted ablation studies across various datasets. The corresponding results are presented in Table 4. In each experiment, individual components were replaced with alternative ones, while the remaining elements were held constant. In Config A, we ignored the designed loss function $\mathcal{L}_{\text{SL}}$ and instead utilized the cross-entropy loss function $\mathcal{L}_{\text{CE}}$ for binary classification. Config B represents the scenario in which we train the classifier in the first step without adversarial training on the ID data, instead using standard training. This reduces robustness as $f_{\theta}$ becomes more susceptible to perturbations within ID classes, ultimately making the final detector more vulnerable to attacks. In Config C, the orthogonal binary layer was replaced with a regular binary layer. In Config D, rather than estimating the ID distribution and sampling OOD data in the embedding space, we substituted this process by creating random noise in the embedding space as fake OOD data. This removes the conditioning of the fake OOD distribution on the ID data and, as a result, makes them unrelated. This is in line with previous works that have shown that related and nearby auxiliary OOD samples are more useful (; ). Config E represents our default pipeline. Finally, in Config F, we extended AROS by augmenting the fake OOD embedding data with additional OOD images (i.e., Food-101 ()) alongside the proposed fake OOD strategy. Specifically, we transformed these additional OOD images into the embedding space using $f_{\theta}$ and combined them with the crafted fake embeddings, which led to enhanced performance.

## 7 Conclusions

In this paper we introduce AROS, a framework for improving OOD detection under adversarial attacks. By leveraging Lyapunov stability theory, AROS drives ID and OOD samples toward stable equilibrium points to mitigate adversarial perturbations. Fake OOD samples are generated in the embedding space, and a tailored loss function is used to enforce stability. Additionally, an orthogonal binary layer is employed to enhance the separation between ID and OOD equilibrium points. Limitations and future directions can be found in the Appendix A6.

Appendix

## Appendix A1 Review of Related Work

In our experimental evaluation we compare our results with works that have proposed a defense mechanism for their OOD detection method, as well as those that have not. We will describe each separately below. Subsequently, we will detail the post-hoc score functions.

Adversarially Robust OOD Detection Methods. Previous adversarially robust methods for OOD detection have built on the outlier exposure [] technique and conducted adversarial training on a union of exposed outliers and ID samples. These methods primarily aim to enhance the outlier exposure technique by improving the diversity of the extra OOD image dataset. To tackle this, ALOE leverages an auxiliary OOD dataset and perturbs the samples to adversarially maximize the KL-divergence between the model’s output and a uniform distribution. It is important to note that the adversarial evaluation in their pipeline was less rigorous than that in our approach, due primarily to the limited budget allocated for adversarial attacks. ATOM, in contrast, selectively samples informative outliers rather than using random outliers. The adversarial evaluation of ATOM is also not entirely standard, as it exclusively targets OOD test samples. However, a more comprehensive approach would involve attacking both ID and OOD test samples to ensure enhanced robustness. Meanwhile, ATD employs a GAN to generate auxiliary OOD images for adversarial training, instead of relying on an external dataset. RODEO aims to demonstrate that enhancing the diversity of auxiliary OOD images, while maintaining their stylistic and semantic alignment with ID samples, will improve robustness. Consequently, they utilize a pretrained CLIP model [] and a diffusion model for OOD image synthesis.

Standard OOD Detection Methods.
CSI enhances the outlier detection task by building on standard contrastive learning through the introduction of ’distributionally-shifted augmentations’—transformations that encourage the model to treat augmented versions of a sample as OOD. This approach enables the model to learn representations that more effectively distinguish between ID and OOD samples. The paper also proposes a detection score based on the contrastive features learned through this training scheme, which demonstrates effectiveness across various OOD detection scenarios, including one-class, multi-class, and labeled multi-class settings. DHM involves modeling the joint density of data and labels in a single forward pass. By factorizing this joint density into three sources of uncertainty (aleatoric, distributional, and parametric), DHMs aim to distinguish in-distribution samples from OOD samples. To achieve computational efficiency and scalability, the method employs weight normalization during training and utilizes normalizing flows (NFs) to model the probability distribution of the features. The key idea is to use bi-Lipschitz continuous mappings, enabled by spectral normalization, which allows the use of state-of-the-art deep neural networks for learning expressive and geometry-preserving representations of data. VOS uses virtual outliers to regularize the model’s decision boundary and improve its ability to distinguish between ID and OOD data. The framework includes an unknown-aware training objective that uses contrastive learning to shape the uncertainty surface between the known data and the synthesized outliers. This method is effective for both object detection and image classification. CATEX use of two hierarchical contexts—perceptual and spurious—to describe category boundaries more precisely through automatic prompt tuning in vision-language models like CLIP. The perceptual context distinguishes between different categories (e.g., cats vs. apples), while the spurious context helps identify samples that are similar but not in-distribution (e.g., distinguishing cats from panthers). This hierarchical structure helps create more precise category boundaries.

Post-hoc Methods for OOD Detection. Post-hoc methods for OOD detection are approaches applied after training a classifier on ID samples. These methods utilize information from the classifier to indicate OOD detection. A simple but effective approach is the Maximum Softmax Probability (MSP) method. Applied to a $K$-class classifier $f_{c}$, MSP returns $\max_{c\in\{1,2,...,K\}}f_{c}(x)$ as the likelihood that the sample $x$ belongs to the ID set. In contrast, OpenMax replaces the softmax layer with a calibrated layer that adjusts the logits by fitting a class-wise probability model, such as the Weibull distribution. Another perspective on OOD detection is to measure the distance of a sample to class-conditional distributions. The Mahalanobis distance (MD) is a prominent method for this. For an ID set with $K$ classes, MD-based approaches fit a class-conditional Gaussian distribution $\mathcal{N}(\mu_{k},\Sigma)$ to the pre-logit features $z$. The mean vector and covariance matrix are calculated as follows:

$$ $\mu_{k}=\frac{1}{N}\sum_{i:y_{i}=k}z_{i},\quad\Sigma=\frac{1}{N}\sum_{k=1}^{K} \sum_{i:y_{i}=k}(z_{i}-\mu_{k})(z_{i}-\mu_{k})^{T},\quad k=1,2,...,K.$ $$

The MD for a sample $z^{\prime}$ relative to class $k$ is defined as: $MD_{k}(z^{\prime})=(z^{\prime}-\mu_{k})^{T}\Sigma^{-1}(z^{\prime}-\mu_{k}).$

The final score MD used for OOD detection is given by: $\text{score}_{\text{MD}}(x^{\prime})=-\min_{k}\{MD_{k}(z^{\prime})\}$

## Appendix A2 Algorithm

Here we provide pseudocode for our proposed AROS framework, designed for adversarially robust OOD detection. We begin by leveraging adversarial training on ID data to obtain robust feature representations, utilizing the well-known practice of adversarial training with 10-step PGD. These features are then used to fit class-conditional multivariate Gaussians, from which we sample low-likelihood regions to generate fake OOD embeddings, effectively creating a proxy for real OOD data in the embedding space. By constructing a balanced training set of ID and fake OOD embeddings, we then employ a stability-based objective using a NODE pipeline, coupled with an orthogonal binary layer. This layer maximizes the separation between the equilibrium points of ID and OOD samples, promoting a robust decision boundary under perturbations. During inference, we compute the OOD score based on the orthogonal binary layer’s output, enabling the model to reliably distinguish ID samples from OOD samples, even in the presence of adversarial attacks.

Figure: Algorithm 1 Adversarially Robust OOD Detection through Stability (AROS)

## Appendix A3 Supplementary Experimental Results and Details for AROS

### A3.1 Additional Experimental Results

Each experiment discussed in the main text was repeated 10 times, with the reported results representing the mean of these trials. Here, we provide the standard deviation across these runs, as summarized in Table 4(c).

**(c) Table 6a: Standard deviation of AROS performance under both clean and PGD, across 10 repeated experiments ‘ Clean/$\text{PGD}^{1000}$‘.**
| AROS | CIFAR-10 | CIFAR-100 | ImageNet-1k |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | CIFAR-100 | SVHN | LSUN | CIFAR-10 | SVHN | LSUN | Texture | iNaturalist | LSUN |
| Mean Performance | 88.2 / 80.1 | 93.0 / 86.4 | 90.6 / 82.4 | 74.3 / 67.0 | 81.5 /7 0.6 | 74.3 / 68.1 | 78.3 / 69.2 | 84.6 / 75.3 | 79.4 / 69.0 |
| Standard Deviation | $\pm$ 0.9 / $\pm$ 1.6 | $\pm$ 0.7 / $\pm$ 1.3 | $\pm$ 0.6/$\pm$ 0.9 | $\pm$ 1.3 / $\pm$ 1.8 | $\pm$ 1.4 / $\pm$ 2.0 | $\pm$ 1.8 / $\pm$ 2.3 | $\pm$ 2.5 / $\pm$ 3.1 | $\pm$ 1.9 / $\pm$ 3.0 | $\pm$ 2.8 / $\pm$ 3.7 |

#### A3.1.1 Comparative Analysis of AROS and Diffusion-Based Purification Methods

We present additional experiments to further demonstrate the effectiveness of AROS.
We compare AROS’s performance against diffusion-based (purification) methods, with results detailed in Table 4(d).

Purification techniques in adversarial training aim to enhance model robustness by ‘purifying’ or ‘denoising’ adversarial examples prior to feeding them into the model. The primary goal is to mitigate adversarial perturbations through preprocessing, often by leveraging neural networks or transformation-based methods to restore perturbed inputs to a state resembling clean data. A common approach involves training a generative diffusion model on the original training samples, which is then utilized as a purification module [, , ]. In contrast, certain approaches categorize stable NODE-based methods as non-diffusion-based strategies for improving robustness [].

However, in the context of OOD detection, purification using diffusion methods [] may not be effective. This is primarily because diffusion models trained on ID samples tend to shift the features of unseen OOD data towards ID features during the reverse process. Such a shift can mistakenly transform OOD samples into ID, compromising both OOD detection performance and clean robustness []. To emphasize this distinction, we compare our approach against purification using diffusion-based models. Specifically, we adopt the AdvRAD [] setup for OOD detection and present a comparison with our method in Table 4(d).

**(d) Table 7a: Comparison of AROS and AdvRAD under clean and $\text{PGD}^{1000}(l_{\infty})$ evaluation, measured by AUROC (%). The table cells denote results in the ‘ Clean/$\text{PGD}^{1000}$‘ format.**
| Method | CIFAR-10 | CIFAR-100 | ImageNet-1k |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | CIFAR-100 | SVHN | LSUN | CIFAR-10 | SVHN | LSUN | Texture | iNaturalist | LSUN |
| AdvRAD | 61.0/49.0 | 68.5/52.7 | 66.8/50.7 | 54.8/49.4 | 60.1/52.0 | 54.8/50.2 | 57.7/51.0 | 62.4/56.5 | 58.5/50.9 |
| AROS | 88.2/80.1 | 93.0/86.4 | 90.6/ 82.4 | 74.3/67.0 | 81.5/70.6 | 74.3/68.1 | 78.3/ 69.2 | 84.6/75.3 | 79.4/69.0 |

#### A3.1.2 AROS Under AutoAttack (AA) and Adaptive AA

Additionally, we evaluate the robustness of AROS under different perturbation norms by substituting the $l_{\infty}$ norm with the $l_{2}$ norm in $\text{PGD}^{1000}$, setting $\epsilon=\frac{128}{255}$. The outcomes of this evaluation are presented in Table 4(e). Furthermore, the performance of AROS under AutoAttack (AA) and adaptive AA is included in Table 4(f).

**(e) Table 8a: Evaluation of AROS under $\text{PGD}^{1000}(l_{2})$, where $\epsilon=128/255$ is used for low-resolution datasets and $\epsilon=64/255$ for high-resolution datasets. The results are measured by AUROC (%).**
| Attack | CIFAR-10 | CIFAR-100 | ImageNet-1k |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | CIFAR-100 | SVHN | LSUN | CIFAR-10 | SVHN | LSUN | Texture | iNaturalist | LSUN |
| $\text{PGD}^{1000}(l_{2})$ | 81.6 | 87.1 | 83.7 | 67.4 | 71.0 | 69.3 | 70.5 | 75.9 | 69.8 |

**(f) Table 9a: Evaluation of AROS under AutoAttack and Adaptive AA. The results are measured by AUROC (%).**
| Attack | CIFAR-10 | CIFAR-100 | ImageNet-1k |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | CIFAR-100 | SVHN | LSUN | CIFAR-10 | SVHN | LSUN | Texture | iNaturalist | LSUN |
| AutoAttack | 78.9 | 83.4 | 80.2 | 66.5 | 70.2 | 68.9 | 67.4 | 73.6 | 67.1 |
| Adaptive AA | 76.4 | 82.9 | 78.6 | 65.2 | 67.4 | 68.3 | 66.1 | 70.5 | 66.9 |

#### A3.1.3 Architecture comparison & Enhancing Clean Performance with Transfer Learning

Additionally, we investigate the influence of replacing our default backbone architecture, WideResNet, with alternative architectures (Table 4(g)). We also explore transfer learning techniques to enhance clean performance by leveraging robust pre-trained classifiers.

Lastly, while AROS demonstrates a significant improvement of up to 40% in adversarial robustness, it shows a performance gap of approximately 10% when compared to state-of-the-art clean detection methods. Although this trade-off between robustness and clean performance is well-documented in the literature [, , ], our aim is to enhance clean performance. A promising approach would involve enhancing clean performance while preserving robustness by leveraging transfer learning through distillation from a large, robust pretrained model, rather than training the classifier from scratch, as is currently done in the pipeline. Specifically, by utilizing adversarially pretrained classifiers on ImageNet [], we aim to improve our clean performance. Results in lower part of Table 4(g) indicate that leveraging such pretrained models can improve clean performance by 6%. Moreover, we also consider using different architectures trained from scratch to further demonstrate the robustness of AROS across various backbones.

Table: (g) Table 10a: Ablation study on different backbone architectures & Transfer learning. Results are reported under clean and $\text{PGD}^{1000}(l_{\infty})$ evaluations, measured by AUROC (%). Each table cell presents results in the ‘ Clean/$\text{PGD}^{1000}$‘ format.

### A3.2 Extended Ablation Study

Further ablation studies explore the sensitivity of AROS to various hyperparameters. The effect of the threshold parameter $\beta$, which is used to select fake OOD embeddings, is presented in Table 4(h), while the impact of varying $\gamma_{2}$ and $\gamma_{3}$ is detailed in Table 4(i).

**(h) Table 11a: Ablation study on the $\beta$ hyperparameter. Results are reported under clean and $\text{PGD}^{1000}(l_{\infty})$ evaluations, measured by AUROC (%). Each table cell presents results in the ‘ Clean/$\text{PGD}^{1000}$‘ format.**
| Hyperparameter | CIFAR-10 | CIFAR-100 | ImageNet-1k |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | CIFAR-100 | SVHN | LSUN | CIFAR-10 | SVHN | LSUN | Texture | iNaturalist | LSUN |
| $\beta=0.001$(default) | 88.2/80.1 | 93.0/86.4 | 90.6/ 82.4 | 74.3/67.0 | 81.5/70.6 | 74.3/68.1 | 78.3/ 69.2 | 84.6/75.3 | 79.4/69.0 |
| $\beta=0.01$ | 87.3/80.2 | 92.2/85.3 | 89.4/80.7 | 74.7/65.8 | 80.2/68.9 | 73.1/66.6 | 78.1/69.5 | 83.0/74.2 | 79.0/68.5 |
| $\beta=0.025$ | 88.2/80.1 | 93.0/86.4 | 90.6/ 82.4 | 74.3/67.0 | 81.5/70.6 | 74.3/68.1 | 78.3/ 69.2 | 84.6/75.3 | 79.4/69.0 |
| $\beta=0.05$ | 86.5/80.1 | 92.5/86.1 | 90.8/82.7 | 74.5/66.4 | 81.7/69.6 | 72.8/68.3 | 77.9/67.4 | 82.7/75.1 | 77.9/68.5 |
| $\beta=0.075$ | 88.4/78.4 | 92.7/85.2 | 89.1/82.3 | 72.4/65.7 | 81.5/69.4 | 72.5/67.9 | 78.6/69.7 | 84.8/73.5 | 78.8/69.3 |
| $\beta=0.1$ | 86.6/79.5 | 92.0/85.4 | 90.9/80.9 | 72.3/65.8 | 80.3/69.4 | 73.3/66.7 | 77.8/67.5 | 84.1/74.9 | 78.2/67.8 |

**(i) Table 12a: An ablation study on the hyperparameters $\gamma_{3}$ and $\gamma_{2}$, where $\gamma_{1}$ was fixed at 1 as it is dominant to other hyperparamters. Results are reported under clean and $\text{PGD}^{1000}(l_{\infty})$ evaluations, measured by AUROC (%). Each table cell presents results in the ‘ Clean/$\text{PGD}^{1000}$‘ format.**
| Hyperparameter | CIFAR-10 | CIFAR-100 | ImageNet-1k |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | CIFAR-100 | SVHN | LSUN | CIFAR-10 | SVHN | LSUN | Texture | iNaturalist | LSUN |
| $\gamma_{2}=\gamma_{3}=0.05$ (default) | 88.2/80.1 | 93.0/86.4 | 90.6/ 82.4 | 74.3/67.0 | 81.5/70.6 | 74.3/68.1 | 78.3/ 69.2 | 84.6/75.3 | 79.4/69.0 |
| $\gamma_{2}=\gamma_{3}=0.025$ | 86.4/78.2 | 90.4/86.3 | 88.6/80.4 | 74.9/64.1 | 78.8/68.7 | 72.8/68.3 | 79.2/69.7 | 83.3/76.0 | 78.8/67.5 |
| $\gamma_{2}=\gamma_{3}=0.075$ | 87.5/80.3 | 92.1/87.2 | 88.9/81.6 | 72.7/67.7 | 80.8/68.7 | 73.2/68.8 | 76.4/69.9 | 83.4/73.4 | 80.2/69.9 |
| $\gamma_{2}=\gamma_{3}=0.1$ | 86.9/78.6 | 93.6/82.1 | 85.8/78.2 | 70.0/65.8 | 80.6/66.2 | 72.6/67.3 | 79.3/69.6 | 82.8/74.0 | 78.9/67.2 |

### A3.3 Time Complexity

The computational complexity of our model is reported in Table 4(j).

**(j) Table 13a: Time Complexity of Model Steps for CIFAR-10, CIFAR-100, and ImageNet-1k, measured on a NVIDIA RTX A5000 GPU (on a workstations running Ubuntu 20.04, Intel Core i9-10900X: 10 cores, 3.70 GHz, 19.25 MB cache; within Docker).**
| Step | CIFAR-10 | CIFAR-100 | ImageNet-1k |
| --- | --- | --- | --- |
| Step 1: Adversarial Training of Classifier | 15 hours | 15 hours | 180 hours |
| Step 2: Crafting Fake OOD Data | 7 hours | 7 hours | 150 hours |
| Step 3: Training with Stability Loss ($\mathcal{L}_{\text{SL}}$) | 8 hours | 8 hours | 100 hours |

## Appendix A4 Details of Evaluation and Experimental Setup

OOD detection can be framed as a binary classification task, where training samples are confined to a single set (the ID data), and during testing, input samples from OOD set must be identified. A key challenge is that OOD data is not as clearly defined as ID data; any semantic content absent from the ID distribution is considered OOD. The primary objective in OOD detection is to develop a pipeline capable of assigning meaningful OOD scores to input samples, where a higher score suggests that the model perceives the input as having a greater likelihood of being OOD. An optimal OOD detector would produce score distributions for OOD and ID samples that are fully separated, with no overlap, ensuring clear differentiation between the two.

Formally, the OOD detection decision can be performed as follows:

G_λ(x)= {ID if SF(x) ≤λOOD if SF(x)>λ,

where $\lambda$ is a threshold parameter.

Thus, the scoring function $S_{\mathcal{F}}$ is central to the performance of the OOD detector. In the setup of adversarial evaluation, PGD and other attack methods, we adversarially target $S_{\mathcal{F}}$ and perturb the inputs as described in Section 2. Intuitively, these attacks aim to shift ID samples closer to OOD and vice versa. This approach is fair and consistent with existing OOD detection frameworks, as all such methods define an OOD score function. Furthermore, this adversarial strategy has been previously explored in related work. In the following, we will provide details on AutoAttack and adaptive AutoAttack in our evaluation.

AutoAttack. AutoAttack is an ensemble of six attack methods: APGD with Cross-Entropy loss, APGD with Difference of Logits Ratio (DLR) loss, APGDT, FAB [], multi-targeted FAB [], and Square Attack []. However, the DLR loss-based attacks assume that the target model is a classifier trained on more than two classes. In OOD detection, the problem is more akin to binary classification, as we are only distinguishing between OOD and ID classes. Therefore, we excluded these specific DLR-based attacks in our adaptation of AutoAttack and instead used an ensemble of the remaining attacks.

Adaptive AA. We also employed Adaptive AutoAttack (AA) for evaluation, an attack framework designed to efficiently and reliably approximate the lower bound of a model’s robustness. Adaptive AA integrates two main strategies: Adaptive Direction Initialization to generate better starting points for adversarial attacks, and Online Statistics-Based Discarding to prioritize attacking easier-to-perturb images. Unlike standard AutoAttack, Adaptive AA adapts its attack directions based on the model’s specific defense properties and dynamically allocates iterations to improve the efficiency of successful attacks. For the perturbation budget, we used a similar budget to that considered for PGD, and for other hyperparameters, we used their default values. For the implementation of adversarial attacks, we utilized the Torchattacks library in PyTorch.

### A4.1 Details of the Reported Results

To report and evaluate previous works, we reproduced their results using the official GitHub repositories. For the clean evaluation setup, if our reproduced results differed from the originally reported values, we reported the higher value. If no results were available, we presented our reproduced results. A similar approach was taken for adversarial evaluation: if their evaluation details and considered datasets matched ours, we used their reported results. However, if the attacks details in their evaluation differed or if they did not consider our datasets or benchmarks, we reported our reproduced results.

### A4.2 Metrics

Our main results are reported using AUROC for comparison across methods, as it is more commonly utilized in the detection literature. However, in Table 4.3, we also compare our method’s performance using other metrics, including AUPR and FPR95. Below, we provide an explanation of each of these metrics.

AUROC. The Area Under the Receiver Operating Characteristic Curve (AUROC) is a metric that evaluates classification performance by measuring the trade-off between the True Positive Rate (TPR) and the False Positive Rate (FPR) across various threshold settings. TPR, also known as recall or sensitivity, measures the proportion of actual positives correctly identified, while FPR measures the proportion of actual negatives incorrectly classified as positives. The AUROC, which ranges from 0.5 (random classifier) to 1.0 (perfect classifier), provides an aggregate performance measure.

AUPR. The Area Under the Precision-Recall Curve (AUPR) is particularly useful for imbalanced datasets where the positive class is rare. The AUPR captures the trade-off between precision (the proportion of predicted positives that are actual positives) and recall. A high AUPR indicates a model with both high precision and recall, providing valuable insights in scenarios where the dataset is skewed.

FPR95. False Positive Rate at 95% True Positive Rate (FPR95), which assesses the model’s ability to correctly identify in-distribution samples while rejecting OOD samples. Specifically, FPR95 is the false positive rate when the true positive rate is set to 95%, indicating how often OOD samples are misclassified as in-distribution. Lower values of FPR95 indicate better OOD detection capabilities, as the model more accurately differentiates between ID and OOD samples. Together, these metrics offer a comprehensive understanding of model performance and robustness in classification and OOD detection tasks.

## Appendix A5 Additional Details about the Datasets

In our experiments, we considered several datasets. Our perturbation budget is determined based on the image size of the ID training set. It is set to $\frac{4}{255}$ for scenarios where the ID training set consists of high-resolution images (e.g., ImageNet-1K), and $\frac{8}{255}$ for high-resolution datasets (e.g., CIFAR-10 and CIFAR-100). In all experiments, the ID and OOD datasets contain disjoint semantic classes. If there is an overlap, we exclude those semantics from the OOD test set. In all experiments, the ID and OOD datasets contain disjoint semantic classes. If there is an overlap, we exclude those semantics from the OOD test set. In the following, we provide a brief explanation of the datasets used.

CIFAR-10 and CIFAR-100. are benchmark datasets commonly used for image classification tasks. CIFAR-10 consists of 60,000 color images of size $32\times 32$ pixels across 10 classes, with 6,000 images per class. CIFAR-100 is similar but contains 100 classes with 600 images each, providing a more fine-grained classification challenge.

ImageNet-1k. ImageNet-1K contains 1,281,167 training images, 50,000 validation images and 100,000 test images. This dataset was compiled to facilitate research in computer vision by providing a vast range of images to develop and test algorithms, particularly in the areas of object recognition, detection, and classification.

Texture Dataset. Texture Dataset is designed for studying texture recognition in natural images. It comprises diverse textures captured in the wild, enabling research on classifying and describing textures under varying conditions.

Street View House Numbers (SVHN). SVHN is a real-world image dataset for developing machine learning and object recognition algorithms with minimal data preprocessing. It contains over 600,000 digit images obtained from house numbers in Google Street View images.

iNaturalist. The iNaturalist Species Classification and Detection Dataset aims to address real-world challenges in computer vision by focusing on large-scale, fine-grained classification and detection. This dataset, consisting of 859,000 images from over 5,000 different species of plants and animals, is noted for its high class imbalance and the visual similarity of species within its collection. The images are sourced globally, contributed by a diverse community through the iNaturalist platform, and verified by multiple citizen scientists.

Places365. Places365 is a scene-centric dataset containing over 10 million images spanning 365 scene categories. It is designed for scene recognition tasks and aids in understanding contextual information in images.

Large-scale Scene Understanding (LSUN).The Large-scale Scene Understanding (LSUN) challenge is designed to set a new standard for large-scale scene classification and comprehension. It features a classification dataset that includes 10 scene categories, such as dining rooms, bedrooms, conference rooms, and outdoor churches, among others. Each category in the training dataset comprises an extensive range of images, from approximately 120,000 to 3,000,000 images. The dataset also provides 300 images per category for validation and 1,000 images per category for testing.

iSUN.The iSUN dataset is a large-scale eye tracking dataset that leverages natural scene images from the SUN database. It was specifically developed to address the limitations of small, in-lab eye tracking datasets by enabling large-scale data collection through a crowdsourced, webcam-based eye tracking system deployed on Amazon Mechanical Turk.

MNIST. The MNIST dataset (Modified National Institute of Standards and Technology dataset) is a large collection of handwritten digits that is widely used for training and testing in the field of machine learning. It contains 70,000 images of handwritten digits from 0 to 9, split into a training set of 60,000 images and a test set of 10,000 images. Each image is a 28x28 pixel grayscale image.

Fashion-MNIST (FMNIST). FMNIST dataset is a collection of article images designed to serve as a more challenging replacement for the traditional MNIST dataset. It consists of 70,000 grayscale images divided into 60,000 training samples and 10,000 test samples, each image having a resolution of 28x28 pixels. The dataset contains 10 different categories of fashion items such as T-shirts/tops, trousers, pullovers, dresses, coats, sandals, shirts, sneakers, bags, and ankle boots.

Imagenette. Imagenette is a subset of ImageNet consisting of ten easily classified classes. It was released to encourage research on smaller datasets that require less computational resources, facilitating experimentation and algorithm development.

CIFAR-10-C and CIFAR-100-C. CIFAR-10-C and CIFAR-100-C are corrupted versions of CIFAR-10 and CIFAR-100, respectively. They include various common corruptions and perturbations such as noise, blur, and weather effects, used to evaluate the robustness of image classification models against real-world imperfections.

ADNI Neuroimaging Dataset. The Alzheimer’s Disease Neuroimaging Initiative (ADNI) dataset is a large-scale collection of neuroimaging data aimed at tracking the progression of Alzheimer’s disease. In our study, we categorize the dataset into six classes based on cognitive status and disease progression. The classes CN (Cognitively Normal) and SMC (Subjective Memory Concerns) are designated as ID, representing individuals without significant neurodegenerative conditions or with only minor memory concerns. The other four classes—AD (Alzheimer’s Disease), MCI (Mild Cognitive Impairment), EMCI (Early Mild Cognitive Impairment), and LMCI (Late Mild Cognitive Impairment)—are treated as OOD, encompassing various stages of cognitive decline related to Alzheimer’s. The dataset contains 6,000 records for each class, providing a comprehensive representation of the spectrum of cognitive health and Alzheimer’s disease. A summary of each class is as follows:

- •
AD: Patients diagnosed with Alzheimer’s disease, showing significant cognitive decline.
- •
CN: Individuals with normal cognitive functioning, serving as a control group.
- •
MCI: A stage of cognitive decline that lies between normal aging and more advanced impairment, often preceding Alzheimer’s disease.
- •
EMCI: Patients with early signs of mild cognitive impairment, indicating the initial onset of cognitive issues.
- •
LMCI: Patients with symptoms indicative of more advanced mild cognitive impairment, closer to Alzheimer’s in severity.
- •
SMC: Individuals reporting memory concerns but performing normally on cognitive assessments.

We used the middle slice of MRI scans from ADNI phases 1, 2, and 3. We should note that the ADNI dataset was the only one we split into ID and OOD using the strategy mentioned earlier. For the other datasets in our OSR experiments, we randomly divided each dataset into ID and OOD at a ratio of 0.6 and 0.4, respectively.

### A5.1 Details on Dataset Corruptions

Corruptions: The first type of corruption is Gaussian noise, which commonly appears in low-light conditions. Shot noise, also known as Poisson noise, results from the discrete nature of light and contributes to electronic noise. Impulse noise, similar to salt-and-pepper noise but in color, often arises due to bit errors. Defocus blur happens when an image is out of focus. Frosted glass blur is caused by the appearance of "frosted glass" on windows or panels. Motion blur occurs due to rapid camera movement, while zoom blur happens when the camera moves swiftly towards an object. Snow is an obstructive form of precipitation, and frost occurs when lenses or windows accumulate ice crystals. Fog obscures objects and is often simulated using the diamond-square algorithm. Brightness is affected by the intensity of daylight, and contrast levels change based on lighting conditions and the object’s color. Elastic transformations distort small image regions by stretching or contracting them. Pixelation results from upscaling low-resolution images. Lastly, JPEG compression, a lossy format, introduces noticeable compression artifacts.

## Appendix A6 Limitations and Future Research

We considered classification image-based benchmarks, that while difficult, do not cover the full breadth of real-world attacks in situations such as more complex open-set images or video, i.e., time-series data. Future work should test our proposed method in video streaming data (time-series), as inherently we leverage stability properties in dynamical systems that could be very attractive for such settings. Namely, because video frames are often highly correlated, one can even leverage the prior stability points in time in order to make better future predictions. This could also lower the compute time.

Moreover, moving to tasks beyond classification could be very attractive. Concretely, one example is pose estimation. This is a keypoint detection task that can often be cast as a panoptic segmentation task, where each keypoint needs to be identified in the image and grouped appropriately [, ]. By using AROS, one could find OOD poses could not only improve data quality, but alert users to wrongly annotated data. Another example is in brain decoding where video frame or scene classification is critical, and diffusion models are becoming an attractive way to leverage generative models []. Given AROS ability in OOD detection, this could be smartly used to correct wrong predictions.
In summary, adapting AROS to these other data domains could further extend its applicability.

## Peer Reviews

confidence: 2
contribution: 3
initial_rating: 8
presentation: 3
questions: 1. I’m curious about the sampling methods. Do you have some justification that the low-likelihood part would represent the embeddings of the realistic OOD samples, or do you just not care about the realisticness of the embeddings?
soundness: 4
strengths: 1. The proposed method's theoretical background is solid, and the main trick (i.e., the Levy-Desplanques Theorem) seems useful for other neural ODE models.
2. With an orthogonal layer, the authors effectively overcame practical problems, such as exploding gradients and vanishing gradients.
3. The experiments are well done. The authors used very strong attacks and many baseline models to compare. The proposed method's performance is really impressive.
summary: This paper proposes a new out-of-distribution detector that is robust against adversarial attacks. Specifically, the authors point out the problems of adversarial training with auxiliary datasets and propose a novel approach based on neural ordinary differential equation (ODE) and Lyapunov stability. The authors force the neural ODE model’s dynamical system to have stable equilibrium points on both in-distribution (ID) and out-of-distribution (OOD) samples. The authors also present a theoretical background that supports the proposed method. With experiments, the authors present the performance of the proposed method and some ablation studies.
weaknesses: 1. The proposed method generates fake OOD data in the embedding space, which might expose other vulnerabilities in ID embedding extraction. For example, the adversary can try poisoning the training ID data by injecting OOD samples so that the crafted OOD data does not include those injected OOD samples.
2. If I understand correctly, the fake OOD embedding is sampled from the low-likelihood space. This makes sense because OOD samples will be embedded in the low-likelihood part. However, this could be an ineffective method to generate embeddings of “realistic” OOD samples because even random noise would be mapped to the low-likelihood part.

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: See Weaknesses.
soundness: 2
strengths: 1. The paper proposes an OOD detection method based on Lyapunov stability and NODE, representing an innovative attempt to integrate control theory with OOD detection to improve model robustness under adversarial perturbations.
2. The proposed orthogonal binary layer is effective in enhancing the separation of ID and OOD samples.
summary: This paper introduces a novel adversarially robust out-of-distribution (OOD) detection method, AROS, which leverages Neural Ordinary Differential Equations (NODE) and Lyapunov stability theory to enhance model stability against adversarial perturbations. AROS employs a pseudo-OOD data generation strategy, sampling low-likelihood regions in the embedding space to create pseudo-OOD samples, thereby improving the model's generalization capability. Additionally, it incorporates an orthogonal binary layer to strengthen the separation between in-distribution (ID) and OOD samples. Experiments on CIFAR-10, CIFAR-100, and ImageNet-1k demonstrate that AROS maintains high detection accuracy across various attacks, including strong adversarial PGD and adaptive AutoAttack. Ablation studies indicate that Lyapunov stability regularization and pseudo-OOD embedding generation are particularly important for enhancing robustness.
weaknesses: 1. In the formula for the pseudo-embedding generation strategy, $p(r | y = j)$ denotes the conditional probability of generating pseudo-OOD embeddings. Here, the conditional probability notation $p(\cdot | \cdot)$ is used to describe feature vectors that meet a given condition, but in reality, it defines an inequality rather than a complete probabilistic expression. To avoid misunderstandings, it is recommended to rewrite this as an inequality, preventing the impression that a probability density function is defined here.

2. The definition and application of the orthogonal binary layer $B_{\eta}$ are somewhat complex. This layer aims to enhance the separation of ID and OOD samples by enforcing orthogonality in specific directions of the feature space. However, in the formula $L_{SL}$, directly using $B_{\eta}$ as a layer with multiple parameters may cause confusion, especially when multiple hyperparameters are involved. The expression might be clearer if $B_{\eta}$ is decomposed or its function is clearly annotated.

3. The model architecture used in the experimental section is not clearly described in the paper. Please clarify the model architecture.

4. Most of the models used in the experiments are based on traditional CNN architectures. Could the authors consider using Transformer-based models to evaluate performance differences between different methods?

5. It seems the experiments use untargeted attacks. Has the author considered the impact of targeted attacks on OOD detection?

6. In Section A3.2, "Extended Ablation Study," the authors provide results from ablation experiments but do not analyze the reasons for choosing the default parameters in the paper or discuss how different parameters might affect the results.

---

confidence: 4
contribution: 3
initial_rating: 5
presentation: 3
questions: 1. In the experiments in Table 1, the authors used different model architectures. What is the reason for this choice? Could a unified model architecture be used to ensure fairness in method comparison?
2. Tables 2, 3, and 4 do not specify the model architectures used. Only OOD detection performance on different datasets is shown, which reduces the reproducibility of the paper.
3. In the text, $\epsilon$ is set to 8/255 and 4/255, but in Table 8a, the authors set $\epsilon$ to 128/255 and 64/255. Such high perturbation rates would cause noticeable distortion in samples. Please explain the significance of this setting. Could results for perturbation rates of 16/255 and 32/255, especially 16/255 (the default parameter in most adversarial attack methods), be added?
4. The authors simply list the experimental results for $\beta$ without providing in-depth analysis. For instance, in Table 11a, why are the results for $\beta = 0.001$ identical to those for $\beta = 0.025$? The three hyperparameters $\gamma_1$, $\gamma_2$, and $\gamma_3$ in the loss function $L_{SL}$ are also listed without further analysis.
5. Could some generated pseudo-OOD data samples be provided for readers to view?
6. I am curious whether the proposed method in the paper can be applied to the detection of backdoor attack samples.
soundness: 2
strengths: 1. The paper is clearly written and easy to understand.
2. The authors conducted extensive experiments to validate the effectiveness of their method.
summary: This paper proposes the Adversarially Robust OOD Detection through Stability (AROS) method, aimed at enhancing robustness in out-of-distribution (OOD) detection, particularly under adversarial conditions. The authors base their approach on Neural Ordinary Differential Equations (NODE) and Lyapunov stability theory, designing a time-invariant dynamic system to train the model for stability in perturbed environments. The AROS method includes adversarial training, pseudo-OOD embedding generation, Lyapunov stability regularization, and an orthogonal binary layer to construct a robust feature space that improves the separation between in-distribution (ID) and OOD samples. Experimental results demonstrate that AROS outperforms other OOD detection methods across multiple benchmark datasets (e.g., CIFAR-10, CIFAR-100, and ImageNet-1k), especially under strong adversarial attacks such as PGD, AutoAttack, and Adaptive AutoAttack.
weaknesses: 1. The loss function $L_{SL}$ includes multiple hyperparameters, $\gamma_1$, $\gamma_2$, and $\gamma_3$. The choice of these hyperparameters affects the model's focus on different regularization terms, but directly showing them in the formula can seem verbose.
2. A detailed explanation of the elements in $[\nabla h_{\phi}(X_{\text{train}})]_{ii}$ 

and $[\nabla h_{\phi}(X_{\text{train}})]_{ij}$ is needed to clarify their computation.

3. In the section on the orthogonal binary layer, the equation $z^T z = I$ expresses the orthogonalization condition. However, it is unclear if $z$ has been normalized and whether its inner product yielding $I$ is the required condition.
4. The adversarial attack methods used in experiments are not the latest. The authors are encouraged to add 2023 and 2024 adversarial attack methods, particularly those with stronger transferability and generalization. See this work [1] for reference.
5. The authors did not provide the code for the experiments.

**Reference:**

[1] https://github.com/Trustworthy-AI-Group/TransferAttack

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: 1. Could the authors clarify the theoretical guarantees of Lyapunov stability when applied within the NODE framework, particularly for high-dimensional embeddings? Specifically, could they expand on how the equilibrium points are stabilized across varying adversarial perturbation magnitudes, especially under different norm constraints? Additionally, the derivations and stability proofs related to Theorems 1 and 2 are complex. Would the authors consider including expanded derivations or references in the appendix to enhance understanding for readers without a control theory background?


2. The introduction of the orthogonal binary layer aims to enhance ID-OOD separation. Could the authors provide more empirical insights or visualizations to demonstrate the layer's effectiveness in maintaining separation, particularly in adversarial scenarios? Furthermore, an analysis of the sensitivity of this layer to different perturbation levels would strengthen the practical understanding of its robustness.


3. The authors propose generating synthetic OOD embeddings by sampling from low-likelihood regions in the ID feature space. However, how well does this synthetic data represent real-world OOD instances, which may be more complex in structure? Could the authors provide empirical evidence or a quantitative comparison to validate the representativeness of these synthetic OOD samples? Additionally, would the authors consider including an ablation or alternative generation methods to explore the impact of different OOD data synthesis strategies?
soundness: 3
strengths: 1. **Innovative Use of Stability Theory:** The integration of Lyapunov stability within NODEs for OOD detection is novel and well-motivated. The application of stability principles to mitigate adversarial perturbations shows theoretical grounding.

2. **Comprehensive Evaluation:** The method undergoes extensive testing across datasets (CIFAR, ImageNet, and medical data) under both adversarial and clean conditions. Performance metrics like AUROC and AUPR are presented alongside ablations, providing a thorough examination.

3. **Orthogonal Binary Layer:** The addition of an orthogonal layer to further separate equilibrium points of ID and OOD data adds robustness and addresses alignment issues in perturbed scenarios.
summary: This paper introduces AROS, a method for enhancing the robustness of OOD detection under adversarial attacks. Using Lyapunov-stabilized embeddings within a NODE framework, AROS aims to stabilize the decision boundaries between ID and OOD samples by promoting equilibrium convergence through adversarial training. The approach includes generating synthetic OOD data in the feature space and applying an orthogonal binary layer to maximize separation between ID and OOD samples.
weaknesses: 1. **Complexity of Mathematical Justifications:** The paper’s reliance on Lyapunov stability and NODEs introduces significant mathematical complexity. Equation derivations and stability proofs (such as those around equilibrium points) are not fully explained, making it challenging for readers without a control theory background.

2. **Synthetic OOD Data Generation:** While the fake OOD generation in the feature space is practical, it lacks clarity on how well it approximates real-world OOD samples. Further analysis or empirical validation of this approximation would strengthen the argument for its effectiveness.

3. **Loss Function Ambiguity:** The custom loss function, $L_{SL}$, is somewhat ambiguous in its practical effects on training stability. Further detail on parameter tuning (e.g., effects of $\gamma$-values) and ablation studies on these would clarify its role in achieving robustness.

Meta-review: Out-of-distribution detection aims to improve the systems' robustness by letting the system say no to something unknown to it. However, the safety of OOD detection algorithm is rarely discussed or studied. This paper focuses on this important problem and makes a further step towards robust OOD detection algorithms. The novelty and contribution of this paper are enough to this venue, agreed by all reviewers. However, relevant comments must be merged into the final version of this paper.

Decision: Accept (Poster)