FedNSAM: Federated Nesterov SAM
- FedNSAM is a federated learning optimizer that integrates global Nesterov momentum with sharpness-aware minimization to harmonize local and global flatness.
- It introduces a flatness distance metric to quantify the mismatch between locally flat solutions and their aggregated global counterpart under non-IID data.
- Empirical evaluations on datasets like CIFAR-100 show that FedNSAM outperforms FedSAM with improved accuracy and communication efficiency.
Searching arXiv for FedNSAM and closely related federated SAM papers to ground the article. FedNSAM is a federated-learning optimizer introduced in “FedNSAM: Consistency of Local and Global Flatness for Federated Learning” (Liu et al., 27 Feb 2026). It addresses a specific limitation of SAM-style federated optimization: under multi-step local updates and high data heterogeneity, flatness obtained on individual clients does not necessarily translate into a flat global solution after aggregation. The method formalizes this mismatch through a flatness distance and modifies local SAM training by introducing global Nesterov momentum into both perturbation estimation and extrapolation. In the paper’s formulation, the objective is not merely to make local losses flat, but to harmonize the consistency of local and global flatness while retaining the generalization-oriented motivation of sharpness-aware minimization (Liu et al., 27 Feb 2026).
1. Problem setting and motivating failure mode
FedNSAM is posed in the standard federated setting with global objective
where is client ’s local loss. The paper focuses on the case in which local client training uses SAM-like updates to search for flatter minima, but the client data are non-IID and local training proceeds for multiple steps between communications (Liu et al., 27 Feb 2026).
The central claim is that, in federated learning, locally flat solutions can be mutually inconsistent. When data are close to IID, client update directions are similar, local flat regions overlap, and the averaged global model may lie in a shared flat region. When data are highly heterogeneous, client updates point in different directions, each client’s flat region can be located differently, and the averaged global model may fall outside those flat regions. In that regime, minimizing the sharpness of local loss surfaces does not ensure flatness of the aggregated model, so the generalization benefit usually associated with SAM can deteriorate (Liu et al., 27 Feb 2026).
This framing places FedNSAM in direct continuity with FedSAM, which applies sharpness-aware minimization as the local optimizer in federated learning (Qu et al., 2022). FedNSAM does not reject SAM’s objective; rather, it argues that the local perturbation direction must be made globally consistent if flatness is to remain meaningful after aggregation under heterogeneity.
2. Flatness distance and the local–global consistency question
To formalize the gap between local and global flatness, the paper defines the flatness distance. If the global model at round is
where is client ’s model after local steps in round , then the flatness distance is
This quantity measures how far the local terminal models are from the aggregated global model (Liu et al., 27 Feb 2026).
The interpretation is geometric and operational. Small 0 means that local models cluster, so their flat regions are closer and global flatness is more plausible. Large 1 indicates that local models are dispersed, so local flat regions differ and the average model is less likely to lie in a flat region. The paper uses this as the key explanation for why FedSAM can be effective under low heterogeneity yet degrade under strong heterogeneity (Liu et al., 27 Feb 2026).
The empirical narrative in the paper follows the same logic. As heterogeneity increases, 2 increases and test performance degrades. The paper explicitly reports that, on CIFAR-100 with ResNet-18, FedSAM’s accuracy drops sharply under stronger heterogeneity, whereas FedNSAM maintains a much smaller flatness distance and substantially better accuracy. This suggests that FedNSAM is best understood not simply as an accelerated SAM variant, but as a method for controlling the mismatch between client-wise flatness and server-side aggregation.
3. Algorithmic mechanism: SAM with global Nesterov momentum
FedNSAM combines SAM’s perturbation-based flatness search with Nesterov momentum, but the crucial modification is that the momentum is global rather than client-local. The server maintains
3
where 4 is the set of selected clients, 5, and 6 is the momentum parameter (Liu et al., 27 Feb 2026).
The paper’s approximation is that the desired global perturbation direction can be estimated through this momentum: 7 This is the conceptual pivot of the algorithm. Standard FedSAM constructs perturbations from local gradients; FedNSAM replaces that with a shared direction derived from server-side momentum, so the perturbation geometry becomes aligned across clients (Liu et al., 27 Feb 2026).
The local update uses a three-stage sequence. First, a Nesterov extrapolation: 8 Second, a SAM-style perturbation along the global momentum direction: 9 Third, a local gradient step evaluated at the perturbed point: 0 After 1 local updates, clients transmit the model drift 2, the server aggregates them, updates 3, and applies
4
The paper emphasizes two consequences: perturbation correction, because client perturbations become globally consistent, and update acceleration, because Nesterov extrapolation improves optimization speed (Liu et al., 27 Feb 2026).
4. Theoretical analysis
The convergence analysis is carried out for non-convex objectives under three standard assumptions: each client loss is 5-smooth,
6
client heterogeneity is bounded,
7
and stochastic gradient variance is bounded,
8
Under a stepsize condition
9
the paper proves a convergence rate and states that it is tighter than the corresponding FedSAM bound because the dominant term scales more favorably with 0, reflecting Nesterov acceleration (Liu et al., 27 Feb 2026).
A second theoretical thread concerns flatness distance itself. The paper provides upper bounds for both FedSAM and FedNSAM and states that FedNSAM achieves a better upper bound. The key technical reason is a perturbation-consistency lemma: 1 for FedNSAM, because the perturbation direction is shared across local steps within a round. In FedSAM, the corresponding term is nonzero and is bounded by a quantity proportional to 2. This is the paper’s main analytical explanation for why local–global flatness mismatch is reduced in FedNSAM (Liu et al., 27 Feb 2026).
The proof strategy introduces a transformed sequence 3, uses smoothness to track descent in 4, and bounds the effects of momentum, stochasticity, and heterogeneity. A plausible implication is that FedNSAM’s advantage is not only better search of flat regions, but more stable propagation of a shared geometry across clients.
5. Empirical evaluation
The experiments are designed to test both optimization speed and generalization under heterogeneous federated learning. On CNNs, the paper evaluates LeNet-5, VGG-11, and ResNet-18 on CIFAR-10 and CIFAR-100. Non-IID splits are generated with Dirichlet heterogeneity levels 5, 6, and 7, where Dirichlet-8 denotes lower heterogeneity and Dirichlet-9 denotes high heterogeneity. The paper reports that, on CIFAR-10 and CIFAR-100 with Dirichlet-0.6 and 100 clients, FedNSAM achieves the best accuracy across all three CNN architectures (Liu et al., 27 Feb 2026).
One reported example is CIFAR-100 with ResNet-18, where the paper gives
- FedNSAM: 66.04%
- FedSAM: 47.83%
The communication-efficiency comparison is similarly explicit. On CIFAR-100 with ResNet-18, FedNSAM reaches 55% accuracy in 316 rounds, whereas FedSAM needs 1000+ rounds. The paper interprets this as evidence of both improved optimization and improved generalization (Liu et al., 27 Feb 2026).
The transformer experiments use Tiny ImageNet with Swin-Small, Swin-Base, and ViT-Base, initialized from ImageNet-22k pre-trained weights. The reported setting is 100 communication rounds, Dirichlet-0.1, 5% participation, batch size 16, and learning rate 0.01 decayed by 0.99. FedNSAM again achieves the best reported accuracies:
- Swin-Small: 70.12%
- Swin-Base: 70.86%
- ViT-Base: 71.23%
It also reaches the target threshold in 67, 42, and 26 rounds, respectively. The paper further studies participation rates of 2%, 5%, and 10%, reporting that FedNSAM remains consistently strong when fewer clients participate and when heterogeneity worsens. This supports the claim that the momentum-based global direction estimate is robust under partial participation (Liu et al., 27 Feb 2026).
6. Position within the federated-learning literature and naming issues
FedNSAM belongs to the line of federated methods that import sharpness-aware minimization into local client optimization. The immediate precursor is FedSAM, introduced as a federated method that replaces local ERM with the SAM min–max objective and, in its base form, is essentially FedAvg with SAM as the local optimizer (Qu et al., 2022). FedNSAM differs by using global Nesterov momentum as the direction of local estimation of client global perturbations and extrapolation, thereby addressing a limitation that the FedNSAM paper identifies in high-heterogeneity regimes.
The name can be confused with other federated methods whose abbreviations begin with “FedN” or “FedS.” It should be distinguished from FedNS, the Newton-sketch method in “FedNS: A Fast Sketching Newton-Type Algorithm for Federated Learning,” which communicates sketched square-root Hessians and targets second-order communication efficiency rather than sharpness-aware flatness consistency (Li et al., 2024). It should also be distinguished from pFedSAM, a personalized federated framework for Segment Anything Model adaptation in medical image segmentation, where “SAM” refers to the foundation model rather than sharpness-aware minimization (Wang et al., 19 Sep 2025).
A recurrent misconception in the broader literature is that local flatness is sufficient for global generalization in federated training. FedNSAM is centered on rejecting that assumption. Its defining contribution is the claim that, in federated learning, flatness is meaningful only if the client-side perturbation and update directions are coordinated strongly enough that the aggregated model remains within the relevant flat region. This suggests that the “N” in FedNSAM refers to the incorporation of Nesterov momentum, though the paper’s substantive contribution is not nomenclature but the consistency of local and global flatness (Liu et al., 27 Feb 2026).