Out-of-Distribution Detection via Deep Multi-Comprehension Ensemble

Chenhui Xu, Fuxun Yu, Zirui Xu, Nathan Inkawhich, Xiang Chen

This paper, presented at ICML 2024, tackles a fundamental problem in AI safety: how to reliably detect when a machine learning model is being asked to make a prediction on data it wasn't trained for—known as Out-of-Distribution (OOD) detection.

TL;DR

The authors demonstrate that traditional model ensembles fail at OOD detection because their individual models are "too similar" (mode-connected). By training ensemble members on fundamentally different tasks (e.g., classification vs. contrastive learning), they create a Multi-Comprehension (MC) Ensemble that provides the feature diversity necessary to significantly outperform state-of-the-art OOD detectors.

What Problem Does This Paper Address?

Deep neural networks are notoriously overconfident. When shown an image of something they’ve never seen before (an OOD sample), they often classify it into a known category with high certainty. OOD detection aims to identify these samples so the system can fail gracefully.

Researchers often use ensembles—combining multiple models—to improve robustness. The intuition is that different models will "disagree" on OOD data. However, recent studies suggest that "Deep Ensembles" (multiple models trained with different random seeds) don't actually improve OOD detection much more than a single large model.

The authors identify the root cause: Mode Connectivity. Models trained with the same loss function (like Cross-Entropy), even with different starting points, end up in the same "loss basin." They learn nearly identical feature representations, meaning they don't provide the diverse "second opinions" needed to spot OOD data.

Methods

The authors propose the Multi-Comprehension (MC) Ensemble. Instead of just changing random seeds, they change the supervision task for each model in the ensemble:

  1. Cross-Entropy (SupCE): Standard mapping of data to labels.
  2. SimCLR: A self-supervised task that learns by comparing augmented versions of the same image.
  3. Supervised Contrastive (SupCon): A task that pulls images of the same class together in feature space while pushing different classes away.

To prove these models are actually different, they introduce two new evaluation tools:

  • Loss Barrier Visualization: They show that models from different tasks are separated by high "energy barriers" in the loss landscape, making them impossible to align via simple transformations.
  • Self-Coupling Index (SCI): A quantitative metric based on Optimal Transport that measures the degree of consistency between two models' feature representations. A low SCI indicates high diversity.
Figure 1. (a) Models trained by different initialization (Θ1, Θ2) but with the same cross-entropy classification task (CE-SGD) can fall into the same or symmetric loss basin, which can be affine-transformed into the same basin (Re-Basin (Ainsworth et al., 2023)). This indicates the two models provide little variability. (b) By contrast, a different comprehension task (SimCLR-SGD) directs the model parameters in other directions. When SimCLR-SGD weights are relocated to the same loss landscape of CE-SGD weights, we can observe the loss barrier between two sets of weights is high so that Re-Basin is not possible, thus increasing the model and feature diversity.

Datasets

The researchers evaluated their approach on standard OOD benchmarks:

  • In-Distribution (ID): CIFAR-10 and ImageNet-1K.
  • Out-of-Distribution (OOD): SVHN, LSUN, iSUN, Textures, Places365, and iNaturalist.
  • Near-OOD: CIFAR-100 (used as OOD for a CIFAR-10 model), which is a much harder task because the classes are semantically similar.

Key Insights and Ideas

  • The Illusion of Diversity: Naive ensembles are "self-coupled." Even if you train them on different subsets of data, their features can be aligned by a simple linear transformation. They are essentially the same model in different clothes.
  • Task Diversity > Seed Diversity: Changing the objective of the training is the most effective way to break mode connectivity. This forces the models to develop different "comprehensions" of the same data.
  • Feature-Level Ensembling: Instead of just averaging final probabilities, the authors show that ensembling at the penultimate feature layer is a powerful "OOD booster" because it reduces the variance of feature estimates for ID data while keeping OOD activations distinct.
Figure 2. Visualization showing that models with high loss barriers (H1-H2) result in more stochastic (diverse) coupling matrices compared to models from the same task (H1-H3).

Key Results

The MC Ensemble consistently outperformed both single models and naive ensembles across all benchmarks:

  • CIFAR-10: Using a KNN-based scoring method, the MC Ensemble achieved an average FPR95 of 5.58% (False Positive Rate at 95% True Positive Rate). For comparison, a standard Deep Ensemble (3xSupCE) had an FPR95 of 27.78%.
  • Near-OOD: On the difficult CIFAR-10 vs. CIFAR-100 task, the MC Ensemble reduced the FPR95 by 30.05% compared to a naive ensemble.
  • Efficiency: The authors demonstrated that the ensemble's knowledge can be distilled into a single model (using EnD²), maintaining high performance while eliminating the computational overhead of running multiple models at inference time.

Limitations and Future Work

  • Task Pool Size: The study only explored a few training tasks (CE, SimCLR, SupCon). The authors note that as more diverse training criteria are developed, the "task pool" could be expanded to find even more diverse combinations.
  • Computational Cost: Training multiple models is expensive. While distillation solves the latency issue during deployment, the initial training phase still requires significant resources.
  • Selection Logic: While the SCI helps guide model selection, finding the absolute optimal combination of tasks for a specific dataset remains an open area for further study.

Summary updated

Abstract

Recent research underscores the pivotal role of the Out-of-Distribution (OOD) feature representation field scale in determining the efficacy of models in OOD detection. Consequently, the adoption of model ensembles has emerged as a prominent strategy to augment this feature representation field, capitalizing on anticipated model diversity. However, our introduction of novel qualitative and quantitative model ensemble evaluation methods, specifically Loss Basin/Barrier Visualization and the Self-Coupling Index, reveals a critical drawback in existing ensemble methods. We find that these methods incorporate weights that are affine-transformable, exhibiting limited variability and thus failing to achieve the desired diversity in feature representation. To address this limitation, we elevate the dimensions of traditional model ensembles, incorporating various factors such as different weight initializations, data holdout, etc., into distinct supervision tasks. This innovative approach, termed Multi-Comprehension (MC) Ensemble, leverages diverse training tasks to generate distinct comprehensions of the data and labels, thereby extending the feature representation field. Our experimental results demonstrate the superior performance of the MC Ensemble strategy in OOD detection compared to both the naive Deep Ensemble method and a standalone model of comparable size. This underscores the effectiveness of our proposed approach in enhancing the model's capability to detect instances outside its training distribution.
BibTeX
@inproceedings{xu2024out,
  author = {Chenhui Xu and Fuxun Yu and Zirui Xu and Nathan Inkawhich and Xiang Chen},
  title = {{Out-of-Distribution Detection via Deep Multi-Comprehension Ensemble}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=HusShERjlc},
}
Figure