Learning in Multiple Spaces: Few-Shot Network Attack Detection with Metric-Fused Prototypical Networks

Fernando Martinez-Lopez, Lesther Santana, Mohamed RahoutiarXiv 2024 · DOI

TL;DR

This paper introduces the Multi-Space Prototypical Learning (MSPL) framework, a novel approach to detecting network attacks with very limited labeled data (few-shot learning). By combining multiple distance metrics and stabilizing learning with Polyak averaging, MSPL significantly improves the detection of rare and zero-day threats compared to existing methods.

What Problem Does This Paper Address?

Network intrusion detection systems (NIDS) are crucial for cybersecurity, but they struggle to identify new and evolving attack patterns, especially when labeled data is scarce. Traditional NIDS are good at recognizing known threats but fail when faced with "zero-day" attacks or rare variants. This is a significant challenge because adversaries constantly develop new methods. Few-shot learning (FSL) offers a promising solution by enabling models to learn from minimal examples, but existing FSL methods for NIDS still face issues with data imbalance, scalability, and robust generalization across diverse attack types.

Methods

The core of this paper is the Multi-Space Prototypical Learning (MSPL) framework. Here's a breakdown of its key components:

  • Multi-Metric Space Integration: Instead of relying on a single distance metric (like Euclidean or Cosine) to compare network traffic embeddings, MSPL fuses information from four different metrics: Euclidean, Cosine, Chebyshev, and Wasserstein. Each metric captures different aspects of the data's geometry and distribution, and their combination aims to create more robust representations. These metrics are z-score normalized and clipped to ensure comparable scales before being integrated using a constrained weighting scheme.
  • Polyak-Averaged Prototype Generation: To stabilize the learning process, especially in the context of episodic training (where the model learns from many small, distinct tasks), MSPL uses Polyak averaging. Instead of directly averaging model parameters to create prototypes, it maintains an exponential moving average (EMA) of the model's parameters. This EMA model is then used to compute prototypes, leading to a more stable embedding function and smoother optimization.
  • Episodic Training: MSPL employs an episodic training paradigm, common in FSL. This involves constructing "episodes," each simulating a few-shot learning scenario with a limited number of "support" examples for training and "query" examples for evaluation. A stratified sampling strategy is used to ensure balanced representation of attack classes, even rare ones, within each episode.

Datasets

The authors evaluated their MSPL framework on three benchmark datasets:

  • CICEVSE2024: A dataset focused on EV charging station security.
  • CICIDS2017: A widely used dataset for network intrusion detection.
  • CICIoV2024: A dataset related to Internet of Vehicles (IoV) security.

The experiments were conducted under a strict few-shot setting, using only 200 instances for training.

Key Insights and Ideas

  • Metric Fusion is Key: The paper strongly suggests that combining multiple distance metrics is more effective than using a single one for network attack detection. Different metrics capture complementary information, leading to a more comprehensive understanding of attack patterns.
  • Stabilizing FSL with Polyak Averaging: Applying Polyak averaging not just to prototypes but to the entire model parameters significantly improves stability and reduces variance during episodic training, which is crucial for few-shot learning.
  • Balancing Rare Attacks: The episodic training with stratified sampling is vital for ensuring that the model doesn't ignore rare attack types, which are often the most critical to detect in real-world scenarios.
  • Adaptability Across Domains: The framework shows consistent improvements across diverse datasets, indicating its generalizability and adaptability to different types of network traffic and attack scenarios.

Key Results

MSPL consistently outperformed baseline methods (including traditional non-deep learning models and single-metric prototypical networks) across all three datasets.

  • CICEVSE2024: MSPL achieved a balanced accuracy of 0.8143–0.8192 (up from 0.7884–0.7888 for the baseline) and an AUPRC of 0.7333 (up from 0.6081).
  • CICIDS2017: Balanced accuracy improved from 0.8460–0.8572 to 0.8740–0.8768, and AUPRC rose from 0.3913–0.4010 to 0.4658–0.4798.
  • CICIoV2024: Even on this high-performing dataset, MSPL pushed balanced accuracy to 0.9718–0.9813 (from 0.9621–0.9669) and AUPRC to 0.8992–0.9506 (from 0.8373–0.9277).

The paper highlights that the quad-metric configuration for CICIoV2024 provided the best adaptability.

Limitations and Future Work

  • Limitations: While the paper demonstrates strong performance, the evaluation was conducted under a controlled few-shot setting (200 instances). Real-world deployment might involve even more complex data distributions and dynamic threat landscapes. The specific weighting of metrics was determined empirically, and further research could explore automated methods for learning these weights.
  • Future Work: The authors suggest extending the MSPL framework to handle multimodal datasets (e.g., combining network traffic with system logs or packet payloads) and enabling real-time detection capabilities. Further exploration into automated metric weight optimization is also a promising direction.

Summary updated

BibTeX
@misc{martinezlopez2024learning,
  author = {Fernando Martinez-Lopez and Lesther Santana and Mohamed Rahouti},
  title = {{Learning in Multiple Spaces: Few-Shot Network Attack Detection with Metric-Fused Prototypical Networks}},
  year = {2024},
  eprint = {2501.00050},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.00050},
}
Figure