Seeking Consistent Flat Minima for Better Domain Generalization via Refining Loss Landscapes

Aodi Li, Liansheng Zhuang, Xiao Long, Minghong Yao, Shafei Wang

Abstract

Domain Generalization (DG) aims to train models on a set of source domains such that they perform well on unseen target domains. While seeking "flat minima" has proven effective for generalization, standard methods often fail to account for domain shifts that cause loss landscapes to be inconsistent across domains. This paper introduces Self-Feedback Training (SFT), a framework that synchronizes the geometry of training domains by iteratively refining the loss landscape using dynamic soft labels. SFT ensures that the identified flat minima are consistent across domains, leading to superior generalization on diverse benchmarks.

Introduction: The Challenge of Inconsistent Loss Landscapes

In machine learning, the geometry of the loss landscape—the mathematical surface representing the error function—is a key indicator of generalization. Specifically, "flat minima" (regions where the loss remains low despite small weight perturbations) are generally preferred over "sharp minima." However, in Domain Generalization (DG), the presence of domain shift introduces a significant complication: a minimum that is flat in one domain may be sharp or high-loss in another.

Figure 1: Comparison of inconsistent loss landscapes (left) versus aligned, consistent flat minima (right) across multiple domains.

Existing sharpness-aware methods often find flat regions for the training data that do not translate to the test domain because the "valleys" of the loss function do not align. If the optimization process does not account for this geometric inconsistency, the model may converge to a solution that is brittle under distribution shift.

Methods: Self-Feedback Training (SFT)

To address this, the authors propose Self-Feedback Training (SFT), an iterative two-phase framework designed to align the loss landscapes of different domains.

1. The Feedback Phase

The training domains are randomly partitioned into "training" and "held-out" subsets. The framework measures the inconsistency between their respective loss landscapes by calculating the discrepancy in their sharpness. This discrepancy serves as a feedback signal, indicating how well the current optimization state generalizes geometrically across domains.

2. The Refinement Phase

The core innovation of SFT is the landscape refiner, which adjusts the loss landscape from a label-based perspective. Rather than modifying the model architecture, the refiner generates dynamic soft labels. These labels are optimized using a novel Projection Cross-Entropy (PCE) loss, which effectively "sculpts" the loss surfaces to be both flatter and more similar to one another. By moving away from rigid one-hot labels, the framework allows the model to discover a smoother, more invariant optimization path.

Experimental Evaluation

The researchers evaluated SFT using the DomainBed benchmark, covering a wide array of datasets including PACS, VLCS, OfficeHome, TerraIncognita, and DomainNet. The framework was tested across multiple backbones, including ResNet-50 and Vision Transformers (ViT-B/16, ViT-L/14).

Results and Visualization

SFT consistently outperformed both standard Empirical Risk Minimization (ERM) and Sharpness-Aware Minimization (SAM). On ResNet-50, SFT achieved an average accuracy of 67.1%, a 2.6% improvement over SAM. On ViT-B/16, it reached 77.8%, and on ViT-L/14, it achieved a state-of-the-art 81.2%.

Figure 2: 2D loss surface visualizations across four domains. SFT transforms jagged, mismatched landscapes (top row) into smooth, aligned valleys (bottom row) where the optimal point (+) is robust across all domains.

The visualization of 2D loss surfaces confirms that SFT successfully aligns the geometry of different domains. As shown in Figure 2, the jagged and inconsistent landscapes of the baseline are replaced by smooth, synchronized valleys, ensuring that the converged parameters reside in a region that is low-loss and flat for all training domains simultaneously.

Conclusion

This work demonstrates that flatness alone is insufficient for robust domain generalization; consistency of the loss landscape geometry is equally critical. By leveraging dynamic soft labels to refine these landscapes, SFT provides a powerful mechanism for finding truly invariant features. Future work will explore integrating SFT with advanced SAM variants and further investigating the theoretical foundations of label-based landscape refinement.

Summary updated

BibTeX
@inproceedings{li2025seeking,
  author = {Aodi Li and Liansheng Zhuang and Xiao Long and Minghong Yao and Shafei Wang},
  title = {{Seeking Consistent Flat Minima for Better Domain Generalization via Refining Loss Landscapes}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.01430},
}
Figure