# Hierarchical Federated Learning for Edge-Aided Unmanned Aerial Vehicle Networks
## 3 Hierarchical FL Algorithm
In any FL algorithm, there is a decrease in the accuracy of training a machine learning model compared to the centralized learning method due to the weight divergence, which is mainly caused by the following two factors: different initialization of the models of the UAVs in the training process and the non-i.i.d nature of the underlying data distribution [20]. As a result, there are two important factors that should influence the performance of the proposed hierarchical FL algorithm. The first one is the number \(k_{1}\) of iterations in the local updates of the UAVs and the number \(k_{2}\) of aggregation steps in the edge server before transmitting the update result to the global server. Lower values of \(k_{1}\) and \(k_{2}\), that is, fewer iterations steps between global aggregations, will reduce the communication cost in practice. The percentage of commonly shared data \(\mathcal{Q}\) is the second factor. Since the edge servers act as aggregators in the hierarchical FL, it is possible for the edge servers to fine-tune the sizes of the shared dataset independently depending on the data distributions of the UAVs assigned to them. The overall training process is shown in Figure 2.

Figure 2: Overall process of the algorithm. ### Complexity Analysis

Suppose the completion time for the UAV to finish a single training round is \(t_{u}\), the transmission time of the UAV updates to the edge server is \(t_{e}\), the transmission time of aggregated model updates from the edge servers to central server is \(t_{c}\), and the overall communication time complexity in each round is \(\mathcal{O}(CNt_{e}+Lt_{c})\). Since the edge server also acts as a base station between UAVs and central server, the communication time complexity of FedAvg is \(\mathcal{O}(CN(t_{e}+t_{c}))\). Since the active number of users \(CN\) is magnitudes higher than the number of edge servers \(L\), our proposed algorithm yields a small communication complexity compared to FedAvg. ## 4 Numerical Results

In simulations, we consider the image classification task to evaluate and compare the performance of the various FL algorithms. In this task, we consider two scenarios with different degrees of non-i.i.d. data distributions. First, in Scenario I, the widely used MNIST dataset [29] is set to the private dataset \(\mathcal{P}_{l}\) at the UAVs as well as the commonly shared dataset \(\mathcal{Q}\) at the edge servers. To consider the situation with extremely non-i.i.d. data distribution, 100 UAVs and 10 edge servers are selected such that each UAV is given the data samples only with one class and each edge server is assigned 10 UAVs with 2 different classes in total (for example, the first edge server can be assigned the labels 3 and 5, and thus, each UAV assigned to it has the data samples only with either the label 3 or 5). This scenario well describes the case with label distribution skew, i.e., both when each UAV has the data samples only with one class and when each edge server is assigned the UAVs that have the same labels. Second, in Scenario II, the Federated Extended MNIST (FEMNIST) dataset [30] is used to classify 52 handwritten uppercase and lowercase letters in addition to the 10 digits, and the dataset is divided according to the writer of the characters with an unbalanced number of samples per UAV. The purpose of considering this scenario is to study the impact of feature distribution skew on the FL, where \(\mathcal{P}_{i}\) is set to be different among the UAVs. In total, 360 UAVs are assigned to 18 edge servers randomly. In both Scenarios I and II, 5% of the dataset is selected as a shared dataset for the edge servers. The dynamical nature of the UAV networks can lead to some of the devices being the bottleneck in the system (i.e., the straggler effect). Finally, in Scenario III, we also perform experiments using a very low value of \(C=0.008\), to demonstrate the robustness of our system to high dropout or low participation rates due to the straggler effects.