SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2109.02748 · 2021

Zero-Shot Out-of-Distribution Detection Based on the Pre-trained Model CLIP

arXiv · PDF · Open in the Atlas

Code that ran

1 of 11 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 0 failures of our instrument; 10 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/2109.02748.json · badge: /api/ran/2109.02748.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
sesmae/zoc canonical (classifier label)
classifier basis: census
1 ran · 10 no recorded run
FunctionStatusWhere it lives
tokenize_for_clip Ran
ran, honoured the contract we drafted
sesmae/zoc/tinyimagenet_eval.py
code served (permissive licence) · get_code("586e23a21dc8d140")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family int, shape (2, 77) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

class MockTokenizer:
    def __init__(self):
        self.encoder = {
            '<|startoftext|>': 49406,
            '<|endoftext|>': 49407,
        }
        self._vocab = {
            'hello': 1000,
            'world': 1001,
            'test': 1002,
            'sentence': 1003,
        }
    
    def encode(self, text):
        tokens = []
        words = text.lower().split()
        for word in words:
            if word in self._vocab:
                tokens.append(self._vocab[word])
            else:
                tokens.append(1004)
        return tokens

batch_sentences = [
    "hello world",
    "test sentence"
]

tokenizer = MockTokenizer()

ARGS = {
    "batch_sentences": batch_sentences,
    "tokenizer": tokenizer,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family int, shape (2, 77) — shape (2, 77) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
eval_decoder Not yet run
unverified (harvested, no recorded run)
sesmae/zoc/train_decoder.py
code served (permissive licence) · get_code("1e88096b561d13b7")
How it ran

no invocation recorded.

get_bert_training_features Not yet run
unverified (harvested, no recorded run)
sesmae/zoc/dataloaders/coco_full_loader.py
code served (permissive licence) · get_code("ad6951f135361d60")
How it ran

no invocation recorded.

get_bos_sentence_eos Not yet run
unverified (harvested, no recorded run)
sesmae/zoc/dataloaders/coco_full_loader.py
code served (permissive licence) · get_code("f39b19abd2c9cd41")
How it ran

no invocation recorded.

get_clip_image_features Not yet run
unverified (harvested, no recorded run)
sesmae/zoc/dataloaders/coco_full_loader.py
code served (permissive licence) · get_code("37742137dd850137")
How it ran

no invocation recorded.

greedysearch_generation_topk Not yet run
unverified (harvested, no recorded run)
sesmae/zoc/tinyimagenet_eval.py
code served (permissive licence) · get_code("1eac11a38598f275")
How it ran

no invocation recorded.

greedysearch_generation_topk Not yet run
unverified (harvested, no recorded run)
sesmae/zoc/cifar100_eval.py
code served (permissive licence) · get_code("27650a2ee702a0cb")
How it ran

no invocation recorded.

greedysearch_generation_topk Not yet run
unverified (harvested, no recorded run)
sesmae/zoc/cifar10_eval.py
code served (permissive licence) · get_code("e96829e6d222df08")
How it ran

no invocation recorded.

image_decoder Not yet run
unverified (harvested, no recorded run)
sesmae/zoc/tinyimagenet_eval.py
code served (permissive licence) · get_code("1baaac6c70ab5a06")
How it ran

no invocation recorded.

image_decoder Not yet run
unverified (harvested, no recorded run)
sesmae/zoc/cifar100_eval.py
code served (permissive licence) · get_code("ea251c0ac6fabe91")
How it ran

no invocation recorded.

train_decoder Not yet run
unverified (harvested, no recorded run)
sesmae/zoc/train_decoder.py
code served (permissive licence) · get_code("9775c2c477077546")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 10 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
tokenize_for_clip 1 other paper
1 later
2309.12780 (2023-09)
LMC: Large Model Collaboration with Cross-assessment for Training-Free Open-Set Object Recognition

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

In an out-of-distribution (OOD) detection problem, samples of known classes(also called in-distribution classes) are used to train a special classifier. In testing, the classifier can (1) classify the test samples of known classes to their respective classes and also (2) detect samples that do not belong to any of the known classes (i.e., they belong to some unknown or OOD classes). This paper studies the problem of zero-shot out-of-distribution(OOD) detection, which still performs the same two tasks in testing but has no training except using the given known class names. This paper proposes a novel yet simple method (called ZOC) to solve the problem. ZOC builds on top of the recent advances in zero-shot classification through multi-modal representation learning. It first extends the pre-trained language-vision model CLIP by training a text-based image description generator on top of CLIP. In testing, it uses the extended model to generate candidate unknown class names for each test sample and computes a confidence score based on both the known class names and candidate unknown class names for zero-shot OOD detection. Experimental results on 5 benchmark datasets for OOD detection demonstrate that ZOC outperforms the baselines by a large margin.

For agents

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

get_harvested_code_for_paper("2109.02748")
get_code_for_paper("2109.02748")
have("2109.02748")

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

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

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

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

Connect an agent — have() is free.