Unsupervised Layer-Wise Score Aggregation for Textual OOD Detection

Abstract

Out-of-distribution (OOD) detection is a rapidly growing field due to new robustness and security requirements driven by an increased number of AI-based systems. Existing OOD textual detectors often rely on anomaly scores (\textit{e.g.}, Mahalanobis distance) computed on the embedding output of the last layer of the encoder. In this work, we observe that OOD detection performance varies greatly depending on the task and layer output. More importantly, we show that the usual choice (the last layer) is rarely the best one for OOD detection and that far better results can be achieved, provided that an oracle selects the best layer. We propose a data-driven, unsupervised method to leverage this observation to combine layer-wise anomaly scores. In addition, we extend classical textual OOD benchmarks by including classification tasks with a more significant number of classes (up to 150), which reflects more realistic settings. On this augmented benchmark, we show that the proposed post-aggregation methods achieve robust and consistent results comparable to using the best layer according to an oracle while removing manual feature selection altogether.

Cite

Text

Darrin et al. "Unsupervised Layer-Wise Score Aggregation for Textual OOD Detection." AAAI Conference on Artificial Intelligence, 2024. doi:10.1609/AAAI.V38I16.29742

Markdown

[Darrin et al. "Unsupervised Layer-Wise Score Aggregation for Textual OOD Detection." AAAI Conference on Artificial Intelligence, 2024.](https://mlanthology.org/aaai/2024/darrin2024aaai-unsupervised/) doi:10.1609/AAAI.V38I16.29742

BibTeX

@inproceedings{darrin2024aaai-unsupervised,
  title     = {{Unsupervised Layer-Wise Score Aggregation for Textual OOD Detection}},
  author    = {Darrin, Maxime and Staerman, Guillaume and Gomes, Eduardo Dadalto Câmara and Cheung, Jackie C. K. and Piantanida, Pablo and Colombo, Pierre},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year      = {2024},
  pages     = {17880-17888},
  doi       = {10.1609/AAAI.V38I16.29742},
  url       = {https://mlanthology.org/aaai/2024/darrin2024aaai-unsupervised/}
}