Organizations: College of Intelligence and Computing, Tianjin University, Tianjin, China · College of Management and Economics, Tianjin University, Tianjin, China · Medical College, Tianjin University; Peng Cheng Laboratory, Tianjin, China · School of Artificial Intelligence, Xidian University, Xian, China
In federated learning (FL), multi-step local updates and data heterogeneity usually lead to sharper global minima, which degrades the performance of the global model. Popular FL algorithms integrate sharpness-aware minimization (SAM) into local training to address this issue. However, in the high data heterogeneity setting, the flatness in local training does not imply the flatness of the global model. Therefore, minimizing the sharpness of the local loss surfaces on the client data does not enable the effectiveness of SAM in FL to improve the generalization ability of the global model. We define the flatness distance to explain this phenomenon. By rethinking the SAM in FL and theoretically analyzing the flatness distance, we propose a novel FedNSAM algorithm that accelerates the SAM algorithm by introducing global Nesterov momentum into the local update to harmonize the consistency of global and local flatness. FedNSAM uses the global Nesterov momentum as the direction of local estimation of client global perturbations and extrapolation. Theoretically, we prove a tighter convergence bound than FedSAM by Nesterov extrapolation. Empirically, we conduct comprehensive experiments on CNN and Transformer models to verify the superior performance and efficiency of FedNSAM. The code is available at https://github.com/junkangLiu0/FedNSAM.
Figures & tables
Figure 1. (a) and (b) show the global training loss surface of FedSAM ( Qu et al., 2022 ) under Dirichlet distributions with coefficients of 0.6 (low data heterogeneity) and 0.1 (high data heterogeneity) on CIFAR-100 with ResNet-18. (c) shows the training loss surface of our FedNSAM with Dirichlet-0.1. FedSAM can search global flat minima in low data heterogeneity but fails in high data heterogeneity. (d) suggests that the flat region of the client is closer in low data heterogeneity setting. The global model falls within the flat region. (e) suggests that the flat region of the client is far in high data heterogeneity setting. The global model cannot fall within the flat region. (f) suggests that our FedNSAM draws the flat region between each client closer by alignment correction so that the global model falls within the flat region of each client. FedNSAM ’s global model finds flat minima in (c).
Figure 2. Illustration of flatness distance (left) and global sharpness (right) during federated training on CIFAR100, using Dirichlet distributions with coefficients 0.1, 0.3, and 0.6 across 100 clients and a 10% participation rate. Test accuracies are 40.18%, 46.02%, and 47.83% for FedSAM with Dirichlet-0.1, 0.3, and 0.6 respectively, and 58.53% for FedNSAM with Dirichlet-0.1.
Research work
Perturbation Correction
Updating correction
Acceleration
Less Computation
Com Cost
FedSAM ( Qu et al., 2022 )
×
×
×
×
1 ×
MoFedSAM ( Qu et al., 2022 )
×
✓
×
×
1 ×
FedGAMMA ( Dai et al., 2023 )
×
✓
×
×
2 ×
FedSMOO ( Sun et al., 2023 )
✓
×
×
×
2 ×
FedLESAM ( Fan et al., 2024 )
✓
×
×
✓
1 ×
FedNSAM (ours)
✓
✓
✓
✓
1 ×
Table 1. Summary of federated SAM-based algorithms for addressing data heterogeneity, focusing on perturbation correction, updating correction, acceleration, and extra computation introduced by SAM. Here, perturbation correction is a correction for δi,kt , updating correction is a correction for ∇Fi(θk+1/2t) , and Com Cost denotes the communication cost.
Figure 3. (a) and (b) depict the local update procedures of FedSAM and FedNSAM , respectively. FedNSAM incorporates global Nesterov momentum into local sharpness-aware updates to improve alignment between local and global flatness.
CIFAR10
CIFAR100
Method
LeNet-5
VGG-11
ResNet-18
LeNet-5
VGG-11
ResNet-18
Acc.(%)
Rounds
Acc.(%)
Rounds
Acc.(%)
Rounds
Acc.(%)
Rounds
Acc.(%)
Rounds
Acc.(%)
Rounds
1000R
78%
1000R
80%
1000R
85%
1000R
52%
1000R
53%
1000R
55%
FedAvg
79.63±0.27
574
84.14±0.32
313
88.92±0.24
542
41.15±0.18
1000+
48.94±0.39
1000+
54.25±0.39
1000+
FedAvgM
81.15±0.23
659
83.74±0.11
794
89.05±0.36
656
48.35±0.29
1000+
51.94±0.17
1000+
60.91±0.37
516
SCAFFOLD
79.43±0.33
799
86.94±0.09
272
88.56±0.21
543
50.21±0.35
1000+
50.81±0.28
1000+
54.12±0.15
1000+
Table 2. Comparison of testing accuracy (%) on CIFAR10 and CIFAR100, E=5 , Dirichlet-0.6 respectively.
Figure 4. Convergence plots for FedNSAM and other baselines on Dirichlet-0.6 of CIFAR10 and CIFAR100 with ResNet-18.
Figure 5. Convergence plots for FedNSAM with different λ and ρ , CIFAR100 datasets with ResNet-18.
Data Set
Tiny ImageNet
Model
Swin-Small
Swin-Base
ViT-Base
Param
50M
80M
88M
FLOPs
8.7G
15.4G
55.4G
Acc
Rounds
Acc
Rounds
Acc
Rounds
Method
100R
68%
100R
68%
100R
68%
FedAvg
69.80 ±0.21
100+
67.41
100+
64.64
100+
Table 3. Comparision the accuracy of different Transformer models with Dirichlet-0.1, 5% participation.
Participation Rate
Data Heterogeneity (Dirichlet- α )
Method
p=2%
p=5%
p=10%
α=0.1
α=0.3
α=0.6
Acc
R
Acc
R
Acc
R
Acc
R
Acc
R
Acc
R
FedAvg
51.61 ± 0.35
1000+
51.53 ± 0.12
1000+
54.25 ± 0.39
1000+
45.81 ± 0.19
1000+
52.53 ± 0.15
1000+
54.25 ± 0.39
1000+
FedAvgM
15.72 ± 0.23
1000+
46.63 ± 0.33
1000+
60.91 ± 0.37
516
48.63 ± 0.40
1000+
58.84 ± 0.08
808
60.91 ± 0.37
516
SCAFFOLD
51.93 ± 0.29
1000+
53.64 ± 0.37
1000+
54.12 ± 0.28
1000+
49.02 ± 0.33
1000+
51.92 ± 0.25
1000+
54.12 ± 0.28
1000+
FedACG
54.01 ± 0.16
1000+
61.94 ± 0.26
506
61.92 ± 0.31
521
53.56 ± 0.34
1000+
60.87 ± 0.12
425
61.92 ± 0.31
521
Table 4. Comparison of testing accuracy (%) and convergence rounds on CIFAR100 ( E=5 ) for different participation rates (left) and different data heterogeneity levels (right).
Figure 6. Convergence plots of FedNSAM and baselines on CIFAR100 with ResNet-18 under different heterogeneity (a,b) and participation rates (c,d).
Figure 7. Global training loss surfaces plots (a,b,c,d,e,f) and global testing loss surfaces plots (g,h,i,j,k,l) for FedNSAM and other baselines in different settings on Dirichlet-0.1 of CIFAR100 datasets with ResNet-18. FedNSAM could approach a more general and flat loss landscape which efficiently improves the generalization performance in FL.
CIFAR100
Method
Dirichlet-0.1
Dirichlet-0.6
Acc
Rounds
Acc
Rounds
1000R
55%
1000R
55%
FedAvg
45.81 ±0.35
1000+
54.25 ±0.19
1000+
FedNSAM
58.53 ±0.27
695
66.04 ±0.22
316
SCAFFOLD
49.02 ±0.29
1000+
54.12 ±0.40
1000+
Table 5. Comparison different data heterogeneity of testing accuracy (%) of ablation on variants on CIFAR100.
CIFAR100
Method
Dirichlet-0.1
Dirichlet-0.6
Acc
Rounds
Acc
Rounds
1000R
55%
1000R
55%
FedAvg
45.81 ±0.32
1000+
54.25 ±0.15
1000+
FedAvg+Nesterov
54.23 ±0.28
1000+
60.26 ±0.39
512
FedSAM
40.18 ±0.27
1000+
47.83 ±0.09
1000+
Table 6. Comparison different data heterogeneity of testing accuracy (%) of each algorithm with Nesterov on CIFAR100.
Sharpness-aware minimization (SAM) is an effective method for improving the generalization of federated learning (FL) by steering local training toward flat minima. Under data heterogeneity, however, device-side SAM searches for locally flat basins that are incompatible with the flat region preferred by the global objective. We identify this structural failure mode as flatness incompatibility, which explains why improving local flatness alone may provide limited training and generalization improvement for the global model. We reveal that flatness incompatibility arises from data heterogeneity and the friendly adversary phenomenon, and is further amplified by local updates and partial device participation. To mitigate this issue, we propose Federated Learning with variance-suppressed sharpness-aware minimization (FedVSSAM), which constructs a variance-suppressed adjusted direction and uses it consistently in local flatness search, local descent, and global update. FedVSSAM anchors both perturbation and update directions to a more stable global direction, instead of correcting only an isolated local perturbation. We establish non-convex convergence guarantees of FedVSSAM and prove that the mean-square deviation between the adjusted direction and the global gradient is effectively controlled. Experiments demonstrate that FedVSSAM mitigates flatness incompatibility and outperforms the baselines across diverse FL settings.
Bingnan Xiao, Yuan Gao, Bingcong Li +3
Fudan University · ETH Zurich · Edith Cowan University +1
Federated Learning (FL) enables decentralized training without data sharing, but suffers from statistical heterogeneity across clients, leading to client drift, poor generalization, and sharp minima compared to centralized training. Sharpness-Aware Minimization (SAM) has emerged as a promising approach to improve generalization, yet its application in federated learning still suffers from divergence problems, since perturbations are computed locally and reflect client-specific loss geometries. To better understand this issue, we provide experimental evidence from a new perspective, the frequency domain, for SAM perturbations in federated settings, revealing that inter-client perturbation inconsistencies are predominantly concentrated in the low-frequency spectrum. Motivated by this insight, we propose Federated learning with Frequency-domain Filtering of SAM perturbations (FedFFT). It is a lightweight and plug-and-play method that filters out low-frequency components of SAM perturbations without requiring additional communication, thereby suppressing inconsistent components in client updates while preserving consistent learning signals. Extensive experiments across multiple benchmarks and diverse backbones demonstrate that FedFFT consistently outperforms SAM-based FL methods, particularly under severe non-IID distributions. These results highlight the effectiveness, scalability, and general applicability of our frequency-domain perspective for sharpness-aware federated optimization.
Liyang Yuan, Yibo Yang, Dandan Guo
School of Artificial Intelligence, Jilin University, Changchun, China · King Abdullah University of Science and Technology, Saudi Arabia
Federated learning (FL) commonly involves clients with diverse communication and computational capabilities. Such heterogeneity can significantly distort the optimization dynamics and lead to objective inconsistency, where the global model converges to an incorrect stationary point potentially far from the pursued optimum. Despite its critical impact, the joint effect of communication and computation heterogeneity has remained largely unexplored, due to the intrinsic complexity of their interaction. In this paper, we reveal the fundamentally distinct mechanisms through which heterogeneous communication and computation drive inconsistency in FL. To the best of our knowledge, this is the first unified theoretical analysis of general heterogeneous FL, offering a principled understanding of how these two forms of heterogeneity jointly distort the optimization trajectory under arbitrary choices of local solvers. Motivated by these insights, we propose Federated Heterogeneity-Aware Client Sampling, FedACS, a universal method to eliminate all types of objective inconsistency. We theoretically prove that FedACS converges to the correct optimum at a rate of O(1/R), even in dynamic heterogeneous environments. Extensive experiments across multiple datasets show that FedACS outperforms state-of-the-art and category-specific baselines by 4.3%-36%, while reducing communication costs by 22%-89% and computation loads by 14%-105%, respectively.
Shudi Weng, Chao Ren, Ming Xiao +1
Division of Information Science and Engineering, School of Electrical Engineering and Computer Science (EECS), KTH Royal Institute of Technology, 11428 Stockholm, Sweden