Preprint
Large Language Models

Exploring the limits of out-of-distribution detection

Stanislav Fort, Jie Jessie Ren, Balaji Lakshminarayanan
January 1, 2021Neural Information Processing Systems434 citations

434

Citations

50

Influential Citations

Neural Information Processing Systems

Venue

2021

Year

Abstract

Near out-of-distribution detection (OOD) is a major challenge for deep neural networks. We demonstrate that large-scale pre-trained transformers can significantly improve the state-of-…

Analysis

Why This Paper Matters

Out-of-distribution (OOD) detection is critical for deploying deep learning models in real-world settings where inputs may deviate from the training distribution. Traditional methods often struggle with 'near' OOD examples that are semantically similar to training data. This paper, presented at NeurIPS 2021, demonstrates that large-scale pre-trained transformers can dramatically improve OOD detection, setting a new state of the art. The findings suggest that scale and pre-training are key factors for robustness, shifting the focus from specialized OOD algorithms to leveraging powerful base models.

This work is significant because it bridges the gap between representation learning and OOD detection. By showing that features from pre-trained transformers are highly effective for distinguishing in-distribution from OOD data, it provides a simple yet powerful baseline for future research. The paper also offers insights into why larger models perform better, which has implications for model design and training strategies.

Technical Contributions

  • Use of Pre-trained Transformers: The authors employ large-scale vision transformers (ViT) pre-trained on massive datasets (e.g., ImageNet-21k, JFT) and show that their features are highly discriminative for OOD detection.
  • Feature-based OOD Scoring: Instead of training a separate OOD detector, they use the intermediate feature statistics (e.g., mean and variance) from the transformer to compute OOD scores, such as Mahalanobis distance or energy scores.
  • Systematic Evaluation: They conduct a thorough comparison across multiple OOD benchmarks (e.g., CIFAR-10 vs. CIFAR-100, SVHN, etc.) and show consistent improvements with increasing model size.
  • Analysis of Scale Effects: The paper provides an analysis of how model capacity and pre-training data size affect OOD detection, revealing that larger models yield better separation between in-distribution and OOD features.

Results

The proposed method achieves state-of-the-art results on several OOD detection benchmarks. For example, on CIFAR-10 vs. CIFAR-100 (a near-OOD task), the method reduces the false positive rate (FPR@95) to below 10%, compared to over 30% for previous methods. AUROC scores exceed 0.95, significantly outperforming baselines like ODIN, Mahalanobis, and energy-based approaches. The improvements are consistent across different OOD datasets and model architectures, with the largest gains observed for the largest transformer models.

Significance

This paper has had a lasting impact on the field of OOD detection and robust deep learning. It demonstrates that large-scale pre-training is a powerful tool for improving model reliability, and it has inspired subsequent work on using foundation models for OOD detection and uncertainty estimation. The findings also raise important questions about the role of scale and inductive biases in neural networks, influencing research on model evaluation and safety. For practitioners, the paper provides a practical recipe: use a large pre-trained transformer and simple feature statistics to achieve strong OOD detection without complex training procedures.