# Research into Robust Federated Learning Methods Driven by Heterogeneity Awareness
## 4 Experiment
### Comparative Experiment  
To verify the effectiveness of the proposed method under non-IID heterogeneous conditions, four representative federated learning approaches are selected for comparison. * FedAvg: A basic federated averaging algorithm that does not consider data heterogeneity among clients. * FedProx: Alleviates the model drift caused by heterogeneity by incorporating an additional regularization term in the local optimization process. * FedSAM: Introduces gradient perturbation during optimization to enhance models' robustness against data fluctuations and distributional differences. * FedMOON: Enhances client feature consistency through contrastive learning, effectively combating client drift. On top of these, the proposed method introduces a heterogeneity-aware mechanism. By integrating a composite loss function to model data distribution characteristics and adopting a heterogeneity-weighted aggregation strategy, it significantly improves the stability and generalization of the global model in heterogeneous scenarios. Table 2 summarizes the comparative performance under moderate heterogeneity (Dirichlet \(\alpha\) = 0.5), and Table 3 summarizes the results under high heterogeneity (Dirichlet \(\alpha\) = 0.1). The proposed heterogeneity-aware method (HAD) consistently achieves the best performance across all four datasets, validating its effectiveness and robustness under non-IID conditions. When the heterogeneity is moderate (alpha = 0.5), the proposed method achieves accuracy scores of 67.69% (CIFAR-10), 93.9% (SVHN), 98.62% (MNIST), and 93.73% (NotMNIST), outperforming the traditional FedAvg and FedProx and in some cases surpassing FedSAM and FedMOON, demonstrating superior generalization. Under highly heterogeneous conditions (alpha = 0.1), the method maintains its leading performance, especially on MNIST and NotMNIST, with a high accuracy of 97.41% and 92.86%, respectively, significantly outperforming the other methods. This \begin{table}
\begin{tabular}{c c c c c c c c c c c c c} \hline \hline \multirow{2}{*}{**Method**} & \multicolumn{3}{c}{**CIFAR-10**} & \multicolumn{3}{c}{**SVHN**} & \multicolumn{3}{c}{**MINIST**} & \multicolumn{3}{c}{**NotMINIST**} \\ \cline{2-13}  & **Accuracy** & **Precision** & **Recall** & **Accuracy** & **Precision** & **Recall** & **Accuracy** & **Precision** & **Recall** & **Accuracy** & **Precision** & **Recall** \\ \hline FedAvg & 55.67 & 55.03 & 56.23 & 88.07 & 88.78 & 87.54 & 96.71 & 96.16 & 97.43 & 89.95 & 89.20 & 90.43 \\ \hline FedProx & 56.44 & 56.77 & 55.89 & 76.76 & 77.26 & 76.04 & 93.51 & 93.15 & 94.14 & 86.25 & 86.56 & 85.79 \\ \hline FedSAM & 63.50 & 64.22 & 62.78 & 91.82 & 91.40 & 92.37 & 95.77 & 95.38 & 96.28 & 91.79 & 91.09 & 92.31 \\ \hline FedMOON & 66.54 & 66.19 & 67.33 & 92.71 & 93.04 & 92.21 & 98.28 & 98.88 & 97.91 & 92.44 & 92.00 & 93.01 \\ \hline FedHAD & 67.69 & 67.01 & 68.32 & 93.90 & 94.48 & 93.22 & 98.62 & 98.94 & 98.91 & 93.73 & 94.30 & 93.10 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Performance comparison under heterogeneous settings (alpha = 0.5). \begin{table}
\begin{tabular}{c c c c c c c c c c c c c} \hline \hline \multirow{2}{*}{**Method**} & \multicolumn{3}{c}{**CIFAR-10**} & \multicolumn{3}{c}{**SVHN**} & \multicolumn{3}{c}{**MINIST**} & \multicolumn{3}{c}{**NotMINIST**} \\ \cline{2-13}  & **Accuracy** & **Precision** & **Recall** & **Accuracy** & **Precision** & **Recall** & **Accuracy** & **Precision** & **Recall** \\ \hline FedAvg & 47.63 & 47.12 & 48.13 & 69.65 & 69.08 & 70.30 & 89.16 & 88.95 & 89.89 & 82.33 & 82.91 & 81.59 \\ \hline FedProx & 47.05 & 46.65 & 47.52 & 46.73 & 47.47 & 46.17 & 67.58 & 66.13 & 66.95 & 61.07 & 60.60 & 61.94 \\ \hline FedSAM & 45.94 & 45.83 & 46.57 & 76.81 & 77.34 & 76.11 & 87.67 & 87.87 & 87.41 & 88.67 & 88.90 & 88.21 \\ \hline FedMOON & 50.64 & 51.42 & 51.03 & 83.37 & 83.01 & 83.45 & 96.30 & 96.71 & 95.91 & 92.39 & 92.89 & 93.59 \\ \hline FedHAD & 52.71 & 52.03 & 53.33 & 85.19 & 84.36 & 85.60 & 97.41 & 97.98 & 96.82 & 92.86 & 92.39 & 93.74 \\ \hline \hline \end{tabular}
\end{table}