arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.13282cs.CLcs.LG
收藏

是否需要微调?预训练语言模型在分布外检测中近乎完美

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

University of Wisconsin-Madison(威斯康星大学麦迪逊分校)

Rheeya Uppaal, Junjie Hu, Yixuan Li

AI总结:

针对OOD检测是否需要微调的疑问,本文证明直接利用预训练语言模型进行基于距离的检测即可在领域变化时实现近乎完美的性能,大幅优于微调版本,并揭示了如何平衡ID准确率与OOD检测性能。

摘要:

分布外(OOD)检测是文本可靠预测的关键任务。使用预训练语言模型进行微调,一直是针对分布内(ID)数据构建OOD检测器的既定流程。尽管被广泛使用,但对微调的作用及其在OOD检测中的必要性的理解在很大程度上仍未被探索。本文提出疑问:OOD检测是否需要微调?我们开展了一项研究,调查直接利用预训练语言模型进行OOD检测的有效性,且不对ID数据进行任何模型微调。我们将该方法与几种具有竞争力的微调目标进行比较,并在各种类型的分布偏移下提供了新见解。在8对多样的ID-OOD数据集上的广泛评估表明,该方法实现了近乎完美的OOD检测性能(在许多情况下FPR95为0%),大幅优于其微调版本。我们证明,当分布偏移涉及领域变化时,使用基于距离的检测方法,预训练语言模型是近乎完美的OOD检测器。此外,我们研究了微调对OOD检测的影响,并明确了如何平衡ID准确率与OOD检测性能。我们的代码已在https://github.com/Uppaal/lm-ood公开发布。

英文摘要:

Out-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 evaluations on 8 diverse ID-OOD dataset pairs demonstrate near-perfect OOD detection performance (with 0% FPR95 in many cases), strongly outperforming 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 effect of fine-tuning on OOD detection and identify how to balance ID accuracy with OOD detection performance. Our code is publically available at https://github.com/Uppaal/lm-ood.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑