TL;DR
This paper introduces NFAD, a novel method for anomaly detection that effectively incorporates known (but scarce) anomalous samples into the training process. By using normalizing flows to generate "surrogate" anomalies, NFAD transforms the problem into a more robust binary classification task, achieving superior performance compared to existing methods, especially when anomalies are rare or non-representative.
What Problem Does This Paper Address?
Anomaly detection (AD) is crucial across many fields, from fraud detection to medical diagnosis. Traditional AD methods often fall into two categories: one-class methods that assume anomalies are distinctly different from normal data, and standard binary classifiers that require a balanced dataset. The challenge arises when anomalies are not perfectly separable from normal data, or when only a few, non-representative anomalous samples are available. This scarcity makes it difficult for standard methods to learn effectively, leading to suboptimal performance. The paper tackles this by proposing a way to leverage these limited anomalous samples, along with normal data, to train a more robust anomaly detector.
Methods
The core of NFAD is a two-step approach:
- Training a Normalizing Flow (NF): The authors first train a normalizing flow model on the normal data. Normalizing flows are powerful generative models that learn to map a simple probability distribution (like a Gaussian) to a complex data distribution through a series of invertible transformations. This trained NF can then be used to generate new samples.
- Generating Surrogate Anomalies and Training a Classifier: The key innovation is how these NF capabilities are used. Instead of directly generating anomalies, the NF is used to sample from the tails of the learned normal data distribution. These samples, which are less likely to be normal, are then transformed by the NF to create "surrogate anomalies." These surrogate anomalies are then combined with the original normal data and any available real anomalies to train a standard binary classifier. This effectively augments the limited anomaly data and helps the classifier learn to distinguish between normal and anomalous patterns, even when they are similar. A crucial addition is Jacobian regularization, which helps preserve the distribution density during transformations, improving the quality of generated anomalies.
Datasets
The paper evaluates NFAD on a variety of datasets:
- Tabular Datasets: KDD-99, SUSY, HIGGS.
- Image Datasets: MNIST, Omniglot, CIFAR-10.
These datasets are used to create tasks with varying numbers of negative (anomalous) samples, reflecting realistic AD scenarios.
Key Insights and Ideas
- Leveraging Scarce Anomalies: The most significant insight is that even a small number of known anomalies can be powerfully augmented using generative models like normalizing flows. This circumvents the need for large, balanced anomaly datasets.
- Surrogate Anomalies as a Bridge: By generating surrogate anomalies from the tails of the normal distribution, the method creates samples that are "ambiguous" – close to normal but still anomalous. This helps train classifiers that are robust to novel or slightly different types of anomalies.
- Model-Agnostic Augmentation: NFAD doesn't modify the underlying classifier architecture. It provides a flexible data augmentation strategy that can be applied to any binary classifier, making it highly adaptable.
- Jacobian Regularization is Key: The paper highlights that without proper regularization (Jacobian regularization), the density distortion introduced by normalizing flows can lead to poor anomaly generation. This regularization is crucial for the method's success.
Key Results
NFAD demonstrates strong performance across various datasets, often outperforming state-of-the-art anomaly detection algorithms, particularly in scenarios with very few anomalous samples.
- Tabular Data: NFAD (specifically
nfad-iafandnfad-nsf) consistently achieves statistically significant improvements in ROC AUC on datasets like KDD-99 and HIGGS, especially when the number of anomalous samples is extremely low (e.g., 1 or 2). - Image Data: While performance on image datasets like CIFAR-10 is competitive, the paper notes that normalizing flows might struggle with capturing global semantics in images, suggesting room for improvement with newer NF techniques.
- Robustness: The method shows robustness to varying amounts of known anomalies, a key advantage over methods that require balanced datasets.
Limitations and Future Work
- Data-Specific Requirements: The paper notes that NFAD performs best when the normal class has a single mode and convex borders. Non-convex borders or multi-modal normal distributions can lead to less optimal separation.
- Hyperparameter Tuning: The performance of NFAD is sensitive to hyperparameters like the tail size
pfor sampling surrogate anomalies and the Jacobian regularization parameterλ. The paper suggests heuristics for tuning these but acknowledges they need careful selection. - Image Data Semantics: For image datasets, the authors suggest that future work could focus on improving the ability of normalizing flows to capture global image semantics, which could further boost performance. They also mention that careful monitoring of classifier overfitting is important.
- Generalizability: The authors believe their model-agnostic augmentation scheme opens up wide prospects for further anomaly detection research, allowing any classifier to be used on any data type.
Summary updated