Training Free Zero-Shot Visual Anomaly Localization via Diffusion Inversion

Samet Hiçsönmez, Abd El Rahman Shabayek, Djamila Aouada

Abstract

Zero-Shot image Anomaly Detection (ZSAD) aims to detect and localise anomalies without access to any normal training samples of the target data. While recent ZSAD approaches leverage additional modalities such as language to generate fine-grained prompts for localisation, vision-only methods remain limited to image-level classification, lacking spatial precision. In this work, we introduce a simple yet effective training-free vision-only ZSAD framework that circumvents the need for fine-grained prompts by leveraging the inversion of a pretrained Denoising Diffusion Implicit Model (DDIM). Specifically, given an input image and a generic text description (e.g., "an image of an [object class]"), we invert the image to obtain latent representations and initiate the denoising process from a fixed intermediate timestep to reconstruct the image. Since the underlying diffusion model is trained solely on normal data, this process yields a normal-looking reconstruction. The discrepancy between the input image and the reconstructed one highlights potential anomalies. Our method achieves state-of-the-art performance on VISA dataset, demonstrating strong localisation capabilities without auxiliary modalities and facilitating a shift away from prompt dependence for zero-shot anomaly detection research.

Introduction

Visual Anomaly Detection (AD) is critical for applications like manufacturing quality control, but traditional methods require collecting and training on large datasets of "normal" images for every new object class. Zero-Shot AD (ZSAD) attempts to bypass this by using pretrained models without any target-specific training data.

However, current ZSAD methods rely heavily on Vision-Language Models (VLMs) and require extensive "prompt engineering." Domain experts must manually craft hundreds of text prompts describing potential defects (e.g., "a photo of a scratched bottle," "a cracked screen"). While vision-only, training-free methods exist, they generally only output image-level classifications and fail at precise, pixel-level spatial localization. This paper introduces DIVAD (Diffusion Inversion for Visual Anomaly Detection), a framework that achieves highly accurate pixel-level anomaly localization without any training and without relying on complex text prompts.

Methodology

The core engine of DIVAD is a pretrained Stable Diffusion (SD) model, utilized in a reconstructive manner to exploit its generative priors. The process follows three key steps:

  1. DDIM Inversion and Partial Denoising: Given an input image and a generic prompt ("an image of a [class]"), the model uses DDIM inversion to run the diffusion process backwards, adding noise to the image's latent representation. Instead of denoising from pure noise, DIVAD starts denoising from an intermediate timestep ($T'=10$). Because the pretrained SD model is biased toward generating "normal" images, this partial denoising acts as a healing process, washing away the anomaly and reconstructing a clean, normal-looking version of the input.
  2. Feature-Space Comparison: Directly comparing pixels is often too noisy. Instead, DIVAD passes both the original and reconstructed images through a pretrained Vision Transformer (DINO) to extract deep features. The cosine dissimilarity between these feature maps generates the final anomaly heatmap.
  3. Unsupervised Masking: For object-centric images, background clutter often triggers false positives. DIVAD optionally uses CutLER, an off-the-shelf unsupervised segmentation model, to mask out the background and focus the anomaly map strictly on the object.
Comparison of DIVAD's vision-only approach against current prompt-heavy ZSAD methods.

Experimental Results

DIVAD achieves state-of-the-art (SoTA) performance among training-free ZSAD methods, particularly on complex datasets:

  • VisA Dataset: Achieved SoTA pixel-level metrics with a ROC of 93.4 and a Per-Region-Overlap (PRO) of 78.2.
  • MPDD Dataset: Significantly outperformed existing training-free methods, reaching a pixel-level ROC of 94.9 and an Average Precision (AP) of 22.9.
  • MVTec-AD Dataset: Achieved performance on par with prompt-guided methods (Pixel ROC 88.6), proving it can compete without heavy manual text engineering.
Qualitative results across various industrial and object classes, demonstrating precise anomaly localization.

Discussion and Limitations

The success of diffusion inversion hinges on the "sweet spot" of noise. Adding too much noise destroys structural integrity, while too little preserves the anomaly. Starting at $T'=10$ balances retaining object identity with erasing defects.

However, DIVAD has limitations. If an anomaly is a missing component, the inversion process may fail to "hallucinate" the missing part, leading to false negatives. Additionally, the model struggles to perfectly reconstruct hyper-fine details, which can cause false positives. Future work could extend this framework to a few-shot setting, where a small number of "normal" images could help calibrate the model against acceptable variations.

Summary updated

BibTeX
@misc{hicsonmez2026training,
  author = {Samet Hiçsönmez and Abd El Rahman Shabayek and Djamila Aouada},
  title = {{Training Free Zero-Shot Visual Anomaly Localization via Diffusion Inversion}},
  year = {2026},
  eprint = {2601.08022},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.08022},
}
Figure