# Hierarchical Federated Learning for Edge-Aided Unmanned Aerial Vehicle Networks
## 2 System Model and Problem Description  
As shown in Figure 1, we consider an edge-aided UAV network that includes one cloud server, \(L\) edge servers located in base stations, and \(N\) UAVs. The UAVs are divided into \(L\) groups, and the \(l\)th group of UAVs, denoted by \(\mathcal{C}_{l}\) with cardinality \(|\mathcal{C}_{l}|=C_{l}\), is assigned to the \(l\)th edge server. Let \(n\) be the total number of data samples across the UAVs, where the \(i\)th UAV has a dataset, denoted as \(\mathcal{P}_{i}\), consisting of \(n_{i}\) data samples. The objective of the FL is to minimize the following (global) loss function:  
\[f(w)=\sum_{i=1}^{N}\frac{n_{i}}{n}F_{i}(w)\quad\text{where}\quad F_{i}(w)= \frac{1}{n_{i}}\sum_{j\in\mathcal{P}_{i}}f_{j}(w). \tag{1}\]  
In (1), \(f(w)\) denotes the loss function for the global model \(w\), and \(f_{j}(w)\) is the loss function for the \(j\)th data sample of the \(i\)th UAV. In the naive FL, the training process begins with the central cloud server sending the global model \(w\) to the UAVs [5]. Then, at each step \(t\), the \(i\)th UAV trains the global model \(w\) locally, which results in a local model \(w_{i}\), using its private dataset \(\mathcal{P}_{i}\) based on the gradient descent method as  
\[w_{i}(t+1)=w_{i}(t)-\eta_{t}\
abla F_{i}(w(t)) \tag{2}\]  
where \(\eta_{t}\) denotes a step size. After sending the local models \(\{w_{i}\}\) back to the central cloud server, the global model \(w\) is updated via the following aggregation: \(w(t+1)\leftarrow\sum_{i=1}^{N}\frac{n_{i}}{n}w_{i}(t)\). The above procedure is repeated until a desired accuracy is achieved. Suppose that the global model is updated in every \(k\) steps; otherwise, the local models are trained. Then it follows that  
\[\mathbf{w}_{i}(t+1)= \begin{cases}w_{i}(t)-\eta_{t}\
abla F_{i}(w_{i}(t)),&\text{ if }rem(t,k)\
eq 0\\ \sum_{i=1}^{N}\frac{n_{i}}{n}w_{i}(t)&\text{if }rem(t,k)=0\end{cases}  \tag{3}\]  
Figure 1: An edge-aided UAV network. where \(rem(a,b)\) denotes the remainder when \(a\) is divided by \(b\). Non-Identical Distributions among UAVsGiven the differences in commercial types of UAVs and their hardware, the data acquired by those different UAVs are highly likely to be non-i.i.d. This is especially the case of the FL in the practical UAV networks, compared to the traditional machine learning, where the training data are expected to be uniform. Therefore, heterogeneity of the UAVs leads to poor performance and convergence behavior of the FL due to the large deviation among the local models trained at the devices [20]. Under these circumstances, training a model \(F_{k}\) in its data \(P_{k}\) will not be representative of the joint global model \(f\)[19]:  
\[\mathbb{E}_{P_{k}}[F_{k}(w)]\
eq f(w) \tag{4}\]  
There are several ways in which the data among devices can be deviated from being i.i.d:  
* Feature distribution skew: The marginal distributions \(\mathcal{P}_{i}\) vary among the devices. That means the features of data are different between the devices. For example, the picture of the same object might differ in terms of brightness, occlusion, camera sensor, etc. * Label distribution skew: The marginal distributions \(\mathcal{P}_{i}\) variance, where devices have access to a small subset of all available labels. For example, each device has access to a couple of images of a certain digit. * Concept shift (different features, same label): The conditional distributions \(\mathcal{P}_{i}(x|y)\) vary among the devices. This is the case where the same label \(y\) might have different features \(x\) among devices. In the digit recognition case, digits might be written in drastically different ways, which results in varying underlying features for the same digit. * Concept shift (same features, different label): The conditional distributions \(\mathcal{P}_{i}(x|y)\) vary among the devices. Here, similar features might be labeled differently across devices. For example, different digits are written in very similar ways, such as 5 and 6, or 3 and 8.