Aug 2026· Applied Sciences· Vol 16, pp. 8323· 0 citations· 45 references
TL;DR
This study investigates three contrastive learning loss functions, Contrastive Loss, Soft Nearest Neighbor Loss, and Supervised Contrastive Loss, integrated into a Conditional Variational Autoencoder (CVAE) regularised via the standard Kullback-Leibler divergence objective, showing the effectiveness of integrating contrastive learning into the CVAE framework is dependent on the specific dataset, minority class, contrastive loss function, and distance metric.
Abstract
Class imbalance, where majority-class samples vastly outnumber minority-class samples, remains a persistent challenge in network intrusion detection systems (NIDS), often causing classifiers to overlook rare but critical attack types while yielding misleadingly optimistic performance metrics. Synthetic data generation is a common mitigation strategy. However, existing methods often fail to capture the non-linear network traffic and neglect inter-class relationships with the majority class, resulting in inconsistent performance gains. This study investigates three contrastive learning loss functions, Contrastive Loss, Soft Nearest Neighbor Loss, and Supervised Contrastive Loss, integrated into a Conditional Variational Autoencoder (CVAE) regularised via the standard Kullback-Leibler divergence objective. Experiments were conducted on four widely used NIDS benchmark datasets (NSL-KDD, UNSW-NB15, CIC-IDS2017, and CSE-CIC-IDS2018), with synthetic data evaluated using four machine learning classifiers against the original imbalanced data, a non-contrastive CVAE, and conventional oversampling approaches. The results show that the effectiveness of integrating contrastive learning into the CVAE framework is dependent on the specific dataset, minority class, contrastive loss function, and distance metric, with the proposed approach outperforming traditional oversampling techniques in several settings without degrading majority-class performance or overall accuracy. These findings provide practical guidance for selecting contrastive learning objectives in class-imbalanced NIDS scenarios.
With its lightweight design, HEDM-KD effectively mitigates the impact of class imbalance and demonstrates potential for improving detection robustness in resource-constrained scenarios.
Yan-Song Li, Bin Gao, Qian Wang· IEEE Access· 0 citations
A hybrid framework that integrates SMOTE and CTGAN for minority-class augmentation, a Bidirectional Long Short-Term Memory network for supervised traffic classification, and a benign-trained Variational Autoencoder (VAE) for validating low-confidence predictions is proposed.
Felicia Maake, Justice Nkoana, V. Baloyi et al.· Big Data and Cognitive Compu...· 0 citations
A Transformer-based network intrusion detection system (t-NIDS) that integrates a Transformer encoder with contrastive learning to learn discriminative and robust feature representations for network traffic classification is proposed, suitable for practical deployment in real-world network intrusion detection environme...
The principal contribution of this work is architectural and diagnostic rather than a performance improvement: it documents that combining feature-wise attention with out-of-fold stacked generalization does not, in this setting, outperform a plain multi-layer perceptron, while incurring the highest memory footprint of...
Mahima Khanna, V. Murthy, Siva Ramavarapu et al.· International Journal for Gl...· 0 citations
This paper proposes HCAE-NIDS that jointly optimizes reconstruction with similarity-based contrastive objectives, enforcing compactness in the normal latent space, and shows a significant improvement over the baselines AE, VAE, and DAE.
Nowsheen Mearaj, Hilal Ahmad Khanday· 2026 6th International Confe...· 0 citations
Industrial Internet of Things (IIoT) intrusion detection remains challenging because of class imbalance, rare attacks, and heterogeneous evaluation protocols. This study proposes a modular intrusion-detection framework based on task-specific autoencoder representation learning and downstream CatBoost classification. Th...