Nearest Neighbor Guidance for Out-of-Distribution Detection
Jaewoo Park, Yoon Gyo Jung, Andrew Beng Jin Teoh
Abstract
Detecting out-of-distribution (OOD) samples are crucial for machine learning models deployed in open-world environments. Classifier-based scores are a standard approach for OOD detection due to their fine-grained detection capability. However, these scores often suffer from overconfidence issues, misclassifying OOD samples distant from the in-distribution region. To address this challenge, we propose a method called Nearest Neighbor Guidance (NNGuide) that guides the classifier-based score to respect the boundary geometry of the data manifold. NNGuide reduces the overconfidence of OOD samples while preserving the fine-grained capability of the classifier-based score. We conduct extensive experiments on ImageNet OOD detection benchmarks under diverse settings, including a scenario where the ID data undergoes natural distribution shift. Our results demonstrate that NNGuide provides a significant performance improvement on the base detection scores, achieving state-of-the-art results on both AU-ROC, FPR95, and AUPR metrics. The code is given at https://github.com/roomo7time/nnguide .
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext d89f38ac-bfb6-4a73-b856-7a1740a9c83bCited by top-tier papers28
- Out-of-Distribution Detection with Negative PromptsJun Nie, Yonggang Zhang, Zhen Fang, Tongliang Liu et al.ICLR 2024 · 48 citations
- Kernel PCA for Out-of-Distribution DetectionKun Fang, Qinghua Tao, Kexin Lv, Mingzhen He et al.NeurIPS 2024 · 37 citations
- Conjugated Semantic Pool Improves OOD Detection with Pre-trained Vision-Language ModelsMengyuan Chen, Junyu Gao, Changsheng XuNeurIPS 2024 · 21 citations
- What If the Input is Expanded in OOD Detection?Boxuan Zhang, Jianing Zhu, Zengmao Wang, Tongliang Liu et al.NeurIPS 2024 · 19 citations
- ANTS: Adaptive Negative Textual Space Shaping for OOD Detection via Test-Time MLLM Understanding and ReasoningWenjie Zhu, Yabin Zhang, Xin Jin, Wenjun Zeng et al.CVPR 2026 · 12 citations
Builds on24
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
- Energy-based Out-of-distribution DetectionWeitang Liu, Xiaoyun Wang, John D. Owens, Yixuan LiNeurIPS 2020 · 2,213 citations
- Out-of-Distribution Detection with Deep Nearest NeighborsYiyou Sun, Yifei Ming, Xiaojin Zhu, Yixuan LiICML 2022 · 789 citations
- ReAct: Out-of-distribution Detection With Rectified ActivationsYiyou Sun, Chuan Guo, Yixuan LiNeurIPS 2021 · 733 citations
- Measuring Robustness to Natural Distribution Shifts in Image ClassificationRohan Taori, Achal Dave, Vaishaal Shankar, Nicholas Carlini et al.NeurIPS 2020 · 731 citations
Related papers
- Out-of-Distribution Detection with Relative AnglesBerker Demirel, Marco Fumero, Francesco LocatelloNeurIPS 2025 · 3 citations
- Learning Transferable Negative Prompts for Out-of-Distribution DetectionTianqi Li, Guansong Pang, Xiao Bai, Wenjun Miao et al.CVPR 2024
- Out-of-Distribution Detection with Prototypical Outlier ProxyMingrong Gong, Chaoqi Chen, Qingqiang Sun, Yue Wang et al.AAAI 2025 · 8 citations
- DiffGuard: Semantic Mismatch-Guided Out-of-Distribution Detection using Pre-trained Diffusion ModelsRuiyuan Gao, Chenchen Zhao, Lanqing Hong, Qiang XuICCV 2023 · 29 citations
- MOS: Towards Scaling Out-of-Distribution Detection for Large Semantic SpaceRui Huang, Yixuan LiCVPR 2021
