Revisiting Mahalanobis Distance for Transformer-Based Out-of-Domain Detection
Not on the map. Why?
Abstract (arXiv)
Real-life applications, heavily relying on machine learning, such as dialog systems, demand out-of-domain detection methods. Intent classification models should be equipped with a mechanism to distinguish seen intents from unseen ones so that the dialog agent is capable of rejecting the latter and avoiding undesired behavior. However, despite increasing attention paid to the task, the best practices for out-of-domain intent detection have not yet been fully established. This paper conducts a thorough comparison of out-of-domain intent detection methods. We prioritize the methods, not requiring access to out-of-domain data during training, gathering of which is extremely time- and labor-consuming due to lexical and stylistic variation of user utterances. We evaluate multiple contextual encoders and methods, proven to be efficient, on three standard datasets for intent classification, expanded with out-of-domain utterances. Our main findings show that fine-tuning Transformer-based encoders on in-domain data leads to superior results. Mahalanobis distance, together with utterance representations, derived from Transformer-based encoders, outperforms other methods by a wide margin and establishes new state-of-the-art results for all datasets. The broader analysis shows that the reason for success lies in the fact that the fine-tuned Transformer is capable of constructing homogeneous representations of in-domain utterances, revealing geometrical disparity to out of domain utterances. In turn, the Mahalanobis distance captures this disparity easily. The code is available in our GitHub repo: https://github.com/huawei-noah/noah-research/tree/master/Maha_OOD .
Key facts. Cited by 70 papers in the map (data through 14 Oct 2026). Builds on 25 of its 35 references that are in the map. First posted on arXiv 11 Jan 2021.
Builds on
25 of 35 references.
References · 25
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,170
- 2019DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lightercited by 4,307
- 2016A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networkscited by 2,385
- 2018A Simple Unified Framework for Detecting Out-of-Distribution Samples and Adversarial Attackscited by 1,485
- 2017Enhancing The Reliability of Out-of-distribution Image Detection in Neural Networkscited by 1,328
- 2018Deep Anomaly Detection with Outlier Exposurecited by 942
- 2018Predictive Uncertainty Estimation via Prior Networkscited by 557
- 2019Likelihood Ratios for Out-of-Distribution Detectioncited by 453
- 2018Do Deep Generative Models Know What They Don't Know?cited by 443
13 more
- 2020Simple and Principled Uncertainty Estimation with Deterministic Deep Learning via Distance Awarenesscited by 389
- 2019An Evaluation Dataset for Intent Classification and Out-of-Scope Predictioncited by 386
- 2020Pretrained Transformers Improve Out-of-Distribution Robustnesscited by 294
- 2020Selective Question Answering under Domain Shiftcited by 238
- 2018Cross-Lingual Transfer Learning for Multilingual Task Oriented Dialogcited by 125
- 2019Deep Unknown Intent Detection with Margin Losscited by 66
- 2019Out-of-domain Detection for Natural Language Understanding in Dialog Systemscited by 62
- 2019Out-of-Domain Detection for Low-Resource Text Classification Taskscited by 36
- 2019Likelihood Ratios and Generative Classifiers for Unsupervised Out-of-Domain Detection In Task Oriented Dialogcited by 33
- 2017Distance-based Confidence Score for Neural Network Classifierscited by 30
- 2019Statistical Analysis of Nearest Neighbor Methods for Anomaly Detectioncited by 29
- 2020Why is the Mahalanobis Distance Effective for Anomaly Detection?cited by 28
- 2019Robustness properties of Facebook's ResNeXt WSL modelscited by 17
Built on by
Citing papers per year: 2021: 3; 2022: 16; 2023: 20; 2024: 12; 2025: 7; 2026: 12.
70 papers.
Sort:
By area:
- 2022Delving into Out-of-Distribution Detection with Vision-Language Representationscited by 216
- 2022POEM: Out-of-Distribution Detection with Posterior Samplingcited by 108
- 2024Benchmarking Uncertainty Quantification Methods for Large Language Models with LM-Polygraphcited by 105
- 2023A Survey of Safety and Trustworthiness of Large Language Models through the Lens of Verification and Validationcited by 93
- 2023GL-MCM: Global and Local Maximum Concept Matching for Zero-Shot Out-of-Distribution Detectioncited by 36
- 2023A Survey on Out-of-Distribution Detection in NLPcited by 31
- 2023Is Fine-tuning Needed? Pre-trained Language Models Are Near Perfect for Out-of-Domain Detectioncited by 29
- 2021How is BERT surprised? Layerwise detection of linguistic anomaliescited by 24
- 2022Rainproof: An Umbrella To Shield Text Generators From Out-Of-Distribution Datacited by 21
- 2024BadActs: A Universal Backdoor Defense in the Activation Spacecited by 21
- 2021GOLD: Improving Out-of-Scope Detection in Dialogues using Data Augmentationcited by 20
- 2022Expose Backdoors on the Way: A Feature-Based Efficient Defense against Textual Backdoor Attackscited by 19
38 more
- 2024Robust AI-Generated Text Detection by Restricted Embeddingscited by 18
- 2025Token-Level Density-Based Uncertainty Quantification Methods for Eliciting Truthfulness of Large Language Modelscited by 18
- 2023How Good Are LLMs at Out-of-Distribution Detection?cited by 17
- 2023Unsupervised Layer-wise Score Aggregation for Textual OOD Detectioncited by 15
- 2023Out-of-Distribution Detection by Leveraging Between-Layer Transformation Smoothnesscited by 15
- 2022Towards Textual Out-of-Domain Detection without In-Domain Labelscited by 14
- 2023Fine-Tuning Deteriorates General Textual Out-of-Distribution Detection by Distorting Task-Agnostic Featurescited by 12
- 2022Towards Computationally Feasible Deep Active Learningcited by 11
- 2022Estimating Soft Labels for Out-of-Domain Intent Detectioncited by 11
- 2022Multi-Level Knowledge Distillation for Out-of-Distribution Detection in Textcited by 11
- 2024Your Finetuned Large Language Model is Already a Powerful Out-of-distribution Detectorcited by 11
- 2023Uncertainty Estimation of Transformers' Predictions via Topological Analysis of the Attention Matricescited by 8
- 2022Keywords and Instances: A Hierarchical Contrastive Learning Framework Unifying Hybrid Granularities for Text Generationcited by 7
- 2025Shh, don't say that! Domain Certification in LLMscited by 7
- 2025Mysteries of the Deep: Role of Intermediate Representations in Out of Distribution Detectioncited by 7
- 2022Holistic Sentence Embeddings for Better Out-of-Distribution Detectioncited by 6
- 2023Online Reinforcement Learning in Non-Stationary Context-Driven Environmentscited by 6
- 2023Out-of-Domain Intent Detection Considering Multi-Turn Dialogue Contextscited by 6
- 2025Uncertainty-aware abstention in medical diagnosis based on medical textscited by 6
- 2021Data Invariants to Understand Unsupervised Out-of-Distribution Detectioncited by 5
- 2022Self-Supervised Losses for One-Class Textual Anomaly Detectioncited by 5
- 2022Learning to Classify Open Intent via Soft Labeling and Manifold Mixupcited by 5
- 2023Classical Out-of-Distribution Detection Methods Benchmark in Text Classification Taskscited by 5
- 2024Domain Adaptation in Intent Classification Systems: A Reviewcited by 4
- 2024A new approach for fine-tuning sentence transformers for intent classification and out-of-scope detection taskscited by 4
- 2026Benchmarking and Improving Monitors for Out-Of-Distribution Alignment Failure in LLMscited by 4
- 2022Beyond Mahalanobis-Based Scores for Textual OOD Detectioncited by 3
- 2023SELFOOD: Self-Supervised Out-Of-Distribution Detection via Learning to Rankcited by 3
- 2023Toward Stronger Textual Attack Detectorscited by 3
- 2024Out-of-Distribution Detection through Soft Clustering with Non-Negative Kernel Regressioncited by 3
- 2024Lightweight Model Attribution and Detection of Synthetic Speech via Audio Residual Fingerprintscited by 3
- 2026Trust The Typicalcited by 3
- 2026An Embarrassingly Simple Detector for Model Extraction Attacks in Large Language Model API Trafficcited by 3
- 2023Probing Out-of-Distribution Robustness of Language Models with Parameter-Efficient Transfer Learningcited by 2
- 2023A Hybrid Architecture for Out of Domain Intent Detection and Intent Discoverycited by 2
- 2023Detecting out-of-distribution text using topological features of transformer-based language modelscited by 2
- 2022Contrastive Novelty-Augmented Learning: Anticipating Outliers with Large Language Modelscited by 1
- 2023General-Purpose Multi-Modal OOD Detection Frameworkcited by 1
50 most cited of 70 All 70 (JSON)
- 2026Genesis Steering: Better Activation Steering Through Training Data13 Oct 2026
- 2026Structural Baselines Matter for Agent Failure Detection and Attribution12 Oct 2026
- 2026Beyond frequency measures: Can contextual embeddings capture meaning change in scientific texts?16 Sep 2026
- 2026Few-Shot Out of Domain Intent Detection with Covariance Corrected Mahalanobis Distance1 Sep 2026
- 2026ToxScreen: Detecting Whether an LLM Has Been Poisoned29 Jul 2026
- 2026An Embarrassingly Simple Detector for Model Extraction Attacks in Large Language Model API Traffic4 Jun 2026
- 2026Benchmarking and Improving Monitors for Out-Of-Distribution Alignment Failure in LLMs20 May 2026
- 2026Domain Restriction via Multi SAE Layer Transitions12 May 2026
- 2026Revisiting JBShield: Breaking and Rebuilding Representation-Level Jailbreak Defenses4 May 2026
- 2026Mechanistic Anomaly Detection via Functional Attribution21 Apr 2026
- 2026To Predict or Not to Predict? Towards reliable uncertainty estimation in the presence of noise7 Mar 2026
- 2026Trust The Typical4 Feb 2026
38 more
- 2025Test-time reward-guided alignment of language models by importance sampling on pre-logit space30 Oct 2025
- 2025Mysteries of the Deep: Role of Intermediate Representations in Out of Distribution Detection7 Oct 2025
- 2025LeanTTA: A Backpropagation-Free and Stateless Approach to Quantized Test-Time Adaptation on Edge Devices20 Mar 2025
- 2025Finer Disentanglement of Aleatoric Uncertainty Can Accelerate Chemical Histopathology Imaging27 Feb 2025
- 2025Shh, don't say that! Domain Certification in LLMs26 Feb 2025
- 2025Uncertainty-aware abstention in medical diagnosis based on medical texts25 Feb 2025
- 2025Token-Level Density-Based Uncertainty Quantification Methods for Eliciting Truthfulness of Large Language Models20 Feb 2025
- 2024Lightweight Model Attribution and Detection of Synthetic Speech via Audio Residual Fingerprints21 Nov 2024
- 2024A new approach for fine-tuning sentence transformers for intent classification and out-of-scope detection tasks17 Oct 2024
- 2024Robust AI-Generated Text Detection by Restricted Embeddings10 Oct 2024
- 2024Out-of-Distribution Detection through Soft Clustering with Non-Negative Kernel Regression18 Jul 2024
- 2024One Stone, Four Birds: A Comprehensive Solution for QA System Using Supervised Contrastive Learning12 Jul 2024
- 2024Benchmarking Uncertainty Quantification Methods for Large Language Models with LM-Polygraph21 Jun 2024
- 2024How Out-of-Distribution Detection Learning Theory Enhances Transformer: Learnability and Reliability13 Jun 2024
- 2024BadActs: A Universal Backdoor Defense in the Activation Space18 May 2024
- 2024VI-OOD: A Unified Representation Learning Framework for Textual Out-of-distribution Detection9 Apr 2024
- 2024Your Finetuned Large Language Model is Already a Powerful Out-of-distribution Detector7 Apr 2024
- 2024Domain Adaptation in Intent Classification Systems: A Review26 Mar 2024
- 2024Towards Trustworthy Reranking: A Simple yet Effective Abstention Mechanism20 Feb 2024
- 2023Detecting out-of-distribution text using topological features of transformer-based language models22 Nov 2023
- 2023Toward Stronger Textual Attack Detectors21 Oct 2023
- 2023Out-of-Distribution Detection by Leveraging Between-Layer Transformation Smoothness4 Oct 2023
- 2023Uncertainty Estimation of Transformers' Predictions via Topological Analysis of the Attention Matrices22 Aug 2023
- 2023How Good Are LLMs at Out-of-Distribution Detection?20 Aug 2023
- 2023How Does Diffusion Influence Pretrained Language Models on Out-of-Distribution Data?26 Jul 2023
- 2023General-Purpose Multi-Modal OOD Detection Framework24 Jul 2023
- 2023Classical Out-of-Distribution Detection Methods Benchmark in Text Classification Tasks13 Jul 2023
- 2023BED: Bi-Encoder-Based Detectors for Out-of-Distribution Detection15 Jun 2023
- 2023SELFOOD: Self-Supervised Out-Of-Distribution Detection via Learning to Rank24 May 2023
- 2023Is Fine-tuning Needed? Pre-trained Language Models Are Near Perfect for Out-of-Domain Detection22 May 2023
- 2023A Survey of Safety and Trustworthiness of Large Language Models through the Lens of Verification and Validation19 May 2023
- 2023Out-of-Domain Intent Detection Considering Multi-Turn Dialogue Contexts5 May 2023
- 2023A Survey on Out-of-Distribution Detection in NLP5 May 2023
- 2023GL-MCM: Global and Local Maximum Concept Matching for Zero-Shot Out-of-Distribution Detection10 Apr 2023
- 2023A Hybrid Architecture for Out of Domain Intent Detection and Intent Discovery7 Mar 2023
- 2023Unsupervised Layer-wise Score Aggregation for Textual OOD Detection20 Feb 2023
- 2023Online Reinforcement Learning in Non-Stationary Context-Driven Environments4 Feb 2023
- 2023Fine-Tuning Deteriorates General Textual Out-of-Distribution Detection by Distorting Task-Agnostic Features30 Jan 2023
50 newest of 70 All 70 (JSON)
- 2022Expose Backdoors on the Way: A Feature-Based Efficient Defense against Textual Backdoor Attackscited by 19
- 2026Trust The Typicalcited by 3
- 2026Mechanistic Anomaly Detection via Functional Attributioncited by 1
- 2026ToxScreen: Detecting Whether an LLM Has Been Poisonedcited by 1
- 2026Revisiting JBShield: Breaking and Rebuilding Representation-Level Jailbreak Defensescited by 0
- 2026ToxScreen: Detecting Whether an LLM Has Been Poisoned29 Jul 2026
- 2026Revisiting JBShield: Breaking and Rebuilding Representation-Level Jailbreak Defenses4 May 2026
- 2026Mechanistic Anomaly Detection via Functional Attribution21 Apr 2026
- 2026Trust The Typical4 Feb 2026
- 2022Expose Backdoors on the Way: A Feature-Based Efficient Defense against Textual Backdoor Attacks14 Oct 2022
- 2026Genesis Steering: Better Activation Steering Through Training Data13 Oct 2026
- 2026Domain Restriction via Multi SAE Layer Transitions12 May 2026
- 2022Delving into Out-of-Distribution Detection with Vision-Language Representationscited by 216
- 2022POEM: Out-of-Distribution Detection with Posterior Samplingcited by 108
- 2024Benchmarking Uncertainty Quantification Methods for Large Language Models with LM-Polygraphcited by 105
- 2023A Survey of Safety and Trustworthiness of Large Language Models through the Lens of Verification and Validationcited by 93
- 2023GL-MCM: Global and Local Maximum Concept Matching for Zero-Shot Out-of-Distribution Detectioncited by 36
- 2023A Survey on Out-of-Distribution Detection in NLPcited by 31
- 2023Is Fine-tuning Needed? Pre-trained Language Models Are Near Perfect for Out-of-Domain Detectioncited by 29
- 2021How is BERT surprised? Layerwise detection of linguistic anomaliescited by 24
- 2022Rainproof: An Umbrella To Shield Text Generators From Out-Of-Distribution Datacited by 21
- 2024BadActs: A Universal Backdoor Defense in the Activation Spacecited by 21
- 2021GOLD: Improving Out-of-Scope Detection in Dialogues using Data Augmentationcited by 20
- 2024Robust AI-Generated Text Detection by Restricted Embeddingscited by 18
12 most cited of 59 All 59 (JSON)
- 2026Beyond frequency measures: Can contextual embeddings capture meaning change in scientific texts?16 Sep 2026
- 2026Few-Shot Out of Domain Intent Detection with Covariance Corrected Mahalanobis Distance1 Sep 2026
- 2026An Embarrassingly Simple Detector for Model Extraction Attacks in Large Language Model API Traffic4 Jun 2026
- 2026Benchmarking and Improving Monitors for Out-Of-Distribution Alignment Failure in LLMs20 May 2026
- 2026To Predict or Not to Predict? Towards reliable uncertainty estimation in the presence of noise7 Mar 2026
- 2025Mysteries of the Deep: Role of Intermediate Representations in Out of Distribution Detection7 Oct 2025
- 2025LeanTTA: A Backpropagation-Free and Stateless Approach to Quantized Test-Time Adaptation on Edge Devices20 Mar 2025
- 2025Finer Disentanglement of Aleatoric Uncertainty Can Accelerate Chemical Histopathology Imaging27 Feb 2025
- 2025Shh, don't say that! Domain Certification in LLMs26 Feb 2025
- 2025Uncertainty-aware abstention in medical diagnosis based on medical texts25 Feb 2025
- 2025Token-Level Density-Based Uncertainty Quantification Methods for Eliciting Truthfulness of Large Language Models20 Feb 2025
- 2024Lightweight Model Attribution and Detection of Synthetic Speech via Audio Residual Fingerprints21 Nov 2024
12 newest of 59 All 59 (JSON)