Papers › Detecting Out-of-Distribution Examples with In-distribution Examples and Gram Matrices

Detecting Out-of-Distribution Examples with In-distribution Examples and Gram Matrices

28 Dec 2019arXiv:1912.12510archive 2025-07-28

Chandramouli Shama Sastry, Sageev Oore

When presented with Out-of-Distribution (OOD) examples, deep neural networks yield confident, incorrect predictions. Detecting OOD examples is challenging, and the potential risks are high. In this paper, we propose to detect OOD examples by identifying inconsistencies between activity patterns and class predicted. We find that characterizing activity patterns by Gram matrices and identifying anomalies in gram matrix values can yield high OOD detection rates. We identify anomalies in the gram matrices by simply comparing each value with its respective range observed over the training data. Unlike many approaches, this can be used with any pre-trained softmax classifier and does not require access to OOD data for fine-tuning hyperparameters, nor does it require OOD access for inferring parameters. The method is applicable across a variety of architectures and vision datasets and, for the important and surprisingly hard task of detecting far-from-distribution out-of-distribution examples, it generally performs better than or equal to state-of-the-art OOD detection methods (including those that do assume access to OOD examples).

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1912.12510")

Code

Syntology Ran 5 of 8 code samples harvested from 1 repository linked to this paper; 3 have no recorded run. Of those that ran: 5 ran · our draft was wrong.

By repository: official repository: 3 samples from 1 repository, 0 ran; 5 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

VectorInstitute/gram-ood-detection officialmentioned in papermentioned on GitHubpytorch report
joelsimonoff/gram-adversary-detection mentioned on GitHubpytorch report
nazim1021/OOD-detection-using-OECC mentioned on GitHubpytorch report
zeroshot-ood/ood-detection mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

8 samples harvested; 5 ran; 0 honoured the contract we drafted; 3 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

5ran · our draft was wrong
3unverified

Licence: 8 of the 8 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from VectorInstitute/gram-ood-detection. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

compute_metric VectorInstitute/gram-ood-detection/calculate_log.py official repository unverified no licence file found · pointer only · 160824dee7076cd5 · report
get_curve VectorInstitute/gram-ood-detection/calculate_log.py official repository unverified no licence file found · pointer only · 749638f4131be5e5 · report
metric VectorInstitute/gram-ood-detection/calculate_log.py official repository unverified no licence file found · pointer only · 511013ffe412491c · report
G_p identical code first harvested elsewhere ran · our draft was wrong fingerprinted licence of this copy not recorded · 17dd7052b2035130 · report
cpu identical code first harvested elsewhere ran · our draft was wrong licence of this copy not recorded · 48a9e0f0fbcaf665 · report
normalize_l2 identical code first harvested elsewhere ran · our draft was wrong fingerprinted licence of this copy not recorded · b16e920816efe253 · report
tensor_clamp identical code first harvested elsewhere ran · our draft was wrong fingerprinted licence of this copy not recorded · 5b640b32a444ae38 · report
tensor_clamp_l2 identical code first harvested elsewhere ran · our draft was wrong fingerprinted licence of this copy not recorded · 63b4423b18c974ad · report

Tasks

Out of Distribution (OOD) DetectionOut-of-Distribution Detection

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Out-of-Distribution Detection CIFAR-10 vs CIFAR-100 ResNet + diagonal elements of Gram matrix AUROC 79.7 #14 of 14 Archive leaderboard report
Out-of-Distribution Detection CIFAR-100 vs CIFAR-10 ResNet + diagonal elements of Gram matrix AUROC 76.6 #13 of 14 Archive leaderboard report
Out-of-Distribution Detection CIFAR-100 vs CIFAR-10 DenseNet + diagonal elements of Gram matrix AUROC 70.1 #14 of 14 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Softmax

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections