ODIM: Outlier Detection via Likelihood of Under-Fitted Generative Models

Dongha Kim, Jaesung Hwang, Jongjin Lee, Kunwoong Kim, Yongdai Kim

TL;DR

Fully trained deep generative models notoriously fail at unsupervised outlier detection because they often assign high likelihoods to anomalous data. This paper introduces ODIM, a method that flips this failure on its head by intentionally under-fitting the model to exploit the "inlier-memorization effect"—the tendency of generative models to learn normal data patterns before anomalous ones. By stopping training after just a few updates, ODIM achieves state-of-the-art outlier detection across tabular, image, and text data while running tens to hundreds of times faster than traditional deep learning approaches.

What Problem Does This Paper Address?

Unsupervised Outlier Detection (UOD) is a highly realistic but challenging task: you are given a dataset contaminated with anomalies, but you have no labels to tell you which samples are normal (inliers) and which are anomalous (outliers).

A natural approach would be to train a Deep Generative Model (DGM), like a Variational Autoencoder (VAE), on the data and flag low-likelihood samples as outliers. However, machine learning researchers have documented a bizarre, counter-intuitive phenomenon: fully trained DGMs often assign higher likelihoods to out-of-distribution data or outliers than to the actual inliers. This makes standard likelihood-based anomaly detection highly unreliable in unsupervised settings.

Methods

The authors propose ODIM (Outlier Detection via the Inlier-Memorization effect). Instead of training a DGM to convergence, they intentionally under-fit it.

Figure 1. An illustration of the ODIM method.

The core algorithm consists of four main steps:

  1. Pre-processing: Apply min-max scaling to the dataset to ensure the norms of inliers and outliers are comparable.
  2. Under-fitted Training: Train an Importance Weighted Autoencoder (IWAE) for only a few updates (often less than a single epoch).
  3. Adaptive Early Stopping: To find the exact moment when the model has learned the inliers but not the outliers, ODIM fits a 2-component Gaussian Mixture Model (GMM-2) to the per-sample losses at each update. It calculates the Wasserstein distance between the two components to measure the degree of bimodality. Training stops when this distance stops improving.
  4. Ensemble Aggregation: To mitigate stochasticity from random initialization and mini-batching, ODIM trains $B$ models (typically 10) in parallel and averages their per-sample losses to compute the final outlier score.

Datasets

The authors evaluated ODIM on a massive benchmark suite of 57 datasets sourced from ADBench:

  • 36 Tabular Datasets: Spanning domains like healthcare, finance, and astronomy (e.g., Cardio, Arrhythmia, Thyroid).
  • 6 Image Datasets: MNIST, MNIST-C, FMNIST, CIFAR10, SVHN, and MVTec-AD, using feature vectors extracted by a Vision Transformer (ViT).
  • 5 Text Datasets: Amazon, 20news, Agnews, IMDb, and Yelp, using embedding features from BERT or RoBERTa.

Key Insights and Ideas

  • The Inlier-Memorization (IM) Effect: In the early stages of training, a continuous loss function naturally prioritizes dense regions (inliers) over sparse regions (outliers) to maximize overall loss reduction. As a result, the loss for normal data drops significantly faster than for anomalies.
  • The Danger of Over-training: As training progresses, the DGM eventually memorizes the outliers, causing the loss distributions of the two groups to overlap and rendering the likelihood score useless.
Figure 2. (1st to 5th) The distributions of the per-sample (normalized) VAE loss values of Cardio after 10, 20, 30, 40, and 500 training updates, respectively. For each panel, we depict the histograms of inliers and outliers separately. (Last) The positive relationship between the Wasserstein distance and identifying performance (AUC) on Cardio.
  • Norms Matter for Gradients: The authors mathematically prove (Proposition 3.1) that the initial VAE gradient magnitude is proportional to the $l_1$-norm of the input vector. Standard normalization (standardization) inadvertently inflates the norms of outliers, biasing early updates toward memorizing anomalies first. Min-max scaling keeps the norms aligned, preserving the IM effect.
Figure 3. Distributions of per-sample (Left) input l1-norm values and (Right) gradient l2-norm values of VAE loss on Cardio. We consider two pre-processing schemes to normalize each feature: 1) (Upper) min-max scaling, and 2) (Lower) standardization.

Key Results

  • Performance: Across 46 tabular datasets, ODIM achieved the highest average AUC (0.757) and Precision-Recall (PR) score (0.366) compared to 20 baseline methods (including OCSVM, DeepSVDD, and ECOD). On image data, it outperformed competitors by a substantial margin (Average AUC of 0.813 vs. 0.757 for the next best method, DTE).
  • Speed: Because it requires very few training updates, ODIM is incredibly fast. For example, on the Cover dataset, DeepSVDD took 3463 seconds, while ODIM took just 7.7 seconds—a ~450x speedup.
  • Robustness: The method proved highly stable across a wide range of learning rates (from $10^{-4}$ to $10^{-2}$) and hyperparameter choices ($K \ge 50$ samples in IWAE, and $N_{pat} \ge 10$ patience steps).

Limitations and Future Work

  • Optimal Pre-processing: While min-max scaling was shown to be superior to standardization for preserving the IM effect, the authors note it may not be the absolute optimal pre-processing strategy. Finding the ideal data transformation remains an open research question.
  • Distribution Assumptions: The adaptive stopping heuristic relies on the assumption that the loss distributions of inliers and outliers roughly follow Gaussian distributions, which might not hold true for highly complex or multi-modal normal data distributions.

Summary updated

BibTeX
@inproceedings{kim2024odim,
  author = {Dongha Kim and Jaesung Hwang and Jongjin Lee and Kunwoong Kim and Yongdai Kim},
  title = {{ODIM: Outlier Detection via Likelihood of Under-Fitted Generative Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=R8nbccD7kv},
}
Figure