Focus on Where You Aggregate: Restricted SAM for Non-IID Federated Learning

Haotong Wen, Junkang Liu, Yi Xu, Xiao Liu, Longkun Guo, Kewen LiaoNeurIPS 2026

TL;DR

When training machine learning models across distributed devices with wildly different data, averaging their updates often lands the global model in a high-error "trap." Standard methods try to prevent this by smoothing out the error landscape in all directions around each local model—an unfocused and inefficient approach. FedRSAM fixes this by predicting the specific cone-shaped region where the global model is actually headed, focusing its smoothing efforts exclusively where they matter most.

What Problem Does This Paper Address?

Federated Learning (FL) lets devices collaboratively train a shared global model without sharing raw data: devices train locally for a few steps, and a central server averages their parameter updates. However, real-world client data is rarely uniform (it is non-IID). When clients train on vastly different data distributions, their local models wander off in conflicting directions—a phenomenon called client drift.

To make the averaged model more resilient to drift, researchers introduced Sharpness-Aware Minimization (SAM) to FL (e.g., FedSAM). Instead of just finding a low-loss point, SAM looks for a flat neighborhood—a wide, forgiving valley in the loss landscape—by testing worst-case parameter perturbations inside a spherical radius around the local model.

Here is the catch: under severe data heterogeneity, local models drift so far apart that their locally flattened spheres don't overlap with the spot where the server's averaged model actually lands. The global model still falls into a sharp, high-loss canyon between clients. Some recent methods use client-side momentum (historical update trends) to bridge this gap, but when data is heavily skewed, momentum can accumulate biased directions and cause training to completely collapse.

Geometric comparison of FedSAM flattening arbitrary spherical neighborhoods vs. FedRSAM targeting the orange aggregation-relevant cone.

Methods

Instead of flattening a uniform sphere around each client, the authors propose Federated Restricted SAM (FedRSAM), a client-side momentum-free optimizer that restricts SAM's perturbation search to an anticipated aggregation-relevant cone.

Here is how FedRSAM builds and uses that cone at each communication round:

  • The Central Axis: The server calculates the previous global update direction ($\theta^t - \theta^{t-1}$). This serves as the forward-pointing central axis of the cone, predicting the trajectory of the next global model.
  • The Cone Width (Variance Box): The server computes the coordinate-wise variance of the client models from the previous round. Using just the diagonal variance (rather than a massive, intractable full covariance matrix) defines a statistically plausible "spread" around the central axis.
  • Restricted Perturbation Search: During local training, standard SAM takes a gradient ascent step anywhere inside a sphere of radius $\rho$ to find the worst-case loss, then updates the model from there. FedRSAM keeps the outer update step standard, but restricts that inner ascent step: perturbations can only move forward along the central axis and sideways within the bounds of the client variance box, before being scaled to fit the radius $\rho$.

Datasets

The authors evaluate FedRSAM on standard vision and natural language benchmarks, artificially partitioned across clients using a Dirichlet distribution ($\alpha_{\text{dir}} \in \{0.01, 0.1\}$) to simulate severe non-IID data heterogeneity. No new datasets are introduced.

  • Vision: CIFAR-10, CIFAR-100 (trained with LeNet-5 and ResNet-18), and Tiny-ImageNet (trained with ViT-B).
  • Language: Four tasks from the GLUE benchmark—QNLI, MNLI, RTE, and QQP (trained using RoBERTa-Base with LoRA).

Key Insights and Ideas

  • Less global flatness, better global models: Visualizations of the loss landscape reveal a counterintuitive "aha" moment: standard FedSAM actually creates a flatter overall loss surface than FedRSAM. Yet FedRSAM consistently achieves a much smaller aggregation loss gap (the jump in error when local models are averaged). Sacrificing omnidirectional flatness for targeted, directional flatness directly protects the averaged model.
  • Historical constraints beat client momentum: Using past global updates to constrain a search space is much safer than adding them directly to local gradients via momentum. On language tasks (MNLI), tuning client-side momentum in baselines like FedNSAM and FedAdamW above a threshold ($\gamma \geq 0.3$) causes accuracy to plummet from ~78% to ~32%, whereas momentum-free FedRSAM remains stable across hyperparameter sweeps.
Test accuracy on MNLI showing stability of momentum-free FedRSAM compared to momentum-based FedNSAM and FedAdamW.
  • Both parts of the cone matter: Ablation studies show that perturbing only along the historical central axis gets you most of the way there (jumping from 49.79% to 72.04% on CIFAR-10), while perturbing only in the orthogonal residual space flops (51.33%). Combining the axis with variance-bounded residuals yields the best performance (75.01%).

Key Results

FedRSAM outperforms FedAvg, FedSAM, and state-of-the-art momentum/global-flattening baselines across all tested benchmarks while retaining standard $\mathcal{O}(T^{-1/2})$ convergence guarantees:

  • Vision: On CIFAR-10 with ResNet-18, FedRSAM hits 75.01% accuracy, beating FedSAM (64.62%) and crushing FedNSAM (53.21%). On CIFAR-100 (ResNet-18), it reaches 52.51% (+7.26 points over FedNSAM). On Tiny-ImageNet (ViT-B), it achieves 81.55% (+3.91 points over FedNSAM).
  • Language (GLUE): FedRSAM sweeps all four tasks, notably jumping to 81.04% on QNLI (compared to 76.92% for FedNSAM and 51.58% for FedAdamW) and 54.23% on RTE (+3.69 points over FedNSAM).
  • Efficiency Trade-off: Because the server must broadcast the variance vector alongside the model, FedRSAM uses 50% more communication (78.8 GiB vs. 52.6 GiB) and 52% more runtime per round (13.43s vs. 8.81s) than basic FedSAM on MobileNetV2. However, it is faster and more communication-efficient than heavier global-SAM baselines like FedSMOO (15.57s, 184.0 GiB).

Limitations and Future Work

  • Degradation under ultra-sparse participation: In an extreme stress test where only 1% of 500 clients participate per round, the predicted cone's ability to cover the true next aggregation direction ("Hit@10%") drops from 94% (at 10% participation) down to just 7.36%. (Though FedRSAM still edges out FedSAM in accuracy, 9.85% vs. 7.30%).
  • Overhead: Broadcasting coordinate-wise variance increases server-to-client communication and local projection compute compared to vanilla FedAvg or FedSAM.
  • Theoretical scope: The authors' theoretical proof showing that the cone yields a tighter error bound relies on quadratic local objectives and uniform directional sampling, rather than guaranteeing faster convergence rates for optimized perturbations. Future directions are not explicitly discussed in the main text.

Summary updated

Abstract

Federated learning (FL) under heterogeneous data distributions suffers from client drift, particularly with multiple local updates, which undermines the stability of global model aggregation. Existing sharpness-aware minimization (SAM)-based FL methods mitigate this issue by promoting flatter local loss landscapes. However, their spherical perturbation neighborhoods do not explicitly account for the geometry of global parameter aggregation, limiting the benefits of local flattening for the aggregated model. To address this limitation, we propose Federated Restricted SAM (FedRSAM), which promotes aggregation-aware flatness by restricting SAM perturbations to an anticipated aggregation region. Specifically, FedRSAM constructs a cone-shaped region using the previous global update direction and the variance of client updates to capture where subsequent global aggregation is likely to occur. By restricting perturbations to this region, FedRSAM focuses local sharpness-aware optimization on directions most relevant to global aggregation. Theoretically, we establish tighter aggregation-sensitivity error bounds while retaining the convergence guarantee. Extensive experiments across vision and language benchmarks demonstrate the stability and superior performance of FedRSAM under heterogeneous data distributions.
BibTeX
@inproceedings{wen2026focus,
  author = {Haotong Wen and Junkang Liu and Yi Xu and Xiao Liu and Longkun Guo and Kewen Liao},
  title = {{Focus on Where You Aggregate: Restricted SAM for Non-IID Federated Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=hTzdtftVAe},
}
Figure