Source-linked AI summary
Training OOD Detectors in their Natural Habitats
Julian Katz-Samuels, Julia Nakhleh, Robert Nowak, Yixuan Li
TL;DR
Auxiliary-outlier training assumes outlier data is completely separable from ID data, while OOD detection matters because deployed models encounter unknown inputs. WOODS uses labeled ID and unlabeled mixed wild data, optimizing wild-data classification errors subject to constraints on ID OOD errors and ID classification accuracy, with an augmented-Lagrangian deep-network training procedure. On CIFAR-100, WOODS outperforms a strong baseline using only Pin by 48.10% in FPR95 on average and outperforms Outlier Exposure (OE) by 7.36% in FPR95.
Problem
Auxiliary-outlier training assumes outlier data is completely separable from ID data, while OOD detection matters because deployed models encounter unknown inputs.
Source: §1 · p. 1Method
WOODS uses labeled ID and unlabeled mixed wild data, optimizing wild-data classification errors subject to constraints on ID OOD errors and ID classification accuracy, with an augmented-Lagrangian deep-network training procedure.
Source: §1 · pp. 1–2Results
On CIFAR-100, WOODS outperforms a strong baseline using only Pin by 48.10% in FPR95 on average and outperforms Outlier Exposure (OE) by 7.36% in FPR95.
Source: §1 · p. 2Takeaways & Limitations
Wild data is abundant, arises upon deployment, and often better matches test-time data than offline-collected data, though it contains both ID and OOD examples.
Source: §7 · p. 9WOODS is not expected to perform as well in the non-stationary wild setting, where the test-time OOD distribution differs from the training OOD distribution.
Source: §5.2 · p. 8
Abstract
from arXiv · showhide
Out-of-distribution (OOD) detection is important for machine learning models deployed in the wild. Recent methods use auxiliary outlier data to regularize the model for improved OOD detection. However, these approaches make a strong distributional assumption that the auxiliary outlier data is completely separable from the in-distribution (ID) data. In this paper, we propose a novel framework that leverages wild mixture data, which naturally consists of both ID and OOD samples. Such wild data is abundant and arises freely upon deploying a machine learning classifier in their natural habitats. Our key idea is to formulate a constrained optimization problem and to show how to tractably solve it. Our learning objective maximizes the OOD detection rate, subject to constraints on the classification error of ID data and on the OOD error rate of ID examples. We extensively evaluate our approach on common OOD detection tasks and demonstrate superior performance.
1. Introduction
Existing auxiliary-outlier methods rely on data that may mismatch deployment OOD and require costly collection and cleaning. WOODS instead uses unlabeled mixed wild data with constrained optimization, and the paper reports state-of-the-art OOD detection performance.
1. Introduction
- Offline auxiliary outlier data may mismatch unknown deployment data and require labor-intensive collection and careful cleaning to avoid overlap with ID data.The paper presents unlabeled in-the-wild data as an alternative to these limitations.Source: §1 · p. 1
- WOODS uses unlabeled wild data, which is abundant and often better matches test-time data than offline outlier data, but contains both ID and OOD samples.The paper describes such data as arising upon deployment and being available without human annotation.Source: §1 · p. 1
- WOODS minimizes errors classifying wild data as ID, subject to low ID-as-OOD error and ID classification accuracy matching or approaching a baseline without an OOD requirement.The framework uses labeled ID data and unlabeled wild data, without a clean OOD dataset.Source: §1 · p. 1
- The deep-network implementation adapts the augmented Lagrangian method to inequality constraints and uses stochastic gradient descent for end-to-end training.The paper contrasts constrained optimization with adding a regularization term and says it offers strong guarantees.Source: §1 · p. 2
- On CIFAR-100, WOODS outperforms a strong baseline using only Pin by 48.10% in average FPR95, and outperforms Outlier Exposure (OE) by 7.36% in FPR95.Source: §1 · p. 2
- The paper reports theoretical insights supporting WOODS, particularly the choice of loss functions.Source: §1 · p. 2
2. Problem Setup
The setup distinguishes labeled ID classification data from unlabeled wild data and defines OOD detection as rejecting inputs outside the ID distribution. Wild data is modeled as a mixture, and both stationary and non-stationary test settings are considered.
2. Problem Setup
- The input space is X = R^d, the label space is Y = {1, ..., K}, and fθ maps inputs to class predictions.Source: §2 · p. 2
- The labeled training data are drawn from joint distribution PXY, with Pin denoting its marginal on the input space X and the in-distribution.Source: §2 · p. 2
- OOD detection decides whether a test input belongs to Pin; inputs classified as OOD are rejected, while ID inputs are classified by fθ.Source: §2 · p. 2
- Unlabeled wild samples may contain both ID and OOD data and are modeled using the Huber contamination model, with mixture proportion π in (0, 1].Source: §2 · p. 2
- The learning framework builds OOD and multiclass classifiers using ID and wild data, and evaluates both OOD and classification errors.Source: §2 · p. 2
- The setup distinguishes stationary wild data, where Ptest_out equals Pout, from non-stationary wild data, where they differ.Source: §2 · pp. 2–3
3. Method: Out-of-distribution Learning via Constrained Optimization
The method trains OOD and multiclass classifiers using labeled ID data and unlabeled wild data through a constrained objective. It replaces clean OOD examples with observed wild data and uses an augmented Lagrangian approach to optimize the constraints.
3.1. Learning Objective
- The objective minimizes wild samples classified as ID while limiting ID-to-OOD errors and keeping multiclass classification error below a threshold.The formulation uses labeled ID data and unlabeled wild data, which may contain both ID and OOD examples.Source: §3.1 · p. 3
- Because clean samples from Pout are unavailable, the method substitutes observed Pwild data, which is sufficient under mild conditions.The empirical objective minimizes wild samples labeled as ID while requiring at least 1−α of ID samples to be labeled correctly and meeting the classification threshold.Source: §3.1 · p. 3
- Under a mild condition, suitable decay of the function classes’ Rademacher complexities makes the solution approach feasibility and optimality for the population problem.The analysis uses tractable sigmoid loss for OOD detection and hinge loss for classification; it extends prior theory from 0/1 to sigmoid loss and replaces VC dimension with Rademacher complexity.Source: §3.1 · p. 4
- Weight decay, joint classification and OOD training, and fine-tuning from a pretrained classifier are described as regularizing features that limit network expressivity.The authors conjecture that requiring good classification performance also regularizes the OOD task.Source: §3.1 · p. 4
3.2. Solving the Constrained Optimization
- The method adapts augmented Lagrangian optimization to inequality constraints and stochastic training with modern neural networks.Its per-batch objective upper-bounds the augmented Lagrangian; the algorithm updates the dual variables at epoch end and increases constraint penalties.Source: §3.2 · pp. 4–5
4. Loss Functions with Neural Networks
The section defines neural-network losses for classification and OOD detection, using energy-based separation with a sigmoid surrogate. It contrasts the resulting setting with approaches that assume clean, separable auxiliary outliers.
Loss Functions
- The framework uses a classification loss on network outputs and an OOD loss based on energy to distinguish ID from OOD data.The classification loss can use cross-entropy, while the negative log partition function is proportional to −log p(x) and is known as free energy.Source: §4 · pp. 5–6
- The method estimates an energy level set at threshold 0, with negative energy for ID data and positive energy for OOD data.It replaces the intractable 0/1 loss with a smooth binary sigmoid loss.Source: §4 · p. 6
- The OOD sigmoid loss uses a learnable parameter w to modulate its slope.The loss is defined as 1 / (1 + exp(−w · Eθ(x))).Source: §4 · p. 6
- Unlike energy-regularized learning, WOODS allows wild data to contain both ID and OOD samples rather than requiring fully separable auxiliary outliers.The authors also contrast this setting with methods such as OE, which generally require manual data collection and cleaning.Source: §4 · p. 6
5. Experiments
WOODS is evaluated on CIFAR-10 and CIFAR-100 with varied wild-mixture ratios and OOD test distributions. It outperforms baselines, remains more robust at small mixture ratios, and satisfies its ID constraint within tolerance.
5.1. Experimental Setup
- Experiments use CIFAR-10 and CIFAR-100 as ID datasets and five natural-image datasets for OOD testing, with wild mixtures spanning π values from 0.05 to 1.0.The study also tests a setting where the wild outlier source differs from the OOD test distribution.Source: §5.1 · p. 6
5.2. Results
- 48.10% lower FPR95 than Mahalanobis on average across test datasets and 7.36% lower FPR95 than OE; ID accuracy remains comparable to CE training.These comparisons use CIFAR-100; methods using wild data share the same dataset and π = 0.1.Source: Table 1 · p. 7, §5.2 · p. 8
- WOODS outperforms state-of-the-art methods in the stationary wild setting, where the OOD test and training distributions match.The main-results comparison is on CIFAR-100.Source: §5.2 · pp. 7–8, Table 1 · p. 7
- At π = 0.05, WOODS outperforms OE by 12.85% in FPR95 on 300K Random Images, while OE's FPR95 rises from 44.29% at π = 1.0 to 75.33% at π = 0.05.Smaller π makes learning harder because the ID and wild distributions overlap more.Source: §5.2 · p. 8
- WOODS reduces the ID constraint value to zero within the specified tolerance of 0.05.The constraint is checked during training as a sanity check of the constrained optimization objective.Source: §5.2 · p. 8
- WOODS-alt performs strongly when training and test OOD distributions match, but is not expected to perform as well when they differ.Unlike WOODS's energy score, WOODS-alt would do no better than random guessing without auxiliary data; the authors observed this in some experiments.Source: §5.2 · pp. 8–9
6. Related Work
Related OOD work includes scoring methods trained on ID data and regularization methods that use auxiliary outliers. This paper instead uses mixed wild data and constrained optimization, differing from related formulations in its joint classification and OOD focus and neural-network implementation.
Related Work
- ID-only scoring methods include Open-Max, MSP, ODIN, Mahalanobis, energy, gradient-based, and KNN scores; using wild data can build a stronger OOD detector.The paper also distinguishes OOD detection from anomaly detection, which does not require learning a classifier for PXY.Source: §6 · p. 9
- Training-time regularization methods use auxiliary outlier data or synthesize virtual outliers, whereas this work trains on wild mixtures containing both ID and OOD data.The paper describes wild mixtures as obtainable upon deploying a classifier and formulates a constrained optimization problem for them.Source: §6 · p. 9
- Compared with Blanchard et al. (2010), this work jointly considers classification and OOD detection and addresses test-time OOD distributions that may differ from the training outlier distribution.It uses a differentiable sigmoid loss and an ALM-based neural-network approach rather than a computationally intractable 0-1 loss and plug-in kernel-density estimator.Source: §6 · p. 9
- The paper adapts augmented Lagrangian optimization to inequality constraints in deep neural networks, a setting it says has few prior examples.It presents constrained optimization as a new approach to OOD detection.Source: §6 · p. 9
7. Conclusion
The conclusion presents constrained optimization with augmented Lagrangian adaptation as a tractable way to use abundant wild data for OOD detection despite its mixture of ID and OOD examples.
Conclusion
- Wild data is abundant, nearly free to collect upon deployment, and often better matched to test-time data than offline-collected data, but includes both ID and OOD examples.The framework addresses this mixture by adapting the augmented Lagrangian method to deep neural networks.Source: §7 · p. 9
A.1. Main Experiments: CIFAR-10
On CIFAR-10, WOODS outperforms the compared OOD baselines on average, and its performance remains strong across mixture proportions. WOODS-alt instead learns its OOD confidence score with a separate network attached to the ID classifier.
A.1. Main Experiments: CIFAR-10
- On CIFAR-10, WOODS outperforms CSI by 13.59% and OE by 3.61% on average.The comparison uses the same dataset and π = 0.1 for methods trained with Pwild.Source: §A.1 · p. 12, Table 3 · p. 12
- Across many values of π, WOODS outperforms OE and Energy by an even larger margin than on CIFAR-10.The ablation varies π, which controls the fraction of OOD data in Pwild; Table 4 uses CIFAR-10 ID data and 300K Random Images.Source: §A.1 · p. 12, Table 4 · p. 12
A.2. WOODS-alt Description
- WOODS-alt learns an OOD confidence score with a separate neural network attached to the ID classifier’s penultimate layer.The described network has one fully connected hidden layer with 300 neurons, followed by ReLU and a single output logit.Source: §A.2 · pp. 12–13
A.3. Additional Experimental Details
The experiments simulate wild data as a mixture of ID and OOD examples, using specified batch sizes and data splits. They repeat each experiment with five separate seeds.
A.3. Additional Experimental Details
- Each training iteration draws 128 ID examples and 128 wild examples, with wild examples sampled from Pout with probability π and Pin with probability 1 − π.Source: §A.3 · p. 13
- The described data splits use 70% of SVHN for mixture training and validation, reserving the remainder for testing, while the 300K Random Images setting uses 99% for training and validation.For the latter setting, half of the ID data is used for ID training and half for generating the mixture.Source: §A.3 · p. 13
- Each experiment is repeated five times with five separate seeds.Source: §A.3 · p. 13
B. Proof of Proposition 3.1
The proof uses the sigmoid loss’s symmetry to establish a lemma analogous to prior work using 0/1 loss. It also gives a setting in which the stated assumption holds.
B. Proof of Proposition 3.1
- The sigmoid loss symmetry, σ(z) + σ(−z) = 1, enables a lemma analogous to the 0/1-loss result of Blanchard et al. (2010).Source: B. Proof of Proposition 3.1 · pp. 13–14
- With probability at least 1 − δ, the stated bound gives E_XY[Lcls(f_bθϵ(x), y)] ≤ τ + c3ϵ_n.The proof invokes concentration events and feasibility of the approximate optimizer for the constrained problem.Source: B. Proof of Proposition 3.1 · p. 15
- If P0 is absolutely continuous with respect to Lebesgue measure, Assumption B.2 holds for the stated linear-map example.The passage also notes that the maps could be replaced with neural networks sharing a penultimate layer.Source: B. Proof of Proposition 3.1 · p. 16
C. Validation using Pwild data
The validation procedure selects among thresholded OOD predictors using holdout ID and mixture data. Its theoretical justification relies on a condition that is shown to hold when P0 is absolutely continuous with respect to Lebesgue measure.
C. Validation using Pwild data
- The holdout mixture is Pwild = (1 − π)P0 + πP1, with unknown π, and the procedure assumes access to a holdout set from P0.Source: C. Validation using Pwild data · p. 17
- The validation procedure chooses a thresholded predictor that minimizes holdout FNR@95, using a finite candidate set of OOD predictors.The candidate predictors are obtained by thresholding models in G.Source: C. Validation using Pwild data · p. 17
- The stated validation guarantee bounds R0(bhϵ) by α + cπ^-1ϵ_n.The theoretical justification applies under Assumption C.1, which the text says holds if P0 is absolutely continuous with respect to Lebesgue measure.Source: C. Validation using Pwild data · pp. 17–18
Related papers
This paper cites
- Describing Textures in the Wild2013
- A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networks2016
- Enhancing The Reliability of Out-of-distribution Image Detection in Neural Networks2017
- Deep Anomaly Detection with Outlier Exposure2018
- Energy-based Out-of-distribution Detection2020
- A Unifying Review of Deep and Shallow Anomaly Detection2020