VLMDiff: Leveraging Vision-Language Models for Multi-Class Anomaly Detection with Diffusion

Samet Hicsonmez, Abd El Rahman Shabayek, Djamila Aouada

TL;DR

This paper introduces VLMDiff, a novel unsupervised framework for multi-class visual anomaly detection that combines the power of Vision-Language Models (VLMs) with Latent Diffusion Models (LDMs). By leveraging VLMs to generate detailed textual descriptions of normal images, VLMDiff provides richer conditioning for LDMs, leading to improved anomaly detection and localization without requiring per-class training or synthetic anomaly generation.

What Problem Does This Paper Address?

Detecting and localizing visual anomalies in diverse, multi-class real-world images is a significant challenge. Traditional anomaly detection (AD) methods often struggle with the rarity and diversity of anomalous instances, making unsupervised approaches that rely solely on normal data essential. While recent diffusion-based methods have shown promise, they often suffer from limited generalization due to synthetic anomaly generation, require per-class model training (hindering scalability), and their guidance signals can be weak. Furthermore, existing methods that leverage VLMs for AD often require specialized prompt engineering or labeled anomaly data, which are not always available. This paper aims to bridge this gap by proposing a more robust, scalable, and generalizable multi-class AD framework that effectively utilizes the descriptive power of VLMs without extensive prompt tuning or per-class training.

Methods

VLMDiff integrates a Latent Diffusion Model (LDM) with a Vision-Language Model (VLM) to enhance anomaly detection and localization. The core idea is to use a pre-trained VLM with a simple, generic prompt to extract detailed textual descriptions of normal images. These descriptions are then encoded into a conditioning vector and used to guide the training of the LDM.

Here's a breakdown of the key components:

  • Vision-Language Model (VLM) Integration: Instead of relying on synthetic anomaly generation or complex prompt engineering, VLMDiff uses off-the-shelf VLMs (like InternVL-2) to generate descriptive text for normal images. This text acts as a powerful conditioning signal for the diffusion model.
  • Latent Diffusion Model (LDM): The paper utilizes an LDM for its efficient reconstruction capabilities. The LDM is trained to denoise latent representations of images, guided by the VLM-generated text.
  • Unsupervised, Multi-Class Approach: A single model is trained for each dataset, encompassing all normal classes. This contrasts with many prior methods that require separate models for each anomaly class, leading to better generalization and scalability.
  • Anomaly Segmentation: During inference, the input image and its reconstructed counterpart are fed into a self-supervised model (like DINO) to extract features. Dissimilarities between these features are used to generate an anomaly map, localizing the defective regions.

Datasets

The paper evaluates VLMDiff on two large-scale datasets:

  • Real-IAD [46]: An industrial defect detection dataset featuring 30 objects with multiple views and a wide range of defect types, including subtle ones.
  • COCO-AD [59]: A real-world anomaly localization dataset derived from the original COCO dataset. It uses 20 consecutive classes as anomalies, aiming to test generalization to unseen object categories.

Key Insights and Ideas

  • VLM Descriptions as Powerful Guidance: The paper demonstrates that detailed textual descriptions from VLMs, even with simple prompts, provide significantly richer and more effective guidance for diffusion models in AD compared to traditional noise-based conditioning.
  • Multi-Class, Single-Model Advantage: Training a single model for all normal classes in a dataset leads to improved generalization, robustness, scalability, and efficiency compared to per-class training. This is crucial for real-world applications with diverse object categories.
  • Inference-Time Text Conditioning Can Be Detrimental: Surprisingly, the authors found that using VLM descriptions during inference on images with visible defects could sometimes harm performance. This suggests that for anomaly localization, unconditional generation during inference might be more effective, allowing the model to focus on reconstruction errors.
  • Domain Generalization: VLMDiff shows strong performance on both industrial (Real-IAD) and natural image (COCO-AD) datasets, highlighting its ability to adapt to different domains and anomaly types (pixel-level defects vs. object-level anomalies).

Key Results

VLMDiff achieves competitive performance and significant improvements on several metrics:

  • Real-IAD Dataset: VLMDiff improves the pixel-level Per-Region-Overlap (PRO) metric by up to 25 points compared to state-of-the-art diffusion-based approaches. It also achieves on-par performance with other leading methods on image-level ROC and pixel-level ROCP.
  • COCO-AD Dataset: The method shows an 8-point improvement in the PRO metric compared to diffusion-based methods, demonstrating its generalization capability. It also achieves on-par results with other state-of-the-art approaches.
  • Qualitative Results: VLMDiff successfully detects various types of defects, including subtle ones, and in some cases, even localizes missed annotations. It also excels at localizing anomalous objects in complex scenes on the COCO-AD dataset.

Limitations and Future Work

The authors acknowledge a few limitations and suggest future directions:

  • Fixed Prompt Strategy: The current approach uses a fixed, simple prompt for VLM descriptions. Future work could explore optimizing these prompts through prompt learning techniques to extract even richer descriptions tailored to specific datasets.
  • Inference-Time Conditioning: While VLM descriptions are beneficial for training, their use during inference can sometimes be detrimental. Further research could investigate how to best leverage VLM insights during inference for optimal anomaly detection.
  • Feature Extractor Choice: The choice of feature extractor for anomaly segmentation can impact performance. While DINO and ImageNet-pretrained models were explored, further investigation into optimal feature extractors could be beneficial.

Summary updated

BibTeX
@inproceedings{hicsonmez2026vlmdiff,
  author = {Samet Hicsonmez and Abd El Rahman Shabayek and Djamila Aouada},
  title = {{VLMDiff: Leveraging Vision-Language Models for Multi-Class Anomaly Detection with Diffusion}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2026},
}
Figure