Abstract
Detecting out-of-distribution (OOD) inputs is crucial for the safe deployment of natural language processing (NLP) models. Though existing methods, especially those based on the statistics in the feature space of fine-tuned pre-trained language models (PLMs), are claimed to be effective, their effectiveness on different types of distribution shifts remains underexplored. In this work, we take the first step to comprehensively evaluate the mainstream textual OOD detection methods for detecting semantic and non-semantic shifts. We find that: (1) no existing method behaves well in both settings; (2) fine-tuning PLMs on in-distribution data benefits detecting semantic shifts but severely deteriorates detecting non-semantic shifts, which can be attributed to the distortion of task-agnostic features. To alleviate the issue, we present a simple yet effective general OOD score named GNOME that integrates the confidence scores derived from the task-agnostic and task-specific representations. Experiments show that GNOME works well in both semantic and non-semantic shift scenarios, and further brings significant improvement on two cross-task benchmarks where both kinds of shifts simultaneously take place. Our code is available at this https URL.
Abstract (translated)
检测非分布输入(OOD)对于安全部署自然语言处理(NLP)模型至关重要。虽然现有的方法,特别是基于优化预训练语言模型(PLM)特征空间的统计学方法,声称有效,但它们对于不同类型的分布迁移的 effectiveness 仍然未被充分研究。在这项工作中,我们迈出了第一步,全面评估主流文本OOD检测方法,以检测语义和非语义迁移。我们发现:(1) 现有方法在两种设置下表现良好;(2) 在分布数据上优化PLM可以检测语义迁移,但严重恶化了检测非语义迁移的能力,这可能是由于任务无关特征的扭曲。为了缓解这个问题,我们提出了一个简单但有效的通用OOD得分,名为GNOME,它集成了任务无关和任务特定表示的自信得分。实验表明,GNOME在语义和非语义迁移场景下都表现出色,并在同时发生两种迁移的两个跨任务基准上取得了显著的改善。我们的代码可在 this https URL 上获取。
URL
https://arxiv.org/abs/2301.12715