Papers › AdaCLIP: Adapting CLIP with Hybrid Learnable Prompts for Zero-Shot Anomaly Detection

AdaCLIP: Adapting CLIP with Hybrid Learnable Prompts for Zero-Shot Anomaly Detection

22 Jul 2024arXiv:2407.15795archive 2025-07-28

Yunkang Cao, Jiangning Zhang, Luca Frittoli, Yuqi Cheng, Weiming Shen, Giacomo Boracchi

Zero-shot anomaly detection (ZSAD) targets the identification of anomalies within images from arbitrary novel categories. This study introduces AdaCLIP for the ZSAD task, leveraging a pre-trained vision-language model (VLM), CLIP. AdaCLIP incorporates learnable prompts into CLIP and optimizes them through training on auxiliary annotated anomaly detection data. Two types of learnable prompts are proposed: static and dynamic. Static prompts are shared across all images, serving to preliminarily adapt CLIP for ZSAD. In contrast, dynamic prompts are generated for each test image, providing CLIP with dynamic adaptation capabilities. The combination of static and dynamic prompts is referred to as hybrid prompts, and yields enhanced ZSAD performance. Extensive experiments conducted across 14 real-world anomaly detection datasets from industrial and medical domains indicate that AdaCLIP outperforms other ZSAD methods and can generalize better to different categories and even domains. Finally, our analysis highlights the importance of diverse auxiliary data and optimized prompts for enhanced generalization capacity. Code is available at https://github.com/caoyunkang/AdaCLIP.

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 28 code samples harvested from 1 repository linked to this paper: 20 ran (of which 10 constructed an object rather than computing a result; 12 with no instrument failure: 0 honoured, 1 violated, 11 with no contract checked; 8 where Syntology's instrument failed) · 8 unverified. Where Syntology's instrument failed: 8 where our contract draft was wrong; failures of Syntology's instrument, not of the code.

By repository: official repository: 28 samples from 1 repository, 20 ran (12 with no instrument failure; 8 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.

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 20 samples that ran have no recorded date.

caoyunkang/adaclip officialmentioned in papermentioned on GitHubpytorchMITSyntology: 28 samples, 20 ran (8 instrument-failed) · 8 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.

Code Syntology ran Syntology

28 samples harvested: 20 ran (of which 10 constructed an object rather than computing a result; 12 with no instrument failure: 0 honoured, 1 violated, 11 with no contract checked; 8 where Syntology's instrument failed) · 8 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 · violated contract
8ran · our draft was wrong
11ran
8unverified

Licence: 4 of the 28 samples are pointer only, meaning Syntology does not serve that copy's text. For 4 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 caoyunkang/adaclip. “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”. For 3 samples that ran, the graph records a signature this page does not show: for a class the fixture built without calling, the harness called the object with inputs it made up itself, so the recorded signature is the harness's probe, not the fixture's arguments. “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.

caoyunkang/adaclip official repository 28 samples, 20 ran (8 instrument-failed) · 8 unverified
AttentionalPooler method/adaclip.py ran MIT (permissive) · 8933c7b9c7e59316 · report fixture: returned AttentionalPooler · level recorded 2026-09-22
CLIPTextCfg method/adaclip.py ran MIT (permissive) · d53cfe614e64f0f8 · report fixture: returned CLIPTextCfg · level recorded 2026-09-22
CLIPVisionCfg in 5 papers method/adaclip.py ran MIT (permissive) · 358336605882f8ac · report fixture: returned CLIPVisionCfg · level recorded 2026-09-22
HybridSemanticFusion method/adaclip.py ran MIT (permissive) · 7fef9e3e704a163e · report fixture: returned HybridSemanticFusion · level recorded 2026-09-22
LayerNorm in 121 papers
census: 5 implementations from 5 papers, 5 distinct outputs across 3 buckets, one shared input per bucket
method/adaclip.py ran fingerprinted MIT (permissive) · 60328965616e6752 · report fixture: signature x:Tensor/2/float · returned Tensor · level recorded 2026-09-24
LayerNormFp32 method/adaclip.py ran fingerprinted MIT (permissive) · 7a539f31051f66e9 · report fixture: returned LayerNormFp32 · level recorded 2026-09-22
PatchDropout method/adaclip.py ran fingerprinted MIT (permissive) · a47771f643ef84d8 · report fixture: returned PatchDropout · level recorded 2026-09-22
ProjectLayer method/adaclip.py ran MIT (permissive) · 9bb8bb245a3e6712 · report fixture: returned ProjectLayer · level recorded 2026-09-22
PromptLayer method/adaclip.py ran MIT (permissive) · baa7068d196ec4c6 · report fixture: returned PromptLayer · level recorded 2026-09-22
ResidualAttentionBlock in 38 papers method/adaclip.py ran MIT (permissive) · 7affcf897896a315 · report fixture: returned ResidualAttentionBlock · level recorded 2026-09-22
TextTransformer method/adaclip.py ran MIT (permissive) · f60673dd45a8761e · report fixture: returned TextTransformer · level recorded 2026-09-22
basic_clean in 217 papers method/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
convert_to_custom_text_state_dict in 59 papers method/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
freeze_batch_norm_2d in 15 papers method/utils.py ran · our draft was wrong MIT (permissive) here; the stored copy is pointer only · 9b5765523c6d17fd · report fixture: signature module:callable/0/?, module_match:dict/0/?, name:str/0/str · returned SimpleModel · level recorded 2026-09-26
get_cast_dtype in 67 papers method/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
get_pairs in 260 papers method/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
list_pretrained in 7 papers method/custom_clip.py ran · our draft was wrong MIT (permissive) · c213fb0a0028da05 · report fixture: signature as_str:bool/0/bool · returned list · level recorded 2026-09-24
list_pretrained_models_by_tag in 5 papers method/custom_clip.py ran · our draft was wrong fingerprinted MIT (permissive) · 63bcf6e40f415106 · report fixture: signature tag:str/0/str · returned list · level recorded 2026-09-24
list_pretrained_tags_by_model in 5 papers method/custom_clip.py ran · our draft was wrong fingerprinted MIT (permissive) · 1fe3bf9de033fd8f · report fixture: signature model:str/0/str · returned list · level recorded 2026-09-24
whitespace_clean in 230 papers method/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
AdaCLIP method/adaclip.py unverified MIT (permissive) · ccef093b595414f9 · report
CLIP in 25 papers method/adaclip.py unverified MIT (permissive) · 7dd2e9759231f093 · report
TextEmbebddingLayer method/adaclip.py unverified MIT (permissive) · 6e78fb5e970d4a0b · report
Transformer in 173 papers method/adaclip.py unverified MIT (permissive) · 2480af5fe5844d5b · report
VisionTransformer in 53 papers method/adaclip.py unverified MIT (permissive) · 51acd62f8b9ee4da · report
_build_text_tower method/adaclip.py unverified MIT (permissive) · 432535468a1356fd · report
_build_vision_tower method/adaclip.py unverified MIT (permissive) · 98b01b93d323fa78 · report
build_model_from_openai_state_dict in 42 papers method/clip_model.py unverified MIT (permissive) · 5d5046aaa43f74c7 · 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 AdaCLIP (graph method: AdaCLIP). 26 bricks; individually on a fixture: 19 ran (of which 11 constructed an object rather than computing a result; 15 with no instrument failure: 0 honoured, 0 violated, 15 with no contract checked; 4 where Syntology's instrument failed) · 7 unverified. The assembly has not been run end-to-end.

  1. AdaCLIP entry · level 0 · unverified · ccef093b595414f9
  2. CLIP helper · level 0 · unverified · 7dd2e9759231f093
  3. HybridSemanticFusion model · level 1 · ran · 7fef9e3e704a163e
  4. ProjectLayer helper · level 1 · ran · 9bb8bb245a3e6712
  5. PromptLayer model · level 1 · ran · baa7068d196ec4c6
  6. TextEmbebddingLayer model · level 0 · unverified · 6e78fb5e970d4a0b
  7. CLIPTextCfg helper · level 1 · ran · d53cfe614e64f0f8
  8. CLIPVisionCfg helper · level 1 · ran · 358336605882f8ac
  9. _build_text_tower helper · level 0 · unverified · 432535468a1356fd
  10. _build_vision_tower helper · level 0 · unverified · 98b01b93d323fa78
  11. LayerNorm helper · level 1 · ran · 60328965616e6752
  12. LayerNormFp32 helper · level 1 · ran · 7a539f31051f66e9
  13. QuickGELU helper · level 1 · ran · 8c5c4de012c0aab9
  14. TextTransformer helper · level 1 · ran · f60673dd45a8761e
  15. VisionTransformer helper · level 0 · unverified · 51acd62f8b9ee4da
  16. Transformer helper · level 0 · unverified · 2480af5fe5844d5b
  17. AttentionalPooler helper · level 1 · ran · 8933c7b9c7e59316
  18. PatchDropout helper · level 1 · ran · a47771f643ef84d8
  19. ResidualAttentionBlock helper · level 1 · ran · 7affcf897896a315
  20. LayerScale helper · level 1 · ran · a77a876f784480d3
  21. _ntuple helper · level 1 · ran · our draft was wrong · 553ee0765abad219
  22. basic_clean helper · level 1 · ran · our draft was wrong · 98f385d847636a3e
  23. bytes_to_unicode helper · level 1 · ran · 6059f632163bf188
  24. default_bpe helper · level 1 · ran · c032e98969097964
  25. get_pairs helper · level 1 · ran · our draft was wrong · d919ae32e5e4e616
  26. whitespace_clean helper · level 1 · ran · our draft was wrong · 9542161e9640b858

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="2407.15795") returns these assemblies with each brick's role and wiring (how to connect).

Tasks

Anomaly DetectionLanguage ModelingLanguage Modellingzero-shot anomaly detection

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Anomaly Detection MPDD AdaCLIP Detection AUROC 82.5 #13 of 16 Archive leaderboard report
Anomaly Detection MPDD AdaCLIP Segmentation AUROC 96.1 #13 of 16 Archive leaderboard report
Anomaly Detection MVTec AD AdaCLIP Detection AUROC 89.2 #113 of 148 Archive leaderboard report
Anomaly Detection MVTec AD AdaCLIP Segmentation AUROC 88.7 #113 of 148 Archive leaderboard report
Anomaly Detection VisA AdaCLIP Detection AUROC 85.8 #34 of 50 Archive leaderboard report
Anomaly Detection VisA AdaCLIP Segmentation AUROC 95.5 #34 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

CLIP

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