DI-NIDS: Domain Invariant Network Intrusion Detection System

Siamak Layeghy, Mahsa Baktashmotlagh, Marius Portmann · DOI

Introduction

Machine Learning (ML) has become a cornerstone of modern Network Intrusion Detection Systems (NIDS). However, a significant hurdle remains: the "lab-to-field" gap. Models that achieve near-perfect accuracy on benchmark datasets often fail when deployed in diverse, real-world network environments. This paper introduces DI-NIDS, a framework designed to bridge this gap through domain-invariant feature extraction.

The Challenge of Domain Shift

The primary cause of performance degradation in NIDS is domain shift. Network traffic statistics vary significantly across different environments due to variations in hardware, topology, and usage patterns. A feature distribution considered "normal" in one network may be flagged as "suspicious" in another. Furthermore, the extreme class imbalance—where benign traffic vastly outweighs attack instances—makes standard supervised domain adaptation techniques less effective.

Proposed Methodology: DI-NIDS

DI-NIDS addresses these challenges by combining adversarial domain adaptation with unsupervised anomaly detection. The framework consists of two main components:

1. Adversarial Feature Extraction

The system utilizes a Domain-Adversarial Neural Network (DANN) to extract features that are consistent across different network domains. The DANN architecture includes a feature extractor ($G_f$), a label classifier ($G_c$), and a domain classifier ($G_d$).

A critical element is the Gradient Reversal Layer. During training, the domain classifier attempts to identify the source network of the data. Simultaneously, the feature extractor is optimized to maximize the domain classifier's loss, effectively "blinding" the extractor to domain-specific characteristics. This process forces the network to learn representations that are invariant to the underlying network environment.

2. Unsupervised Anomaly Detection

To handle the inherent class imbalance of network data, DI-NIDS employs a One-Class SVM (OSVM) for the final classification. Instead of a standard supervised classifier, the OSVM learns the boundary of "normal" behavior within the domain-invariant feature space. Any data point falling outside this boundary is classified as an intrusion.

Figure 1: The DI-NIDS framework integrates a Domain-Adversarial Neural Network (DANN) for feature extraction with a One-Class SVM for anomaly detection.

Training Process

The training of the DANN component involves two primary phases: source label training and domain classifier training. This dual-objective optimization ensures that the extracted features are both discriminative for intrusion detection and invariant across domains.

Figure 5: The two-stage training process for the DANN component, showing (a) source label training and (b) domain classifier training with gradient reversal.

Experimental Evaluation

The researchers evaluated DI-NIDS using the NFv2-CIC-2018 and NFv2-UNSW-NB15 datasets. By utilizing the NetFlow V2 versions, they maintained a consistent set of 43 features across both datasets, enabling rigorous cross-domain testing.

Key Results

DI-NIDS demonstrated superior stability compared to conventional ML models (e.g., Random Forest, LSTM) and existing state-of-the-art methods:

  • Performance Stability: While traditional models suffered F1-score drops of 80-94% in cross-domain scenarios, DI-NIDS maintained an average F1-score of 89.54%.
  • Minimal Degradation: The average performance degradation for DI-NIDS was only 6.42%, significantly lower than the 19.3% observed for the previous state-of-the-art (EFC).
  • Importance of OSVM: Supervised DANN alone resulted in 31-80% degradation, highlighting the necessity of the One-Class SVM in managing class imbalance.

Conclusion

DI-NIDS provides a robust solution for cross-domain network intrusion detection. By leveraging adversarial training to extract domain-invariant features and unsupervised learning for anomaly detection, it significantly reduces the "lab-to-field" performance gap. Future work will focus on reducing computational overhead for real-time deployment and enhancing resilience against evolving "Zero-Day" attacks.

Summary updated

BibTeX
@article{layeghy2023di,
  author = {Siamak Layeghy and Mahsa Baktashmotlagh and Marius Portmann},
  title = {{DI-NIDS: Domain Invariant Network Intrusion Detection System}},
  journal = {Knowledge-Based Systems},
  year = {2023},
  doi = {10.1016/j.knosys.2023.110626},
}
Figure