ExCeL : Combined Extreme and Collective Logit Information for Enhancing Out-of-Distribution Detection

Naveen Karunanayake, Suranga Seneviratne, Sanjay ChawlaarXiv 2023 · DOI

Abstract

Deep Neural Networks (DNNs) often exhibit overconfidence when encountering Out-of-Distribution (OOD) data, posing significant risks in safety-critical applications. This paper introduces ExCeL (Combined Extreme and Collective Logit Information), a novel post-hoc detection method. ExCeL integrates the "extreme" information of the top prediction confidence with "collective" information derived from a new metric: the class rank signature. By analyzing the predictable patterns of secondary class rankings for In-Distribution (ID) data, ExCeL effectively distinguishes between known and unknown inputs. Experimental results on the OpenOOD benchmark demonstrate that ExCeL achieves the best overall performance across CIFAR100 and ImageNet-200 compared to 21 competitive baselines.

Introduction

The deployment of Deep Neural Networks in real-world scenarios is often hindered by their tendency to assign high-confidence scores to inputs they have never seen during training. This phenomenon, known as OOD overconfidence, is a critical challenge for autonomous systems, medical diagnostics, and financial modeling.

Existing post-hoc OOD detectors—methods that work with pre-trained models without requiring retraining—typically focus on one of two information types. "Extreme" methods, such as MaxLogit or Softmax confidence, look solely at the magnitude of the highest output. "Collective" methods analyze the broader behavior of the output layer across multiple classes. The authors of ExCeL argue that relying on a single information source is insufficient. They propose that combining the strength of the primary prediction with the contextual "signature" of the remaining classes provides a more robust defense against OOD samples.

Methodology: The Class Rank Signature

The central innovation of ExCeL is the observation that for In-Distribution (ID) data, the rankings of classes beyond the top prediction are not random. Instead, they form a deterministic "class rank signature" based on semantic relationships. For instance, if a model correctly identifies an "Elephant," its secondary and tertiary predictions are likely to be semantically related animals like "Camel" or "Bear." In contrast, OOD data typically results in chaotic, near-random secondary rankings.

The Class Likelihood Matrix (CLM)

To capture these signatures, ExCeL utilizes a Class Likelihood Matrix (CLM). During a pre-computation phase using the training set, a matrix is constructed for every class $c$. This matrix $M_c$ stores the probability $P(i, j | c)$ that class $i$ appears at rank $j$ when the model correctly predicts class $c$.

Class Likelihood Matrices (CLM) for ID classes, illustrating the deterministic 'rank signature' where secondary predictions are semantically related.

Smoothing and Scoring

To ensure generalizability and prevent overfitting to the training data, a piecewise smoothing function is applied to the CLM. This function rewards rankings that appear frequently in the training set while penalizing those that resemble random noise. At test time, a Rank Score (RS) is calculated by comparing the input's specific class ranking against the stored CLM signature for the predicted class.

The final ExCeL score is a linear combination of the Rank Score and the standard MaxLogit: $$Score_{ExCeL} = \alpha \cdot MaxLogit + (1 - \alpha) \cdot RS$$ This fusion ensures the detector considers both the "extreme" confidence of the top pick and the "collective" context of the secondary classes.

Experimental Evaluation

ExCeL was evaluated using the comprehensive OpenOOD benchmarking library, covering both small-scale (CIFAR100) and large-scale (ImageNet-200) In-Distribution datasets. The evaluation included Near-OOD datasets (semantically similar to ID) and Far-OOD datasets (visually distinct, such as SVHN, Textures, and Places365).

Performance and Consistency

ExCeL was compared against 21 state-of-the-art post-hoc methods, including MSP, Energy, and Mahalanobis. A key finding was ExCeL's unique consistency across different scales. While some methods like RMDS performed exceptionally on CIFAR100 but struggled on ImageNet-200, ExCeL maintained a top-tier position on both benchmarks.

Mean overall rank comparison across CIFAR100 and ImageNet-200 benchmarks. ExCeL (blue star) achieves the best consistency and performance compared to 21 baselines.

On the ImageNet-200 benchmark, ExCeL reduced the False Positive Rate (FPR95) by 5.6% for far-OOD detection compared to the MaxLogit baseline. This improvement highlights the value of incorporating collective rank information to ground extreme confidence scores.

Discussion and Limitations

ExCeL offers a versatile, post-hoc solution that can be integrated into existing pipelines without the need for expensive retraining. Its primary strength lies in far-OOD detection, where the "rank signature" of OOD samples is most distinct from ID signatures.

However, challenges remain in near-OOD detection. If an OOD sample is semantically very close to an ID class, its rank signature may inadvertently mimic the expected ID pattern. Additionally, while the authors identified stable default hyperparameters ($a=10, b=5, \alpha=0.8$), optimal performance on specific datasets may require further tuning.

Conclusion

By bridging the gap between extreme and collective logit information, ExCeL provides a more nuanced "sense of context" for neural networks. The method's ability to maintain high performance across diverse benchmarks makes it a promising candidate for enhancing the reliability of AI systems in open-world environments. Future research may explore the application of rank signatures to larger architectures like Vision Transformers or to non-visual domains such as Natural Language Processing.

Summary updated

Abstract

Deep learning models often exhibit overconfidence in predicting out-of-distribution (OOD) data, underscoring the crucial role of OOD detection in ensuring reliability in predictions. Among various OOD detection approaches, post-hoc detectors have gained significant popularity, primarily due to their ease of use and implementation. However, the effectiveness of most post-hoc OOD detectors has been constrained as they rely solely either on extreme information, such as the maximum logit, or on the collective information (i.e., information spanned across classes or training samples) embedded within the output layer. In this paper, we propose ExCeL that combines both extreme and collective information within the output layer for enhanced accuracy in OOD detection. We leverage the logit of the top predicted class as the extreme information (i.e., the maximum logit), while the collective information is derived in a novel approach that involves assessing the likelihood of other classes appearing in subsequent ranks across various training samples. Our idea is motivated by the observation that, for in-distribution (ID) data, the ranking of classes beyond the predicted class is more deterministic compared to that in OOD data. Experiments conducted on CIFAR100 and ImageNet-200 datasets demonstrate that ExCeL consistently is among the five top-performing methods out of twenty-one existing post-hoc baselines when the joint performance on near-OOD and far-OOD is considered (i.e., in terms of AUROC and FPR95). Furthermore, ExCeL shows the best overall performance across both datasets, unlike other baselines that work best on one dataset but has a performance drop in the other.
BibTeX
@misc{karunanayake2023excel,
  author = {Naveen Karunanayake and Suranga Seneviratne and Sanjay Chawla},
  title = {{ExCeL : Combined Extreme and Collective Logit Information for Enhancing Out-of-Distribution Detection}},
  year = {2023},
  eprint = {2311.14754},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.14754},
}
Figure