TL;DR
This paper provides the first comprehensive survey of Out-of-Distribution (OOD) detection methods specifically for Natural Language Processing (NLP). It categorizes existing approaches based on OOD data availability, outlines key datasets and metrics, and discusses future research directions, offering a valuable resource for researchers and practitioners in the field.
What Problem Does This Paper Address?
In real-world applications, NLP systems often encounter data that differs from what they were trained on. This "out-of-distribution" (OOD) data can lead to incorrect predictions and compromise system reliability and safety. For instance, a dialogue system trained on a limited set of user intents might fail when faced with novel or unexpected requests. While OOD detection has seen progress in computer vision, a systematic overview for NLP is lacking. This paper aims to fill that gap by providing a structured understanding of OOD detection in NLP, highlighting its unique challenges and existing solutions.
Methods
The paper categorizes OOD detection methods into three main groups based on the availability of OOD data during training:
- OOD Data Available: These methods utilize both in-distribution (ID) and OOD data. They are further divided into those using extensive OOD data (treating OOD as a separate class or using outlier exposure) and those using only a small amount of OOD data (often involving data generation techniques).
- OOD Data Unavailable + ID Label Available: This is a significant focus, as labeled OOD data is scarce. Methods here typically involve learning robust representations from ID data and then using a scoring function to detect OOD samples. This often includes pre-training and fine-tuning of language models, as well as various output-based, feature-based, and ensemble-based detection strategies.
- OOD Data Unavailable + ID Label Unavailable: This setting is akin to traditional anomaly detection and is less explored in NLP. It focuses on extracting robust features and estimating data distributions without any labels.
The paper also discusses techniques for generating pseudo-OOD samples when real OOD data is unavailable, including phrase distortion, feature mixup, latent generation (e.g., using GANs), and open-domain sampling.
Datasets
The survey highlights several datasets commonly used for OOD detection in NLP:
- CLINC150: A manually labeled dataset with 150 in-domain intents and 1,200 out-of-scope queries.
- Banking: A dataset for intent classification.
- StackOverflow: A dataset often used for text classification tasks.
- STAR: A multi-turn dialogue dataset with annotated turn-level intents, including OOD labels.
- ROSTD: A dataset constructed by annotating OOD samples.
The paper also notes that OOD samples can be curated by holding out classes from existing datasets or by using samples from entirely different corpora.
Key Insights and Ideas
- Pre-trained models are crucial: The paper emphasizes that pre-trained transformer models (like BERT) significantly improve OOD detection performance, often outperforming models trained from scratch.
- Calibration matters: Better-calibrated models tend to yield higher OOD detection performance.
- NLP's unique challenges: OOD detection in NLP faces distinct challenges compared to computer vision, including discrete input spaces, complex output structures (like sequential generation), and the need to model contextual information.
- Data scarcity is a major hurdle: The lack of readily available labeled OOD data drives research into methods that can learn from ID data alone or generate synthetic OOD samples.
- LLMs offer new possibilities: Large Language Models (LLMs) are not only powerful tools for OOD detection but can also be leveraged for data augmentation and potentially for lifelong learning systems.
Key Results
The paper does not present new empirical results but rather synthesizes findings from existing research. Key findings highlighted include:
- Pre-trained models consistently achieve superior OOD detection performance across various tasks.
- Methods that leverage contrastive learning to increase inter-class discrepancies show improved OOD detection.
- Techniques like outlier exposure and calibrated scoring functions are effective in improving OOD detection.
Limitations and Future Work
The authors acknowledge several limitations:
- The survey primarily focuses on NLP domains, complementing existing CV surveys.
- Some methods are described at a high level due to space constraints.
- The paper does not present new empirical results or comparative experiments.
Future research directions suggested include:
- Jointly addressing OOD detection and domain generalization: Developing models that are both robust to distribution shifts and capable of detecting OOD inputs.
- Leveraging extra information sources: Incorporating modalities beyond text (e.g., images, audio) and external knowledge (e.g., knowledge graphs, internet search) to improve OOD detection.
- Integrating OOD detection with lifelong learning: Developing systems that can continuously learn from OOD inputs rather than simply ignoring them, enabling more human-like AI systems.
- Theoretical analysis of OOD detection: Bridging the gap between empirical success and theoretical understanding.
Summary updated