SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2204.06507 · ICML · 2022

Out-of-Distribution Detection with Deep Nearest Neighbors

Xiaojin Zhu, Yixuan Li, Yifei Ming, Yiyou Sun

arXiv · PDF · Open in the Atlas

Code that ran

30 of 38 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 4 honoured the contract we drafted, 5 violated it and 0 have no contract verdict; 21 failures of our instrument; 8 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2204.06507.json · badge: /api/ran/2204.06507.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
deeplearning-wisc/knn-ood canonical (classifier label)
classifier basis: classifier_2025
16 ran · 3 no recorded run
ArthurHoa/deep-eknn community
Papers with Code archive
14 ran · 5 no recorded run
FunctionStatusWhere it lives
G_p Ran
ran, honoured the contract we drafted
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("aafda009101cbfd4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

btom Ran
ran, honoured the contract we drafted
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("d19bd686618a876f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

btopl Ran
ran, violated the contract we drafted
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("44a0bd7d7960c422")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

calc_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("7d9344ac520f8918")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

decisionDST Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("0b036e2cb2801ede")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

forward_fun Ran
ran; our contract draft was wrong, not the code
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("9b68216c4f2d895c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_Mahalanobis_score Ran
ran; our contract draft was wrong, not the code
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("32ed88f27881480a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_ModedMaha_score Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("e3080865e3e46e82")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_cos_score Ran
ran; our contract draft was wrong, not the code
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("6c3b1825ad096dce")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_energy_score Ran
ran; our contract draft was wrong, not the code
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("209469a90d2f8a72")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_exlgst_score Ran
ran; our contract draft was wrong, not the code
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("5560caaae9a95e1e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_godin_score Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("bc501b91abbe50d1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_gradient_score Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("3d782851b3c7d7e7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_infl_score Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("861d7015808075fb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_lgst_score Ran
ran; our contract draft was wrong, not the code
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("683101b9e3719e85")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_mahalanobis_score Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("0d63630115fb978b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_modedmaha_score Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("0b59395cfb5cb50d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_msp_score Ran
ran, honoured the contract we drafted
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("6126345504c875f7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_odin_score Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("4f51a10a1b49685f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

mtob Ran
ran, violated the contract we drafted
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("0dee8a92419cff7b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

mtobel Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("bc8c3813716a0475")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

mtobetp Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("d666af0191f0d996")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

mtonm Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("c8f5824b7a3abec9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

mtopl Ran
ran, violated the contract we drafted
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("b502b7ebecfb473e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

mtoq Ran
ran, violated the contract we drafted
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("bbbc398d91edfdea")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

mtow Ran
ran, honoured the contract we drafted
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("e3776c1edecaa404")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

qtom Ran
ran, violated the contract we drafted
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("d9c1685e770cd6de")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

qtow Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("de4f0891f2a2ecb3")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

wtom Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("9970a3a581cf0c70")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

wtoq Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("5ac9567da183a7fb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

DST Not yet run
unverified (harvested, no recorded run)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("86c6428acf21785c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

EKNN Not yet run
unverified (harvested, no recorded run)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("c615b69c364d7bbd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

LNS Not yet run
unverified (harvested, no recorded run)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("df7da02ff75b6fbd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

LNS_SSF Not yet run
unverified (harvested, no recorded run)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("ed7b5ddceab83aeb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

compute_deviations Not yet run
unverified (harvested, no recorded run)
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("ba2203eb42a97fcf")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_gram_score Not yet run
unverified (harvested, no recorded run)
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("4c3cef6f0f0e686b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_score Not yet run
unverified (harvested, no recorded run)
deeplearning-wisc/knn-ood/util/score.py
pointer only (licence: NONE) · get_code("b874b3a0ce06fd5f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, deeplearning-wisc/knn-ood when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

noise_imprecision Not yet run
unverified (harvested, no recorded run)
ArthurHoa/deep-eknn/deep_eknn.py
pointer only (licence: NONE) · get_code("422865e3a9dbb328")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ArthurHoa/deep-eknn when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 38 samples lifted from this paper's linked repositories, 38 carry a function identity and 0 do not. Of the 38 distinct functions with an identity, 8 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 8 later) and 30 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
G_p
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2312.11536 (2023-12)
Fast Decision Boundary based Out-of-Distribution Detector
calc_loss
brick of this paper's assembly: helper
1 other paper
1 later
2308.10467 (2023-08)
Single-User Injection for Invisible Shilling Attack against Recommender Systems
compute_deviations
brick of this paper's assembly: helper
1 other paper
1 later
2312.11536 (2023-12)
Fast Decision Boundary based Out-of-Distribution Detector
forward_fun
brick of this paper's assembly: helper
1 other paper
1 later
2312.11536 (2023-12)
Fast Decision Boundary based Out-of-Distribution Detector
get_energy_score
brick of this paper's assembly: metric
1 other paper
1 later
2308.10239 (2023-08)
From Global to Local: Multi-scale Out-of-distribution Detection
get_gram_score
brick of this paper's assembly: metric
1 other paper
1 later
2312.11536 (2023-12)
Fast Decision Boundary based Out-of-Distribution Detector
get_lgst_score
brick of this paper's assembly: metric
1 other paper
1 later
2308.10239 (2023-08)
From Global to Local: Multi-scale Out-of-distribution Detection
get_msp_score
brick of this paper's assembly: metric
1 other paper
1 later
2308.10239 (2023-08)
From Global to Local: Multi-scale Out-of-distribution Detection

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Out-of-distribution (OOD) detection is a critical task for deploying machine learning models in the open world. Distance-based methods have demonstrated promise, where testing samples are detected as OOD if they are relatively far away from in-distribution (ID) data. However, prior methods impose a strong distributional assumption of the underlying feature space, which may not always hold. In this paper, we explore the efficacy of non-parametric nearest-neighbor distance for OOD detection, which has been largely overlooked in the literature. Unlike prior works, our method does not impose any distributional assumption, hence providing stronger flexibility and generality. We demonstrate the effectiveness of nearest-neighbor-based OOD detection on several benchmarks and establish superior performance. Under the same model trained on ImageNet-1k, our method substantially reduces the false positive rate (FPR@TPR95) by 24.77% compared to a strong baseline SSD+, which uses a parametric approach Mahalanobis distance in detection. Code is available: https://github.com/ deeplearning-wisc/knn-ood.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2204.06507")
get_code_for_paper("2204.06507")
have("2204.06507")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2204.06507.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2204.06507.svg)](https://syntology.ai/paper/2204.06507)

Connect an agent — have() is free.