journal article·2025-06-10Open access

LLM-Based Cyberattack Detection Using Network Flow Statistics

Leopoldo Gutiérrez-Galeano, Juan-José Domínguez-Jiménez, Jörg Schäfer, Inmaculada Medina-Bulo

Applied Sciences· Volume 15· Issue 12

Abstract

Cybersecurity is a growing area of research due to the constantly emerging new types of cyberthreats. Tools and techniques exist to keep systems secure against certain known types of cyberattacks, but are insufficient for others that have recently appeared. Therefore, research is needed to design new strategies to deal with new types of cyberattacks as they arise. Existing tools that harness artificial intelligence techniques mainly use artificial neural networks designed from scratch. In this paper, we present a novel approach for cyberattack detection using an encoder–decoder pre-trained Large Language Model (T5), fine-tuned to adapt its classification scheme for the detection of cyberattacks. Our system is anomaly-based and takes statistics of already finished network flows as input. This work makes significant contributions by introducing a novel methodology for adapting its original task from natural language processing to cybersecurity, achieved by transforming numerical network flow features into a unique abstract artificial language for the model input. We validated the robustness of our detection system across three datasets using undersampling. Our model achieved consistently high performance across all evaluated datasets. Specifically, for the CIC-IDS-2017 dataset, we obtained an accuracy, precision, recall, and F-score of more than 99.94%. For CSE-CIC-IDS-2018, these metrics exceeded 99.84%, and for BCCC-CIC-IDS-2017, they were all above 99.90%. These results collectively demonstrate superior performance for cyberattack detection, while maintaining highly competitive false-positive rates and false-negative rates. This efficacy is achieved by relying exclusively on real-world network flow statistics, without the need for synthetic data generation.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Network Security and Intrusion Detection · Advanced Malware Detection Techniques · Internet Traffic Analysis and Secure E-voting

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Escuela Superior de Ingeniería, Universidad de Cádiz, Avda. Universidad de Cádiz, 10, 11519 Puerto Real, Spain

Faculty of Computer Science and Engineering, Frankfurt University of Applied Sciences, Nibelungenplatz 1, 60318 Frankfurt am Main, Germany

Funding

R&D&I · MICIU/AEI/10.13039/501100011033 · Plan Propio of the University of Cádiz

References (56)

Show source-provided references
1. Cyber security: State of the art, challenges and future directions10.1016/j.csa.2023.100031 ↗
2. Vielberth, M., and Pernul, G. (2018, January 20–23). A Security Information and Event Management Pattern. Proceedings of the 12th Latin American Conference on Pattern Languages of Programs (SLPLoP), Valparaíso, Chile.
3. Ashoor, A.S., and Gore, S. (2011, January 15–17). Difference between intrusion detection system (IDS) and intrusion prevention system (IPS). Proceedings of the Advances in Network Security and Applications: 4th International Conference, CNSA 2011, Chennai, India.10.1007/978-3-642-22540-6_48 ↗
4. Importance of intrusion detection system (IDS)
5. A survey on deep learning for cybersecurity: Progress, challenges, and opportunities10.1016/j.comnet.2022.109032 ↗
6. Deep Learning10.1038/nature14539 ↗
7. Burkov, A. (2019). The Hundred-Page Machine Learning Book, Andriy Burkov.
8. Emerging trends: A gentle introduction to fine-tuning10.1017/S1351324921000322 ↗
9. A comparative study of fine-tuning deep learning models for plant disease identification10.1016/j.compag.2018.03.032 ↗
10. A survey on deep learning tools dealing with data scarcity: Definitions, challenges, solutions, tips, and applications10.1186/s40537-023-00727-2 ↗
11. Maruthupandi, J., Sivakumar, S., Dhevi, B.L., Prasanna, S., Priya, R.K., and Selvarajan, S. (2025). An intelligent attention based deep convoluted learning (IADCL) model for smart healthcare security. Sci. Rep., 15.10.1038/s41598-024-84691-8 ↗
12. Semi-Supervised Spatiotemporal Deep Learning for Intrusions Detection in IoT Networks10.1109/JIOT.2021.3060878 ↗
13. Intrusion Detection for Secure Social Internet of Things Based on Collaborative Edge Computing: A Generative Adversarial Network-Based Approach10.1109/TCSS.2021.3063538 ↗
14. An end-to-end intrusion detection system with IoT dataset using deep learning with unsupervised feature extraction10.1007/s10207-023-00807-7 ↗
15. Enhanced neural network-based attack investigation framework for network forensics: Identification, detection, and analysis of the attack10.1016/j.cose.2023.103521 ↗
16. An Attention-Based Convolutional Neural Network for Intrusion Detection Model10.1109/ACCESS.2023.3271408 ↗
17. Malicious Data Classification in Packet Data Network Through Hybrid Meta Deep Learning10.1109/ACCESS.2023.3341911 ↗
18. HDFEF: A hierarchical and dynamic feature extraction framework for intrusion detection systems10.1016/j.cose.2022.102842 ↗
19. Yilmaz, M., and Bardak, B. (2022, January 7–9). An Explainable Anomaly Detection Benchmark of Gradient Boosting Algorithms for Network Intrusion Detection Systems. Proceedings of the 2022 Innovations in Intelligent Systems and Applications Conference (ASYU 2022), Antalya, Turkey.10.1109/ASYU56188.2022.9925451 ↗
20. MMM-RF: A novel high accuracy multinomial mixture model for network intrusion detection systems10.1016/j.cose.2022.102777 ↗
21. PBCNN: Packet Bytes-based Convolutional Neural Network for Network Intrusion Detection10.1016/j.comnet.2021.108117 ↗
22. An optimization model of computer network security based on GABP neural network algorithm10.1186/s13635-025-00196-5 ↗
23. Guo, D., and Xie, Y. (2025). Research on Network Intrusion Detection Model Based on Hybrid Sampling and Deep Learning. Sensors, 25.10.3390/s25051578 ↗
24. A Hybrid Deep Learning Model for Network Intrusion Detection System Using Seq2Seq and ConvLSTM-Subnets10.1109/ACCESS.2025.3541399 ↗
25. Understanding LLMs: A comprehensive overview from training to inference10.1016/j.neucom.2024.129190 ↗
26. Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W., and Liu, P.J. (2020). Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. arXiv.
27. Pre-trained language model-enhanced conditional generative adversarial networks for intrusion detection10.1007/s12083-023-01595-6 ↗
28. FlowTransformer: A transformer framework for flow-based network intrusion detection systems10.1016/j.eswa.2023.122564 ↗
29. Revolutionizing Cyber Threat Detection with Large Language Models: A Privacy-Preserving BERT-Based Lightweight Model for IoT/IIoT Devices10.1109/ACCESS.2024.3363469 ↗
30. A systematic analysis of performance measures for classification tasks10.1016/j.ipm.2009.03.002 ↗
31. University of California (1999). KDD Cup 1999 Data, University of California.
32. UNB (2009). NSL-KDD Dataset, UNB.
33. UNSW (2015). The UNSW-NB15 Dataset, UNSW.
34. UNB (2017). Intrusion Detection Evaluation Dataset (CIC-IDS2017), UNB.
35. Sharafaldin, I., Habibi Lashkari, A., and Ghorbani, A.A. (2018, January 22–24). Toward Generating a New Intrusion Detection Dataset and Intrusion Traffic Characterization. Proceedings of the 4th International Conference on Information Systems Security and Privacy (ICISSP), Funchal, Portugal.10.5220/0006639801080116 ↗
36. UNB (2016). CICFlowMeter, UNB.
37. UNB (2018). IPS/IDS Dataset on AWS (CSE-CIC-IDS2018), UNB.
38. UNB (2019). DDoS Evaluation Dataset (CIC-DDoS2019), UNB.
39. Sharafaldin, I., Lashkari, A.H., Hakak, S., and Ghorbani, A.A. (2019, January 1–3). Developing Realistic Distributed Denial of Service (DDoS) Attack Dataset and Taxonomy. Proceedings of the 2019 International Carnahan Conference on Security Technology (ICCST), Chennai, India.10.1109/CCST.2019.8888419 ↗
40. University of the Aegean (2016). The AWID2 Dataset, University of the Aegean.
41. University of the Aegean (2021). The AWID3 Dataset, University of the Aegean.
42. Intrusion detection in 802.11 networks: Empirical evaluation of threats and a public dataset10.1109/COMST.2015.2402161 ↗
43. Empirical Evaluation of Attacks against IEEE 802.11 Enterprise Networks: The AWID3 Dataset10.1109/ACCESS.2021.3061609 ↗
44. NTLFlowLyzer: Towards generating an intrusion detection dataset and intruders behavior profiling through network and transport layers traffic analysis and pattern extraction10.1016/j.cose.2024.104160 ↗
45. York University (2025). Behaviour-Centric Cybersecurity Center (BCCC): Cybersecurity Datasets, York University.
46. York University (2025). NTLFlowLyzer, York University.
47. A Comparative Study of Current Dataset Used to Evaluate Intrusion Detection System
48. Wu, Y., Schuster, M., Chen, Z., Le, Q.V., Norouzi, M., Macherey, W., Krikun, M., Cao, Y., Gao, Q., and Macherey, K. (2016). Google’s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation. arXiv.
49. Galeano, L.G. (2022, January 5–8). LJGG @ CLEF JOKER Task 3: An improved solution joining with dataset from task 1. Proceedings of the CEUR Workshop Proceedings, Bologna, Italy.
50. scikit-learn developers (2025, May 11). Cross-Validation: Evaluating Estimator Performance, 2007–2024. Available online: https://scikit-learn.org/stable/modules/cross_validation.html.
51. Roy, S. (2025, May 11). simpleT5. Available online: https://github.com/Shivanandroy/simpleT5.
52. Deep learning techniques to detect cybersecurity attacks: A systematic mapping study10.1007/s10664-023-10302-1 ↗
53. Barolli, L. (2024). Harnessing the Advanced Capabilities of LLM for Adaptive Intrusion Detection Systems. Proceedings of the Advanced Information Networking and Applications, Springer.
54. APELID: Enhancing real-time intrusion detection with augmented WGAN and parallel ensemble learning10.1016/j.cose.2023.103567 ↗
55. Hybrid Chaotic Zebra Optimization Algorithm and Long Short-Term Memory for Cyber Threats Detection10.1109/ACCESS.2024.3397303 ↗
56. Harrell, F.E. (2015). Regression Modeling Strategies: With Applications to Linear Models, Logistic and Ordinal Regression, and Survival Analysis, Springer. [2nd ed.].10.1007/978-3-319-19425-7 ↗