Holistic Sentence Embeddings for Better Out-of-Distribution Detection
Not on the map. Why?
Abstract (arXiv)
Detecting out-of-distribution (OOD) instances is significant for the safe deployment of NLP models. Among recent textual OOD detection works based on pretrained language models (PLMs), distance-based methods have shown superior performance. However, they estimate sample distance scores in the last-layer CLS embedding space and thus do not make full use of linguistic information underlying in PLMs. To address the issue, we propose to boost OOD detection by deriving more holistic sentence embeddings. On the basis of the observations that token averaging and layer combination contribute to improving OOD detection, we propose a simple embedding approach named Avg-Avg, which averages all token representations from each intermediate layer as the sentence embedding and significantly surpasses the state-of-the-art on a comprehensive suite of benchmarks by a 9.33% FAR95 margin. Furthermore, our analysis demonstrates that it indeed helps preserve general linguistic knowledge in fine-tuned PLMs and substantially benefits detecting background shifts. The simple yet effective embedding method can be applied to fine-tuned PLMs with negligible extra costs, providing a free gain in OOD detection. Our code is available at https://github.com/lancopku/Avg-Avg.
Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). Builds on 30 of its 47 references that are in the map. First posted on arXiv 14 Oct 2022.
Builds on
30 of 47 references.
References · 30
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2014Adam: A Method for Stochastic Optimizationcited by 36,960
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
- 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,854
- 2019DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lightercited by 4,243
- 2019ALBERT: A Lite BERT for Self-supervised Learning of Language Representationscited by 2,772
- 2016A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networkscited by 2,362
- 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,168
- 2015A large annotated corpus for learning natural language inferencecited by 1,837
- 2018A Simple Unified Framework for Detecting Out-of-Distribution Samples and Adversarial Attackscited by 1,472
- 2017Enhancing The Reliability of Out-of-distribution Image Detection in Neural Networkscited by 1,325
18 more
- 2020Energy-based Out-of-distribution Detectioncited by 1,296
- 2021Generalized Out-of-Distribution Detection: A Surveycited by 796
- 2018What you can cram into a single vector: Probing sentence embeddings for linguistic propertiescited by 452
- 2020Generalized ODIN: Detecting Out-of-distribution Image without Learning from Out-of-distribution Datacited by 408
- 2019An Evaluation Dataset for Intent Classification and Out-of-Scope Predictioncited by 378
- 2015Skip-Thought Vectorscited by 321
- 2018SentEval: An Evaluation Toolkit for Universal Sentence Representationscited by 294
- 2020Pretrained Transformers Improve Out-of-Distribution Robustnesscited by 293
- 2021Exploring the Limits of Out-of-Distribution Detectioncited by 283
- 2016Multi30K: Multilingual English-German Image Descriptionscited by 250
- 2021Whitening Sentence Representations for Better Semantics and Faster Retrievalcited by 198
- 2017Unsupervised Learning of Sentence Embeddings using Compositional n-Gram Featurescited by 103
- 2021Types of Out-of-Distribution Texts and How to Detect Themcited by 80
- 2021WhiteningBERT: An Easy Unsupervised Sentence Embedding Approachcited by 68
- 2021Revisiting Mahalanobis Distance for Transformer-Based Out-of-Domain Detectioncited by 67
- 2019Deep Unknown Intent Detection with Margin Losscited by 66
- 2020Feature Space Singularity for Out-of-Distribution Detectioncited by 49
- 2022News Category Datasetcited by 42
Built on by
Citing papers per year: 2023: 3; 2024: 2; 2025: 0; 2026: 1.
6 papers.
- 2023A Survey of Safety and Trustworthiness of Large Language Models through the Lens of Verification and Validationcited by 91
- 2023A Survey on Out-of-Distribution Detection in NLPcited by 31
- 2024Understanding LLM Embeddings for Regressioncited by 19
- 2023Fine-Tuning Deteriorates General Textual Out-of-Distribution Detection by Distorting Task-Agnostic Featurescited by 12
- 2024Out-of-Distribution Detection with Attention Head Masking for Multimodal Document Classificationcited by 2
- 2026Domain Restriction via Multi SAE Layer Transitionscited by 0
- 2026Domain Restriction via Multi SAE Layer Transitions12 May 2026
- 2024Understanding LLM Embeddings for Regression22 Nov 2024
- 2024Out-of-Distribution Detection with Attention Head Masking for Multimodal Document Classification20 Aug 2024
- 2023A Survey of Safety and Trustworthiness of Large Language Models through the Lens of Verification and Validation19 May 2023
- 2023A Survey on Out-of-Distribution Detection in NLP5 May 2023
- 2023Fine-Tuning Deteriorates General Textual Out-of-Distribution Detection by Distorting Task-Agnostic Features30 Jan 2023