Abstract
This paper introduces an efficient approach to anomaly detection using Generative Adversarial Networks (GANs) by incorporating a BiGAN (Bidirectional GAN) architecture. By learning an encoder simultaneously with the generator during training, the model eliminates the need for costly optimization at test time. This method achieves a massive speedup—nearly 800 times faster than previous GAN-based methods—while reaching state-of-the-art accuracy on both image and network intrusion datasets.
Introduction
Anomaly detection is critical in fields like cyber-security and medical imaging, where identifying deviations from "normal" behavior is essential. While GANs are excellent at modeling complex, high-dimensional data, they are traditionally "implicit" models. In a standard GAN, one can generate data from a latent code ($z \to x$), but the reverse mapping ($x \to z$) is not directly available. Previous methods like AnoGAN required a slow iterative optimization process at test time to find the latent code that best reconstructs a specific sample, making them impractical for real-time or large-scale applications.
Methodology
The authors leverage the BiGAN architecture to learn three components simultaneously:
- Generator ($G$): Maps latent codes to data ($z \to x$).
- Encoder ($E$): Maps data back to latent codes ($x \to z$).
- Discriminator ($D$): Evaluates pairs $(x, z)$ to determine if they originated from the Encoder or the Generator.
By training the encoder $E$ alongside the generator, the model learns to "invert" the generation process. At test time, a new sample is passed through the encoder to obtain its latent representation instantly. An anomaly score $A(x)$ is then calculated based on Reconstruction Loss ($L_G$) and Discriminator Loss ($L_D$). The authors found that using a "feature-matching" (FM) loss—which compares intermediate discriminator layers—provided a more informative signal for identifying anomalies in images.
Experimental Results
Efficiency Breakthrough
The primary contribution of this work is the dramatic reduction in inference time. By moving the computational heavy lifting from the test phase to the training phase, the proposed model achieves a speedup of 700x to 900x compared to the AnoGAN baseline.
Performance on MNIST and KDD99
The model was evaluated on the MNIST handwritten digit dataset and the KDD99 network intrusion benchmark. On MNIST, the model consistently outperformed Variational Autoencoders (VAEs) and AnoGAN across various digit classes designated as anomalies.
On the KDD99 dataset, which consists of high-dimensional tabular data, the model achieved an F1 score of 0.9372, surpassing specialized benchmarks like DAGMM and OC-SVM. This demonstrates the versatility of GAN-based anomaly detection beyond image data.
Conclusion
By utilizing a bidirectional GAN framework, this research successfully addresses the computational bottleneck of GAN-based anomaly detection. The approach provides a scalable, real-time solution that maintains high accuracy across diverse data types. Future work may explore further refinements to the encoder accuracy and alternative bidirectional training strategies to enhance performance even further.
Summary updated