Effective out-of-distribution (OOD) detection is crucial for reliable machine learning models, yet most current methods are limited in practical use due to requirements like access to training data or intervention in training. We present a novel method for detecting OOD data in Transformers based on transformation smoothness between intermediate layers of a network (BLOOD), which is applicable to pre-trained models without access to training data. BLOOD utilizes the tendency of between-layer representation transformations of in-distribution (ID) data to be smoother than the corresponding transformations of OOD data, a property that we also demonstrate empirically. We evaluate BLOOD on several text classification tasks with Transformer networks and demonstrate that it outperforms methods with comparable resource requirements. Our analysis also suggests that when learning simpler tasks, OOD data transformations maintain their original sharpness, whereas sharpness increases with more complex tasks.
翻译:有效的分布外检测对于可靠的机器学习模型至关重要,然而由于需要访问训练数据或干预训练过程等要求,当前大多数方法在实际应用中受到限制。我们提出了一种基于网络中间层间变换平滑性(BLOOD)的新颖方法,用于检测Transformer中的分布外数据,该方法适用于无法访问训练数据的预训练模型。BLOOD利用了分布内数据的层间表示变换比分布外数据的相应变换更平滑的趋势,这一性质也通过实验得到证明。我们在多个基于Transformer网络的文本分类任务上评估了BLOOD,结果表明其性能优于资源需求相当的其他方法。分析还表明,在学习较简单任务时,分布外数据的变换保持其原始锐度,而随着任务复杂度增加,锐度也随之上升。