NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Correcting Deviations from Normality: A Reformulated Diffusion Model for Multi-Class Unsupervised Anomaly Detection

Farzad Beizaee, Gregory A. Lodygensky, Christian Desrosiers, Jose Dolz

Introduction

Unsupervised Anomaly Detection (UAD) is a critical task in computer vision, particularly for industrial quality control and medical imaging. The objective is to train models exclusively on "normal" data to identify and localize "abnormal" deviations during inference. While Diffusion Models have demonstrated exceptional generative capabilities, their application to UAD has been hindered by two primary challenges: the "Sledgehammer Effect," where global noise destruction compromises fine textures, and the "Identity Shortcut," where insufficient noise allows the model to reconstruct the anomaly itself.

This paper introduces DeCo-Diff (Deviation Correction Diffusion), a novel reformulation that treats anomalies as deviations to be corrected rather than noise to be removed from a total generative process. By focusing on selective region alteration and context preservation, DeCo-Diff achieves state-of-the-art performance in multi-class UAD scenarios.

The Limitations of Standard Diffusion in UAD

Reconstruction-based UAD typically relies on the premise that a model trained only on normal data will fail to reconstruct anomalous regions, thereby highlighting them through a residual map. However, standard Denoising Diffusion Probabilistic Models (DDPMs) face significant hurdles:

  1. The Sledgehammer Effect: Standard diffusion adds noise to the entire image. This often destroys fine, healthy details (like the grain of wood or the texture of a tile), making it difficult to distinguish between reconstruction errors and actual anomalies.
  2. The Identity Shortcut: If the noise level is too low, the model may simply "copy-paste" the anomaly into the reconstruction. Conversely, if the noise level is too high, the model loses the semantic context of the specific object, leading to poor reconstructions.

These issues are particularly pronounced in multi-class settings, where a single model must generalize across diverse categories (e.g., from transistors to bottles) without losing the specific nuances of each.

Methodology: Deviation Correction Diffusion (DeCo-Diff)

DeCo-Diff addresses these challenges through a reformulated diffusion process designed for "deviation correction" rather than scratch generation.

Latent Space Processing

To improve computational efficiency and focus on semantic features, DeCo-Diff operates within the latent space of a pre-trained Variational Auto-Encoder (VAE). This allows the model to interpret anomalies as mathematical deviations from the learned distribution of normal data.

Direction of Deviation (DoD)

Instead of predicting the total noise added to an image, the model is trained to predict the Direction of Deviation (DoD) from normality. During inference, the model progressively "corrects" the latent representation, nudging it toward the nearest point on the manifold of normal data.

Context-Aware Training

To prevent the identity shortcut and preserve healthy textures, the authors employ a specialized training strategy involving Random Masking & Patch Shuffling. During training, the model is presented with images where some patches are noisy, some are shuffled from other images, and others remain intact. This forces the model to leverage the surrounding "healthy" context to figure out how to fix the "corrupted" parts.

Multi-Scale Discrepancy

Anomaly localization is performed by calculating discrepancies at multiple scales. By combining pixel-level differences (sensitive to sharp edges) and latent-level differences (sensitive to subtle semantic changes) via a geometric mean, the model produces highly accurate anomaly maps.

Experimental Results

The model was rigorously evaluated on four major industrial benchmarks: MVTec-AD, VisA, MPDD, and Real-IAD.

Performance Highlights

DeCo-Diff demonstrated a significant leap in performance, particularly in the difficult task of localization (pixel-level precision):

  • MVTec-AD: Achieved a pixel-level AUPRC of 74.9%, representing a 14.1% improvement over the previous state-of-the-art (GLAD). The image-level AUROC reached 99.3%, indicating near-perfect detection.
  • VisA: Achieved 51.3% AUPRC, outperforming the runner-up (MambaAD) by 11.7%.

These results underscore the model's ability to handle complex, multi-class environments where previous methods struggled to maintain high precision.

Discussion and Limitations

While DeCo-Diff sets a new benchmark, the authors identify specific areas for future work:

  • Structural Anomalies: The model occasionally struggles with large-scale displacements, such as a missing component or a significantly shifted part, where the "correction" logic is less straightforward than texture repair.
  • VAE Bottlenecks: Extremely subtle anomalies (like microscopic scratches) may be lost during the initial VAE compression phase before the diffusion model can process them.
  • Residual Artifacts: In some instances, a faint "ghost" or footprint of the original anomaly persists in the reconstruction, which can slightly muddle the final anomaly map.

Conclusion

DeCo-Diff represents a significant shift in how diffusion models are applied to anomaly detection. By reframing the problem as one of deviation correction rather than pure generation, and by utilizing context-aware training strategies, the model provides a robust solution for high-precision, multi-class industrial inspection.

Summary updated

BibTeX
@inproceedings{beizaee2025correcting,
  author = {Farzad Beizaee and Gregory A. Lodygensky and Christian Desrosiers and Jose Dolz},
  title = {{Correcting Deviations from Normality: A Reformulated Diffusion Model for Multi-Class Unsupervised Anomaly Detection}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.01778},
}
Figure