Abstract
When formulated as an unsupervised learning problem, anomaly detection often requires a model to learn the distribution of normal data. Previous works apply Generative Adversarial Networks (GANs) to anomaly detection tasks and show good performances from these models. Motivated by the observation that GAN ensembles often outperform single GANs in generation tasks, we propose to construct GAN ensembles for anomaly detection. In the proposed method, a group of generators and a group of discriminators are trained together, so every generator gets feedback from multiple discriminators, and vice versa. Compared to a single GAN, a GAN ensemble can better model the distribution of normal data and thus better detect anomalies. Our theoretical analysis of GANs and GAN ensembles explains the role of a GAN discriminator in anomaly detection. In the empirical study, we evaluate ensembles constructed from four types of base models, and the results show that these ensembles clearly outperform single models in a series of tasks of anomaly detection.
Introduction
Anomaly detection—identifying data points that deviate from the "normal" norm—is a cornerstone of machine learning, used in everything from fraud detection to medical diagnosis. Generative Adversarial Networks (GANs) have become a popular tool for this because they are excellent at learning complex data distributions.
However, single GANs face two major hurdles:
- Training Instability: They are notoriously difficult to tune and often suffer from "mode collapse," where the generator only learns a small slice of the data distribution.
- The Theory-Practice Gap: Standard GAN theory suggests that at the end of training, a discriminator should be unable to distinguish real from fake data. Yet, in practice, the internal features of a discriminator are incredibly effective at spotting anomalies.
This paper bridges this theoretical gap and solves stability issues by moving from a single GAN to an ensemble framework.
Methodology
The proposed GAN Ensemble consists of $I$ generators (encoder-decoders) and $J$ discriminators.
- Random Pairing: Instead of a static setup, the model randomly pairs one generator with one discriminator during each training iteration. This ensures every generator receives feedback from multiple discriminators and vice versa, preventing any single pair from overfitting.
- Multi-Part Loss Function: The training objective incorporates Adversarial Loss, Reconstruction Loss (ensuring accurate rebuilding of normal samples), and Discriminative Loss (using hidden layer representations of the discriminator to measure differences between a sample and its reconstruction).
- Anomaly Scoring: To test a new sample, the model calculates an anomaly score by averaging the results across all possible generator-discriminator pairs in the ensemble. This smoothing effect filters out "spurious" scores from individual models.
Theoretical Insights
- The "Distance" Proof: Through Theorem 1, the authors prove that an optimal discriminator in a Wasserstein GAN (WGAN) learns a function representing the distance between a sample and the training data. This provides a rigorous mathematical explanation for the effectiveness of discriminator features in anomaly detection.
- Capturing the "Modes": Multiple generators allow the ensemble to cover the entire "normal" distribution, reducing the risk of false positives for valid but rare normal samples.
- Latent Space Alignment: In an ensemble, the representations of training and test "normal" samples align much more closely than in a single GAN, leading to better generalization on unseen data.
Empirical Evaluation
The researchers evaluated their approach across four diverse benchmarks: MNIST, CIFAR-10, OCT (medical retinal images), and KDD99 (network intrusion detection).
The ensemble approach consistently outperformed standalone models across the board:
- MNIST: The
f-AnoGANensemble boosted the average AUROC from 0.799 to 0.857. - CIFAR-10: On the "ship" class, the
Skip-GANomalyensemble achieved a near-perfect 0.991 AUROC. - Medical Utility: On the OCT dataset, the ensemble showed dramatic improvements, particularly on the "DRUSEN" anomaly class, where the
Skip-GANomalyensemble hit 0.952 AUROC. - KDD99: The ensemble outperformed established non-GAN baselines like DAGMM and OC-SVM.
Conclusion
While the GAN ensemble framework provides significant performance gains, there are areas for further exploration. The authors noted diminishing returns beyond an ensemble size of 3 ($I=J=3$). Additionally, performance remains dependent on hyperparameter tuning for loss components. Future work could investigate mixing different types of GAN architectures within a single ensemble to further increase robustness.
Summary updated