Skip to content
Open access

Network Intrusion Detection With Contrastive Learning and Transformer

2026 · IEEE Access · Vol 14, pp. 145098-145115 · 0 citations · 51 references

TL;DR

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

Abstract

Network intrusion detection systems (NIDS) play a critical role in protecting modern communication networks against increasingly sophisticated cyber attacks. In this paper, we propose 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. To improve representation learning under highly imbalanced data distributions, the proposed framework employs balanced sampling together with dropout-based view generation. Unlike conventional Transformer-based approaches that typically rely on high-dimensional embedding representations, the proposed framework achieves competitive detection performance using a compact embedding representation while maintaining a lightweight architecture. The proposed method was comprehensively evaluated on the CIC-IDS2017, CIC-DDoS2019, and NSL-KDD benchmark datasets. To improve the statistical reliability of the evaluation, all experiments were independently repeated ten times using randomly sampled training and testing datasets, and the average performance with standard deviation was reported. Experimental results demonstrate that the proposed framework consistently outperforms representative state-of-the-art methods, achieving average performance improvements of 6.63%, 5.06%, and 1.42% on the CIC-IDS2017, CIC-DDoS2019, and NSL-KDD datasets, respectively. In particular, the proposed method achieved a 112% improvement for the SQL Injection class on CIC-IDS2017 and a 17.43% improvement for the UDP class on CIC-DDoS2019. These results demonstrate that the proposed framework effectively captures complex traffic patterns while learning compact and discriminative feature representations with a lightweight Transformer architecture. Consequently, the proposed t-NIDS provides an effective balance between detection accuracy, computational efficiency, and robustness, making it suitable for practical deployment in real-world network intrusion detection environments.

Read PDF

Similar papers

Open access Aug 2026

An enhanced multi-model ensemble learning architecture for robust network intrusion detection

An Enhanced Multi-Model Ensemble Network Intrusion Detection System (EME-NIDS), a deep meta-learning system that combines five different heterogeneous learning paradigms, including Convolutional Neural Networks, Dense Neural Networks, Transformers, XGBoost, and Random Forests is introduced.

Dwarsala Sireesha, Kakelli Anil Kumar · 0 citations
Open access Sep 2026

Intrusion detection based on the ManFormer model

ManFormer is designed and implements, a hybrid Transformer–Mamba classification architecture that integrates Transformer and Mamba for high-dimensional imbalanced classification tasks, and achieves good overall performance in high-dimensional imbalanced multi-class intrusion detection tasks.

Chang-Sheng Zhu, Tao Yue, Hong-Wei Bai et al. · 0 citations
Review Open access Sep 2026

DEEP LEARNING-BASED INTRUSION DETECTION SYSTEMS: ARCHITECTURES, IMPLEMENTATIONS, AND CHALLENGES IN MODERN NETWORK ANOMALY DETECTION

The revised framework extends this four-layer pipeline by explicitly integrating Explainable AI (XAI) and edge-oriented deployment as cross-cutting operational requirements by explicitly integrating Explainable AI (XAI) and edge-oriented deployment as cross-cutting operational requirements.

A. Havy, Muhammad Faishol Amrulloh · 0 citations
Open access Sep 2026

Graph-guided contrastive transformer architecture for robust and explainable network intrusion detection

A new graph-guided contrastive transformer-based intrusion detection system (GCT-IDS) which aims at improving detection accuracy and robustness and preserving real-time feasibility is presented.

Archana Jayapal, Kamalakkannan Somasundaram, Arun Kumar Ramamoorthy · 0 citations
Open access Sep 2026

Machine Learning-Based Network Intrusion Detection System: A Dual-Pipeline Approach with Explainable AI and Multi-Model Integration

Traditional Network Intrusion Detection Systems (NIDS) usually have high false-positive rates, low interpretability, and inefficiency in detecting offensive attack patterns in real-time. This paper will describe a dual-pipeline NID architecture which combines ensemble machine learning and hybrid deep learning models to...

Namash Kate, P. Suryavanshi, Mayank Patil · 0 citations

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