# Federated Learning for Secure In-Vehicle Communication
## 6 Conclusions and Future Work  
In this paper, we tackled a critical limitation of CAN protocol its lack of data encryption which makes it vulnerable to a wide range of cyberattacks. To mitigate this issue, we proposed FL-IVN-IDS, a federated intrusion detection system that can effectively classify attacks based on multiple datasets. Quantitatively, FL-IVN-IDS-5E achieved 100% testing accuracy, outperforming the LSTM-5E model which required more time to reach a slightly lower accuracy of 99.95%. Similarly, FL-IVN-IDS-1E reached 99.73% accuracy, compared to 98.15% accuracy by LSTM-1E. This demonstrates that FL-IVN-IDS not only improves classification performance but also reduces training time significantly up to 40% when compared with LSTM-5E. Our model achieves 100% on all metrics of evaluation, significantly better than the baseline FL-based LSTM architecture in terms of accuracy, precision, recall, F1-score, and training time. The confusion matrix and ROC curves further substantiate the effectiveness of our approach. Furthermore, our solution generates low communication overhead, thus ensuring that it is highly scalable and deployable on smart CAV networks. Our FL-IVN-IDS model, in both 1E and 5E variants, improved a superior balance between model performance and training efficiency. By reducing training time without compromising accuracy, FL-IVN-IDS emerges as an ideal solution for large-scale and real-time federated learning applications. It enables faster model updates, lower device energy consumption, and greater flexibility towards real-world constraints. Thus, it is a very effective choice for improving cybersecurity in intelligent vehicular networks. Future WorksFurther works may consider enhancing privacy by adding strong encryption of FL-IVN-IDS weights to protect model parameters from attacks. Also, considering CAN-FD (CAN with flexible data rate) datasets to train the FL-IVN-IDS for higher data rates, improved efficiency, and better scalability for modern CAVs. future work can explore how pre-trained LLMs (e.g., transformer models) can be adapted and customized through federated learning on structured vehicle data (CAN messages). It involves modifying LLMs to handle time-series or sequence-based inputs through the use of embedding layers or tokenization methods suitable for CAN traffic patterns. Every device or edge vehicle can fine-tune the local model using its local traffic data and send only the updates to the model (not actual data) to the central aggregator. In this way, the LLM can be trained on local attack trends per vehicle while, over time, improving its generalization to detect more general types of attacks fleet-wide, with the prove of data privacy. Conceptualization, by M.G., N.-E.-H.Y. and S.B. ; methodology, M.G., N.-E.-H.Y., A.B. and S.B. ; software, M.G. ; validation, N.-E.-H.Y., S.B. and A.B. ; formal analysis, M.G., N.-E.-H.Y., S.B. and A.B. ; investigation, M.G., N.-E.-H.Y., S.B. and A.B. ; resources, M.G. ; data curation, M.G. ; writing--original draft preparation, M.G., N.-E.-H.Y., S.B. and A.B. ; writing--review and \begin{table}
\begin{tabular}{l c c} \hline \hline
**Model** & **Accuracy (\%)** & **Time (s)** \\ \hline LSTM-1E & 98.15 & 5300.74 \\ LSTM-5E & 99.95 & 20,139.08 \\ FL-IVN-IDS-1E & 99.73 & 3822.06 \\ FL-IVN-IDS-5E & 100 & 12,001.79 \\ \hline \hline \end{tabular}
\end{table} 
Table 10: Comparison of Model Performance in Testing Accuracy and Training Time- Global model. editing, M.G., N.-E.-H.Y., S.B. and A.B. ; visualization, N.-E.-H.Y. and M.G. ; supervision, N.-E.-H.Y., S.B. and A.B. ; project administration, M.G. ; funding acquisition, M.G., N.-E.-H.Y., S.B. and A.B. All authors have read and agreed to the published version of the manuscript. This research received no external funding. **Data Availability Statement**: No new data were generated as part of this study.