Distribution Calibration for Out-of-Domain Detection with Bayesian Approximation

Yanan Wu, Zhiyuan Zeng, Keqing He, Yutao Mou, Pei Wang, Weiran Xu

Standard intent classifiers are notoriously overconfident when they encounter "Out-of-Domain" (OOD) queries, often assigning them high-confidence scores for incorrect categories. This paper introduces a simple, plug-and-play Bayesian framework using Monte-Carlo Dropout to calibrate this uncertainty, boosting OOD detection performance with minimal computational cost.

The Problem: Overconfidence in OOD Detection

In task-oriented dialog systems, models must distinguish between "In-Domain" (IND) intents and "Out-of-Domain" (OOD) requests. A standard approach uses the Maximum Softmax Probability (MSP); if the highest probability is low, the query is flagged as OOD. However, deep neural networks suffer from distribution uncertainty. Because the model has never seen OOD data during training, its predictions on those samples are erratic and often "sharp," making them indistinguishable from valid IND samples.

Methodology: Bayesian Calibration

The authors propose a Bayesian framework that requires no additional parameters or OOD-specific training data. The core mechanism is Monte-Carlo (MC) Dropout used during inference.

The overall architecture performs $N$ stochastic forward passes with dropout to compute an averaged 'expected' softmax distribution.

Instead of a single forward pass, the model performs $N$ stochastic passes for a single query. During each pass, Dropout is kept active. For OOD samples, these distributions vary wildly across passes. By averaging these $N$ distributions, the erratic high-confidence peaks cancel each other out, resulting in a flatter, more uniform distribution that accurately reflects the model's uncertainty.

Key Insights

  • The "Random Seed" Revelation: The authors discovered that while different random seeds don't change how a model handles IND data, they cause the model to fail on OOD data in completely different ways. One seed might predict "Intent A," while another predicts "Intent B."
  • Averaging as Calibration: By simulating an ensemble of models via MC Dropout, the "wrong" high-confidence peaks for OOD samples are smoothed out. This moves the OOD prediction closer to a uniform distribution, which is ideal for detection.
  • Efficiency: Significant gains are achieved with as few as 10 passes ($N=10$), which increases inference time by a negligible 0.41%.

Experimental Results

The framework was evaluated on the CLINC-Full and CLINC-Imbal datasets using both Bi-LSTM and BERT backbones.

Distribution of MSP and Entropy before and after Bayesian calibration. The method significantly improves the separation between In-Domain (IND) and Out-of-Domain (OOD) samples.

As illustrated in the frequency plots above, Bayesian calibration successfully pushes OOD samples toward lower MSP and higher entropy. On the CLINC-Full dataset with an LSTM, the OOD F1-score jumped from 50.13% to 70.05%. Even with a powerful BERT model, the Bayesian approach provided a significant boost, raising the F1-score from 52.79% to 71.25%.

Conclusion

This Bayesian approach consistently outperforms standard softmax baselines and sophisticated distance-based methods. By calibrating distribution uncertainty through simple averaging, it provides a robust and efficient solution for OOD detection in real-world dialog systems. Future work may focus on model distillation to further optimize the latency of multiple forward passes.

Summary updated

BibTeX
@inproceedings{wu2022distribution,
  author = {Yanan Wu and Zhiyuan Zeng and Keqing He and Yutao Mou and Pei Wang and Weiran Xu},
  title = {{Distribution Calibration for Out-of-Domain Detection with Bayesian Approximation}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2022},
  url = {https://openreview.net/forum?id=aPIgpaQlPqI},
}
Figure