A Unifying Review of Deep and Shallow Anomaly Detection

Lukas Ruff, Jacob R. Kauffmann, Robert A. Vandermeulen, Grégoire Montavon, Wojciech Samek, Marius Kloft, Thomas G. Dietterich, Klaus-Robert Müller · DOI

Abstract

Deep learning approaches to anomaly detection have recently improved the state of the art in detection performance on complex datasets such as large collections of images or text. These results have sparked a renewed interest in the anomaly detection problem and led to the introduction of a great variety of new methods. With the emergence of numerous such methods, including approaches based on generative models, one-class classification, and reconstruction, there is a growing need to bring methods of this field into a systematic and unified perspective. In this review we aim to identify the common underlying principles as well as the assumptions that are often made implicitly by various methods. In particular, we draw connections between classic 'shallow' and novel deep approaches and show how this relation might cross-fertilize or extend both directions. We further provide an empirical assessment of major existing methods that is enriched by the use of recent explainability techniques, and present specific worked-through examples together with practical advice. Finally, we outline critical open challenges and identify specific paths for future research in anomaly detection.

Introduction

Anomaly detection (AD) is a critical yet challenging subfield of machine learning, essential for applications ranging from fraud detection to medical diagnostics. Historically, the field has been bifurcated into "shallow" classic algorithms, such as One-Class SVMs, and "deep" neural network approaches like Autoencoders. In "A Unifying Review of Deep and Shallow Anomaly Detection," Lukas Ruff and colleagues provide a comprehensive framework to bridge this gap, proposing a formal structure that connects traditional statistical methods with modern deep learning.

A Unifying Theoretical Framework

The core contribution of this work is a unifying mathematical language for AD. The authors propose that any anomaly detection objective can be expressed through a general optimization problem: $$\min_{\theta} \frac{1}{n} \sum \ell(f_{\theta}(x_i), y_i) + \mathcal{R}(f, \phi, \theta)$$

This framework is defined by five modeling dimensions:

  1. Loss ($\ell$): The scoring function, such as reconstruction error or negative log-likelihood.
  2. Model ($f_\theta$): The function mapping input data to an anomaly score.
  3. Feature Map ($\phi$): The representation of data, ranging from raw pixels to deep neural layers.
  4. Regularization ($\mathcal{R}$): Constraints that prevent the model from learning a trivial identity mapping, which would render anomalies invisible.
  5. Inference Mode: The statistical paradigm (frequentist or Bayesian) used for parameter estimation.
Taxonomy of anomaly detection methods across feature map depth and model type.

By "neuralizing" shallow models—mathematically rewriting them as equivalent neural networks—the authors enable the application of deep learning tools like Layer-wise Relevance Propagation (LRP) to traditional algorithms. This allows for unprecedented interpretability in classic AD methods.

Categorizing Anomalies: Sensory vs. Semantic

A key insight of the review is the distinction between different types of anomalies. All AD methods rely on the Concentration Assumption: normal data concentrates in a small volume of the feature space, and anomalies are points falling outside this region. However, the nature of these points varies significantly.

Different types of anomalies: from simple point anomalies to complex semantic and contextual ones.
  • Sensory Anomalies: These involve low-level changes, such as a texture defect in fabric. Shallow models or low-level features often suffice for these tasks.
  • Semantic Anomalies: These involve high-level conceptual changes, such as a dog appearing in a dataset of cats. These require the hierarchical feature representations unique to deep learning.
  • Contextual Anomalies: Points that are normal in isolation but anomalous within a specific context (e.g., a temperature spike in winter).

Empirical Insights and the "Clever Hans" Effect

The authors' empirical evaluation across benchmarks like MVTec-AD and MNIST-C reveals that there is "no silver bullet." While deep models excel at semantic object detection, simple Kernel Density Estimation (KDE) can outperform them on texture-based sensory anomalies.

Furthermore, the use of Explainable AI (XAI) revealed the "Clever Hans" effect: models often succeed for the wrong reasons by exploiting spurious correlations. For instance, a model might flag a defect not by identifying the defect itself, but by reacting to changes in background patterns. XAI serves as a vital debugger, allowing researchers to refine models by identifying these failures.

Conclusion and Future Directions

The review identifies several open challenges, notably the "Likelihood Paradox," where deep generative models sometimes assign higher probabilities to out-of-distribution data. Future research is encouraged in "Outlier Exposure" (using auxiliary datasets to better define the boundaries of normality) and in developing more realistic benchmarks that move beyond simple "k-classes-out" scenarios. This unifying framework provides the necessary foundation for building more robust and interpretable anomaly detection systems.

Summary updated

BibTeX
@inproceedings{ruff2021unifying,
  author = {Lukas Ruff and Jacob R. Kauffmann and Robert A. Vandermeulen and Grégoire Montavon and Wojciech Samek and Marius Kloft and Thomas G. Dietterich and Klaus-Robert Müller},
  title = {{A Unifying Review of Deep and Shallow Anomaly Detection}},
  booktitle = {Proc. IEEE},
  year = {2021},
  url = {https://openreview.net/forum?id=IpIOeceRsGw},
}
Figure