Logit-based Uncertainty Measure in Classification

Huiyu Wu, Diego Klabjan

Abstract

Deep neural networks often exhibit overconfidence in their predictions, even when faced with out-of-distribution data. While methods like Softmax entropy are standard, they frequently fail to provide reliable uncertainty estimates. We present a novel logit-based uncertainty measure that models the distribution of raw logit outputs using Gaussian Mixture Models (GMMs). This approach is model-agnostic, requires no retraining, and offers a significant speed advantage—up to 200x faster than high-performance alternatives like Deep k-Nearest Neighbors (DkNN)—while maintaining competitive accuracy in error detection.

Introduction

The reliability of deep learning models in safety-critical applications depends not just on their accuracy, but on their ability to quantify uncertainty. A model should "know what it doesn't know." However, the standard Softmax function tends to squash logit values, leading to overconfident predictions for unfamiliar inputs. Existing remedies, such as Bayesian Ensembles or Monte Carlo Dropout, are computationally expensive, while others like Evidential Deep Learning require specialized training. We propose a post-hoc method that leverages the rich information contained in the logit layer to provide a more nuanced uncertainty score.

Methodology: Modeling Logit Space

Our method shifts the focus from the final probability distribution back to the raw, unnormalized scores (logits) produced before the Softmax layer. We observe that for a well-trained model, the logits of correctly classified samples for a specific class tend to cluster in a predictable way.

  1. GMM Fitting: We fit a Gaussian Mixture Model (GMM) to the logits of correctly classified training samples for each class. This creates a density map of "confident" logit patterns.
  2. Uncertainty Scoring: For a new input, we calculate its distance from the high-density regions of the GMM corresponding to the predicted class.
  3. Normalization: This distance is mapped to a 0–1 scale using a Sigmoid function, where 1 indicates maximum uncertainty.

The Informational Value of Logits

A key insight of this work is that logits capture inter-class relationships that are often lost after Softmax normalization. For example, in a model trained on CIFAR-10, the logit pattern for a "truck" will be more similar to a "car" than to an "airplane."

Figure 2: Logit scores for 'dog' and 'cat' classes across various labels, demonstrating how raw scores capture class similarities.

As shown in Figure 2, the raw scores provide a hierarchy of similarity. A robust uncertainty measure should reflect this; a model should be less "surprised" by a truck if it knows cars, compared to an entirely unrelated object. Our logit-based GMM successfully captures this "order relationship."

Experimental Results

We evaluated our method across multiple benchmarks, including MNIST, FashionMNIST, and CIFAR-10, comparing it against Dropout, Ensembles, Evidential models, and DkNN.

Performance and Efficiency

The logit-based approach is exceptionally efficient. In large-scale tests involving GAN-generated images, it was over 200 times faster than DkNN. Furthermore, it requires significantly less memory, as it only needs to store GMM parameters rather than the entire training set.

Error Detection Accuracy

The effectiveness of an uncertainty measure is often judged by its ability to assign high scores to incorrect predictions and low scores to correct ones.

Figure 6: Cumulative distribution of uncertainty scores for correct (a) and incorrect (b) predictions across different methods.

In Figure 6, we compare the cumulative distribution functions (CDFs) of uncertainty scores. For incorrect predictions (6b), an ideal measure would have a curve that stays low until high uncertainty values. Our "Logit" method (green) outperforms standard Dropout and Ensemble methods in identifying incorrect predictions, providing a cleaner separation between certain and uncertain outcomes.

Conclusion

Logit-based uncertainty offers a practical, high-performance solution for real-world AI deployment. By treating the neural network as a black box and modeling its internal logit distributions, we achieve a measure that is both computationally efficient and theoretically grounded. This method enables more reliable "human-in-the-loop" systems where models can safely hand off low-confidence tasks to human experts.

Summary updated

BibTeX
@inproceedings{wu2021logit,
  author = {Huiyu Wu and Diego Klabjan},
  title = {{Logit-based Uncertainty Measure in Classification}},
  booktitle = {IEEE BigData},
  year = {2021},
  doi = {10.1109/bigdata52589.2021.9672066},
}
Figure