# Hierarchical Federated Learning-Based Intrusion Detection for In-Vehicle Networks
## 2 Background and Related Work
### Federated Learning-Based Intrusion Detection Systems  
[PERSON] et al. [9] introduced an FL-based framework to identify attacks in vehicular sensor networks. Given the resource constraints of smart sensing devices in vehicular networks, the authors emphasized the significance of adopting lightweight security approaches. To address this issue, they utilized a set of Gated Recurrent Units with an ensemble method based on Random Forest to aggregate the global machine learning models. They distributed the dataset equally among clients. [PERSON] et al. [10] presented an FL-based IDS for enhancing security in autonomous systems. The authors personalized the model for each client participating in the FL process. The study integrates both supervised and unsupervised FL-based IDS to analyze patterns in CAN buses. Moreover, to create a more generalized model, local clients have the option to refine the global model using their local data and deploy it during inference. [PERSON] et al. [11] introduced an FL-based IDS based on Long Short-Term Memory (LSTM) for in-vehicle networks. They utilized the periodicity of CAN communications to predict the arbitration IDs of new messages. The 11-bit arbitration ID is transformed into vectors using one-hot encoding, and these vectors are utilized by the LSTM to predict the subsequent arbitration ID. Data are evenly distributed among clients, with each client holding 1000 instances for training and 200 instances for testing. A comparison between the FL-based and a centralized IDS revealed a 0.071 accuracy loss for the FL-based IDS. However, the authors suggested that this loss could be mitigated through a cumulative error scheme. [PERSON] et al. [12] developed an anomaly detection system utilizing a graph neural network, capable of detecting CAN bus intrusions within a minimal 3-millisecond time-frame. They constructed a two-stage classifier cascade consisting of a classifier designed for anomaly detection in one class, and another classifier for categorizing attacks into multiple classes. To address novel anomalies from unseen classes, an openmax layer is integrated into the multi-class classifier. [PERSON] et al. [13] introduced an IDS for in-vehicle networks utilizing federated deep learning. The proposed approach leverages the periodicity of network messages, employs the ConvLSTM model, and trains the model through federated deep learning. To simulate a non-IID environment, clients were assigned varying data samples (ranging from 50 to 3500),  
Figure 1: Cloud-based FL and H-FL. although specific details regarding data distribution among clients and the distribution of samples across all classes were not provided. [PERSON] et al. [14] proposed ImageFed, a practical IDS designed to preserve privacy, which utilizes federated Convolutional Neural Networks. To simulate a non-IID setting, data were distributed to vehicles using a Dirichlet \((\mu)\) distribution, with \((\mu)\) values varying from 0.1 to 0.7. To assess ImageFed's resilience, they examined two potential scenarios leading to performance decline in FL: non-IID clients and limited availability of training data. Table 1 summarizes previous works and highlights our contribution. In cases where the aggregation function is not explicitly indicated, as in [9; 10], we assume that FedAvg is the method employed. Although previous works have deployed their in-vehicle IDSs in an FL environment, they exhibit some limitations. Firstly, all the proposed FL-based in-vehicle IDSs in the literature utilized a standard cloud-based FL architecture to deploy and evaluate their proposed IDSs, relying solely on one central aggregator. However, this standard FL architecture can limit the IDS's adaptability and effectiveness in detecting diverse, evolving threats. Additionally, it leads to network congestion and communication delays due to the time required to share the model between the central aggregator and a large number of vehicles, potentially millions [16].