English

Flatness and Gradient Alignment Are Both Necessary: Spectral-Aware Gradient-Aligned Exploration for Multi-Distribution Learning

Machine Learning 2026-05-11 v1 Computer Vision and Pattern Recognition

Abstract

Sharpness-aware and gradient-alignment methods have been shown to improve generalization, however each family of methods targets a single geometric property of the loss landscape, while ignoring the other. In this paper, we show that this omission is structurally unavoidable and that both flatness and gradient alignment should be considered in multi-distribution learning settings. Specifically, we derive an excess-risk decomposition that yields two additive leading-order terms: (i) an alignment term, controlled by the trace of Hˉ1Σg\bar{H}^{-1}\Sigma_g and (ii) a curvature term, controlled by Hˉ\bar{H}, where Hˉ\bar{H} is the average Hessian and Σg\Sigma_g is the covariance of the gradient across distributions. Notably, Hˉ\bar{H} appears inverted in one and non-inverted in the other. We further show, via a counterexample, that neither quantity bounds the other in general, so no algorithm targeting only one term can guarantee low excess risk. Motivated by this decomposition, we propose SAGE (Spectral-Aware Gradient-Aligned Exploration) that targets both terms. The curvature component replaces SAM's gradient-scaled perturbation with the polar factor of each layer's gradient matrix, computed via Newton-Schulz iteration, so that the ascent step probes all directions with similar magnitude. On the other hand, the alignment component injects isotropic noise at the descent step, the magnitude of which scales with cross-distribution gradient disagreement. Experiments on five domain-generalization and two multi-task learning benchmarks show that the proposed method establishes a new state-of-the-art on DomainBed and acts as a general-purpose improvement to base MTL solvers, remaining competitive with, or even surpassing, state-of-the-art methods.

Keywords

Cite

@article{arxiv.2605.07914,
  title  = {Flatness and Gradient Alignment Are Both Necessary: Spectral-Aware Gradient-Aligned Exploration for Multi-Distribution Learning},
  author = {Aristotelis Ballas and Christos Diou},
  journal= {arXiv preprint arXiv:2605.07914},
  year   = {2026}
}

Comments

Preprint - Submitted to NeurIPS 2026

R2 v1 2026-07-01T12:58:03.515Z