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 Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
28 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Conjugated Semantic Pool Improves OOD Detection with Pre-trained Vision-Language Models cites Energy-based Out-of-distribution Detection
- Conjugated Semantic Pool Improves OOD Detection with Pre-trained Vision-Language Models cites ReAct: Out-of-distribution Detection With Rectified Activations
- Conjugated Semantic Pool Improves OOD Detection with Pre-trained Vision-Language Models cites Out-of-Distribution Detection with Deep Nearest Neighbors
- Conjugated Semantic Pool Improves OOD Detection with Pre-trained Vision-Language Models cites Out-of-Distribution Detection with Negative Prompts
- ReAct: Out-of-distribution Detection With Rectified Activations cites Energy-based Out-of-distribution Detection
- Out-of-Distribution Detection with Deep Nearest Neighbors cites Energy-based Out-of-distribution Detection
- Out-of-Distribution Detection with Deep Nearest Neighbors cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Out-of-Distribution Detection with Deep Nearest Neighbors cites ReAct: Out-of-distribution Detection With Rectified Activations
- Out-of-Distribution Detection with Negative Prompts cites Energy-based Out-of-distribution Detection
- Out-of-Distribution Detection with Negative Prompts cites ReAct: Out-of-distribution Detection With Rectified Activations
- Out-of-Distribution Detection with Negative Prompts cites Out-of-Distribution Detection with Deep Nearest Neighbors
- Kernel PCA for Out-of-Distribution Detection cites Energy-based Out-of-distribution Detection
- Kernel PCA for Out-of-Distribution Detection cites ReAct: Out-of-distribution Detection With Rectified Activations
- Kernel PCA for Out-of-Distribution Detection cites Out-of-Distribution Detection with Deep Nearest Neighbors
- What If the Input is Expanded in OOD Detection? cites Energy-based Out-of-distribution Detection
- What If the Input is Expanded in OOD Detection? cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- What If the Input is Expanded in OOD Detection? cites ReAct: Out-of-distribution Detection With Rectified Activations
- What If the Input is Expanded in OOD Detection? cites Out-of-Distribution Detection with Deep Nearest Neighbors
- ANTS: Adaptive Negative Textual Space Shaping for OOD Detection via Test-Time MLLM Understanding and Reasoning cites Conjugated Semantic Pool Improves OOD Detection with Pre-trained Vision-Language Models
- ANTS: Adaptive Negative Textual Space Shaping for OOD Detection via Test-Time MLLM Understanding and Reasoning cites Energy-based Out-of-distribution Detection
- ANTS: Adaptive Negative Textual Space Shaping for OOD Detection via Test-Time MLLM Understanding and Reasoning cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- ANTS: Adaptive Negative Textual Space Shaping for OOD Detection via Test-Time MLLM Understanding and Reasoning cites ReAct: Out-of-distribution Detection With Rectified Activations
- ANTS: Adaptive Negative Textual Space Shaping for OOD Detection via Test-Time MLLM Understanding and Reasoning cites Out-of-Distribution Detection with Negative Prompts
- ANTS: Adaptive Negative Textual Space Shaping for OOD Detection via Test-Time MLLM Understanding and Reasoning cites What If the Input is Expanded in OOD Detection?
Cited 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
