{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/domain-inspired-sharpness-aware-minimization","title":"Domain-Inspired Sharpness-Aware Minimization Under Domain Shifts","arxiv_id":"2405.18861","date":"2024-05-29","proceeding":null,"authors":["Ruipeng Zhang","Ziqing Fan","Jiangchao Yao","Ya zhang","Yanfeng Wang"],"abstract":"This paper presents a Domain-Inspired Sharpness-Aware Minimization (DISAM) algorithm for optimization under domain shifts. It is motivated by the inconsistent convergence degree of SAM across different domains, which induces optimization bias towards certain domains and thus impairs the overall convergence. To address this issue, we consider the domain-level convergence consistency in the sharpness estimation to prevent the overwhelming (deficient) perturbations for less (well) optimized domains. Specifically, DISAM introduces the constraint of minimizing variance in the domain loss, which allows the elastic gradient calibration in perturbation generation: when one domain is optimized above the averaging level \\textit{w.r.t.} loss, the gradient perturbation towards that domain will be weakened automatically, and vice versa. Under this mechanism, we theoretically show that DISAM can achieve faster overall convergence and improved generalization in principle when inconsistent convergence emerges. Extensive experiments on various domain generalization benchmarks show the superiority of DISAM over a range of state-of-the-art methods. Furthermore, we show the superior efficiency of DISAM in parameter-efficient fine-tuning combined with the pretraining models. The source code is released at https://github.com/MediaBrain-SJTU/DISAM.","url_abs":"https://arxiv.org/abs/2405.18861v1","url_pdf":"https://arxiv.org/pdf/2405.18861v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"domain-inspired-sharpness-aware-minimization","repo_url":"https://github.com/mediabrain-sjtu/disam","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"domain-generalization","task_name":"Domain Generalization"},{"task_slug":"parameter-efficient-fine-tuning","task_name":"parameter-efficient fine-tuning"}],"methods":[{"method_slug":"sam","method_name":"SAM"},{"method_slug":"sharpness-aware-minimization","method_name":"Sharpness-Aware Minimization"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2405.18861","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.18861"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/MediaBrain-SJTU/DISAM","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mediabrain-sjtu/disam","reach":{"status":"ok"}}],"summary":{"ran":4,"ran_draft_wrong":1},"by_repo_kind":{"official":{"samples":5,"ran":5,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":5,"samples":[{"code_sha256_prefix":"07453359d24fdebc","entry":"Get_Logger","repo":"MediaBrain-SJTU/DISAM","repo_kind":"official","path":"code/utils/logger.py","file_url":"https://github.com/MediaBrain-SJTU/DISAM/blob/HEAD/code/utils/logger.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"07453359d24fdebc"}},{"code_sha256_prefix":"ac630b6d3f3400fa","entry":"conv1x1","repo":"MediaBrain-SJTU/DISAM","repo_kind":"official","path":"code/models/resnet.py","file_url":"https://github.com/MediaBrain-SJTU/DISAM/blob/HEAD/code/models/resnet.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ac630b6d3f3400fa"}},{"code_sha256_prefix":"fe58fe326c4a2573","entry":"conv3x3","repo":"MediaBrain-SJTU/DISAM","repo_kind":"official","path":"code/models/resnet.py","file_url":"https://github.com/MediaBrain-SJTU/DISAM/blob/HEAD/code/models/resnet.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fe58fe326c4a2573"}},{"code_sha256_prefix":"647d32905ebb0ee7","entry":"random_sample","repo":"MediaBrain-SJTU/DISAM","repo_kind":"official","path":"code/models/resnet.py","file_url":"https://github.com/MediaBrain-SJTU/DISAM/blob/HEAD/code/models/resnet.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"647d32905ebb0ee7"}},{"code_sha256_prefix":"1938167c3e988262","entry":"remove_underline","repo":"mediabrain-sjtu/disam","repo_kind":"official","path":"code/configs/default.py","file_url":"https://github.com/mediabrain-sjtu/disam/blob/HEAD/code/configs/default.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1938167c3e988262"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}