Beyond Average Flatness: Domain-wise Flatness for Domain Generalization
Seungjun Choi, Heeyoung Kim
NeurIPS 2026
TL;DR. Average-loss SAM can hide domain-wise sharpness through sharpness cancellation caused by misaligned dominant Hessian eigenvectors ; CGM promotes domain-wise flatness by penalizing average domain-wise sharpness while discouraging sharpness-imbalance.
Abstract. Sharpness-Aware Minimization (SAM) is widely used in domain generalization to promote flat minima that generalize to unseen distributions. Existing SAM-based methods typically penalize the sharpness of the average loss across domains. We show that this prevailing formulation—termed AvSAM—has a fundamental geometric limitation: it can favor solutions with misaligned domain-wise dominant Hessian eigenvectors. As a result, such solutions may appear flat on average while remaining sharp within individual domains. To address this limitation, we propose an alternative objective that penalizes the average domain-wise sharpness. We show that this objective decomposes into the AvSAM objective plus a non-negative residual term, which we call the Cancellation Gap. This gap is minimized if and only if the domain-wise dominant eigenvectors are aligned up to sign, indicating that it mitigates AvSAM's tendency to favor misaligned solutions. However, we further uncover a degeneracy: the Cancellation Gap can become small without improving alignment when sharpness is highly imbalanced across domains. To mitigate this failure mode, we propose Cancellation Gap Minimization (CGM), which augments the objective with a squared coefficient-of-variation () regularizer to discourage sharpness imbalance. Experiments show that CGM achieves the best average performance across standard domain generalization benchmarks among strong baselines. Diagnostic analyses further confirm reduced domain-wise sharpness and improved alignment of dominant Hessian eigenvectors.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (poster) · 3 reviews · OpenReview
Updated 25 Nov 2026, 03:47 UTC.
- Decision
- Accept (poster)
Read decision
Meta-review
Reviewers appreciated the rigorous "Cancellation Gap" theory and diagnostic clarity. To increase the likelihood of acceptance, please focus your rebuttal on these questions raised by multiple reviewers:
-
DRO/VREx Contrast (Reviewers H41F, gann): Please clarify how CGM conceptually and analytically differs from Group DRO and VREx risk-variance penalties.
-
Optimization Stability (Reviewers H41F, gann): Please explain the training failure when omitting InSAM warm-up (), and clarify the practical impact of the clipping heuristic.
I also encourage the authors to address the additional questions posed by individual reviewers.
Final justification
After rebuttal and further discussion, comparisons to previous methods have been clarified and other concerns have been positively addressed. Reviewers are all in favor of acceptance.
Read meta-review
Meta-review
Reviewers appreciated the rigorous "Cancellation Gap" theory and diagnostic clarity. To increase the likelihood of acceptance, please focus your rebuttal on these questions raised by multiple reviewers:
-
DRO/VREx Contrast (Reviewers H41F, gann): Please clarify how CGM conceptually and analytically differs from Group DRO and VREx risk-variance penalties.
-
Optimization Stability (Reviewers H41F, gann): Please explain the training failure when omitting InSAM warm-up (), and clarify the practical impact of the clipping heuristic.
I also encourage the authors to address the additional questions posed by individual reviewers.
Final justification
After rebuttal and further discussion, comparisons to previous methods have been clarified and other concerns have been positively addressed. Reviewers are all in favor of acceptance.
1 comment
- Rating
- 5/6
- Confidence
- 3/5
- Quality
- 4/4
- Clarity
- 3/4
- Significance
- 4/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper focuses on the flaw in the Sharpness-Aware minimization in the domain generalization setup. Previous approaches, such as AvSAM, average the loss across the domain before the SAM is applied, which causes domain-wise sharpness cancellation. The paper formulates this as Cancellation gap in the proposed method, and the naive fix(InSAM) causes the model to learn a degenerate solution through sharpness imbalance. To counter this, CGM is introduced, which adds a squared coefficient-of-variation regulariser to enforce balanced flatness across domains. The method is well-backed by theory, and some gains in the benchmark dataset also validate the proposed method.
Strengths and weaknesses
Strength
- The theoretical contribution is rigorous. There is clear progession on the method throught the paper.
- The validation in Table 2 is a strong indication that the empricial results are in line with the theory of proposed method.
- The CV2 regulariser is scale-invariant by construction, this ensures there no confusion between absolute sharpness magnitude with imbalance.
- Evaluation follows DomainBed protocol strictly, which is the correct standard for DG comparisons.
Weakness
- Even though the proposed method is clean and the theoretical contribution is substantial, the gains in the benchmark is quite modest. So it may not justify the added complexity of tuning alpha and the CV2 term.
- VREx[1] penalises variance in domain-wise risk, which is conceptually related to the CV2 penalty. The paper should explicitly discuss whether CGM's CV2 term subsumes or complements the variance penalties in VREx and why spectral misalignment is right direction for this problem rather than distributional shift.
- The ablation study for gammav(warm-up ratio) in Figure 3 reveals that CGM requires a substantial warm-up phase (30% to 60% of training) using InSAM before turning on the CV2 penalty. This suggests that the CV2 objective is highly unstable or detrimental during the early phases of training. [1] Krueger, David, et al. "Out-of-distribution generalization via risk extrapolation (rex)." International conference on machine learning. PMLR, 2021.
Questions
- Figure 3 shows a significant performance drop if CGM is applied without a substantial InSAM warm-up (gamma < 0.2). Could you elaborate on the exact mechanism causing this failure mode?
- Following up on the conceptual similarity to VREx that I have mentioned, could the authors provide an analytical comparison between the gradient of the CV2 sharpness penalty and the gradient of the risk variance penalty in VREx?
- Given the acknowledgment towards the end of the paper that symmetric domain treatment is a limitation, did you observe any instances during benchmark evaluations where a particularly noisy or difficult source domain hijacked the CV2 optimization, bringing down overall target performance?
Limitations
Yes
Final justification
I recommend Accept. The VREx comparison meaningfully distinguishes CGM's sharpness-based modulation from VREx's risk-based reweighting, and no raised weakness challenges the core theoretical claim, which remains well-supported by the AvSAM to InSAM to CGM progression.
Formatting concerns
None
3 comments
Rebuttal
Thank you for your careful review of our paper and for the insightful and constructive comments. Please find our detailed answers to your comments below.
<Responses to "Weaknesses" and “Questions”>
Q1&W3 — Why does CGM performance degrade when the warm-up ratio is too small ?
We thank the reviewer for this important question. We believe the drop under small warm-up ratios occurs because CGM activates sharpness-dependent coefficient modulation before the sharpness estimates are reliable.
CGM computes from estimated domain-wise sharpness. Early in training, the model is far from the local regime considered in our analysis, and these estimates can be noisy or confounded by transient optimization difficulty. Applying CGM too early may therefore assign inappropriate interpolation weights between the standard gradient and the perturbed SAM gradient.
The InSAM warm-up avoids this premature domain-dependent modulation by applying the same update rule to all domains. After sufficient warm-up, the model is closer to the local loss-landscape regime, where domain-wise sharpness better reflects the geometric quantities in our analysis. At this stage, the regularizer becomes more meaningful because it targets the sharpness-dominance shortcut that can arise when minimizing the Cancellation Gap.
This is consistent with Fig. 2: sharpness dominance becomes more pronounced during training, and CGM suppresses this dominance relative to InSAM while maintaining a small Cancellation Gap. Thus, warm-up delays sharpness-imbalance regularization until the coefficient estimates are more stable and the bad shortcut becomes relevant.
Q2&W2 — What is the relation between V-Rex and CGM’s term?
We thank the reviewer for this important question. We agree that this relationship was not discussed sufficiently in the main paper, and we appreciate the opportunity to clarify it.
Philosophical distinction
V-REx and CGM are similar in form because both penalize dispersion across domains, but they differ in what is being regularized and why. V-REx penalizes the variance of domain risks, since risk similarity is central to its robustness/invariance principle: under its assumptions, making risks similar across domains discourages reliance on non-invariant predictors.
In contrast, CGM does not aim to equalize domain losses, nor does it treat perfect balance of domain-wise sharpness as an end goal. The main flatness objective remains the average domain-wise sharpness, . The term is introduced as a soft guardrail against the bad shortcut in Theorem 3.4, where the Cancellation Gap becomes small without improving directional alignment. Thus, CGM only needs to mitigate severe sharpness imbalance, not enforce identical sharpness across domains.
This is also reflected in Table 3: CGM reduces average domain-wise sharpness and lowers sharpness on relatively sharper source domains, but the resulting source-domain sharpness values are not equalized. This distinction matters because strict sharpness equality may be undesirable when domains have different intrinsic difficulties, as discussed in our limitations.
Technical distinction
Let denote the empirical risk/loss of domain , and let . A V-REx-style objective can be written as
The gradient of the variance penalty is
Thus, V-REx directly modifies the weights of domain-wise risk/loss gradients according to deviations in domain empirical risks/losses. Equivalently, the full gradient can be written as
In contrast, CGM applies the dispersion penalty to SAM-based domain-wise sharpness estimates, not to domain risks. Let
Using the stopped-gradient denominator for , the gradient of the CGM sharpness-dispersion penalty is approximately
Under the standard SAM first-order approximation,
Therefore, the CGM update becomes
where
This shows the key technical difference. V-REx reweights the domain risk/loss gradients according to domain-risk deviations. CGM instead modulates the SAM correction according to domain-wise sharpness deviations. Thus, sharper-than-average domains receive a more flatness-oriented SAM update, while flatter domains rely more on the standard gradient. In addition, CGM uses a scale-normalized penalty on sharpness values, with the denominator stopped in practice to avoid reducing the penalty by increasing mean sharpness.
Why spectral misalignment?
We also address the latter part of W2, which asks why we focus on spectral misalignment rather than distributional shift itself. Many DG methods address distribution shift through feature-level alignment, such as DANN or CORAL, or through risk/loss/gradient-level criteria, such as V-REx and Fish. SAM-based DG methods motivate a complementary loss-geometry perspective, where parameter-space flatness can affect OOD generalization. From this perspective, the relevant failure is the emergence of flat-on-average yet sharp-per-domain solutions.
In the local quadratic regime, average-loss sharpness depends not only on how sharp each domain is, but also on how domain-wise top-curvature directions interact under averaging. If these directions are severely misaligned, domain-specific sharpness can be canceled in the average loss, producing flat-on-average yet sharp-per-domain solutions. This is precisely the failure mode of AvSAM identified by our theory.
Therefore, spectral misalignment is the relevant object for our analysis because it directly captures this SAM-specific sharpness cancellation mechanism. Distributional shift may be the underlying reason why different domains induce different loss landscapes, but the immediate optimization-geometric failure we address is the misalignment of domain-wise sharp directions. Thus, our perspective is complementary to distributional-shift and risk-level approaches, rather than a replacement for them.
Q3 — Did a noisy or difficult source domain hijack the optimization?
We did not observe a clear benchmark-level case where a single noisy or difficult domain hijacked the optimization and degraded target performance. We believe this is because, as explained in Q2, the regularizer does not enforce equal sharpness across domains, but instead serves only as a guardrail against the bad shortcut. Had it enforced equal sharpness, differences in domain difficulty even at the benchmark level might have caused hijacking. That said, we agree that this concern is realistic in more heterogeneous settings. Our experiments involve standard benchmarks with 3-5 source domains, and we cannot rule out different behavior in large-scale practical DG settings with many noisy or highly imbalanced domains. In such cases, priority- or difficulty-aware variants of CGM may be needed, and we view this as an important future direction.
W1 — The performance gains in the benchmarks are modest.
We agree that the gains over the strongest prior baselines are numerically modest, especially given the strength of recent SAM-based DG methods. However, our contribution is not limited to final accuracy, but also includes the theoretical identification of a failure mode in average-loss SAM and its diagnostic validation.
Although methods such as FAD, SAGM, and DISAM perform strongly on individual datasets, CGM is the only compared method that remains consistently competitive across all benchmarks, resulting in the best overall average performance. Moreover, the empirical results follow the progression predicted by our analysis: AvSAM InSAM improves performance by replacing average-loss sharpness with average domain-wise sharpness, while InSAM CGM further improves performance by suppressing the sharpness-dominance shortcut. The diagnostics support the same mechanism through reduced average domain-wise sharpness, lower sharpness dominance, and improved spectral alignment.
The baseline results in Table 1 were taken from their respective papers and are therefore not paired across seeds. To quantify the performance gap more directly, we will rerun SAGM—the second-best method on average, with publicly available code following the standard DomainBed protocol—and CGM in the same environment using identical seeds. We will report the paired per-seed differences and corresponding statistical analysis in the revision.
Thus, while the absolute gains are modest, we hope the reviewer will also consider CGM’s consistency across benchmarks and the agreement between the theory, the AvSAM InSAM CGM progression, and the diagnostic evidence.
I thank the authors for the rebuttal. I recommend Accept. The rebuttal strengthens the paper's core contribution, i.e. the gradient-level comparison to VREx shows CGM modulates the SAM perturbation via sharpness deviation, while VREx reweights risk gradients via risk deviation, meaningfully distinguishing the two. None of the raised weaknesses challenge the central theoretical claim (the Cancellation Gap and the AvSAM failure mode), and the theory-to-diagnostic-to-empirical progression (AvSAM to InSAM to CGM) validated in Table 2 remains intact.
Dear Reviewer gann,
Thank you very much for your thoughtful follow-up and recommendation for acceptance. We are particularly grateful that our rebuttal clarified the distinction between CGM and V-REx, and that you found the central Cancellation Gap analysis and the AvSAM InSAM CGM theory–diagnostic–empirical progression to remain well supported. Your questions regarding V-REx and the warm-up mechanism helped us sharpen both the conceptual positioning and the practical interpretation of CGM. We will incorporate these clarifications into the revised manuscript. We sincerely appreciate your careful engagement with our work.
Best regards,
The Authors
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper tackles domain generalization (DG) by exposing a geometric weakness in AvSAM, the dominant paradigm that applies Sharpness-Aware Minimization to the average loss across source domains. The central observation is that AvSAM can converge to solutions where individual domain loss landscapes remain sharp, but these per-domain sharpness contributions cancel under averaging — producing minima that look flat on average but are poorly robust within each domain. To formalize this, the authors introduce a spectral alignment score and define the Cancellation Gap as the discrepancy between average domain-wise sharpness and average-loss sharpness. Building on this, they propose Individual-domain SAM (InSAM) as a corrective objective, then go further to identify a degeneracy they call the "bad shortcut": the Cancellation Gap can collapse not through genuine alignment improvement but through sharpness becoming dominated by a single domain. Their final method, Cancellation Gap Minimization (CGM), addresses this by augmenting InSAM with a squared coefficient-of-variation regularizer over domain-wise sharpness. Experiments on five DomainBed benchmarks show CGM achieves the strongest average performance among SAM-based baselines, supported by diagnostic analyses tracking per-domain sharpness, spectral alignment, and sharpness CV².
Strengths and weaknesses
Strengths:
- The paper's core theoretical insight is genuinely non-trivial. Showing that AvSAM's sharpness penalty is lower-bounded by a term governed by spectral alignment, and that this creates an implicit bias against well-aligned solutions, gives a principled explanation for a failure mode that practitioners may have noticed but lacked the language to articulate. The exact decomposition of InSAM as AvSAM plus the non-negative Cancellation Gap, together with the necessary-and-sufficient zero-gap characterization in Theorem 3.3, makes the theoretical contribution cleanly self-contained.
- What I find particularly credible about this work is the treatment of the bad shortcut in Theorem 3.4. Rather than presenting InSAM as a complete solution, the authors actively probe their own objective and surface a meaningful failure case, that sharpness imbalance, not misalignment, can drive the gap toward zero. This kind of self-critical analysis is rare and meaningfully strengthens the motivation for CGM's CV² regularizer.
- The diagnostic evaluation also goes beyond what is typical in DG papers. Tracking spectral alignment scores, per-domain sharpness, and sharpness dispersion alongside benchmark accuracy gives the reader a more grounded account of why CGM works, not just that it does. This mechanistic transparency makes the empirical section substantially more convincing than accuracy tables alone.
Weaknesses:
- The theoretical results rest heavily on the local quadratic approximation in Eq. 7, which requires the domain-wise Hessians to be positive semidefinite in a neighborhood of the joint minimizers in Θ*. This is a standard assumption in loss-landscape analyses, but it is non-trivial in practice, particularly near saddle points or in regimes where the loss surface is non-convex within the perturbation radius ρ. The paper offers no empirical check that these conditions hold during training on the benchmarks tested, leaving open the question of how much the theoretical guarantees actually inform the practical behavior of CGM.
- A related concern involves the clipped coefficient c̄ᵢ introduced in Eq. 14. The authors are transparent that this is a heuristic stabilization rather than the true gradient of the surrogate objective, but they stop short of characterizing how much it changes the optimization trajectory. It would be helpful to know how often clipping is actually active across training runs, and whether CGM's performance degrades meaningfully when clipping is disabled. As it stands, it is unclear whether the algorithm can reliably optimize the learning objective.
- On the empirical side, the margin over the strongest prior baseline is narrow, CGM improves over SAGM by 0.5 points on average, and on PACS the difference falls within one standard error of both SAGM and DISAM. Given the additional theoretical machinery and the three extra hyperparameters introduced (α, ρ, and the warm-up ratio γ), this modest gain warrants scrutiny. The paper would benefit from a paired statistical analysis across seeds rather than relying on standard error overlap as an informal test.
- Finally, the hyperparameter sensitivity of CGM is not adequately characterized. The CV² penalty coefficient α is sampled over a 1.5 log-decade range, and no ablation over α, ρ, or γ appears in the main text. Since the CV² term is scale-invariant by design, the role of α is theoretically curious; it is not obvious what it controls beyond trading off the imbalance penalty against the InSAM objective. An ablation isolating each component's contribution would clarify whether the gains are robust or contingent on careful tuning.
Questions
-
The proposed CGM method aims to up-weight the sharp domain and down-weight the flat domains, which is quite similar to domain-reweighting methods, such as importance-weighted ERM and distributionally robust optimization (DRO), as discussed in:
- [1] Robust generalization against photon-limited corruptions via worst-case sharpness minimization, in CVPR 2023.
- [2] Sharpness-aware Minimization for Worst Case Optimization.
Could the authors clarify the relationship between CGM's sharpness-based reweighting and existing DRO formulations, particularly group DRO? Is the CV² regularizer equivalent to, or strictly stronger than, some form of minimax or variance-penalized objective over domains?
-
CGM requires a forward pass, perturbation, and perturbed forward pass for each domain per iteration, a cost that scales linearly in D. DomainNet uses D=6 domains and is already the most expensive benchmark tested. How does CGM perform relative to baselines when D is substantially larger (e.g., D=20–50, as arises in some practical DG settings)? Does the CV² regularizer remain effective at larger D?
Limitations
Yes.
Final justification
The rebuttal has been effective: the authors have demonstrated that CGM introduces only modest computational overhead, remains substantially more memory-efficient than AvSAM as the number of domains increases, and provides additional empirical evidence supporting their theoretical assumptions.
Formatting concerns
NA
3 comments
Rebuttal
Thank you for your careful review of our paper and for the insightful and constructive comments. Please find our detailed answers to your comments below.
<Responses to "Weaknesses" and “Questions”>
Q1 — How does CGM's sharpness-based reweighting relate to group DRO, V-REx, and standard domain reweighting?
We appreciate the opportunity to clarify this distinction. Although CGM also addresses cross-domain imbalance, it differs from group DRO and V-REx in both what it regularizes and why.
Different quantity and purpose
Group DRO and V-REx operate at the level of domain/group risks: group DRO minimizes the worst-domain/group risk, while V-REx penalizes variance across domain risks. In contrast, CGM's penalty is applied to domain-wise sharpness values, not to risks.
The role of balance is also different. In V-REx, risk similarity is central to the robustness/invariance principle; in group DRO, the objective directly targets worst-domain robustness. In CGM, however, sharpness balance is only a soft guardrail against the bad shortcut. The main flatness objective remains the average domain-wise sharpness, and the term only needs to prevent severe sharpness dominance. It does not require all domains to have identical sharpness. This is reflected in Table 3: CGM reduces average domain-wise sharpness and lowers sharpness on relatively sharper domains, but the resulting source-domain sharpness values are not equalized.
Direct comparison with group DRO
At the update level, CGM is also different from group DRO or standard domain reweighting. Group DRO can be written as a minimax or simplex-weighted risk objective, so it directly changes the weights of domain loss gradients and emphasizes high-risk domains. By contrast, CGM keeps the domain averaging uniform and does not directly up-weight the loss . The coefficient is not a simplex weight over domains; instead, it interpolates within each domain between the standard gradient and the SAM gradient (Eq.13). Thus, sharper domains are not simply assigned larger loss weights; rather, they receive a more SAM gradient, while flatter domains rely more on the standard gradient.
It is also useful to distinguish the notion of “worst case.” In group DRO, the worst case is the worst-performing domain/group. In CGM, the worst case comes from SAM: for each domain, sharpness is the worst-case loss increase under a local perturbation in parameter space. CGM does not perform worst-domain selection. Although is a domain-level dominance measure, it is used in our theory to characterize a bad shortcut; the actual method regularizes , a smooth surrogate that mitigates severe sharpness dominance without introducing a non-smooth max-domain objective.
Direct comparison with V-REx
Due to space limitations, please see our response to Reviewer gann, Q2.
Q2 — How does CGM scale as increases?
Under a fixed total batch size, AvSAM, InSAM, and CGM have comparable theoretical model FLOPs. However, CGM and InSAM require multiple domain-wise forward/backward passes, so the reviewer’s concern is valid.
To isolate the scaling cost, we conducted a controlled stress test on PACS. Since PACS has only three source domains, we sampled a batch of size from each domain and split it into sub-batches of size , yielding domain-wise updates. These sub-batches simulate additional computational units, not heterogeneous domains. We measured median update time (s) and peak memory (GiB) on an RTX A6000, excluding data loading and augmentation; parentheses report ratios relative to AvSAM at the same .
| Method | |||
|---|---|---|---|
| AvSAM time / memory | 0.368 (1.00) / 8.46 (1.00) | 1.085 (1.00) / 24.6 (1.00) | 1.809 (1.00) / 40.8 (1.00) |
| InSAM time / memory | 0.383 (1.04) / 3.54 (0.42) | 1.149 (1.06) / 4.70 (0.19) | 1.922 (1.06) / 5.86 (0.14) |
| CGM time / memory | 0.386 (1.05) / 3.54 (0.42) | 1.160 (1.07) / 4.70 (0.19) | 1.940 (1.07) / 5.86 (0.14) |
The results show that CGM maintains a stable overhead of only - relative to AvSAM and is nearly identical to InSAM, indicating negligible additional cost from the computation. It is also substantially more memory-efficient: at , AvSAM uses 40.75 GiB, whereas InSAM and CGM use 5.86 GiB through sequential domain-wise processing. Beyond , AvSAM runs out of memory, while InSAM and CGM remain feasible. Thus, domain-wise processing incurs modest latency overhead but provides substantial memory savings and may facilitate parallel or distributed implementations.
However, computational feasibility alone does not answer whether update quality remains unchanged for - truly heterogeneous domains. We view this as an important future direction. If update quality degrades as grows, scalable variants could cluster domains by representation or gradient similarity and apply CGM at the cluster level.
W1 — Practical validity of the assumption
We conducted an additional diagnostic on the PACS A/C/P S split. During 5,000 InSAM iterations, we measured how often all source-domain gradient norms were simultaneously below a threshold . We analyze InSAM because it is used during CGM’s warm-up phase.
| Fraction with | |
|---|---|
| 1 | 62.88% |
| 0.1 | 18.36% |
| 0.01 | 0.46% |
| 0.001 | 0.00% |
For a ResNet-50 with about 25 million parameters, gradient norms of and correspond to typical per-parameter gradient magnitudes of roughly and in the root-mean-square sense, respectively. This diagnostic partially supports approximate joint stationarity but does not verify psd hessian geometry. We will clarify this conditional scope of the theory. Although indirect, the warm-up ablation supports this interpretation: CGM performs best when activated after warm-up, suggesting that its sharpness-based modulation becomes more reliable as training approaches a locally stationary regime.
W2 — Authors should clarify practical impact of the clipping heuristic.
We thank the reviewer for the opportunity to clarify the role of clipping. We use to keep CGM interpolative between the standard and perturbed SAM gradients: extrapolates beyond the SAM gradient, whereas reverses the SAM correction. We analyzed the raw coefficients on the PACS A/C/P S split after the 20% warm-up phase (). Because whenever a domain is sharper than average, upper clipping is expected by construction. We therefore report the frequencies of , , and , where lower clipping is the more informative indicator of aggressive extrapolation.
| Domain | ||||
|---|---|---|---|---|
| 0.0005 | A | 69.8% | 30.2% | 0.0% |
| 0.0005 | C | 47.1% | 52.9% | 0.0% |
| 0.0005 | P | 14.4% | 85.6% | 0.0% |
| 0.003 | A | 70.3% | 29.5% | 0.2% |
| 0.003 | C | 48.8% | 50.1% | 1.2% |
| 0.003 | P | 14.5% | 82.1% | 3.5% |
| 0.01 | A | 68.9% | 27.4% | 3.7% |
| 0.01 | C | 47.2% | 45.7% | 7.1% |
| 0.01 | P | 15.1% | 66.1% | 18.9% |
These results show that upper clipping is frequent but stable across , reflecting which domains are sharper than average. In contrast, lower clipping increases with , especially for the relatively flatter P domain. This confirms that controls the aggressiveness of coefficient modulation: larger allows to move farther from 1, making clipping more important.
Effect of clipping on the update direction
We also measured the relative update change on the PACS A/C/P S split,
For each , this quantity was averaged over all iterations after the warm-up phase (). The resulting values were for , for , and for , confirming that clipping has little effect for small but becomes more important as coefficient modulation becomes stronger.
Clipping ablation
Finally, we evaluated CGM without clipping. On PACS, for , performance is nearly unchanged (87.5 with clipping vs. 87.4 without clipping). For , disabling clipping causes a larger drop (87.4 vs. 87.1). Thus, clipping is not the main source of CGM’s gains under moderate , but it is a useful stabilization mechanism when induces more aggressive modulation.
W3 — The performance gains in the benchmarks are modest.
Due to space limitations, please see our response to Reviewer gann, W1.
W4 — Insufficient characterization of CGM’s hyperparameter sensitivity
We apologize that the existing ablations were not sufficiently clear. Section 5.4 already varies and individually on OfficeHome, while Appendix B.3 specifies that all other hyperparameters are fixed, thereby isolating their effects. As clarified in our response to W2, the scale invariance of does not make redundant: controls the strength of coefficient modulation, i.e., how far deviates from 1.
We additionally evaluated sensitivity to using and . Mean accuracies over two runs are:
| AvSAM | InSAM | CGM | |
|---|---|---|---|
| 0.01 | 69.12 | 69.66 | 70.19 |
| 0.03 | 69.30 | 69.81 | 70.27 |
| 0.10 | 69.34 | 69.54 | 70.12 |
CGM achieves the highest mean accuracy at every tested . InSAM and CGM perform best at and decline slightly at , plausibly because larger perturbations increase disagreement among domain-wise SAM gradients. As these are preliminary two-run results, we will validate them with more runs alongside clearer and analyses, in the revision.
Thanks for the rebuttal; most of my concerns are addressed. I am willing to vote for acceptance.
Dear Reviewer H41F,
Thank you for your encouraging follow-up and for recognizing the paper’s theoretical insights and self-critical analysis. Your constructive questions and concerns gave us valuable opportunities to clarify important aspects of the work, particularly the scalability of CGM’s computational cost, the practical impact of the clipping heuristic, and the practical validity of the assumption. We believe these discussions will help us further strengthen the revised version of the paper. We sincerely appreciate your thoughtful evaluation and willingness to support acceptance.
Best regards,
The Authors
- Rating
- 5/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper investigates the geometric limitations of applying Sharpness-Aware Minimization (SAM) to average domain losses. i.e., The avergae can shapness can be low even if the individual domains shapnesses are high. To correct this, the authors introduce Cancellation Gap Minimization (CGM), which employs a squared coefficient-of-variation regularizer to explicitly penalize sharpness imbalances across individual source domains. By forcing this domain-wise sharpness to balance, the optimizer aligns the dominant eigenvectors and prevents the model from settling into minima that are only flat on average but brittle within specific domains. While the main insight closely parallels that of SFT [20] in addressing cross-domain loss inconsistencies, CGM takes a different structural approach. Rather than relying on architectural additions like SFT's soft-label generators, this work provides a purely optimizer-level intervention to enforce uniform geometric flatness.
Strengths and weaknesses
Strengths:
-
The paper provides a mathematical analysis of standard Sharpness-Aware Minimization (AvSAM), linking its failure in domain generalization to the misalignment of dominant Hessian eigenvectors and formalizing this via the "Cancellation Gap".
-
Rather than blindly relying on their proposed metric, the authors identify a bad shortcut where the Cancellation Gap can be trivially minimized through sharpness imbalance, justifying the need for their regularizer.
-
The empirical evaluation goes beyond task accuracy and include detailed diagnostic tracking of domain-wise sharpness, dominance ratios, and spectral alignment, which validates their theoretical claims during actual training.
Weeknesses:
-
The regularizer penalizes sharpness imbalance, forcing all source domains to maintain identical sharpness. This structural constraint ignores the reality that diverse datasets naturally possess different intrinsic complexities and demand different optimal curvatures, which risks underfitting the harder domains. For example, in PACS, some domains are much harder, and domains are diverse. Would this explain the slightly poorer results in this dataset?
-
Because the proposed CGM requires calculating a separate worst-case perturbation () for each individual domain in the batch, the computational cost of the forward and backward passes scales linearly with the number of source domains. There is no details on the computational costs.
-
The evaluation relies strictly on sharpness metrics and raw target accuracy to prove that the bad shortcut is blocked. The paper lacks feature-level interpretability analyses to verify that the geometric alignment actually forces the model to learn causal, reasoning-based features rather than simply finding an alternative black-box shortcut.
Questions
mentioned under weaknesses.
Limitations
yes
Final justification
All three concerns raised have been adequately addressed. Therefore, I maintain my positive acceptance rating.
Formatting concerns
None
3 comments
Rebuttal
Thank you for your careful review of our paper and for the insightful and constructive comments. Please find our detailed answers to your comments below.
<Responses to "Weaknesses" and “Questions”>
W1 (Q1)— The regularizer may force all source domains to have identical sharpness, potentially over-constraining domains with different levels of difficulty.
as a guardrail against the bad shortcut
We would like to clarify that CGM does not impose a hard constraint forcing all domains to have identical sharpness. The term is a soft regularizer with a finite coefficient , designed to mitigate severe sharpness imbalance rather than enforce perfect equality. Consistent with this interpretation, our domain-wise analysis shows that CGM mitigates sharpness imbalance without equalizing domain-wise sharpness values or maximum Hessian eigenvalues.
On differences in domain difficulty
We agree that source domains may differ in intrinsic difficulty or importance, and we explicitly discuss this as a limitation of CGM. Across the evaluated benchmarks, we did not observe a clear case in which differences in domain difficulty caused a failure mode such as underfitting harder domains. We believe this is because, as explained above, the regularizer does not enforce equal sharpness across domains, but instead serves only as a guardrail against the bad shortcut. Had it enforced equal sharpness, differences in domain difficulty even at the benchmark level might have caused problems. Nevertheless, the reviewer’s concern remains valid, particularly in settings with many source domains or substantial differences in difficulty, noise, or importance. In such cases, incorporating prior knowledge about domain difficulty or priority into the regularizer would be an important direction for future work. For example, a weighted or priority-aware variant of could preserve CGM’s goal of preventing severe sharpness dominance while allowing different optimal sharpness levels across domains.
Explanation for the slightly lower performance on PACS
We agree that differences in domain difficulty within PACS could plausibly contribute to CGM’s slightly lower performance. However, the current evidence does not suggest that this factor alone explains why CGM is slightly below the reported FAD [1] result on PACS. First, CGM still improves over both AvSAM and InSAM on PACS, with a gain comparable to those observed on the other datasets. Thus, the PACS result does not indicate that CGM systematically underfits harder or more heterogeneous domains. Second, domain heterogeneity is not unique to PACS and is also pronounced across all DG benchmark datasets.
We also note that Appendix B.5 provides a compatibility study where AvSAM, InSAM, and CGM are combined with the sharpness measures used in GAM [2] and FAD. Under this restricted compatibility setting, FAD+CGM improves over FAD( = FAD+AvSAM) on PACS and also improves the four-dataset average . This suggests that FAD’s strong performance on PACS may be partly attributable to its underlying sharpness measure, which jointly considers zeroth- and first-order flatness, rather than indicating a failure of the mechanism itself. Because this compatibility experiment used a restricted hyperparameter search space due to computational cost, we view it as supporting evidence rather than a definitive conclusion.
W2 (Q2) — Concern about the computational cost of CGM
We agree that sequential domain-wise processing introduces system-level overhead, and we apologize that the analysis in Appendix B.1 may have been easy to miss. We thank the reviewer for raising this practical concern. We first clarify the cost relative to AvSAM. Under a fixed total batch size, AvSAM, InSAM, and CGM have comparable theoretical model FLOPs: AvSAM applies the two-step SAM update once to the aggregated batch, whereas InSAM and CGM apply the same two-step computation domain by domain over the same total number of samples. The following table presents the computational cost analysis reported in Appendix B.1.
| Method | Time / iteration (s) | Peak memory (GiB) |
|---|---|---|
| AvSAM | 0.404 | 8.463 |
| InSAM | 0.425 | 3.544 |
| CGM | 0.426 | 3.550 |
The table above reports end-to-end per-iteration training time under our standard training pipeline, including data-pipeline overhead such as data loading and augmentation. Based on this measurement, on an NVIDIA RTX A6000, CGM is approximately 5.4% slower than AvSAM but only 0.2% slower than InSAM, confirming that the coefficient computation itself adds negligible overhead. CGM also reduces peak memory by approximately 58% relative to AvSAM because it processes one domain batch at a time.
The standard benchmarks considered in this work typically involve source domains, with at most . To examine how the algorithmic update cost scales with , we conducted an additional controlled experiment up to . Unlike the end-to-end measurements above, this scaling experiment isolates the forward/backward/SAM computation and excludes data loading and augmentation. Therefore, its absolute timing values differ from those reported in the table, although both experiments lead to the same qualitative conclusion: CGM adds negligible overhead beyond InSAM, and both CGM and InSAM are approximately 5-7% slower than AvSAM. Please see our response to Reviewer H41F (Q2) for the detailed setup and results.
W3 (Q3) — Lack of feature-level analysis verifying that geometric alignment leads to causal or reasoning-based features rather than reliance on the bad shortcut
We appreciate this suggestion and would like to clarify the scope of our claim. Our paper does not claim that geometric alignment forces the model to learn causal or reasoning-based features. Rather, the “bad shortcut” in our analysis is a specifically defined optimization-geometric mechanism: the Cancellation Gap can become small through severe sharpness imbalance instead of improved directional alignment.
At a nearly identical Cancellation Gap, CGM reduces and increases relative to InSAM, while also reducing average domain-wise sharpness . Thus, the diagnostic evidence directly matches the predicted signature: CGM’s gap reduction is less imbalance-driven and is accompanied by improved directional alignment. Target accuracy is reported as the downstream generalization outcome, not as the sole evidence that the geometric shortcut is suppressed.
We agree that feature-level analyses would provide valuable complementary insight. Unfortunately, the author-response format does not allow us to include additional figures, so we cannot provide the requested visualization here. That said, we understand why the reviewer raises this point: several DG/OOD works have connected cauality/invariance to consistency in risks, losses, or gradients. For example, V-REx [3] relates equality of domain risks to invariant/causal prediction under assumptions; Fish [4], AND-mask [5], and GGA [6] motivate invariance through gradient or loss-surface consistency across domains. Our work is complementary to this line of work: whereas prior approaches mainly consider scalar risk/loss consistency or first-order gradient consistency, we study a second-order directional inconsistency, namely misalignment among domain-wise dominant Hessian eigenvectors. Establishing a direct feature-level or causal interpretation of such Hessian-direction alignment is an important and interesting direction for future work, and we thank the reviewer for pointing it out.
References
[1] Flatness-Aware Minimization for Domain Generalization, ICCV 2023
[2] Gradient Norm Aware Minimization Seeks First-Order Flatness and Improves Generalization, CVPR 2023
[3] Out-of-Distribution Generalization via Risk Extrapolation, ICML 2021
[4] Gradient Matching for Domain Generalization, ICLR 2022
[5] Learning Explanations That are Hard to Vary, ICLR 2021
[6] Gradient-Guided Annealing for Domain Generalization, CVPR 2025
Thanks for addressing my comments. All three concerns raised have been adequately addressed. Therefore, I maintain my positive acceptance rating.
Dear Reviewer hYS1,
Thank you very much for your thoughtful follow-up, for confirming that all three concerns were adequately addressed, and for maintaining your positive recommendation. Your comments gave us valuable opportunities to clarify the role of the regularizer under differences in domain difficulty, provide additional evidence on CGM’s computational cost and scalability, and better define the scope of our geometric-alignment claims. We will incorporate these clarifications and additional analyses into the revised manuscript. We sincerely appreciate your careful and constructive engagement with our work.
Best regards,
The Authors
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
We sincerely thank the Area Chair for recognizing the rigor of our Cancellation Gap analysis and diagnostics, and for highlighting the key issues to address. We summarize our responses to the two central concerns below, with detailed analyses provided in the corresponding reviewer responses.
1. Please clarify how CGM differs from group DRO and V-REx (Reviewers H41F, gann)
Group DRO, V-REx, and CGM may appear similar because all three address cross-domain imbalance. However, they differ in what they regularize and why.
Different regularized quantities and purposes
Group DRO and V-REx operate on domain risks (losses). Group DRO targets worst-domain robustness by emphasizing high-risk domains, whereas V-REx penalizes variance across domain risks. In contrast, CGM penalizes domain-wise sharpness values, not to risks.
The purposes of these mechanisms also differ. Group DRO directly targets worst-domain robustness, while risk similarity is central to the robustness/invariance principle of V-REx. CGM, by contrast, does not treat sharpness balance as an end goal. Its CV2 term serves only as a soft guardrail against the bad shortcut identified in Theorem 3.4. Thus, CGM only needs to mitigate severe sharpness imbalance rather than enforce identical sharpness across domains. Table 3 of our paper supports this: CGM reduces average domain-wise sharpness and imbalance without equalizing sharpness across domains.
Direct comparison with group DRO
Group DRO can be written as a minimax or simplex-weighted risk objective and therefore directly reweights of domain-wise gradients to emphasize high-risk domains. CGM instead keeps the averaging across domains uniform and does not directly up-weight domain losses. Its coefficient cˉi is not a simplex weight over domains; rather, it interpolates within each domain between the standard gradient and the SAM gradient. The meaning of “worst case” is also different. Group DRO targets the worst-performing domain, whereas CGM inherits SAM’s local worst case: the maximum loss increase within each domain under parameter perturbations.
Direct comparison with V-REx
To summarize the key technical distinction, V-REx reweights domain-wise gradients according to domain-risk deviations, whereas CGM modulates the approximate sharpness gradient, according to domain-wise sharpness deviations. For a detailed analytical comparison, please see our response to Reviewer gann (Q2/W2).
2. Please explain the training failure with insufficient InSAM warm-up and clarify the practical impact of the cˉi clipping heuristic (Reviewers H41F, gann)
2-1. Why insufficient warm-up degrades training
CGM computes each coefficient ci from an estimated domain-wise sharpness value. Early in training, the model is far from the local loss-landscape regime considered in our analysis, and these estimates may be noisy. Activating CGM too early can therefore assign unreliable interpolation weights between the standard and SAM gradients. The warm-up avoids this premature domain-dependent modulation by applying the same domain-wise SAM rule to all domains. After sufficient warm-up, the model is closer to a locally stationary regime, where the estimated sharpness values more reliably reflect the geometric quantities motivating CGM.
2-2. Practical impact of the cˉi clipping heuristic
We use cˉi=clip(ci,0,1) to keep the update interpolative between the standard and SAM gradients. Without clipping, ci>1 extrapolates beyond the SAM gradient, whereas ci<0 reverses the intended SAM correction.
Clipping frequencies
We analyzed the raw coefficients ci on the PACS A/C/P → S split after the 20% warm-up phase. We report the frequencies of ci>1, 0≤ci≤1, and ci<0. For detailed experimental results, please see the table in our response to Reviewer H41F (W2). The results show that upper clipping is frequent but stable across values of the CV2 penalty coefficient α, whereas lower clipping increases with α, especially for the relatively flatter P domain. This confirms that α controls the aggressiveness of coefficient modulation: a larger α allows ci to move farther from 1, making clipping more important.
Effect of clipping on the update direction
We also measured the relative update change,
The result confirms that clipping has little effect for small α but becomes more important as α increases and coefficient modulation consequently becomes stronger.
Clipping ablation
On PACS, removing clipping has little effect at α=0.0005 but causes a larger performance drop at α=0.01. Thus, clipping is not the main source of CGM’s gains under moderate α, but serves as a useful stabilizer under more aggressive modulation.