TL;DR
Out-of-distribution (OOD) detectors are crucial for safe machine learning, but tuning their hyperparameters typically requires an adhoc proxy OOD dataset, which introduces high performance variance and is often unavailable in practice. This paper introduces a self-contained tuning framework that simulates OOD data by systematically holding out subsets of classes from the in-distribution training data. The resulting method eliminates the need for external OOD tuning data while matching or exceeding the performance of detectors tuned on actual OOD benchmarks.
What Problem Does This Paper Address?
When machine learning models encounter inputs that differ from their training data (out-of-distribution or OOD inputs), they often make highly confident, incorrect predictions. Post-hoc OOD detectors mitigate this by analyzing a trained network's internal activations to flag anomalies. However, almost all modern OOD detectors rely on hyperparameters (like thresholds or feature-shaping functions) that must be tuned before deployment.
Standard practice relies on using a separate, arbitrary "OOD proxy" dataset for this tuning process. The authors point out two major flaws with this approach:
- Availability & Realism: In practice, true OOD data represents "unknown unknowns" that are difficult to foresee or collect.
- High Variance: Detector performance is highly sensitive to the choice of the tuning dataset. Choosing a different proxy dataset can drastically alter a detector's final accuracy and even flip the performance rankings of different detection methods.
This paper formalizes the problem of tuning OOD detectors without a given OOD dataset and proposes a principled, data-driven solution.
Methods
The core insight of the proposed method is that the internal class structure of the in-distribution (ID) training data already contains enough information to map out the ID/OOD boundary.
Instead of looking for external data, the authors simulate OOD data using a class-splitting strategy:
- Class Splitting: Given an ID dataset with $n$ categories, they randomly select $M$ categories to act as "simulated OOD" data, leaving the remaining $n-M$ categories as "simulated ID" data.
- Pseudo-Task Training: They train a variant of the target neural network architecture solely on the simulated ID categories. To this new network variant, the held-out $M$ categories are genuinely out-of-distribution, serving as a realistic proxy for "near-OOD" examples.
- Ensemble Optimization: To minimize randomness, this process is repeated $N$ times across different random class splits. The parameters of the OOD detector are then optimized via Bayesian optimization to maximize OOD detection performance on average across all simulated splits.
- Hyperparameter Selection: The number of held-out classes ($M$) is treated as a hyperparameter and optimized using a validation loop.
The authors also formalize and evaluate two common synthetic baselines wrapped in this same hyperparameter optimization framework: tuning via Gaussian noise images and tuning via adversarial perturbations (using the Fast Gradient Sign Method).
Datasets
The method was evaluated using standard image classification benchmarks within the OpenOOD framework:
- In-Distribution (ID) Datasets: CIFAR-10, CIFAR-100, ImageNet-200, and ImageNet-1K.
- Evaluation OOD Datasets: A suite of test sets including SVHN, MNIST, Textures, Places365, iNaturalist, NINCO, SSB-hard, and OpenImage-O.
Key Insights and Ideas
- The "Near-OOD" Advantage: By holding out actual semantic classes from the same dataset, the simulated OOD data lies close to the true data manifold. Tuning a detector to separate these "hard" examples helps it generalize effectively to both near-OOD and far-OOD datasets at test time.
- Complexity Demands Better Tuning: Simple OOD detectors with only one parameter (like ReAct or ASH) are relatively robust to sub-optimal tuning. However, advanced, higher-parameter detector families (like Piecewise Linear Functions (PLF) or Variational Rectified Activation (VRA)) easily overfit to simple synthetic data like Gaussian noise. The proposed class-splitting method provides the complex supervision these high-capacity detectors need.
Key Results
- Outperforming Synthetic Baselines: On higher-parameter detector families (PLF and VRA), the proposed method consistently outperformed the Gaussian noise and adversarial baselines across both CIFAR and ImageNet benchmarks. For instance, on CIFAR-100 with a ResNet-18, the proposed method achieved the best AUROC on 5 out of 6 evaluation OOD sets for the VRA detector.
- Competitive with True OOD Tuning: When compared against the standard OpenOOD benchmark—where detectors are tuned using actual external OOD datasets (like TinyImageNet)—the proposed method achieved comparable or superior performance, despite having never seen external OOD data during tuning.
Limitations and Future Work
The primary limitation of this approach is its computational overhead. Simulating the OOD boundary requires training $N$ separate variants of the task neural network. While this is entirely manageable for standard image classification models (taking roughly 30 minutes on a standard workstation), it becomes computationally prohibitive for dense prediction tasks like semantic segmentation or for large language models (LLMs).
Future work will focus on mitigating this training overhead and extending the self-contained tuning formulation to non-convolutional architectures and broader machine learning tasks.
Summary updated