Table of Contents
Fetching ...

Learning Non-Linear Invariants for Unsupervised Out-of-Distribution Detection

Lars Doorenbos, Raphael Sznitman, Pablo Márquez-Neila

TL;DR

This work tackles unsupervised out-of-distribution detection by generalizing the invariant-based framework from affine to non-linear invariants. It introduces NL-Invs, a volume-preserving network that learns non-linear invariants to define a zero-level manifold in feature space, with multi-scale invariants learned from pyramidal CNN features. The method scores samples via an invariant-based term augmented by a 2-NN component and is trained with a forward invariant loss plus a backward reconstruction loss to enforce meaningful invariants. Evaluated on large-scale U-OOD benchmarks and shallow tabular datasets, NL-Invs achieves state-of-the-art performance and demonstrates robustness across architectures and hyperparameters, highlighting the practical potential of invariant-based OOD detection.

Abstract

The inability of deep learning models to handle data drawn from unseen distributions has sparked much interest in unsupervised out-of-distribution (U-OOD) detection, as it is crucial for reliable deep learning models. Despite considerable attention, theoretically-motivated approaches are few and far between, with most methods building on top of some form of heuristic. Recently, U-OOD was formalized in the context of data invariants, allowing a clearer understanding of how to characterize U-OOD, and methods leveraging affine invariants have attained state-of-the-art results on large-scale benchmarks. Nevertheless, the restriction to affine invariants hinders the expressiveness of the approach. In this work, we broaden the affine invariants formulation to a more general case and propose a framework consisting of a normalizing flow-like architecture capable of learning non-linear invariants. Our novel approach achieves state-of-the-art results on an extensive U-OOD benchmark, and we demonstrate its further applicability to tabular data. Finally, we show our method has the same desirable properties as those based on affine invariants.

Learning Non-Linear Invariants for Unsupervised Out-of-Distribution Detection

TL;DR

This work tackles unsupervised out-of-distribution detection by generalizing the invariant-based framework from affine to non-linear invariants. It introduces NL-Invs, a volume-preserving network that learns non-linear invariants to define a zero-level manifold in feature space, with multi-scale invariants learned from pyramidal CNN features. The method scores samples via an invariant-based term augmented by a 2-NN component and is trained with a forward invariant loss plus a backward reconstruction loss to enforce meaningful invariants. Evaluated on large-scale U-OOD benchmarks and shallow tabular datasets, NL-Invs achieves state-of-the-art performance and demonstrates robustness across architectures and hyperparameters, highlighting the practical potential of invariant-based OOD detection.

Abstract

The inability of deep learning models to handle data drawn from unseen distributions has sparked much interest in unsupervised out-of-distribution (U-OOD) detection, as it is crucial for reliable deep learning models. Despite considerable attention, theoretically-motivated approaches are few and far between, with most methods building on top of some form of heuristic. Recently, U-OOD was formalized in the context of data invariants, allowing a clearer understanding of how to characterize U-OOD, and methods leveraging affine invariants have attained state-of-the-art results on large-scale benchmarks. Nevertheless, the restriction to affine invariants hinders the expressiveness of the approach. In this work, we broaden the affine invariants formulation to a more general case and propose a framework consisting of a normalizing flow-like architecture capable of learning non-linear invariants. Our novel approach achieves state-of-the-art results on an extensive U-OOD benchmark, and we demonstrate its further applicability to tabular data. Finally, we show our method has the same desirable properties as those based on affine invariants.
Paper Structure (20 sections, 16 equations, 5 figures, 6 tables)

This paper contains 20 sections, 16 equations, 5 figures, 6 tables.

Figures (5)

  • Figure 1: Motivation for learning non-linear invariants. Affine functions (left) are not expressive enough to model the invariants of the data and are thus unsuccessful at OOD detection. Instead, non-linear functions (right) are more general and flexible. Blue points indicate training samples; darker colors denote regions with higher OOD scores.
  • Figure 2: Architecture of our proposed volume preserving network. The VPN is a fully invertible model with alternating rotation and coupling layers.
  • Figure 3: Example of finding non-linear invariants with the VPN on a toy dataset. (a) illustrates the data, (b) the invariant representation, and (c) the reconstruction of the training data from the invariant representation after zeroing the invariant dimension together with the original data. Background color indicates the distance to the nearest training data point in the original space and tracks how these are modified after the forward and backward pass. In (c), this is compressed into a thin, barely visible line from both ends of the U shape. The images below show how the data is transformed through the nine layers of the network. Images with a white-shaded background result from rotation layers, and images with a gray background result from coupling layers.
  • Figure 4: Assessing invariants. We show how the performance of the top-performing methods changes with respect to the number of classes in the training set for (a) OOD samples belonging to classes not present in the training data and (b) visually dissimilar OOD samples. For invariant-based approaches, the AUC remains high when the OOD test set breaks invariants, regardless of the number of classes in the training set.
  • Figure 5: Visualizing the loss and AUC landscapes of the VPN. For NL-Invs, a low training loss corresponds to high U-OOD performance and vice versa.