Revisiting Mahalanobis Distance for Transformer-Based Out-of-Domain Detection

Real-life applications, heavily relying on machine learning, such as dialog\nsystems, demand out-of-domain detection methods. Intent classification models\nshould be equipped with a mechanism to distinguish seen intents from unseen\nones so that the dialog agent is capable of rejecting the latter and avoiding\nundesired behavior. However, despite increasing attention paid to the task, the\nbest practices for out-of-domain intent detection have not yet been fully\nestablished.\n This paper conducts a thorough comparison of out-of-domain intent detection\nmethods. We prioritize the methods, not requiring access to out-of-domain data\nduring training, gathering of which is extremely time- and labor-consuming due\nto lexical and stylistic variation of user utterances. We evaluate multiple\ncontextual encoders and methods, proven to be efficient, on three standard\ndatasets for intent classification, expanded with out-of-domain utterances. Our\nmain findings show that fine-tuning Transformer-based encoders on in-domain\ndata leads to superior results. Mahalanobis distance, together with utterance\nrepresentations, derived from Transformer-based encoders, outperforms other\nmethods by a wide margin and establishes new state-of-the-art results for all\ndatasets.\n The broader analysis shows that the reason for success lies in the fact that\nthe fine-tuned Transformer is capable of constructing homogeneous\nrepresentations of in-domain utterances, revealing geometrical disparity to out\nof domain utterances. In turn, the Mahalanobis distance captures this disparity\neasily.\n The code is available in our GitHub repo:\nhttps://github.com/huawei-noah/noah-research/tree/master/Maha_OOD .\n

Paper

Similar papers

© 2026 NYSGPT2525 LLC