Papers › AnomalyCLIP: Object-agnostic Prompt Learning for Zero-shot Anomaly Detection

AnomalyCLIP: Object-agnostic Prompt Learning for Zero-shot Anomaly Detection

29 Oct 2023arXiv:2310.18961archive 2025-07-28

Qihang Zhou, Guansong Pang, Yu Tian, Shibo He, Jiming Chen

Zero-shot anomaly detection (ZSAD) requires detection models trained using auxiliary data to detect anomalies without any training sample in a target dataset. It is a crucial task when training data is not accessible due to various concerns, eg, data privacy, yet it is challenging since the models need to generalize to anomalies across different domains where the appearance of foreground objects, abnormal regions, and background features, such as defects/tumors on different products/organs, can vary significantly. Recently large pre-trained vision-language models (VLMs), such as CLIP, have demonstrated strong zero-shot recognition ability in various vision tasks, including anomaly detection. However, their ZSAD performance is weak since the VLMs focus more on modeling the class semantics of the foreground objects rather than the abnormality/normality in the images. In this paper we introduce a novel approach, namely AnomalyCLIP, to adapt CLIP for accurate ZSAD across different domains. The key insight of AnomalyCLIP is to learn object-agnostic text prompts that capture generic normality and abnormality in an image regardless of its foreground objects. This allows our model to focus on the abnormal image regions rather than the object semantics, enabling generalized normality and abnormality recognition on diverse types of objects. Large-scale experiments on 17 real-world anomaly detection datasets show that AnomalyCLIP achieves superior zero-shot performance of detecting and segmenting anomalies in datasets of highly diverse class semantics from various defect inspection and medical imaging domains. Code will be made available at https://github.com/zqhang/AnomalyCLIP.

PaperPDFCodeCode Syntology ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 32 code samples harvested from 2 repositories linked to this paper: 19 ran (of which 0 constructed an object rather than computing a result; 12 with no instrument failure: 1 honoured, 1 violated, 10 with no contract checked; 7 where Syntology's instrument failed) · 13 unverified. Where Syntology's instrument failed: 5 where our contract draft was wrong; 2 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 18 samples from 1 repository, 12 ran (6 with no instrument failure; 6 where Syntology's instrument failed); community (archive-listed): 14 samples from 1 repository, 7 ran (6 with no instrument failure; 1 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

No sample is linked to this paper from 1 of its repositories that Syntology harvested for other papers:

Levels written between 2026-09-22 and 2026-09-26 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 2 of the 19 samples that ran have no recorded date.

zqhang/anomalyclip officialmentioned in papermentioned on GitHubpytorchMITSyntology: 18 samples, 12 ran (6 instrument-failed) · 6 unverified report
zqhang/Accurate-WinCLIP-pytorch mentioned on GitHubpytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to WinCLIP: Zero-/Few-Shot Anomaly Classification and Segmentation (arXiv:2303.14814; that paper's own run record: 7 ran (of which 0 constructed an object rather than computing a result; 6 with no instrument failure: 1 honoured, 2 violated, 3 with no contract checked; 1 where Syntology's instrument failed) · 5 unverified) and PointAD: Comprehending 3D Anomalies from Points and Pixels for Zero-shot 3D Anomaly Detection (arXiv:2410.00320; that paper's own run record: 17 ran (of which 2 constructed an object rather than computing a result; 8 with no instrument failure: 1 honoured, 0 violated, 7 with no contract checked; 9 where Syntology's instrument failed) · 9 unverified); nothing checks that they implement this paper's method. report
zqhang/WinCLIP-pytorch mentioned on GitHubpytorchMITSyntology: 14 samples, 7 ran (1 instrument-failed) · 7 unverified 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.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

32 samples harvested: 19 ran (of which 0 constructed an object rather than computing a result; 12 with no instrument failure: 1 honoured, 1 violated, 10 with no contract checked; 7 where Syntology's instrument failed) · 13 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

1ran · honoured contract
1ran · violated contract
5ran · our draft was wrong
2ran; the contract check could not run
10ran
13unverified

Licence: 15 of the 32 samples are pointer only, meaning Syntology does not serve that copy's text. For 15 of them, this paper's copy is under a permissive licence and cleared, but the stored copy of the same code that Syntology serves is not; the licence label's tooltip gives Syntology's recorded reason. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. “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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

zqhang/anomalyclip official repository 18 samples, 12 ran (6 instrument-failed) · 6 unverified
basic_clean in 217 papers AnomalyCLIP_lib/simple_tokenizer.py ran · our draft was wrong fingerprinted MIT (permissive) here; the stored copy is pointer only · 98f385d847636a3e · report fixture: signature text:str/0/str · returned str · level recorded 2026-09-22
cal_pro_score metrics.py ran; the contract check could not run (RAISES) MIT (permissive) here; the stored copy is pointer only · 178a0488f0c59db0 · report fixture: signature masks:ndarray/3/bool, amaps:ndarray/3/float, max_step:int/0/int, expect_fpr:float/0/float · returned float · level recorded 2026-09-24
generate_class_info dataset.py ran MIT (permissive) · bbbfccbf329e9fdd · report fixture: signature dataset_name:str/0/str · returned tuple · level recorded 2026-09-24
get_logger in 383 papers logger.py ran · our draft was wrong MIT (permissive) here; the stored copy is pointer only · 01e8c2f30dcaa3d3 · report fixture: signature save_path:str/0/str · returned Logger · level recorded 2026-09-24
get_pairs in 260 papers AnomalyCLIP_lib/simple_tokenizer.py ran · our draft was wrong MIT (permissive) · d919ae32e5e4e616 · report fixture: signature word:tuple/1/str · returned set · level recorded 2026-09-22
image_level_metrics metrics.py ran MIT (permissive) · eb13a678b5dba664 · report fixture: signature results:dict/0/?, obj:str/0/str, metric:str/0/str · returned float · level recorded 2026-09-24
load_state_dict in 114 papers AnomalyCLIP_lib/model_load.py ran MIT (permissive) here; the stored copy is pointer only · 4b3a4d17e1df3140 · report fixture: signature checkpoint_path:str/0/str, map_location:str/0/str · returned dict · level recorded 2026-09-24
normalize in 638 papers
census: 70 implementations from 82 papers, 51 distinct outputs across 11 buckets, one shared input per bucket this sample: bucket 1 of 11, arg 1: rank 2, kind float, dtype float32
utils.py ran · honoured contract fingerprinted MIT (permissive) · 0c3f9d9b0ac9f33d · report fixture: signature pred:Tensor/2/float, max_value:float/0/float, min_value:float/0/float · returned Tensor · level recorded 2026-09-22
pixel_level_metrics metrics.py ran MIT (permissive) · cc90ad1a3ffd0e88 · report fixture: signature results:dict/0/?, obj:str/0/str, metric:str/0/str · returned float · level recorded 2026-09-24
smooth in 61 papers
census: 6 implementations from 8 papers, 5 distinct outputs across 3 buckets, one shared input per bucket this sample: bucket 3 of 3, arg 1: rank 3, kind float, dtype float32
loss.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant fingerprinted MIT (permissive) · abedbe9b904a9780 · report fixture: signature arr:Tensor/3/float, lamda1:float/0/float · returned Tensor · level recorded 2026-09-22
sparsity in 14 papers loss.py ran MIT (permissive) here; the stored copy is pointer only · 208456d9417303f4 · report fixture: signature arr:Tensor/2/float, target:int/0/int, lamda2:float/0/float · returned Tensor · level recorded 2026-09-24
whitespace_clean in 230 papers AnomalyCLIP_lib/simple_tokenizer.py ran · our draft was wrong fingerprinted MIT (permissive) here; the stored copy is pointer only · 9542161e9640b858 · report fixture: signature text:str/0/str · returned str · level recorded 2026-09-22
AnomalyCLIP AnomalyCLIP_lib/AnomalyCLIP.py unverified MIT (permissive) · f8d43518b10ab859 · report
VisionTransformer in 53 papers AnomalyCLIP_lib/AnomalyCLIP.py unverified MIT (permissive) · 175f83b44a42759d · report
build_model in 469 papers AnomalyCLIP_lib/build_model.py unverified MIT (permissive) here; the stored copy is pointer only · ed57101d91ad0e4e · report
image_transform in 11 papers AnomalyCLIP_lib/transform.py unverified MIT (permissive) here; the stored copy is pointer only · 2c38b8a1a6553df1 · report
load in 392 papers AnomalyCLIP_lib/model_load.py unverified MIT (permissive) here; the stored copy is pointer only · 45e1ef91f571e2f5 · report
load_checkpoint in 277 papers AnomalyCLIP_lib/model_load.py unverified MIT (permissive) here; the stored copy is pointer only · d53108edea9d2b46 · report
zqhang/WinCLIP-pytorch community (archive-listed) 14 samples, 7 ran (1 instrument-failed) · 7 unverified
apply_ad_scoremap reproduce_WinCLIP.py ran MIT (permissive) · f09367dd0e4c9c94 · report fixture: signature image:ndarray/3/int, scoremap:ndarray/2/float, alpha:float/0/float · returned ndarray · level recorded 2026-09-24
cal_pro_score reproduce_WinCLIP.py ran MIT (permissive) · e6a423edd53e011c · report fixture: signature masks:ndarray/3/bool, amaps:ndarray/3/float, max_step:int/0/int, expect_fpr:float/0/float · returned float · level recorded 2026-09-24
convert_to_custom_text_state_dict in 59 papers src/open_clip/model.py ran · violated contract MIT (permissive) here; the stored copy is pointer only · f19962ebb134b3d7 · report fixture: signature state_dict:dict/0/? · returned dict · level recorded, date not recorded
get_cast_dtype in 67 papers src/open_clip/model.py ran · our draft was wrong MIT (permissive) · dcd422d66b0581d8 · report fixture: signature precision:str/0/str · returned dtype · level recorded, date not recorded
initialize_memory few_shot.py ran fingerprinted MIT (permissive) · 8019976ff0ac258f · report fixture: signature obj_list:list/1/str · returned tuple · level recorded 2026-09-24
prepare_inputs_for_generation in 58 papers src/open_clip/coca_model.py ran MIT (permissive) here; the stored copy is pointer only · fb651d0a97fd4d3f · report fixture: signature input_ids:Tensor/2/int, image_inputs:Tensor/3/float, past:NoneType/0/?, attention_mask:Tensor/2/int, position_ids:Tensor/2/int · returned dict · level recorded 2026-09-26
register_pooler in 46 papers src/open_clip/hf_model.py ran MIT (permissive) here; the stored copy is pointer only · 2a377da4a76a2d44 · report fixture: signature cls:callable/0/? · returned type · level recorded 2026-09-26
build_model_from_openai_state_dict in 42 papers src/open_clip/model.py unverified MIT (permissive) · e332828701fffe70 · report
build_model_from_openai_state_dict in 42 papers src/open_clip/model_revise.py unverified MIT (permissive) · e0b318791c717866 · report
gather_features in 78 papers src/open_clip/loss.py unverified MIT (permissive) here; the stored copy is pointer only · ddcbd45e940484ee · report
get_model_config in 45 papers src/open_clip/factory.py unverified MIT (permissive) · 5c7cf820e99443ff · report
get_tokenizer in 156 papers src/open_clip/factory.py unverified MIT (permissive) here; the stored copy is pointer only · f34d8f34635af394 · report
load_openai_model in 16 papers src/open_clip/openai.py unverified MIT (permissive) · a1693b09a14a516f · report
memory few_shot.py unverified MIT (permissive) · db75b22fe2d18129 · report

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it.

1 assembly on this paper: 1 harvested, 0 generated.

harvested Assembly for AnomalyCLIP (graph method: AnomalyCLIP). 8 bricks; individually on a fixture: 4 ran (of which 3 constructed an object rather than computing a result; 4 with no instrument failure: 0 honoured, 0 violated, 4 with no contract checked; 0 where Syntology's instrument failed) · 4 unverified. The assembly has not been run end-to-end.

  1. AnomalyCLIP entry · level 0 · unverified · f8d43518b10ab859
  2. LayerNorm helper · level 1 · ran · e296840ad4106ad9
  3. Transformer model · level 0 · unverified · 904024b32ecbd1e1
  4. VisionTransformer model · level 0 · unverified · 175f83b44a42759d
  5. ResidualAttentionBlock model · level 0 · unverified · 6cbaa01bb223f295
  6. ResidualAttentionBlock_learnable_token model · level 1 · ran · b0d940f6ea95cb97
  7. Attention helper · level 1 · ran · 2e7ee770aa7c6018
  8. QuickGELU helper · level 1 · ran · 8c5c4de012c0aab9

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2310.18961") returns these assemblies with each brick's role and wiring (how to connect).

Tasks

Anomaly DetectionPrompt LearningZero-Shot Learningzero-shot anomaly detection

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Anomaly Detection MVTec AD AnomalyCLIP Detection AUROC 91.5 #109 of 148 Archive leaderboard report
Anomaly Detection MVTec AD AnomalyCLIP Segmentation AUPRO 81.4 #109 of 148 Archive leaderboard report
Anomaly Detection MVTec AD AnomalyCLIP Segmentation AUROC 91.1 #109 of 148 Archive leaderboard report
Anomaly Detection VisA AnomalyCLIP Detection AUROC 82.1 #39 of 50 Archive leaderboard report
Anomaly Detection VisA AnomalyCLIP Segmentation AUPRO 87.0 #39 of 50 Archive leaderboard report
Anomaly Detection VisA AnomalyCLIP Segmentation AUROC 95.5 #39 of 50 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

CLIPFocus

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