Skip to content
Open access

Investigating Contrastive Learning for Conditional Variational Autoencoders in Network Intrusion Detection

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.

Read PDF

Similar papers

Open access Sep 2026

A Hybrid SMOTE-CTGAN and VAE-LSTM Framework for Interpretable Intrusion Detection in Imbalanced Network Traffic

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. · 0 citations
Open access 2026

Network Intrusion Detection With Contrastive Learning and Transformer

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...

Gyu-Bum Han, Byung-Chang Chung · 0 citations
Open access Aug 2026

HADS-Net: A Hybrid Attention-Based Deep Security Network for Network Intrusion Detection

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. · 0 citations
Conference Open access Aug 2026

HCAE-NIDS: A Hybrid Contrastive Autoencoder for Zero-Day Attack Detection

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 · 0 citations
Open access Sep 2026

A Task-Specific Autoencoder–CatBoost Framework for Intrusion Detection in Imbalanced IIoT

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...

Soumia Felkaoui, Faiza Titouna, Djalila Boughareb et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.