Entropic Out-of-Distribution Detection

David Macêdo, Tsang Ing Ren, Cleber Zanchettin, Adriano L. I. Oliveira, Teresa Bernarda Ludermir

TL;DR

This paper introduces IsoMax loss, a novel drop-in replacement for the standard SoftMax loss, that significantly improves out-of-distribution (OOD) detection performance without sacrificing classification accuracy or increasing inference time. By addressing the inherent limitations of SoftMax loss, IsoMax loss enables "seamless" OOD detection, a more practical and efficient approach for real-world applications.

What Problem Does This Paper Address?

Detecting when a neural network encounters data it wasn't trained on (out-of-distribution or OOD data) is crucial for reliable AI systems. Current OOD detection methods often come with a hefty price: they might require extensive hyperparameter tuning, the collection of specific "outlier" data, or they can even degrade the model's accuracy on its intended task. Furthermore, many OOD techniques introduce computational overhead, leading to slower and more energy-intensive inferences. The authors argue that these issues stem from fundamental flaws in the widely used SoftMax loss function: its "anisotropy" (leading to poorly separated feature representations) and its tendency to produce overconfident, low-entropy predictions, which contradict the principle of maximum entropy. This paper aims to solve these problems by proposing a new loss function that inherently promotes better OOD detection without these practical drawbacks.

Methods

The core contribution is the IsoMax loss, designed to directly address the shortcomings of SoftMax loss.

  • Isotropy: To combat SoftMax's feature anisotropy, IsoMax loss makes the loss function exclusively distance-based. It forces the learned features to be clustered around class prototypes based on their distance, promoting more discriminative representations. This is achieved by modifying the logits to depend solely on the distance between the high-level feature embedding and the class prototype.
  • Entropy Maximization Trick: To counter SoftMax's overconfidence and low-entropy predictions, IsoMax loss employs an "entropy maximization trick." During training, the logits are multiplied by a constant scalar factor called the "entropic scale" ($E_s$). This encourages higher entropy in the output probability distributions. Crucially, this scale factor is removed before inference, allowing the model to produce fast, high-entropy predictions that align with the maximum entropy principle.
  • Entropic Score (ES): For OOD detection itself, the paper proposes using the negative entropy of the neural network's output probabilities, termed the "entropic score." This score leverages information from all output probabilities, not just the maximum, to better identify OOD samples.

The IsoMax loss is designed as a "drop-in replacement" for SoftMax, meaning it requires no changes to the neural network architecture or standard training procedures, beyond replacing the loss function itself.

Datasets

The paper uses standard benchmark datasets for training and evaluation:

  • Training Datasets: CIFAR10, CIFAR100, SVHN, TinyImageNet, LSUN.
  • Out-of-Distribution (OOD) Datasets: LSUN, TinyImageNet, CIFAR10, CIFAR100 (used as OOD data for models trained on other datasets).

The authors emphasize that their approach does not require any OOD or outlier data for training or validation, which is a key aspect of their "seamless" OOD detection definition.

Key Insights and Ideas

  • SoftMax Loss is the Bottleneck: The paper makes a strong case that the inherent properties of the SoftMax loss function (anisotropy and overconfidence) are the primary reasons for poor OOD detection performance in modern neural networks, rather than limitations of the models themselves.
  • Isotropy + Entropy Maximization = Better OOD Detection: Combining a distance-based (isotropic) loss with a mechanism to boost output entropy during training is a powerful combination for improving OOD detection.
  • Seamless OOD Detection is Achievable: The proposed IsoMax loss and entropic score demonstrate that it's possible to achieve state-of-the-art OOD detection performance without the usual burdens of hyperparameter tuning, outlier data collection, or accuracy degradation.
  • High Entropy Correlates with OOD Detection: The experiments strongly suggest that higher entropy in the model's output probabilities directly leads to better OOD detection performance.

Key Results

  • No Classification Accuracy Drop: IsoMax loss trained models maintain classification accuracy comparable to SoftMax loss trained models across various datasets and architectures (DenseNet, ResNet).
  • Improved OOD Detection: IsoMax loss with the entropic score (IsoMax+ES) significantly outperforms SoftMax-based methods and other non-seamless OOD detection approaches in terms of AUROC and TNR@TPR95 metrics. For instance, on DenseNet with CIFAR10 trained data and TinyImageNet as OOD, IsoMax+ES achieves 97.8% AUROC compared to SoftMax+MPS at 55.8%.
  • Fast and Energy-Efficient Inferences: IsoMax loss does not introduce any computational overhead during inference. Models trained with IsoMax are as fast and energy-efficient as those trained with SoftMax, unlike many other OOD methods that require additional preprocessing steps.
  • State-of-the-Art for Seamless OOD: The IsoMax+ES approach achieves state-of-the-art results under the strict "seamless" conditions (no accuracy drop, no extra data, no hyperparameter tuning, fast inference).

Limitations and Future Work

  • Entropic Scale Value: While the paper demonstrates that a high entropic scale ($E_s=10$) is sufficient for optimal performance, they acknowledge that further validation of $E_s$ is not possible under their "seamless" constraints (no OOD data for validation). They suggest that making $E_s$ learnable did not significantly improve results.
  • Baseline for Further Research: The authors position IsoMax loss as a strong baseline. They propose that future work can combine IsoMax loss with existing OOD techniques like outlier exposure, adversarial training, or energy-based methods to potentially achieve even higher performance on non-seamless OOD detection tasks. They also suggest applying IsoMax loss to pretrained models.
  • Scalability to Larger Datasets: While the paper focuses on common benchmarks, they express interest in applying the approach to larger datasets like ImageNet in future work.

Summary updated

Abstract

Out-of-distribution (OOD) detection approaches usually present special requirements (e.g., hyperparameter validation, collection of outlier data) and produce side effects (e.g., classification accuracy drop, slower energy-inefficient inferences). We argue that these issues are a consequence of the SoftMax loss anisotropy and disagreement with the maximum entropy principle. Thus, we propose the IsoMax loss and the entropic score. The seamless drop-in replacement of the SoftMax loss by IsoMax loss requires neither additional data collection nor hyperparameter validation. The trained models do not exhibit classification accuracy drop and produce fast energy-efficient inferences. Moreover, our experiments show that training neural networks with IsoMax loss significantly improves their OOD detection performance. The IsoMax loss exhibits state-of-the-art performance under the mentioned conditions (fast energy-efficient inference, no classification accuracy drop, no collection of outlier data, and no hyperparameter validation), which we call the seamless OOD detection task. In future work, current OOD detection methods may replace the SoftMax loss with the IsoMax loss to improve their performance on the commonly studied non-seamless OOD detection problem.
BibTeX
@article{macedo2022entropic,
  author = {David Macêdo and Tsang Ing Ren and Cleber Zanchettin and Adriano L. I. Oliveira and Teresa Bernarda Ludermir},
  title = {{Entropic Out-of-Distribution Detection}},
  journal = {IEEE Trans. Neural Networks Learn. Syst.},
  year = {2022},
  doi = {10.1109/tnnls.2021.3112897},
}
Figure