Attack Detection of Federated Learning Model Based on Attention Mechanism Optimization in Connected Vehicles
Abstract
1. Introduction
2. Research Methods
2.1. Overall System Framework
2.2. Design of Local Detection Model
- CNN+LSTM infrastructure
- 2.
- Attention mechanism integration scheme
2.3. Optimization of Federated Learning Mechanism
- Basic Process of Federated Learning
- 2.
- Aggregation strategy design (based on attention weights)
3. Results Analysis
3.1. Experimental Environment and Parameter Settings
3.2. Comparative Experiment with Traditional Methods
- Comparison of accuracy and recall rate:
- 2.
- Convergence speed analysis:
- 3.
- Assessment of Communication Costs
3.3. Analysis of the Role of Attention Mechanisms
3.4. Discussion on Computational Cost and Scalability
4. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Ullah, I.; Deng, X.; Pei, X.; Mushtaq, H.; Khan, Z. Securing internet of vehicles: A blockchain-based federated learning approach for enhanced intrusion detection. Clust. Comput. 2025, 28, 256. [Google Scholar] [CrossRef]
- Huang, K.; Xian, R.; Xian, M.; Wang, H.; Ni, L. A comprehensive intrusion detection method for the internet of vehicles based on federated learning architecture. Comput. Secur. 2024, 147, 104067. [Google Scholar] [CrossRef]
- Xing, L.; Wang, K.; Wu, H.; Ma, H.; Zhang, X. Fl-maae: An intrusion detection method for the internet of vehicles based on federated learning and memory-augmented autoencoder. Electronics 2023, 12, 2284. [Google Scholar] [CrossRef]
- Lu, N.; Cheng, N.; Zhang, N.; Shen, X.; Mark, J.W. Connected vehicles: Solutions and challenges. IEEE Internet Things J. 2014, 1, 289–299. [Google Scholar] [CrossRef]
- Contreras-Castillo, J.; Zeadally, S.; Guerrero-Ibañez, J.A. Internet of Vehicles: Architecture, protocols, and security. IEEE Internet Things J. 2017, 5, 3701–3709. [Google Scholar] [CrossRef]
- Yang, J.; Hu, J.; Yu, T. Federated AI-enabled in-vehicle network intrusion detection for internet of vehicles. Electronics 2022, 11, 3658. [Google Scholar] [CrossRef]
- Li, Y.; Tao, X.; Zhang, X.; Liu, J.; Xu, J. Privacy-preserved federated learning for autonomous driving. IEEE Trans. Intell. Transp. Syst. 2021, 23, 8423–8434. [Google Scholar] [CrossRef]
- Al-Garadi, M.A.; Mohamed, A.; Al-Ali, A.K.; Du, X.; Ali, I.; Guizani, M. A survey of machine and deep learning methods for internet of things (IoT) security. IEEE Commun. Surv. Tutor. 2020, 22, 1646–1685. [Google Scholar] [CrossRef]
- Kairouz, P.; McMahan, H.B.; Avent, B.; Bellet, A.; Bennis, M.; Bhagoji, A.N.; Bonawitz, K.; Charles, Z.; Cormode, G.; Cummings, R.; et al. Advances and open problems in federated learning. Found. Trends Mach. Learn. 2021, 14, 1–210. [Google Scholar] [CrossRef]
- Zhao, Y.; Li, M.; Lai, L.; Suda, N.; Civin, D.; Chandra, V. Federated learning with non-IID data. arXiv 2018, arXiv:1806.00582. [Google Scholar] [CrossRef]
- Li, T.; Sahu, A.K.; Zaheer, M.; Sanjabi, M.; Talwalkar, A.; Smith, V. Federated optimization in heterogeneous networks. Proc. Mach. Learn. Syst. 2020, 2, 429–450. [Google Scholar]
- Wang, H.; Yurochkin, M.; Sun, Y.; Papailiopoulos, D.; Khazaeni, Y. Federated learning with matched averaging. arXiv 2020, arXiv:2002.06440. [Google Scholar] [CrossRef]
- Sattler, F.; Wiedemann, S.; Müller, K.R.; Samek, W. Robust and communication-efficient federated learning from non-iid data. IEEE Trans. Neural Netw. Learn. Syst. 2020, 31, 3400–3413. [Google Scholar] [CrossRef] [PubMed]
- Wang, J.; Liu, Q.; Liang, H.; Joshi, G.; Poor, H.V. Tackling the objective inconsistency problem in heterogeneous federated optimization. Adv. Neural Inf. Process. Syst. 2020, 33, 7611–7623. [Google Scholar]
- Saez-De-Camara, X.; Flores, J.; Arellano, C.; Urbieta, A.; Zurutuza, U. Clustered federated learning architecture for network anomaly detection in large scale heterogeneous iot networks. Comput. Secur. 2023, 131, 103299. [Google Scholar] [CrossRef]
- Driss, M.; Almomani, I.; e Huma, Z.; Ahmad, J. A federated learning framework for cyberattack detection in vehicular sensor networks. Complex Intell. Syst. 2022, 8, 4221–4235. [Google Scholar] [CrossRef]
- Wu, J.; Qiu, G.; Wu, C.; Jiang, W.; Jin, J. Federated learning for network attack detection using attention-based graph neural networks. Sci. Rep. 2024, 14, 19088. [Google Scholar] [CrossRef]
- Song, X.; Ma, Q. Intrusion detection using federated attention neural network for edge enabled internet of things. J. Grid Comput. 2024, 22, 15. [Google Scholar] [CrossRef]
- Vadigi, S.; Sethi, K.; Mohanty, D.; Das, S.P.; Bera, P. Federated reinforcement learning based intrusion detection system using dynamic attention mechanism. J. Inf. Secur. Appl. 2023, 78, 103608. [Google Scholar] [CrossRef]
- Qu, Z.; Cai, Z. FEDSA-ResnetV2: An Efficient Intrusion Detection System for Vehicle Road Cooperation Based on Federated Learning. IEEE Internet Things J. 2024, 11, 29852–29863. [Google Scholar]
- Alsamiri, J.; Alsubhi, K. Federated learning for intrusion detection systems in internet of vehicles: A general taxonomy, applications, and future directions. Future Internet 2023, 15, 403. [Google Scholar] [CrossRef]
- Djenouri, Y.; Belbachir, A.N.; Michalak, T.; Belhadi, A.; Srivastava, G. Enhancing smart road safety with federated learning for Near Crash Detection to advance the development of the Internet of Vehicles. Eng. Appl. Artif. Intell. 2024, 133, 108350. [Google Scholar] [CrossRef]
- Xu, Q.; Zhang, L.; Ou, D.; Yu, W. Secure intrusion detection by differentially private federated learning for inter-vehicle networks. Transp. Res. Rec. 2023, 2677, 421–437. [Google Scholar] [CrossRef]
- Zhou, H.; Zheng, Y.; Huang, H.; Shu, J.; Jia, X. Toward robust hierarchical federated learning in internet of vehicles. IEEE Trans. Intell. Transp. Syst. 2023, 24, 5600–5614. [Google Scholar] [CrossRef]
- Aouedi, O.; Piamrat, K.; Muller, G.; Singh, K. Federated semisupervised learning for attack detection in industrial internet of things. IEEE Trans. Ind. Inform. 2022, 19, 286–295. [Google Scholar] [CrossRef]
- Bhavsar, M.H.; Bekele, Y.B.; Roy, K.; Kelly, J.C.; Limbrick, D. Fl-ids: Federated learning-based intrusion detection system using edge devices for transportation iot. IEEE Access 2024, 12, 52215–52226. [Google Scholar] [CrossRef]
- Vinita, L.J.; Vetriselvi, V. Federated Learning-based Misbehaviour detection on an emergency message dissemination scenario for the 6G-enabled Internet of Vehicles. Ad Hoc Netw. 2023, 144, 103153. [Google Scholar] [CrossRef]
- Arya, M.; Sastry, H.; Dewangan, B.K.; Rahmani, M.K.I.; Bhatia, S.; Muzaffar, A.W.; Bivi, M.A. Intruder detection in VANET data streams using federated learning for smart city environments. Electronics 2023, 12, 894. [Google Scholar] [CrossRef]
- Nabil, N.; Najib, N.; Abdellah, J. Leveraging artificial neural networks and lightgbm for enhanced intrusion detection in automotive systems. Arab. J. Sci. Eng. 2024, 49, 12579–12587. [Google Scholar] [CrossRef]
- Xie, N.; Zhang, C.; Yuan, Q.; Kong, J.; Di, X. IoV-BCFL: An intrusion detection method for IoV based on blockchain and federated learning. Ad Hoc Netw. 2024, 163, 103590. [Google Scholar] [CrossRef]
- Mansouri, F.; Tarhouni, M.; Alaya, B.; Zidi, S. A distributed intrusion detection framework for vehicular ad hoc networks via federated learning and blockchain. Ad Hoc Netw. 2025, 167, 103677. [Google Scholar] [CrossRef]
- Huang, J.; Chen, Z.; Liu, S.Z.; Zhang, H.; Long, H.X. Improved Intrusion Detection Based on Hybrid Deep Learning Models and Federated Learning. Sensors 2024, 24, 4002. [Google Scholar] [CrossRef]
- Kumar, A.; Gondhi, N.K. Review paper on machine learning based intrusion detection system in internet of vehicles. Adv. Comput. Sci. Inf. Technol. 2023, 10, 39. [Google Scholar]















| Attention Module | Input Dimension | Internal Structure | Output Dimension | Computational Complexity |
|---|---|---|---|---|
| Feature Attention | F × T | FC (F→F/2) → FC (F/2→F) → Sigmoid | F × T | O (F2T) |
| Time Attention | F × T | Conv1D (k = 3) → FC → Softmax | F × T | O (FT2) |
| Self-Attention | F × T | Q, K, V transform → multi head attention (h = 8) | F × T | O (F2T + FT2) |
| Parameter Category | Parameter | Parameter Values |
|---|---|---|
| Network structure parameters | CNN convolution layers | 3 |
| CNN convolution kernel size | 3, 5, 7 | |
| Number of CNN filters | 64, 128, 256 | |
| Number of hidden units in LSTM | 128 | |
| LSTM layers | 2 | |
| Attention head count | 8 | |
| Attention Hidden Dimension | 64 | |
| Number of fully connected layer neurons | 256, 128, 64 | |
| Training parameters | Batch size | 64 |
| Learning rate | 0.001 | |
| Decline in learning rate | 0.95 per 10 rounds | |
| Optimizer | Adam | |
| Loss function | Cross Entropy | |
| Training epochs | 100 | |
| Early-stop rounds | 10 | |
| Federated Learning Parameters | Number of clients | 10 |
| Local training rounds | 5 | |
| Client sampling rate | 0.8 | |
| Aggregate weight initial value | Equal distribution | |
| Attention aggregation temperature coefficient | 0.5 | |
| Communication compression ratio | 0.5 | |
| Vehicle networking environment parameters | Vehicle movement speed | 0–100 km/h |
| Communication delay | 10–50 ms | |
| Packet loss rate | 0–5% | |
| Bandwidth limitation | 10–25 Mbps | |
| Topology change frequency | Updated every 30 s |
| Evaluation Dimensions | Traditional Model | Attention-optimization model | Improvement Rate (%) |
|---|---|---|---|
| Rounds required to achieve 95% accuracy | 47 | 36 | 23.4 |
| Rounds required to achieve 90% accuracy | 32 | 23 | 28.1 |
| Model accuracy after 10 rounds (%) | 78.3 | 88.7 | 13.3 |
| Model accuracy after 20 rounds (%) | 86.5 | 93.2 | 7.7 |
| Average proportion of participating nodes per round (%) | 100 | 72.5 | 27.5 |
| Average communication volume per round (MB) | 9.2 | 7.8 | 15.2 |
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. Published by MDPI on behalf of the World Electric Vehicle Association. 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
Liu, L.; Wang, F.; Du, N. Attack Detection of Federated Learning Model Based on Attention Mechanism Optimization in Connected Vehicles. World Electr. Veh. J. 2025, 16, 679. https://doi.org/10.3390/wevj16120679
Liu L, Wang F, Du N. Attack Detection of Federated Learning Model Based on Attention Mechanism Optimization in Connected Vehicles. World Electric Vehicle Journal. 2025; 16(12):679. https://doi.org/10.3390/wevj16120679
Chicago/Turabian StyleLiu, Lanying, Fujun Wang, and Ning Du. 2025. "Attack Detection of Federated Learning Model Based on Attention Mechanism Optimization in Connected Vehicles" World Electric Vehicle Journal 16, no. 12: 679. https://doi.org/10.3390/wevj16120679
APA StyleLiu, L., Wang, F., & Du, N. (2025). Attack Detection of Federated Learning Model Based on Attention Mechanism Optimization in Connected Vehicles. World Electric Vehicle Journal, 16(12), 679. https://doi.org/10.3390/wevj16120679

