Source-linked AI summary

Mitigating Neural Network Overconfidence with Logit Normalization

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

arXiv:2205.09310v2cs.LG

TL;DR

Neural networks can assign excessive confidence to both in-distribution and out-of-distribution inputs, making reliable OOD detection difficult. The paper introduces LogitNorm, which constrains logit norms during training, and reports improved OOD detection and calibration with preserved ID accuracy, including substantial FPR95 reductions.

  • Problem

    Neural networks may produce abnormally high confidence for OOD inputs, while the fundamental cause and mitigation of this overconfidence remain insufficiently understood.

  • Method

    LogitNorm modifies cross-entropy training by normalizing logits to a constant norm, decoupling output-norm influence from optimization.

  • Results

    LogitNorm improves OOD detection and calibration while maintaining ID classification accuracy, reducing FPR95 by 33.87% on common benchmarks versus cross-entropy with softmax confidence.

  • Takeaways & Limitations

    Normalized-logit training produces more conservative predictions and stronger confidence-score separation between ID and OOD inputs, while also boosting post-hoc OOD scoring methods.

Abstract

from arXiv · show

Detecting out-of-distribution inputs is critical for safe deployment of machine learning models in the real world. However, neural networks are known to suffer from the overconfidence issue, where they produce abnormally high confidence for both in- and out-of-distribution inputs. In this work, we show that this issue can be mitigated through Logit Normalization (LogitNorm) -- a simple fix to the cross-entropy loss -- by enforcing a constant vector norm on the logits in training. Our method is motivated by the analysis that the norm of the logit keeps increasing during training, leading to overconfident output. Our key idea behind LogitNorm is thus to decouple the influence of output's norm during network optimization. Trained with LogitNorm, neural networks produce highly distinguishable confidence scores between in- and out-of-distribution data. Extensive experiments demonstrate the superiority of LogitNorm, reducing the average FPR95 by up to 42.30% on common benchmarks.

1. Introduction

OOD detection is important because neural networks can be overconfident on unfamiliar inputs, undermining softmax confidence as an OOD signal. LogitNorm addresses this by fixing logit norms during training and improves OOD detection and calibration while preserving ID accuracy.

  • Motivation: OOD detection distinguishes in-distribution inputs from unfamiliar inputs that should not receive high-confidence predictions.It supports safer deployment by allowing models to identify unknown inputs and take precautions.
  • Motivation: Neural networks can produce abnormally high softmax confidence for inputs far from the training distribution, limiting the reliability of maximum softmax probability.The fundamental cause and mitigation of this overconfidence issue remain insufficiently understood.
  • LogitNorm: LogitNorm fixes cross-entropy training by enforcing a constant norm on the pre-softmax logit vector.The method decouples logit-norm influence from optimization and encourages label-consistent directions without increasing output magnitude.
  • Results: 42.30%: LogitNorm reduces FPR95 from 50.33% to 8.03% when CIFAR-10 is ID data and SVHN is OOD data.Averaged across diverse OOD datasets, it reduces FPR95 by 33.87% versus softmax confidence with cross-entropy loss.
  • Results: LogitNorm improves OOD detection and confidence calibration while maintaining classification accuracy on ID data.It also boosts post-hoc scoring methods including ODIN, energy, and GradNorm, and is straightforward to implement.

2. Background

The paper formulates supervised multiclass classification over an in-distribution marginal and defines OOD detection as distinguishing that distribution from unknown inputs. Detection uses score-based level-set estimation with a threshold chosen to retain most ID examples.

  • Classification setup: The supervised problem uses inputs X, labels Y = {1, . . . , k}, a training dataset, and a classifier f: X → R^k with trainable parameters.The classifier maps each input to a k-dimensional output space.
  • Classification setup: The in-distribution marginal P_in represents the input distribution associated with the training data.The setup assumes training examples are independently drawn from a joint data distribution.
  • Classification setup: Cross-entropy with softmax is the commonly used classification loss, with f_y(x; θ) denoting the ground-truth logit and p(y|x) its softmax probability.These quantities connect the classifier output to the training objective.
  • OOD detection: OOD inputs come from unknown distributions and should not be predicted by the classifier, especially when their label sets may not intersect Y.Deployment therefore requires distinguishing them from inputs drawn from P_in.
  • OOD detection: OOD detection is a binary classification problem separating inputs from P_in versus inputs that are not from P_in.A scoring function and threshold implement this separation through level-set estimation.
  • OOD detection: The threshold γ is commonly selected so that a high fraction, such as 95%, of ID data is correctly classified; higher scores are assigned to ID.The framework considers scoring functions including MSP, ODIN, energy, and GradNorm.

3. Method: Logit Normalization

The method attributes overconfidence to growing logit magnitudes and addresses it by fixing the logit norm during training. LogitNorm applies cross-entropy to normalized logits, preserving directional learning while producing more conservative and separable confidence scores.

  • Motivation: Cross-entropy loss depends on both the logit magnitude and direction, and increasing magnitude raises confidence without changing the predicted class.For correctly classified examples, optimization can continue increasing logit magnitude to reduce the loss.
  • Motivation: During training, cross-entropy encourages increasingly larger logit norms for both ID and OOD examples, making their confidence scores harder to separate.The resulting large norms translate directly into overconfident softmax scores.
  • Logit Normalization: LogitNorm decouples logit magnitude from optimization by enforcing a constant L2 norm on the logit vector.The objective constrains the expected cross-entropy loss while requiring ||f(x; θ)||2 = α.
  • Logit Normalization: LogitNorm normalizes logits to a unit direction with constant magnitude, then applies softmax cross-entropy to the normalized output.The normalized vector is f(x; θ)/||f(x; θ)||, with a small positive denominator term used for numerical stability.
  • Effect: The temperature parameter τ modulates logit magnitude, and the loss can be interpreted as using an input-dependent temperature τ||f(x; θ)||.Under logit normalization, output magnitudes are strictly constant at 1/τ.
  • Effect: Because only the logit direction is optimized, LogitNorm encourages label-consistent outputs and tends to produce conservative predictions for inputs far from the training distribution.The method is illustrated as improving confidence separability between ID and OOD samples.

4. Experiments

Experiments evaluate LogitNorm across benchmark datasets, scoring functions, architectures, and calibration, showing improved OOD detection while preserving ID classification accuracy.

  • Experimental setup: Experiments use CIFAR-10 and CIFAR-100 as ID datasets and six common datasets, including SVHN and LSUN variants, as OOD test sets.OOD detection is measured with FPR95, AUROC, and AUPR.
  • OOD detection: 42.3%: LogitNorm reduces FPR95 from 50.33% to 8.03% when CIFAR-10 models are evaluated against SVHN.Averaged across six test datasets, FPR95 decreases by 33.87% compared with MSP on cross-entropy-trained models.
  • Scoring functions: LogitNorm benefits multiple post-hoc OOD scores, reducing ODIN FPR95 from 40.32% to 12.95% and improving energy and GradNorm performance.The reported averages cover six test OOD datasets.
  • Network architectures: LogitNorm consistently improves OOD detection across WRN-40-2, ResNet, and DenseNet architectures, reducing DenseNet average FPR95 from 50.41% to 18.57%.The comparison uses softmax confidence as the test-time OOD score.
  • Confidence calibration: LogitNorm produces smoother ID confidence distributions than cross-entropy and achieves better calibration performance with post-hoc temperature scaling.Cross-entropy concentrates confidence values near 1, whereas LogitNorm preserves more variation across ID examples.

5. Discussion

The discussion contrasts LogitNorm with logit-penalty and related normalization or temperature-scaling approaches, emphasizing differences in how logits are normalized and how methods affect OOD detection.

  • Logit normalization vs. Logit penalty: Logit penalty and LogitNorm both produce small logit norms, but only LogitNorm avoids large OOD logit norms and substantially improves OOD detection.The logit-penalty method can also create optimization difficulty or fail to converge when its multiplier is too large.
  • Relations to temperature scaling: Unlike constant test-time temperature scaling, LogitNorm uses an input-dependent temperature enforced during training.The method remains compatible with test-time temperature scaling and can improve calibration performance with it.
  • Effect of τ: In Figure 5, FPR95 is averaged across six test datasets on CIFAR-10 to examine how τ affects OOD detection.The analysis notes that a large τ increases the loss lower bound, making optimization less desirable.
  • Relations to other normalization methods: LogitNorm normalizes the network output, whereas cosine-based methods normalize the last-layer weights and learned features.LogitNorm also boosts common OOD scoring functions, while GODIN and Cosine loss use specific scoring functions.
  • Relations to other normalization methods: LogitNorm with MSP achieves better OOD detection performance than GODIN in Table 6.

6. Related Work

Related work addresses OOD detection through scoring functions and training-time regularization, while normalization and calibration methods provide adjacent strategies for representation and confidence control.

  • OOD detection: OOD detection methods either design scoring functions or modify training through regularization.
  • OOD detection: Scoring-based approaches include MSP, ODIN, Mahalanobis distance, energy-based scores, ReAct, GradNorm, and KNN-based scores.
  • OOD detection: Training-time regularization methods encourage uniform predictions or higher energies for outliers.
  • Normalization in deep learning: Normalization has been widely used in metric learning, face recognition, and self-supervised learning, with methods normalizing features, weights, or intermediate-layer distributions.
  • Confidence calibration: Confidence calibration includes post-hoc methods such as temperature scaling and histogram binning, alongside regularizers such as weight decay, label smoothing, and focal loss.

7. Conclusion

The conclusion presents LogitNorm as a simple cross-entropy alternative that improves OOD detection and confidence calibration while preserving ID accuracy and remaining practical to implement.

  • Conclusion: LogitNorm decouples logit-norm influence from training, encouraging conservative OOD predictions and stronger confidence separation from ID data.
  • Conclusion: LogitNorm improves OOD detection and confidence calibration while maintaining classification accuracy on ID data.
  • Conclusion: The method is straightforward to implement with existing deep learning frameworks and does not require sophisticated changes to the loss or training scheme.

A. Proof of Proposition 3.1

The proof derives Proposition 3.1 by introducing a scalar transformation, identifying the maximum logit, and applying the resulting inequalities across all classes.

  • A. Proof of Proposition 3.1: For any scalar s > 1, the proof begins by applying a scaled-logit transformation.
  • A. Proof of Proposition 3.1: The argument concludes by establishing Proposition 3.1.
  • A. Proof of Proposition 3.1: The proof defines fc as the maximum logit and t as s − 1 before deriving the proposition.
  • A. Proof of Proposition 3.1: Because fj − fc ≤ 0 for every class j, the proof applies this inequality to complete the derivation.

C. Proof of Proposition 3.3

The proof concludes Proposition 3.3 after establishing that the normalized vector e_f has constant norm 1/τ.

  • e_f is defined as f/(τ∥f∥).
  • The resulting vector norm is ∥e_f∥ = 1/τ.
  • The passage concludes the proof of Proposition 3.3.

D. Descriptions of OOD Datasets

The paper describes several OOD test datasets and identifies theoretical justification and hyperparameter tuning as future-work directions.

  • Descriptions of OOD Datasets: Six OOD test datasets include Textures, SVHN, LSUN-C, LSUN-R, and iSUN.The passage also begins describing the dataset collection used in evaluation.
  • Future Work: Future work includes more rigorous theoretical justification for how LogitNorm improves OOD detection.The current theoretical analysis explains why cross-entropy encourages larger logit magnitudes and overconfidence.
  • Future Work: Tuning τ with Gaussian-noise validation requires training multiple models and is computationally expensive.Future work is expected to automate adjustment of τ during training.

F. Detailed Experimental Results

The detailed results compare OOD detection across methods, scoring functions, losses, datasets, and model architectures, with percentages reported throughout.

  • Detailed Comparisons: Tables 7–9 report detailed OOD detector performance for LogitPenalty, GODIN, scoring functions, losses, and architectures.The comparisons include CE versus LogitNorm and multiple model architectures.
  • Logit Penalty and GODIN: Table 7 compares Logit Penalty with GODIN using WRN-40-2 trained on CIFAR-10.All values are percentages, with λ = 0.05 for Logit Penalty.
  • Loss and Scoring Comparisons: Table 8 compares cross-entropy and LogitNorm using WRN-40-2 and softmax confidence scoring.The table marks whether larger or smaller values are better and highlights superior results.
  • Architecture Comparisons: Table 9 compares cross-entropy and LogitNorm with ResNet-34 and DenseNet-BC.
  • Reporting Convention: The CIFAR-10 in-distribution dataset is used for the reported percentage values in the specified table context.Bold numbers denote superior results.
Loading 2205.09310v2…