Transformer-Based Intrusion Detection on the NSL-KDD Benchmark: A Performance Assessment Against Conventional Classifiers

Network intrusion detection plays a crucial role in cybersecurity, aiding in the detection of malicious traffic and the ability to distinguish between attacks and normal network traffic. This paper compares a Transformer-based model for network intrusion detection on the NSL-KDD benchmark dataset with a binary classification approach. The architecture proposed uses a 41-input-feature projection to 64 dimensions, followed by two Transformer encoder blocks with 4 attention heads processing the 64-dimensional features. The confusion matrix for the resulting model on the evaluation set of 30,000 records is 98.72% accuracy, 98.56% precision, 98.78% recall, and 98.67% F1-score. The false-positive and false-negative rate are 1.34% and 1.22%, respectively. When compared with conventional classifiers, the reported accuracy of the Transformer is lower than the accuracy of XGBoost (99.44%) and Random Forest (99.31%) while being superior to the reported accuracy of the multilayer perceptron (98.56%) and close to the reported accuracy of Gradient Boosting (98.80%). These findings demonstrate that the evaluated Transformer model can achieve a high classification performance on the selected NSL-KDD records, although it does not outperform all conventional classifiers. The study provides a benchmark-based assessment of the model and highlights the importance of consistent evaluation procedures when comparing intrusion detection approaches. Further research may investigate feature-tokenized Transformer architectures and evaluate their performance on datasets representing industrial control system networks.

Authors

Institutions

Publication Details

Journal
Electronics
Published
2026-11-16
DOI
https://doi.org/10.3390/electronics15225316
Primary Topic
Network Security and Intrusion Detection
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
article

Transformer-Based Intrusion Detection on the NSL-KDD Benchmark: A Performance Assessment Against Conventional Classifiers

Awatif Alqahtani, Hanan Alwadi
4 links
Electronics
Network Security and Intrusion Detection
article

Transformer-Based Intrusion Detection on the NSL-KDD Benchmark: A Performance Assessment Against Conventional Classifiers

Awatif Alqahtani, Hanan Alwadi
article en

Abstract

Network intrusion detection plays a crucial role in cybersecurity, aiding in the detection of malicious traffic and the ability to distinguish between attacks and normal network traffic. This paper compares a Transformer-based model for network intrusion detection on the NSL-KDD benchmark dataset with a binary classification approach. The architecture proposed uses a 41-input-feature projection to 64 dimensions, followed by two Transformer encoder blocks with 4 attention heads processing the 64-dimensional features. The confusion matrix for the resulting model on the evaluation set of 30,000 records is 98.72% accuracy, 98.56% precision, 98.78% recall, and 98.67% F1-score. The false-positive and false-negative rate are 1.34% and 1.22%, respectively. When compared with conventional classifiers, the reported accuracy of the Transformer is lower than the accuracy of XGBoost (99.44%) and Random Forest (99.31%) while being superior to the reported accuracy of the multilayer perceptron (98.56%) and close to the reported accuracy of Gradient Boosting (98.80%). These findings demonstrate that the evaluated Transformer model can achieve a high classification performance on the selected NSL-KDD records, although it does not outperform all conventional classifiers. The study provides a benchmark-based assessment of the model and highlights the importance of consistent evaluation procedures when comparing intrusion detection approaches. Further research may investigate feature-tokenized Transformer architectures and evaluate their performance on datasets representing industrial control system networks.

ElectronicsVol. 15(22)
King Saud University (SA)
King Saud University
Network Security and Intrusion Detection
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon