# FLGQM: Robust Federated Learning Based on Geometric and Qualitative Metrics
## 2 Materials and Methods
### Flgom
#### 2.2.2 Aggregation Rule
** Here, we consider that an attacker can exploit more advanced attacks such that the model uploaded by the malicious client has the same geometric direction and size as the benign client's updated model to affect the global model. Thus, defending from a geometric perspective alone is not enough. Therefore, we consider a quality metric for the uploaded local model so as to remove the effect of this kind of malicious client on the global model. Existing defense methods typically maintain a small, clean dataset on the server for quality assessment. The datasets under this approach are usually particularly small and not yet fully representative of the entire data distribution, while also violating the highly problematic principle that federated learning does not collect data. Therefore, we consider delegating server privileges to each client in order to ensure a reliable measure of the quality of the local model, eliminating the influence of the central dataset for distributed quality metrics. Specifically, a certain number of clients are selected to form a union set to participate in the evaluation of the uploaded local models in each round. Then, the generated quality measure score is assigned to the uploaded local models based on the trimmed mean. Figure 3 shows an example of how to calculate the quality metric score. The approximate process is that there are a total of eight training clients and four union clients. After each training client uploads the model weight, the server will send the weights to the union clients, and each union client will use its own local dataset to score the model weights for all the training clients. Then, the server will obtain the final score by trimming the mean for each model weight after collecting all the scores. Figure 3: An example of calculating the quality metric score. In particular, we randomly elect a union client set \(U^{t}=u^{t}_{1},\ldots,u^{t}_{h^{t}},\ldots,u^{t}_{H}\) with \(H\leq K-P\) local clients from the set \(C^{noin}=C-C^{t}\), which do not participate in round \(t\). After the geometric metric, the server sends the local models \(W^{t}_{goodInGeo}=w^{t}_{1},\ldots,w^{t}_{m},\ldots,w^{t}_{M}\) uploaded by the client in \(C^{t_{2}}\) where some malicious clients have been excluded to the union set \(U^{t}\) for quality evaluation. After a union client \(u^{t}_{h}\) receives the local models \(W^{t}_{goodInGeo}\), it uses its local dataset \(\mathbb{D}_{h}\) to score that local model set for evaluation. Then, the union client \(u^{t}_{h}\) will form a set, called the union client score set (\(UCS\)), which is described as follows. \[UCS_{h}=[sv^{1}_{h},\ldots,sv^{m}_{h},\ldots,sv^{M}_{h}] \tag{5}\]  
where \(sv^{m}_{h}\) represents the evaluation score of the union client \(u^{t}_{h}\) for the local model \(w^{t}_{m}\). After the union client finishes evaluating all local models, it sends the evaluation results \(UCS_{h}\) back to the server. After receiving the evaluation results from all union clients, the server evaluates the quality of the local models. Specifically, each model \(w^{t}_{m}\) will have a set called a train client score set (\(TCS\)). \[TCS_{m}=[sv^{m}_{1},\ldots,sv^{m}_{h},\ldots,sv^{m}_{H}] \tag{6}\]  
After the above process, each local model will have \(H\) scores, and then each local model will have a single score based on the trimmed mean. \[sv^{m}=\frac{1}{(1-2\beta)H}\sum_{x\in TCS^{\beta}_{m}}x \tag{7}\]  
where \(sv^{m}\) is the final score of the local model \(w^{t}_{m}\) by the \(H\) union clients. \(\beta\) is the percentage factor that will be eliminated. \(TCS^{\beta}_{m}\subseteq TCS_{m}\) denotes the set that eliminates the largest scores with the number of \(\beta m\) and the smallest scores with the number of \(\beta m\). Then, according to [34], we quantified the local model quality, and the quality metric score of the \(i\)th local model is described as follows. \[QMS_{m}=\frac{\psi}{log\Big{(}\frac{1}{sv^{m}}\Big{)}} \tag{8}\]  
where \(\psi\) is the number of local model iterations.