Various approaches have been proposed for out-of-distribution (OOD) detection by augmenting models, input examples, training sets, and optimization objectives. Deviating from existing work, we have a simple hypothesis that standard off-the-shelf models may already contain sufficient information about the training set distribution which can be leveraged for reliable OOD detection. Our empirical study on validating this hypothesis, which measures the model activation's mean for OOD and in-distribution (ID) mini-batches, surprisingly finds that activation means of OOD mini-batches consistently deviate more from those of the training data. In addition, training data's activation means can be computed offline efficiently or retrieved from batch normalization layers as a `free lunch'. Based upon this observation, we propose a novel metric called Neural Mean Discrepancy (NMD), which compares neural means of the input examples and training data. Leveraging the simplicity of NMD, we propose an efficient OOD detector that computes neural means by a standard forward pass followed by a lightweight classifier. Extensive experiments show that NMD outperforms state-of-the-art OOD approaches across multiple datasets and model architectures in terms of both detection accuracy and computational cost.
翻译:现已提出多种方法,通过扩大模型、输入实例、培训成套方法和优化目标来进行分配外(OOD)检测; 脱离现有工作,我们有一个简单的假设,即标准现成模型可能已经包含足够的关于可用作可靠的OOD检测的训练成套分布的信息。 我们关于验证这一假设的实证研究,该假设测量了OOD和内部(ID)微型插管的模型激活平均值,令人惊讶地发现OOOD微型插管的激活手段始终比培训数据的数据更加偏差。此外,培训数据的激活手段可以在离线之外高效率地进行计算,或作为“免费午餐”从批次正常化层回收。基于这一观察,我们提出一个新的称为神经-表面差异性(NMD)的参数,用以比较输入实例和培训数据的神经手段。我们利用NMDM的简单性,我们提议一个高效的OOD检测器,用标准前方通道和轻量级分级分类来计算神经手段。