Towards Understanding the Role of Sharpness-Aware Minimization Algorithms for Out-of-Distribution Generalization
Samuel Schapiro, Han Zhao
TL;DR
This work empirically and theoretically investigates Sharpness-Aware Minimization (SAM) for out-of-distribution generalization. It conducts a comprehensive comparison of eight SAM variants on zero-shot OOD generalization, finding that SAM improves over Adam by $4.76\%$ on average and that the strongest variants reach $8.01\%$ on average. Extending the study to Gradual Domain Adaptation (GDA), SAM still yields improvements over Adam ($0.82\%$ average; strongest variants at $1.52\%$), and the authors derive corresponding sharpness-based generalization bounds for both OOD and GDA. The results reveal a gap between the empirical benefits of SAM and the asymptotic theory, motivating future work toward tighter analyses that better capture SAM’s practical gains in OOD settings.
Abstract
Recently, sharpness-aware minimization (SAM) has emerged as a promising method to improve generalization by minimizing sharpness, which is known to correlate well with generalization ability. Since the original proposal of SAM, many variants of SAM have been proposed to improve its accuracy and efficiency, but comparisons have mainly been restricted to the i.i.d. setting. In this paper we study SAM for out-of-distribution (OOD) generalization. First, we perform a comprehensive comparison of eight SAM variants on zero-shot OOD generalization, finding that the original SAM outperforms the Adam baseline by $4.76\%$ and the strongest SAM variants outperform the Adam baseline by $8.01\%$ on average. We then provide an OOD generalization bound in terms of sharpness for this setting. Next, we extend our study of SAM to the related setting of gradual domain adaptation (GDA), another form of OOD generalization where intermediate domains are constructed between the source and target domains, and iterative self-training is done on intermediate domains, to improve the overall target domain error. In this setting, our experimental results demonstrate that the original SAM outperforms the baseline of Adam on each of the experimental datasets by $0.82\%$ on average and the strongest SAM variants outperform Adam by $1.52\%$ on average. We then provide a generalization bound for SAM in the GDA setting. Asymptotically, this generalization bound is no better than the one for self-training in the literature of GDA. This highlights a further disconnection between the theoretical justification for SAM versus its empirical performance, with recent work finding that low sharpness alone does not account for all of SAM's generalization benefits. For future work, we provide several potential avenues for obtaining a tighter analysis for SAM in the OOD setting.
