# Unsupervised Layer-wise Score Aggregation for Textual OOD Detection

Source: [Unsupervised Layer-wise Score Aggregation for Textual OOD Detection](<https://www.sota2.com/research/paper/68fa72471e209131cea5580d>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2025-10-26T02:22:12.513Z

Authors: Maxime Darrin, Guillaume Staerman, Eduardo Dadalto C\\^amara Gomes, Jackie CK Cheung, Pablo Piantanida, Pierre Colombo

Published: 2023-02-20T09:26:11.000Z

## 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 an anomaly score (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 could be achieved if the best layer were picked. To leverage this observation, we propose a data-driven, unsupervised method to combine layer-wise anomaly scores. In addition, we extend classical textual OOD benchmarks by including classification tasks with a greater number of classes (up to 77), which reflects more realistic settings. On this augmented benchmark, we show that the proposed post-aggregation methods achieve robust and consistent results while removing manual feature selection altogether. Their performance achieves near oracle's best layer performance.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Readback Anomaly Detection on APCP](<https://www.sota2.com/research/sota/readback-anomaly-detection-on-apcp.md>): Readback Anomaly Detection; APCP; Accuracy: 78.33.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2302.09852>)

[PDF](<https://arxiv.org/pdf/2302.09852.pdf>)
