Abstract
Network security faces increasing challenges from "zero-day" attacks that bypass traditional supervised learning models. This paper introduces GANAD (GAN-based Anomaly Detection), a novel framework that repurposes Generative Adversarial Networks (GANs) for efficient and stable anomaly identification. By integrating a dedicated encoder for direct latent space mapping and utilizing Wasserstein distance with spectral normalization, GANAD overcomes the computational bottlenecks and training instabilities of previous GAN-based detectors. Experimental results on benchmark datasets including KDDCUP’99 and UNSW_NB15 show that GANAD achieves state-of-the-art F1-scores while significantly reducing inference time compared to existing models.
Introduction
As network attacks evolve, traditional supervised machine learning models struggle to recognize threats they have not previously encountered. Generative Adversarial Networks (GANs) offer a promising alternative by learning the distribution of "normal" network traffic and identifying anomalies as deviations from this learned norm. However, existing GAN-based anomaly detectors face two major hurdles: efficiency and stability. Models like AnoGAN require iterative optimization during testing to find latent variables, making real-time detection impractical. Furthermore, GANs are often difficult to train, prone to mode collapse and vanishing gradients when handling high-dimensional network data.
Methodology
GANAD addresses these challenges through several key technical innovations focused on detection efficiency and training stability.
Architecture and Encoder Integration
Unlike standard "generator-only" approaches, GANAD incorporates a dedicated encoder inspired by the BiGAN architecture. This encoder maps real-world data directly to a latent space, enabling a "direct mapping" during the testing phase. This eliminates the need for slow, iterative back-propagation during inference, allowing for high-speed detection suitable for modern network environments.
Training Stability: WGAN-GP and Spectral Normalization
To ensure training stability, GANAD utilizes the Wasserstein GAN (WGAN) framework combined with a Gradient Penalty (GP). This combination provides a smooth and reliable signal from the discriminator (the "critic") to the generator. Additionally, spectral normalization (SN) is applied to the weights of both the encoder and discriminator. By constraining the Lipschitz constant of these functions, SN further stabilizes the adversarial training process and prevents the model from over-focusing on specific modes of normal traffic.
Hybrid Anomaly Scoring
Anomaly detection is performed using a hybrid scoring mechanism. The score is a convex combination of:
- Reconstruction Loss: Measures how accurately the model can reconstruct the input data.
- Discriminator Loss: Measures the discriminator's assessment of how "fake" or anomalous the data appears.
Experimental Evaluation
The performance of GANAD was evaluated on three gold-standard network security benchmarks: KDDCUP’99 (10% subset), NSL-KDD, and UNSW_NB15. The latter is particularly challenging as it contains complex, low-footprint attack activities simulating contemporary traffic.
Performance Results
GANAD consistently outperformed state-of-the-art (SOTA) models such as AnoGAN, ALAD, and DAGMM. On the KDDCUP’99 dataset, GANAD achieved an F1-score of 0.9755, representing a 2-3% improvement over the next best baseline, ALAD. On the modern UNSW_NB15 dataset, it maintained a high F1-score of 0.9482.
Computational Efficiency
A critical advantage of GANAD is its speed. By replacing iterative search with a feed-forward pass through the encoder, GANAD's inference time is significantly lower than its predecessors. For instance, the inference time for ALAD was found to be roughly twice as long as that of GANAD, making GANAD a more viable candidate for high-speed network monitoring.
Conclusion
GANAD demonstrates that shifting the focus of GANs from data synthesis to specialized anomaly detection can yield significant gains in both accuracy and efficiency. The combination of direct latent mapping and advanced stabilization techniques allows the model to handle the complexities of modern network traffic effectively. Future work will focus on identifying even more subtle "stealthy" deviations and enhancing the model's ability to handle completely unknown, out-of-distribution traffic patterns.
Summary updated