Transformer-Based Intrusion Detection for Post-5G and 6G Telecommunication Networks Using Dynamic Semantic Embedding
Abstract
1. Introduction
- We design a comprehensive hybrid feature extraction method for telecommunication network traffic that provides rich information for intrusion detection by considering both semantic content features and communication behavior patterns. This dual-perspective approach enables more robust detection of sophisticated attacks in post-5G and 6G networks compared to methods that rely on a single feature type.
- We propose a novel dynamic semantic embedding mechanism that integrates semantic context awareness into positional encoding, allowing the model to highlight semantic anomalies and improve the detection of advanced intrusion attempts. This adaptive mechanism adjusts the positional information based on semantic changes, enabling the model to identify potential security threats.
- We develop a complete Transformer-based intrusion detection system and validate its effectiveness, robustness, and generalization capability through extensive testing on public network security datasets. Our experimental results demonstrate significant improvements over baseline methods, with F1-score gains of ∼8% on both the CICIDS2017 and UNSW-NB15 datasets compared to LSTM-based approaches, making it suitable for deployment in post-5G and 6G telecommunication infrastructures.
2. Related Work
2.1. Security in Post-5G and 6G Telecommunication Networks
2.2. Intrusion Detection Systems for Telecommunication Networks
2.3. Transformer-Based Threat Detection
3. Detection Method
| Algorithm 1 Dynamic Semantic Threat Detection |
![]() |
3.1. Semantic Feature Extraction
3.1.1. Semantic Content Features
3.1.2. Communication Behavior Features
3.2. Dynamic Semantic Embedding
3.2.1. Semantic Feature Embedding
3.2.2. Semantic-Aware Positional Embedding
3.3. Model Construction and Security Detection
3.3.1. Transformer Architecture
3.3.2. Threat Detection and Classification
3.3.3. Overall Process
4. Experiments
4.1. Experimental Setup
4.1.1. Datasets
4.1.2. Comparison Models
4.1.3. Experimental Parameters
4.1.4. Evaluation Metrics
4.2. Experimental Results
4.2.1. Main Experiment: Model Performance Comparison
4.2.2. Resource Utilization Analysis
4.2.3. Ablation Study
4.2.4. Stability Analysis of Dynamic Weight
4.2.5. Robustness Testing
4.2.6. Cross-Dataset Validation
4.3. Experimental Analysis
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Qin, Z.; Tao, X.; Lu, J.; Tong, W.; Li, G.Y. Semantic communications: Principles and challenges. arXiv 2021, arXiv:2201.01389. [Google Scholar]
- Xie, H.; Qin, Z.; Li, G.Y.; Juang, B.H. Deep learning enabled semantic communication systems. IEEE Trans. Signal Process. 2021, 69, 2663–2675. [Google Scholar] [CrossRef]
- Xin, G.; Fan, P.; Letaief, K.B. Semantic communication: A survey of its theoretical development. Entropy 2024, 26, 102. [Google Scholar] [CrossRef] [PubMed]
- Guo, S.; Wang, Y.; Zhang, N.; Su, Z.; Luan, T.H.; Tian, Z.; Shen, X. A survey on semantic communication networks: Architecture, security, and privacy. IEEE Commun. Surv. Tutor. 2024, 27, 2860–2894. [Google Scholar] [CrossRef]
- Sagduyu, Y.E.; Erpek, T.; Ulukus, S.; Yener, A. Is semantic communication secure? A tale of multi-domain adversarial attacks. IEEE Commun. Mag. 2023, 61, 50–55. [Google Scholar] [CrossRef]
- Vinayakumar, R.; Alazab, M.; Soman, K.P.; Poornachandran, P.; Al-Nemrat, A.; Venkatraman, S. Deep learning approach for intelligent intrusion detection system. IEEE Access 2019, 7, 41525–41550. [Google Scholar] [CrossRef]
- Adefemi Alimi, K.O.; Ouahada, K.; Abu-Mahfouz, A.M.; Rimer, S.; Alimi, O.A. Refined LSTM based intrusion detection for denial-of-service attack in Internet of Things. J. Sens. Actuator Netw. 2022, 11, 32. [Google Scholar] [CrossRef]
- Abd El-Rady, A.; Osama, H.; Sadik, R.; El Badwy, H. Network intrusion detection CNN model for realistic network attacks based on network traffic classification. In Proceedings of the 2023 40th National Radio Science Conference (NRSC), Giza, Egypt, 30 May–1 June 2023; Volume 1, pp. 167–178. [Google Scholar]
- Li, Y.; Shi, Z.; Hu, H.; Fu, Y.; Wang, H.; Lei, H. Secure semantic communications: From perspective of physical layer security. IEEE Commun. Lett. 2024, 28, 2243–2247. [Google Scholar] [CrossRef]
- Wei, K.; Xie, R.; Xu, W.; Lu, Z.; Xiao, H. Robust Semantic Communication Via Adversarial Training. IEEE Trans. Veh. Technol. 2025. early access. [Google Scholar] [CrossRef]
- Gündüz, D.; Qin, Z.; Aguerri, I.E.; Dhillon, H.S.; Yang, Z.; Yener, A.; Wong, K.K.; Chae, C.B. Beyond transmitting bits: Context, semantics, and task-oriented communications. IEEE J. Sel. Areas Commun. 2022, 41, 5–41. [Google Scholar] [CrossRef]
- Chen, S.; Yin, Q.; Song, J. PHierT: A Privacy-Preserving Hierarchical Transformer Model for ICS Network Traffic Classification. In Proceedings of the International Conference on Intelligent Computing, Ningbo, China, 26–29 July 2025; Springer: Berlin/Heidelberg, Germany, 2025; pp. 15–26. [Google Scholar]
- Ahmad, I.; Suomalainen, J.; Porambage, P.; Gurtov, A.; Huusko, J.; Höyhtyä, M. Security of satellite-terrestrial communications: Challenges and potential solutions. IEEE Access 2022, 10, 96038–96052. [Google Scholar] [CrossRef]
- Taricco, G.; Alagha, N. On jamming detection methods for satellite Internet of Things networks. Int. J. Satell. Commun. Netw. 2022, 40, 177–190. [Google Scholar] [CrossRef]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. In Advances in Neural Information Processing Systems 30, Proceedings of the 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA, 4–9 December 2017; Curran Associates Inc.: Red Hook, NY, USA, 2017; Volume 30. [Google Scholar]
- Tsai, M.T.; Tseng, K.C. Intrusion Detection System Based on Transformer. Commun. CCISA 2023, 29, 19–38. [Google Scholar]
- Ding, L.; Du, P.; Hou, H.; Zhang, J.; Jin, D.; Ding, S. Botnet DGA domain name classification using transformer network with hybrid embedding. Big Data Res. 2023, 33, 100395. [Google Scholar] [CrossRef]
- Tuli, S.; Casale, G.; Jennings, N.R. Tranad: Deep transformer networks for anomaly detection in multivariate time series data. arXiv 2022, arXiv:2201.07284. [Google Scholar] [CrossRef]






| Dataset | Model | Accuracy | Recall | F1-Score | AUC-ROC | Privacy Risk |
|---|---|---|---|---|---|---|
| CICIDS2017 | ||||||
| Our | 0.93 ± 0.01 | 0.91 ± 0.01 | 0.92 ± 0.01 | 0.95 ± 0.01 | 0.88 ± 0.02 | |
| BERT | 0.92 ± 0.01 | 0.90 ± 0.01 | 0.91 ± 0.01 | 0.94 ± 0.01 | 0.87 ± 0.02 | |
| LSTM | 0.86 ± 0.02 | 0.83 ± 0.02 | 0.84 ± 0.02 | 0.89 ± 0.02 | 0.82 ± 0.02 | |
| GRU | 0.85 ± 0.02 | 0.82 ± 0.02 | 0.83 ± 0.02 | 0.88 ± 0.02 | 0.81 ± 0.02 | |
| CNN | 0.88 ± 0.02 | 0.85 ± 0.02 | 0.86 ± 0.02 | 0.91 ± 0.02 | 0.84 ± 0.02 | |
| UNSW-NB15 | ||||||
| Our | 0.90 ± 0.01 | 0.88 ± 0.01 | 0.89 ± 0.01 | 0.92 ± 0.01 | 0.85 ± 0.02 | |
| BERT | 0.89 ± 0.01 | 0.87 ± 0.01 | 0.88 ± 0.01 | 0.91 ± 0.01 | 0.84 ± 0.02 | |
| LSTM | 0.83 ± 0.02 | 0.80 ± 0.02 | 0.81 ± 0.02 | 0.86 ± 0.02 | 0.78 ± 0.02 | |
| GRU | 0.82 ± 0.02 | 0.79 ± 0.02 | 0.80 ± 0.02 | 0.85 ± 0.02 | 0.77 ± 0.02 | |
| CNN | 0.85 ± 0.02 | 0.83 ± 0.02 | 0.84 ± 0.02 | 0.88 ± 0.02 | 0.80 ± 0.02 |
| Model | Training Time (h) | Peak Memory (GB) | Inference Latency (ms) |
|---|---|---|---|
| Our Transformer | 6.4 | 9.2 | 18.7 |
| BERT-Transformer | 11.7 | 14.5 | 28.3 |
| LSTM | 4.1 | 6.1 | 15.2 |
| GRU | 3.8 | 5.8 | 14.1 |
| CNN | 3.2 | 5.0 | 12.4 |
| Model Variant | Accuracy | Recall | F1-Score | AUC-ROC |
|---|---|---|---|---|
| Full Model | 0.93 ± 0.01 | 0.91 ± 0.01 | 0.92 ± 0.01 | 0.95 ± 0.01 |
| Without Dynamic Embedding | 0.89 ± 0.02 | 0.86 ± 0.02 | 0.87 ± 0.02 | 0.91 ± 0.02 |
| Without Semantic-Aware Positional Modulation () | 0.91 ± 0.01 | 0.88 ± 0.01 | 0.89 ± 0.01 | 0.93 ± 0.01 |
| Without Learnable Vector | 0.90 ± 0.01 | 0.87 ± 0.01 | 0.88 ± 0.01 | 0.92 ± 0.01 |
| Without Semantic Features | 0.84 ± 0.02 | 0.81 ± 0.02 | 0.82 ± 0.02 | 0.87 ± 0.02 |
| Without Behavior Features | 0.87 ± 0.02 | 0.84 ± 0.02 | 0.85 ± 0.02 | 0.89 ± 0.02 |
| Without Fused Semantic+Behavioral Streams | 0.86 ± 0.02 | 0.83 ± 0.02 | 0.84 ± 0.02 | 0.88 ± 0.02 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Yan, H.; Pang, X.; Zhou, S.; Fan, H. Transformer-Based Intrusion Detection for Post-5G and 6G Telecommunication Networks Using Dynamic Semantic Embedding. Future Internet 2025, 17, 544. https://doi.org/10.3390/fi17120544
Yan H, Pang X, Zhou S, Fan H. Transformer-Based Intrusion Detection for Post-5G and 6G Telecommunication Networks Using Dynamic Semantic Embedding. Future Internet. 2025; 17(12):544. https://doi.org/10.3390/fi17120544
Chicago/Turabian StyleYan, Haonan, Xin Pang, Shaopeng Zhou, and Honghui Fan. 2025. "Transformer-Based Intrusion Detection for Post-5G and 6G Telecommunication Networks Using Dynamic Semantic Embedding" Future Internet 17, no. 12: 544. https://doi.org/10.3390/fi17120544
APA StyleYan, H., Pang, X., Zhou, S., & Fan, H. (2025). Transformer-Based Intrusion Detection for Post-5G and 6G Telecommunication Networks Using Dynamic Semantic Embedding. Future Internet, 17(12), 544. https://doi.org/10.3390/fi17120544

