Is Fine-tuning Needed? Pre-trained Language Models Are Near Perfect for Out-of-Domain Detection

37869

Authors

nan

Abstract

AbstractOut-of-distribution (OOD) detection is a critical task for reliable predictions over text. Fine-tuning with pre-trained language models has been a de facto procedure to derive OOD detectors with respect to in-distribution (ID) data. Despite its common use, the understanding of the role of fine-tuning and its necessity for OOD detection is largely unexplored. In this paper, we raise the question: is fine-tuning necessary for OOD detection? We present a study investigating the efficacy of directly leveraging pre-trained language models for OOD detection, without any model fine-tuning on the ID data. We compare the approach with several competitive fine-tuning objectives, and offer new insights under various types of distributional shifts. Extensive experiments demonstrate near-perfect OOD detection performance (with 0% FPR95 in many cases), strongly outperforming the fine-tuned counterpart.

Keywords

nan

Full Content

Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics Volume 1: Long Papers, pages 12813–12832 July 9-14, 2023 ©2023 Association for Computational Linguistics Is Fine-tuning Needed? Pre-trained Language Models Are Near Perfect for Out-of-Domain Detection Rheeya Uppaal1 Junjie Hu1,2 Yixuan Li1 1Department of Computer Sciences, 2Department of Biostatistics and Medical Informatics University of Wisconsin-Madison {uppaal, jhu, sharonli}@cs.wisc.edu Abstract Out-of-distribution (OOD) detection is a criti- cal task for reliable predictions over text. Fine- tuning with pre-trained language models has been a de facto procedure to derive OOD detec- tors with respect to in-distribution (ID) data. Despite its common use, the understanding of the role of fine-tuning and its necessity for OOD detection is largely unexplored. In this paper, we raise the question: is fine-tuning nec- essary for OOD detection? We present a study investigating the efficacy of directly leveraging pre-trained language models for OOD detec- tion, without any model fine-tuning on the ID data. We compare the approach with several competitive fine-tuning objectives, and offer new insights under various types of distribu- tional shifts. Extensive evaluations on 8 di- verse ID-OOD dataset pairs demonstrate near- perfect OOD detection performance (with 0% FPR95 in many cases), strongly outperform- ing its fine-tuned counterparts. We show that using distance-based detection methods, pre- trained language models are near-perfect OOD detectors when the distribution shift involves a domain change. Furthermore, we study the ef- fect of fine-tuning on OOD detection and iden- tify how to balance ID accuracy with OOD detection performance. Our code is publically available1. 1 Introduction Despite recent successes, high-performing pre- trained language models are still fragile under dis- tribution shifts, making their applications to the real world challenging (Ribeiro et al., 2020). In most real-world settings, the train and test distri- butions are often not independent and identically distributed. Furthermore, test distributions are of- ten non-stationary and can change over time. The problem of out-of-distribution (OOD) detection ad- dresses the identification of anomalous data, en- abling the model to abstain from prediction when it 1https://github.com/Uppaal/lm-ood is not supposed to. This is especially important for high-risk settings like financial and medical appli- cations, where unreliable predictions could incur great costs (Ulmer et al., 2020; Zhang et al., 2021). In literature, a de facto procedure is to fine-tune a pre-trained language model on the in-distribution (ID) data2, and then derive the OOD detector based on the adapted model (Zhou et al., 2021; Hendrycks et al., 2020; Xu et al., 2021). The fine-tuned model is hypothesized to produce embeddings that are customized to the ID data. Thus, prior work fo- cuses on the design of fine-tuning and expects the adapted representations to be more useful for OOD detection. Despite its common use, the understand- ing of the role of fine-tuning and its necessity for OOD detection is largely lacking in the field. Motivated by this, we revisit the common pro- cedure and raise the unexplored question: is fine- tuning necessary at all, for OOD detection? To answer this question, we introduce a …

Content truncated to 500 words

Labeled Text

AbstractOut-of-distribution (OOD) detection is a critical task for reliable predictions over text. Fine-tuning with pre-trained language models has been a de facto procedure to derive OOD detectors with respect to in-distribution (ID) data. Despite its common use, the understanding of the role of fine-tuning and its necessity for OOD detection is largely unexplored. In this paper, we raise the question: is fine-tuning necessary for OOD detection? We present a study investigating the efficacy of directly leveraging pre-trained language models for OOD detection, without any model fine-tuning on the ID data. We compare the approach with several competitive fine-tuning objectives, and offer new insights under various types of distributional shifts. Extensive experiments demonstrate near-perfect OOD detection performance (with 0% FPR95 in many cases), strongly outperforming the fine-tuned counterpart.

Publication Details

Paper ID:
37869
Year:
2023
Publication:
TIPSTER
Publication Type:
conf
DOI:
nan