Pretrained Transformers achieve remarkable performance when training and test data are from the same distribution. However, in real-world scenarios, the model often faces out-of-distribution (OOD) instances that can cause severe semantic shift problems at inference time. Therefore, in practice, a reliable model should identify such instances, and then either reject them during inference or pass them over to models that handle another distribution. In this paper, we develop an unsupervised OOD detection method, in which only the in-distribution (ID) data are used in training. We propose to fine-tune the Transformers with a contrastive loss, which improves the compactness of representations, such that OOD instances can be better differentiated from ID ones. These OOD instances can then be accurately detected using the Mahalanobis distance in the model's penultimate layer. We experiment with comprehensive settings and achieve near-perfect OOD detection performance, outperforming baselines drastically. We further investigate the rationales behind the improvement, finding that more compact representations through margin-based contrastive learning bring the improvement. We release our code to the community for future research.


翻译:培训前的变异器在培训和测试数据来自同一分布时取得显著的性能。 但是,在现实世界中,模型往往会面临分配外(OOD)情况,在推论时间可能造成严重的语义转变问题。 因此,在实践中,可靠的模型应该识别这类情况,然后在推断期间拒绝它们,或者将其传递给处理另一分布的模型。在本文中,我们开发了一种不受监督的OOOD检测方法,在培训中只使用分布(ID)数据。我们建议微调变异的变异器损失,这可以改善表述的紧凑性,使OOD情况与身份特征发生更好的区别。然后可以精确地检测出这些OOOD情况,在模型的侧侧面层使用Mahalanobis距离进行测试,并实现接近于 OOODD的检测性能,比基线要快得多。我们进一步调查改进背后的理由,通过边际对比学习发现更紧凑的表达方式带来改进。我们向社区公布我们的代码,以便将来进行研究。

0
下载
关闭预览

相关内容

专知会员服务
32+阅读 · 2021年9月16日
专知会员服务
35+阅读 · 2021年7月7日
【如何做研究】How to research ,22页ppt
专知会员服务
108+阅读 · 2021年4月17日
【google】监督对比学习,Supervised Contrastive Learning
专知会员服务
30+阅读 · 2020年4月23日
因果图,Causal Graphs,52页ppt
专知会员服务
240+阅读 · 2020年4月19日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
生成式对抗网络GAN异常检测
专知会员服务
114+阅读 · 2019年10月13日
CCF推荐 | 国际会议信息10条
Call4Papers
7+阅读 · 2019年5月27日
计算机 | CCF推荐期刊专刊信息5条
Call4Papers
3+阅读 · 2019年4月10日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
Disentangled的假设的探讨
CreateAMind
9+阅读 · 2018年12月10日
已删除
将门创投
8+阅读 · 2018年10月31日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
【推荐】GAN架构入门综述(资源汇总)
机器学习研究会
10+阅读 · 2017年9月3日
【学习】Hierarchical Softmax
机器学习研究会
4+阅读 · 2017年8月6日
Arxiv
0+阅读 · 2021年10月29日
Generalized Out-of-Distribution Detection: A Survey
Arxiv
15+阅读 · 2021年10月21日
Contrastive Representation Distillation
Arxiv
5+阅读 · 2019年10月23日
VIP会员
相关VIP内容
专知会员服务
32+阅读 · 2021年9月16日
专知会员服务
35+阅读 · 2021年7月7日
【如何做研究】How to research ,22页ppt
专知会员服务
108+阅读 · 2021年4月17日
【google】监督对比学习,Supervised Contrastive Learning
专知会员服务
30+阅读 · 2020年4月23日
因果图,Causal Graphs,52页ppt
专知会员服务
240+阅读 · 2020年4月19日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
生成式对抗网络GAN异常检测
专知会员服务
114+阅读 · 2019年10月13日
相关资讯
CCF推荐 | 国际会议信息10条
Call4Papers
7+阅读 · 2019年5月27日
计算机 | CCF推荐期刊专刊信息5条
Call4Papers
3+阅读 · 2019年4月10日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
Disentangled的假设的探讨
CreateAMind
9+阅读 · 2018年12月10日
已删除
将门创投
8+阅读 · 2018年10月31日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
【推荐】GAN架构入门综述(资源汇总)
机器学习研究会
10+阅读 · 2017年9月3日
【学习】Hierarchical Softmax
机器学习研究会
4+阅读 · 2017年8月6日
Top
微信扫码咨询专知VIP会员