Contrastive Out-of-Distribution Detection for Pretrained Transformers
Wenxuan Zhou, Fangyu Liu, Muhao Chen
摘要
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.
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了每一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
引用它的顶会 Paper30
- Delving into Out-of-Distribution Detection with Vision-Language RepresentationsYifei Ming, Ziyang Cai, Jiuxiang Gu, Yiyou Sun 等NeurIPS 2022 · 被引用 308 次
- POEM: Out-of-Distribution Detection with Posterior SamplingYifei Ming, Ying Fan, Yixuan LiICML 2022 · 被引用 151 次
- Partial and Asymmetric Contrastive Learning for Out-of-Distribution Detection in Long-Tailed RecognitionHaotao Wang, Aston Zhang, Yi Zhu, Shuai Zheng 等ICML 2022 · 被引用 61 次
- A Data-centric Framework to Endow Graph Neural Networks with Out-Of-Distribution Detection AbilityYuxin Guo, Cheng Yang, Yuluo Chen, Jixi Liu 等KDD 2023 · 被引用 26 次
- Beyond Mahalanobis Distance for Textual OOD DetectionPierre Colombo, Eduardo Dadalto Câmara Gomes, Guillaume Staerman, Nathan Noiry 等NeurIPS 2022 · 被引用 24 次
它引用的顶会 Paper10
- A Simple Framework for Contrastive Learning of Visual RepresentationsTing Chen, Simon Kornblith, Mohammad Norouzi, Geoffrey E. HintonICML 2020 · 被引用 24,064 次
- Supervised Contrastive LearningPrannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna 等NeurIPS 2020 · 被引用 7,049 次
- Understanding Contrastive Representation Learning through Alignment and Uniformity on the HypersphereTongzhou Wang, Phillip IsolaICML 2020 · 被引用 2,360 次
- Energy-based Out-of-distribution DetectionWeitang Liu, Xiaoyun Wang, John D. Owens, Yixuan LiNeurIPS 2020 · 被引用 2,213 次
- CSI: Novelty Detection via Contrastive Learning on Distributionally Shifted InstancesJihoon Tack, Sangwoo Mo, Jongheon Jeong, Jinwoo ShinNeurIPS 2020 · 被引用 755 次
相关 Paper
- Is Fine-tuning Needed? Pre-trained Language Models Are Near Perfect for Out-of-Domain DetectionRheeya Uppaal, Junjie Hu, Yixuan LiACL 2023 · 被引用 9 次
- On Prefix-tuning for Lightweight Out-of-distribution DetectionYawen Ouyang, Yongchang Cao, Yuan Gao, Zhen Wu 等ACL 2023 · 被引用 1 次
- X-Mahalanobis: Transformer Feature Mixing for Reliable OOD DetectionTong Wei, Bolin Wang, Jiang-Xin Shi, Yu-Feng Li 等NeurIPS 2025 · 被引用 9 次
- Gradient-Based Novelty Detection Boosted by Self-Supervised Binary ClassificationJingbo Sun, Li Yang, Jiaxin Zhang, Frank Liu 等AAAI 2022 · 被引用 17 次
- Out-of-Distribution Detection by Leveraging Between-Layer Transformation SmoothnessFran Jelenic, Josip Jukic, Martin Tutek, Mate Puljiz 等ICLR 2024 · 被引用 12 次
