DE-CLIP: Few-Shot Anomaly Detection via Difference-Guided Embedding Editing
Paper · 2026 · Yage Zhang, Yukun Jiang, Michael Backes et al.
Summary
CLIP-based anomaly detection struggles because CLIP's text encoder places prompts about normal and defective states, such as an intact versus a broken bottle, very close together in embedding space. Many earlier methods fix this by fine-tuning or adding trainable modules. The authors argue that this extra training is unnecessary. They introduce DiffEdit, which shifts text embeddings along a direction obtained by contrasting embeddings of antonymic state words (normal vs. defect). They also align this shift with a visual anchor computed from a few normal reference images. DE-CLIP builds on DiffEdit to perform few-shot anomaly classification (AC) and anomaly segmentation (AS) with no gradient-based optimization, using multi-scale feature comparison for segmentation. Across industrial (MVTec, VisA) and medical (Brain MRI) benchmarks, it beats both training-based and training-free baselines. Adding DiffEdit to other training-free methods also improves them substantially. The work shows that simple geometric edits in CLIP's latent space can replace costly adaptation in data-scarce inspection settings.
Key points
- AUROC for AC/AS: 96.6/96.7 on MVTec, 87.1/97.6 on VisA, and 75.2/92.6 on Brain MRI.
- When DiffEdit is attached to other baselines, training-free methods gain the most, up to 30.1% AUROC. Heavily fine-tuned models (AA-CLIP, AdaCLIP, AnomalyCLIP) barely change.
- Replacing the hand-crafted antonym lexicon with pairs generated by GPT-5 gives comparable results. The test sampled 18 of 50 pairs, under an 8-shot setting, over 10 seeds, and reached 96.2 ± 0.1 AC-AUROC on MVTec.
- An adjective-only difference vector ΔT(S) performs within 0.3% AUROC of the object-conditioned ΔT(S+O). This makes it a lighter alternative.
- DiffEdit also generalizes beyond anomaly detection. On CIFAR-100, it raises CLIP's Top-1 accuracy from 66.9% to 68.7% in the zero-shot setting and to 74.3% with 10 shots. Code is available at github.com/TrustAIRLab/DE-CLIP.
Institutions
Fields, topics and concepts
📚 Shelves 4The field of science this work belongs to (OpenAlex fields).Computer Science · 18,614 worksArtificial Intelligence · 17,965 worksEngineering · 188 worksIndustrial and Manufacturing Engineering · 11 works
Cite
Cite as Yage Zhang, Yukun Jiang, Michael Backes and Yang Zhang. 2026. DE-CLIP: Few-Shot Anomaly Detection via Difference-Guided Embedding Editing. Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).
@inproceedings{zhang2026de,
title = {{DE-CLIP: Few-Shot Anomaly Detection via Difference-Guided Embedding Editing}},
author = {Yage Zhang, Yukun Jiang, Michael Backes and Yang Zhang},
booktitle = {Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
year = {2026},
doi = {10.18653/v1/2026.acl-long.110},
url = {https://doi.org/10.18653/v1/2026.acl-long.110}
}References
- Although DE-CLIP works without training, it presumes (i) a hand-crafted antonym lexicon for the textual vector ∆ T , which may be hard to define in domains such as satellite imagery or finance, and (ii) that the textual ∆ T and visual ∆ I point in similar directions, misalignment could weaken the ed… find
- Jinan Bao, Hanshi Sun, Hanqiu Deng, Yinsheng He, Zhaoxiang Zhang, and Xingyu Li. 2023. BMAD: Benchmarks for Medical Anomaly Detection. CoRR abs/2306.11876. \#\# Ethical Considerations The primary objective of this work is to advance the understanding and safety of anomaly detection (AD) systems based… — [arXiv:2306.11876](https://arxiv.org/abs/2306.11876) find
- Lawrence W. Barsalou. 1999. Perceptual symbol systems. Behavioral and Brain Sciences, 22(4):577– 660. find
- Paul Bergmann, Michael Fauser, David Sattlegger, and Carsten Steger. 2019. MVTec AD — A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 9592–9600. find
- Jorge Bernal, F. Javier Sánchez, Gloria Fernández-Esparrach, Debora Gil, Cristina Rodríguez, and Fernando Vilariño. 2015. WM-DOVA maps for accurate polyp highlighting in colonoscopy: Validation vs. saliency maps from physicians. Computerized Medical Imaging and Graphics, 43:99–111. find
- Jorge Bernal, Javier Sánchez, and Fernando Vilariño. 2012. Towards Automatic Polyp Detection with a Polyp Appearance Model. Pattern Recognition, 45(9):3166–3182. find
- Yunkang Cao, Jiangning Zhang, Luca Frittoli, Yuqi Cheng, Weiming Shen, and Giacomo Boracchi. 2024. AdaCLIP: Adapting CLIP with Hybrid Learnable Prompts for Zero-Shot Anomaly Detection. In European Conference on Computer Vision (ECCV), pages 55–72. Springer. find
- Xuhai Chen, Yue Han, and Jiangning Zhang. 2023. APRIL-GAN: A Zero-/Few-Shot Anomaly Classification and Segmentation Method for CVPR 2023 VAND Workshop Challenge Tracks 1&2: 1st Place on Zero-shot AD and 4th Place on Few-shot AD. CoRR abs/2305.17382. — [arXiv:2305.17382](https://arxiv.org/abs/2305.17382) find
- Thomas Defard, Aleksandr Setkov, Angelique Loesch, and Romaric Audigier. 2021. PaDiM: A Patch Distribution Modeling Framework for Anomaly Detection and Localization. In International Conference on Pattern Recognition (ICPR), pages 475–489. Springer. find
- Hanqiu Deng and Xingyu Li. 2022. Anomaly Detection via Reverse Distillation from One-Class Embedding. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 9737–9746. find
- Sedigheh Eslami and Gerard de Melo. 2024. Mitigate the Gap: Investigating Approaches for Improving Cross-Modal Alignment in CLIP. CoRR abs/2406.17639. — [arXiv:2406.17639](https://arxiv.org/abs/2406.17639) find
- Tharindu Fernando, Harshala Gammulle, Simon Den-man, Sridha Sridharan, and Clinton Fookes. 2021. Deep Learning for Medical Anomaly Detection–A Survey. ACM Computing Surveys (CSUR), 54(7):1– 37. find
- Ronald A. Fisher. 1936. The Use of Multiple Measurements in Taxonomic Problems. Annals of Eugenics, 7(2):179–188. find
- Chaoqin Huang, Aofan Jiang, Jinghao Feng, Ya Zhang, Xinchao Wang, and Yanfeng Wang. 2024. Adapting Visual-Language Models for Generalizable Anomaly Detection in Medical Images. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 11375–11385. find
- Jongheon Jeong, Yang Zou, Taewan Kim, Dongqing Zhang, Avinash Ravichandran, and Onkar Dabeer. 2023. WinCLIP: Zero-/Few-Shot Anomaly Classification and Segmentation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 19606–19616. find
- Yukun Jiang, Zheng Li, Xinyue Shen, Yugeng Liu, Michael Backes, and Yang Zhang. 2024. Mod-SCAN: Measuring Stereotypical Bias in Large Vision-Language Models from Vision and Language Modalities. In Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 12814–12845. ACL. find
- Raphi Kang, Yue Song, Georgia Gkioxari, and Pietro Perona. 2025. Is CLIP ideal? No. Can we fix it? Yes! CoRR abs/2503.08723. — [arXiv:2503.08723](https://arxiv.org/abs/2503.08723) find
- Alex Krizhevsky. 2009. Learning multiple layers of features from tiny images. Technical report, University of Toronto. find
- George Lakoff and Mark Johnson. 1980. Metaphors We Live By. University of Chicago Press. find
- Ronald W. Langacker. 1987. Foundations of Cognitive Grammar: Theoretical Prerequisites. Stanford University Press. find
- Ye Leng, Junjie Chu, Mingjie Li, Chenhao Lin, Chao Shen, Michael Backes, Yun Shen, and Yang Zhang. 2026. When Understanding Becomes a Risk: Authenticity and Safety Risks in the Emerging Image Generation Paradigm. CoRR abs/2603.24079. — [arXiv:2603.24079](https://arxiv.org/abs/2603.24079) find
- Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. 2023. BLIP-2: Bootstrapping Language-Image Pre-Training with Frozen Image Encoders and Large Language Models. In International Conference on Machine Learning (ICML), pages 19730–19742. PMLR.
- Xurui Li, Ziming Huang, Feng Xue, and Yu Zhou. 2024a. MUSC: Zero-Shot Industrial Anomaly Classification and Segmentation with Mutual Scoring of the Unlabeled Images. In International Conference on Learning Representations (ICLR). find
- Yuanwei Li, Elizaveta Ivanova, and Martins Bruveris. 2024b. FADE: Few-shot/zero-shot Anomaly Detection Engine using Large Vision-Language Model. CoRR abs/2409.00556. — [arXiv:2409.00556](https://arxiv.org/abs/2409.00556) find
- Victor Weixin Liang, Yuhui Zhang, Yongchan Kwon, Serena Yeung, and James Y Zou. 2022. Mind the Gap: Understanding the Modality Gap in Multi-Modal Contrastive Representation Learning. In Annual Conference on Neural Information Processing Systems (NIPS), volume 35, pages 17612–17625. Curran Associates… find
- Wenxin Ma, Xu Zhang, Qingsong Yao, Fenghe Tang, Chenxu Wu, Yingtai Li, Rui Yan, Zihang Jiang, and S Kevin Zhou. 2025. AA-CLIP: Enhancing Zero-Shot Anomaly Detection via Anomaly-Aware CLIP. CoRR abs/2503.06661. — [arXiv:2503.06661](https://arxiv.org/abs/2503.06661) find
- Charles E. Osgood, George J. Suci, and Percy H. Tannenbaum. 1957. The Measurement of Meaning. University of Illinois Press, Urbana, IL. find
- Zhen Qu, Xian Tao, Mukesh Prasad, Fei Shen, Zhengtao Zhang, Xinyi Gong, and Guiguang Ding. 2024. VCP-CLIP: A Visual Context Prompting Model for Zero-Shot Anomaly Segmentation. CoRR abs/2407.12276. — [arXiv:2407.12276](https://arxiv.org/abs/2407.12276) find
- Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. 2021. Learning Transferable Visual Models From Natural Language Supervision. In International Conference on Machin…
- Karsten Roth, Latha Pemula, Joaquin Zepeda, Bernhard Schölkopf, Thomas Brox, and Peter Gehler. 2022. Towards Total Recall in Industrial Anomaly Detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 14318–14328. find
- Junnan Li, Dongxu Li, Caiming Xiong, and Steven C. H. Hoi. 2022. BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation. CoRR abs/2201.12086.
- Simon Schrodi, David T. Hoffmann, Max Argus, Volker Fischer, and Thomas Brox. 2024. Two Effects, One Trigger: On the Modality Gap, Object Bias, and Information Imbalance in Contrastive Vision-Language Representation Learning. In International Conference on Learning Representations (ICLR). find
- Junnan Li, Ramprasaath Selvaraju, Akhilesh Gotmare, Shafiq Joty, Caiming Xiong, and Steven Chu Hong Hoi. 2021. Align Before Fuse: Vision and Language Representation Learning with Momentum Distillation. Annual Conference on Neural Information Processing Systems (NeurIPS), 34:9694–9705. find
- Haoyu Song, Li Dong, Weinan Zhang, Ting Liu, and Furu Wei. 2022. CLIP Models Are Few-Shot Learners: Empirical Studies on VQA and Visual Entailment. In Annual Meeting of the Association for Computational Linguistics (ACL), pages 6088–6100. ACL. find
- Yucheng Suo, Linchao Zhu, and Yi Yang. 2023. Text Augmented Spatial Aware Zero-Shot Referring Image Segmentation. In Findings of the Association for Computational Linguistics: Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1032–1043. ACL. find
- Fisher Linear Discriminant. With the isotropy assumption Σ + ≈ Σ − ≈ σ 2 I (Fisher, 1936), the Rayleigh quotient is maximised by Yingtian Tang, Yutaro Yamada, Yoyo Zhang, and Ilker Yildirim. 2023. When Are Lemons Purple? The Concept Association Bias of Vision-Language Models. In Conference on Empiri… find
- Impact of DiffEdit. DiffEdit injects a scaled visual shift: Shengbang Tong, Zhuang Liu, Yuexiang Zhai, Yi Ma, Yann LeCun, and Saining Xie. 2024. Eyes Wide Shut? Exploring the Visual Shortcomings of Multimodal LLMs. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 9568– 957…
- Kirill Tyshchuk, Polina Karpikova, Andrew Spiridonov, Anastasiia Prutianova, Anton Razzhigaev, and Alexander Panchenko. 2023. On Isotropy of Multimodal Embeddings. Information, 14(7):392. find
- Zhiyuan You, Lei Cui, Yujun Shen, Kai Yang, Xin Lu, Yu Zheng, and Xinyi Le. 2022. A Unified Model for Multi-Class Anomaly Detection. Advances in Neural Information Processing Systems, 35:4571–4584. find
- Zhaoxiang Zhang, Hanqiu Deng, Jinan Bao, and Xingyu Li. 2024. Dual-Image Enhanced CLIP for Zero-Shot Anomaly Detection. CoRR abs/2405.04782. — [arXiv:2405.04782](https://arxiv.org/abs/2405.04782) find
- Qihang Zhou, Guansong Pang, Yu Tian, Shibo He, and Jiming Chen. 2023. AnomalyCLIP: Object-agnostic Prompt Learning for Zero-shot Anomaly Detection. CoRR abs/2310.18961. — [arXiv:2310.18961](https://arxiv.org/abs/2310.18961) find
- Deyao Zhu, Jun Chen, Xiaoqian Shen, Xiang Li, and Mohamed Elhoseiny. 2023. MiniGPT-4: Enhancing Vision-Language Understanding with Advanced Large Language Models. CoRR abs/2304.10592.
- Yang Zou, Jongheon Jeong, Latha Pemula, Dongqing Zhang, and Onkar Dabeer. 2022. SPot-the-Difference Self-Supervised Pre-training for Anomaly Detection and Segmentation. In European Conference on Computer Vision (ECCV), pages 392–408. Springer. find
Updated
This page in Markdown → https://md.research.elamur.ai/free/en/papers/zhang-2026-de-clip-few-shot-anomaly/