Mitigating Neural Network Overconfidence with Logit Normalization

Hongxin Wei, Renchunzi Xie, Hao Cheng, Lei Feng, Bo An, Yixuan Li · DOI

Abstract

Modern neural networks are prone to overconfidence, frequently assigning high certainty to out-of-distribution (OOD) inputs. This paper identifies "magnitude explosion" in logits during standard cross-entropy training as a primary cause. We propose Logit Normalization (LogitNorm), a simple modification that enforces a constant norm on logit vectors. By decoupling logit direction from magnitude, LogitNorm forces the model to learn more discriminative features without relying on increasing output scales. Experimental results demonstrate that LogitNorm significantly improves OOD detection performance across various benchmarks while maintaining high classification accuracy.

Introduction

A critical requirement for deploying machine learning models in safety-critical applications is the ability to identify out-of-distribution (OOD) data—samples that do not belong to any training class. Ideally, a model should provide low-confidence predictions for such inputs. However, deep neural networks often exhibit extreme overconfidence, producing high Maximum Softmax Probability (MSP) scores even for random noise.

The authors trace this issue back to the standard cross-entropy loss. During training, optimization continues even after correct classification by increasing the magnitude (norm) of the logit vectors to further minimize loss. This leads to "spiky" probability distributions at test time that fail to distinguish between known and unknown data.

Logit magnitude continues to grow for in-distribution data throughout training, while OOD magnitudes remain lower but still lead to overconfident softmax outputs.

Methodology: Logit Normalization

To address the overconfidence spiral, we introduce Logit Normalization (LogitNorm). The core principle is to fix the magnitude of the logit vector $f$ during training, thereby forcing the network to minimize loss solely by optimizing the direction of the logits.

In LogitNorm, the logit vector is normalized to a constant magnitude before being passed to the softmax function:

$$\text{LogitNorm}(f) = \frac{f / \|f\|}{\tau}$$

Here, $\|f\|$ represents the Euclidean norm, and $\tau$ is a temperature hyperparameter that controls the fixed magnitude. By preventing the network from "turning up the volume" on its outputs, LogitNorm encourages the learning of more robust, directional representations. At test time, this results in more uniform (lower confidence) probability distributions for OOD samples, which typically lack a strong directional alignment with any specific class.

Experimental Evaluation

The effectiveness of LogitNorm was evaluated using CIFAR-10 and CIFAR-100 as in-distribution (ID) datasets, tested against a diverse suite of OOD benchmarks including SVHN, Textures, and Places365. The method was implemented across several architectures, such as ResNet-34 and WideResNet-40-2.

Key Results

LogitNorm achieves state-of-the-art performance in OOD detection. On the CIFAR-10 vs. SVHN benchmark, it reduced the False Positive Rate at 95% Recall (FPR95) from 50.33% to 8.03%—a substantial 42.3% absolute improvement over the standard cross-entropy baseline. Across six OOD benchmarks, the average FPR95 reduction was 33.87%.

Comparison of class probability distributions: Standard cross-entropy (left) produces overconfident predictions for both ID and OOD data, whereas LogitNorm (right) maintains high confidence for ID data while producing more uniform, low-confidence distributions for OOD data.

Importantly, these gains in OOD detection do not come at the cost of classification accuracy. For instance, LogitNorm maintains a ~94.7% accuracy on CIFAR-10, comparable to standard training. Furthermore, LogitNorm is "plug-and-play," enhancing the performance of other OOD scoring methods like ODIN and Energy scores by improving the underlying model representations.

Discussion and Limitations

While LogitNorm is highly effective, it introduces a dependency on the temperature hyperparameter $\tau$. Optimal values typically fall within the range of 0.01 to 0.05, but tuning may require a validation set with proxy OOD data (e.g., Gaussian noise). Future research could explore adaptive mechanisms for $\tau$ to reduce computational overhead during training. Additionally, further theoretical work is needed to fully characterize the relationship between directional logit information and OOD separability.

Conclusion

Logit Normalization offers a simple yet powerful solution to the overconfidence problem in deep learning. By constraining logit magnitudes during training, it prevents the optimization process from producing artificially high confidence scores, leading to significantly safer and more reliable OOD detection.

Summary updated

BibTeX
@inproceedings{wei2022mitigating,
  author = {Hongxin Wei and Renchunzi Xie and Hao Cheng and Lei Feng and Bo An and Yixuan Li},
  title = {{Mitigating Neural Network Overconfidence with Logit Normalization}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=R-NWNiuTKdR},
}
Figure