Norm-Scaling for Out-of-Distribution Detection

Deepak Ravikumar, Kaushik RoyarXiv 2022 · DOI

Abstract

Deep neural networks are notoriously overconfident when encountering data outside their training distribution, posing a significant risk in safety-critical applications. This paper introduces Norm-Scaling, a simple yet powerful technique that normalizes model outputs (logits) on a per-class basis to improve Out-of-Distribution (OoD) detection. By aligning uncertainty representations across different categories, Norm-Scaling achieves a 33% reduction in false positive rates compared to previous state-of-the-art methods without requiring additional parameter tuning.

Introduction

A fundamental safety flaw in modern deep learning is the tendency of models to be "confidently wrong." When a model trained to recognize cats and dogs is presented with an image of a tractor, it rarely signals uncertainty; instead, it often predicts a known class with high confidence. This overconfidence is a significant barrier to deploying AI in domains such as medical diagnostics and autonomous vehicles, where the ability to say "I don't know" is as important as a correct classification.

The Problem: Class-Specific Distribution Shifts

The standard approach to detecting Out-of-Distribution (OoD) inputs is to monitor the model's confidence score—typically the Maximum Softmax Probability (MSP)—and apply a global threshold. However, this method assumes that "confidence" is a level playing field across all classes.

Research from Purdue University reveals that this assumption is flawed. Different classes naturally exhibit different distributions of similarity scores. For instance, a confidence score of 0.7 might indicate high certainty for one class but significant uncertainty for another. Using a single global threshold leads to suboptimal detection and high misidentification rates because the "baseline" for what constitutes a confident prediction varies by category.

Angular similarity distributions for different classes and out-of-distribution data.

As shown in the figure above, the probability distributions for different classes are shifted and scaled differently. The authors point out that the final layer of a classifier is essentially calculating the "angular similarity" between a latent representation and a class mean. Because these similarities are not naturally calibrated across classes, the raw logits are not directly comparable, creating a "gap" where OoD data can easily be mistaken for in-distribution samples.

Methodology: Norm-Scaling

To address this, the authors propose Norm-Scaling, which applies Z-score normalization to the logits separately for each class. The process is straightforward and computationally efficient:

  1. Training Phase: The model calculates the mean ($\mu$) and standard deviation ($\sigma$) of the logits for every class using the training dataset.
  2. Inference Phase: For a new input, the model predicts a class and then normalizes the corresponding logit by subtracting that class's specific mean and dividing by its standard deviation.
  3. Consistency: This transformation ensures that the resulting value represents a consistent level of uncertainty across the entire dataset. A normalized score now carries the same meaning regardless of whether the model predicted a 'Bird' or a 'Plane'.

This approach can be viewed as a parameter-free version of temperature scaling that is inherently class-specific, requiring no manual hyperparameter tuning on a validation set.

Results and Impact

The researchers evaluated Norm-Scaling using a robust suite of benchmarks, including CIFAR-10, SVHN, and TinyImageNet as in-distribution data, against various noise and natural image datasets as OoD samples. All experiments were conducted using a ResNet-18 backbone.

Comparison of Softmax Confidence distributions with and without Norm-Scaling.

The results demonstrate a significant improvement in detection performance across multiple metrics:

  • FPR95 Reduction: Norm-Scaling achieved a staggering 33.19% reduction in the false positive rate (at 95% true positive rate), which is the primary metric for safety-critical systems.
  • AUROC Improvement: The method showed an average 9.78% improvement in the Area Under the Receiver Operating Characteristic curve.
  • AUPR Gains: The Area Under the Precision-Recall curve improved by 5.99%.
  • Efficiency: Because it involves simple arithmetic on final logits, it adds negligible computational overhead during inference, making it suitable for real-time applications.

Conclusion

Norm-Scaling offers a powerful, computationally efficient solution to the problem of model overconfidence. By recognizing and correcting for class-specific distribution shifts, it provides a more reliable foundation for Out-of-Distribution detection. While current results focus on logit-level normalization, future work may explore applying similar techniques to intermediate feature maps or evaluating performance on extremely long-tailed datasets where class statistics are harder to estimate.

Summary updated

BibTeX
@misc{ravikumar2022norm,
  author = {Deepak Ravikumar and Kaushik Roy},
  title = {{Norm-Scaling for Out-of-Distribution Detection}},
  year = {2022},
  eprint = {2205.03493},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.03493},
}
Figure