Skip to main content

AROS: Adversarially Robust Out-of-Distribution Detection through Stability

PyPI version PyPI Downloads License: Apache 2.0 Paper

Overview

This repository contains the code for the paper "Adversarially Robust Out-of-Distribution Detection Using Lyapunov-Stabilized Embeddings". The method, termed AROS, employs Neural Ordinary Differential Equations (NODEs) with Lyapunov stability to create robust embeddings for OOD detection, significantly improving performance against adversarial attacks. This repository contains the code for the paper "Adversarially Robust Out-of-Distribution Detection Using Lyapunov-Stabilized Embeddings". The method, termed AROS, employs Neural Ordinary Differential Equations (NODEs) with Lyapunov stability to create robust embeddings for OOD detection, significantly improving performance against adversarial attacks. Additionally, the repository includes two notebooks: one demonstrates the training and evaluation process on the CIFAR-10 and CIFAR-100 datasets, while the other focuses on the ablation study.

AROS

Publication

AROS 💍 is accepted to the International Conference on Learning Representations 2025 (ICLR 2025)!

@article{mirzaei2025aros,
      title={Adversarially Robust Out-of-Distribution Detection Using Lyapunov-Stabilized Embeddings}, 
      author={Hossein Mirzaei and Mackenzie W. Mathis},
      year={2025},
      journal={The Thirteenth International Conference on Learning Representations},
      url={https://openreview.net/forum?id=GrDne4055L}, 
}

Preprint

Check out our preprint now out on arXiv! Adversarially Robust Out-of-Distribution Detection Using Lyapunov-Stabilized Embeddings. Hossein Mirzaeri & Mackenzie W. Mathis. Oct 2024.

Key Features

  • Lyapunov Stability for OOD Detection: Ensures that perturbed inputs converge back to stable equilibrium points, improving robustness against adversarial attacks.
  • Fake Embedding Crafting Strategy: Generates fake OOD embeddings by sampling from the low-likelihood regions of the ID data feature space, eliminating the need for additional OOD datasets.
  • Orthogonal Binary Layer: Enhances separation between ID and OOD embeddings, further improving robustness.

Demo

  • Open In Colab This notebook is designed to replicate and analyze the results presented in Table 1 of the AROS paper, focusing on out-of-distribution detection performance under both attack scenarios and clean evaluation.
  • Open In Colab This notebook is designed to demo the ablation study.

Repository Structure

  • AROS/
    • data_loader.py: Contains the data loading utilities for training and evaluation.
    • evaluate.py: Implements the evaluation metrics and testing routines for the AROS model.
    • Main.py: The main script for training and testing AROS, combining all components.
    • stability_loss_function.py: Defines the Lyapunov-based loss function used for stabilizing the NODE dynamics.
    • utils.py: Includes various helper functions used throughout the project.
  • requirements.txt: Lists the dependencies required to run the project.
  • Notebooks/
    • AROS.ipynb
    • Notebooks/Ablation_Study.ipynb

Installation

To install the necessary packages, run:

pip install git+https://github.com/RobustBench/robustbench.git
pip install aros-node

To install the necessary packages from source (locally), run:

pip install -r requirements.txt

Citations

ICLR:

@article{mirzaei2025aros,
      title={Adversarially Robust Out-of-Distribution Detection Using Lyapunov-Stabilized Embeddings}, 
      author={Hossein Mirzaei and Mackenzie W. Mathis},
      year={2025},
      journal={The Thirteenth International Conference on Learning Representations},
      url={https://openreview.net/forum?id=GrDne4055L}, 
}

arXiv:

@article{mirzaei2024aros,
      title={Adversarially Robust Out-of-Distribution Detection Using Lyapunov-Stabilized Embeddings}, 
      author={Hossein Mirzaei and Mackenzie W. Mathis},
      year={2024},
      eprint={2410.10744},
      journal={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2410.10744}, 
}

Metadata

Release files for aros-node 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aros-node 0.0.1
File Size Uploaded
aros_node-0.0.1.tar.gz 22.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aros-node 0.0.1
File Interpreter ABI Platform
aros_node-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 44.0 kB

Release files / aros_node-0.0.1.tar.gz

Download URL aros_node-0.0.1.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f075ba24dd4dbd4324efcbb369ec1f4c06577130424d1a00b7539a6a297130fc
BLAKE2b-256 checksum
How to use checksums
75af50a112e931130c4dcd94555ad1d872fa8352b2da71d9694fd5a063831ab7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / aros_node-0.0.1-py3-none-any.whl

Download URL aros_node-0.0.1-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71ad884b144a7c5ca1d27e0dcca3f140801e7eb6a349bd454278f58a3665e576
BLAKE2b-256 checksum
How to use checksums
b60a899104950a54250439bd3df398e2150e30810d62abf5a6e59cab080c99b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page