{"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/fishr-invariant-gradient-variances-for-out-of","title":"Fishr: Invariant Gradient Variances for Out-of-Distribution Generalization","arxiv_id":"2109.02934","date":"2021-09-07","proceeding":null,"authors":["Alexandre Rame","Corentin Dancette","Matthieu Cord"],"abstract":"Learning robust models that generalize well under changes in the data distribution is critical for real-world applications. To this end, there has been a growing surge of interest to learn simultaneously from multiple training domains - while enforcing different types of invariance across those domains. Yet, all existing approaches fail to show systematic benefits under controlled evaluation protocols. In this paper, we introduce a new regularization - named Fishr - that enforces domain invariance in the space of the gradients of the loss: specifically, the domain-level variances of gradients are matched across training domains. Our approach is based on the close relations between the gradient covariance, the Fisher Information and the Hessian of the loss: in particular, we show that Fishr eventually aligns the domain-level loss landscapes locally around the final weights. Extensive experiments demonstrate the effectiveness of Fishr for out-of-distribution generalization. Notably, Fishr improves the state of the art on the DomainBed benchmark and performs consistently better than Empirical Risk Minimization. Our code is available at https://github.com/alexrame/fishr.","url_abs":"https://arxiv.org/abs/2109.02934v3","url_pdf":"https://arxiv.org/pdf/2109.02934v3.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":"fishr-invariant-gradient-variances-for-out-of","repo_url":"https://github.com/alexrame/fishr","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"fishr-invariant-gradient-variances-for-out-of","repo_url":"https://github.com/facebookresearch/DomainBed","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"domain-generalization","task_name":"Domain Generalization"},{"task_slug":"out-of-distribution-generalization","task_name":"Out-of-Distribution Generalization"}],"methods":[{"method_slug":"fishr","method_name":"Fishr"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/domain-generalization-on-domainnet","task":"Domain Generalization","dataset":"DomainNet","model":"Fishr (ResNet-50)","rank_in_archive_order":38,"of":38,"metrics":{"Average Accuracy":"41.8"},"uses_additional_data":false},{"leaderboard":"/sota/domain-generalization-on-office-home","task":"Domain Generalization","dataset":"Office-Home","model":"Fishr (ResNet-50)","rank_in_archive_order":35,"of":45,"metrics":{"Average Accuracy":"68.2"},"uses_additional_data":false},{"leaderboard":"/sota/domain-generalization-on-pacs-2","task":"Domain Generalization","dataset":"PACS","model":"Fishr(ResNet-50,DomainBed)","rank_in_archive_order":41,"of":133,"metrics":{"Average Accuracy":"86.9"},"uses_additional_data":false},{"leaderboard":"/sota/domain-generalization-on-terraincognita","task":"Domain Generalization","dataset":"TerraIncognita","model":"Fishr(ResNet-50)","rank_in_archive_order":30,"of":30,"metrics":{"Average Accuracy":"47.4"},"uses_additional_data":false},{"leaderboard":"/sota/domain-generalization-on-vlcs","task":"Domain Generalization","dataset":"VLCS","model":"Fishr (ResNet-50)","rank_in_archive_order":34,"of":37,"metrics":{"Average Accuracy":"78.2"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/2109.02934","atlas_url":"https://app.syntology.ai/?focus=2109.02934","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2109.02934"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/DomainBed","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/alexrame/fishr","reach":null}],"summary":{"ran_fixture":1},"by_repo_kind":{"official":{"samples":1,"ran":1,"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":1,"samples":[{"code_sha256_prefix":"d6d6cc53be32629d","entry":"format_mean","repo":"alexrame/fishr","repo_kind":"official","path":"domainbed/scripts/collect_results.py","file_url":"https://github.com/alexrame/fishr/blob/HEAD/domainbed/scripts/collect_results.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"d6d6cc53be32629d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}