This paper introduces Donut, an unsupervised anomaly detection algorithm designed specifically for the "seasonal" Key Performance Indicators (KPIs) that power modern web applications. By combining Variational Auto-Encoders (VAEs) with clever training and detection heuristics, the authors provide a robust solution for monitoring business metrics like page views and order volumes, even when data is noisy or labels are scarce.
TL;DR
Donut is a VAE-based unsupervised anomaly detection framework that achieves state-of-the-art performance (F-scores of 0.75–0.9) on seasonal time-series data. It introduces a modified training objective and MCMC-based imputation to handle missing data and occasional labels, backed by a novel theoretical interpretation of VAEs as a form of Kernel Density Estimation (KDE).
What Problem Does This Paper Address?
Large internet companies monitor thousands of KPIs to ensure service reliability. These KPIs are typically "seasonal," meaning they follow daily or weekly cycles (e.g., traffic peaks at noon and dips at 3 AM). However, detecting anomalies in these streams is notoriously difficult because:
- Local Variations: No two days are identical; "normal" behavior shifts slightly over time.
- Lack of Labels: Manually labeling anomalies across thousands of streams is impossible.
- Data Quality: Real-world data is "dirty," often containing missing values or existing anomalies that can bias a model during training.
Existing statistical models require heavy manual tuning, while supervised deep learning models require more labels than most companies can provide.
Methods
Donut builds on the Variational Auto-Encoder (VAE), a generative model that learns to compress input data ($x$) into a low-dimensional latent space ($z$) and then reconstruct it. The core idea is that the model learns the "normal" patterns; when it encounters an anomaly, it fails to reconstruct it accurately, resulting in a high "reconstruction probability" score.
The authors introduce three key innovations to make VAEs work for KPIs:
- Modified ELBO (M-ELBO): Standard VAE training (maximizing the Evidence Lower Bound) treats all data points equally. M-ELBO allows the model to ignore known missing points or labeled anomalies during training, preventing the model from "learning" what an anomaly looks like.
- Missing Data Injection: To make the model more robust, the authors randomly "inject" missing values into the training data. This forces the model to learn how to reconstruct the entire window even when parts of the input are missing.
- MCMC Imputation: During the detection phase, if a sliding window contains missing data, Donut uses a Markov Chain Monte Carlo (MCMC) technique to "fill in" the gaps with likely normal values before calculating the anomaly score.
Datasets
The researchers evaluated Donut using 18 real-world business KPIs from a top global internet company (Alibaba).
- Resolution: 1-minute intervals.
- Duration: Long enough to capture multiple seasonal cycles (weeks/months).
- Diversity: The paper highlights three specific datasets ($\mathcal{A}$, $\mathcal{B}$, and $\mathcal{C}$) representing low, medium, and high levels of noise/variation to demonstrate the model's versatility.
Key Insights and Ideas
- The KDE Interpretation: The authors provide a solid theoretical bridge, showing that the VAE's reconstruction probability can be viewed as a weighted Kernel Density Estimation (KDE) in latent space. This explains why the model works: it's essentially checking if a new data point "fits" the cluster of normal points in the compressed latent space.
- The Time Gradient Effect: They discovered that the latent space naturally organizes itself by time of day (e.g., 10 AM windows cluster together, separate from 10 PM windows). This "time gradient" allows the model to generalize across different days without needing an explicit "time" input.
- Training on Anomalies is Necessary: Contrary to the common intuition that unsupervised models should only be trained on "clean" data, the authors show that training on data containing anomalies (using M-ELBO) is actually more effective for real-world deployment where clean data is a luxury.
Key Results
- Superior Performance: Donut achieved F-scores between 0.75 and 0.9, significantly outperforming both a baseline VAE and Opprentice, a state-of-the-art supervised ensemble algorithm, especially when labels were limited.
- Robustness: The model maintained high accuracy even when 90% of the anomaly labels were removed, proving its effectiveness as an unsupervised tool.
- Efficiency: By using simple fully-connected layers rather than complex recurrent networks (like VRNNs), Donut remains fast enough for practical large-scale deployment.
Limitations and Future Work
- Hyperparameter Sensitivity: The latent dimension ($K$) and the window size ($W$) are critical. While the authors suggest $K=5$ to $10$ is a good starting point, choosing the optimal $K$ in a purely unsupervised setting remains a challenge.
- Thresholding: Like most anomaly detectors, Donut outputs a score. Choosing the right threshold to trigger an alert still requires some human-in-the-loop or heuristic adjustment.
- Temporal Correlations: While the sliding window captures some context, the authors suggest that incorporating RNN architectures (like LSTMs) into the Donut framework could better handle long-term dependencies and complex correlations across points.
Summary updated