{"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/discovering-environments-with-xrm","title":"Discovering environments with XRM","arxiv_id":"2309.16748","date":"2023-09-28","proceeding":null,"authors":["Mohammad Pezeshki","Diane Bouchacourt","Mark Ibrahim","Nicolas Ballas","Pascal Vincent","David Lopez-Paz"],"abstract":"Environment annotations are essential for the success of many out-of-distribution (OOD) generalization methods. Unfortunately, these are costly to obtain and often limited by human annotators' biases. To achieve robust generalization, it is essential to develop algorithms for automatic environment discovery within datasets. Current proposals, which divide examples based on their training error, suffer from one fundamental problem. These methods introduce hyper-parameters and early-stopping criteria, which require a validation set with human-annotated environments, the very information subject to discovery. In this paper, we propose Cross-Risk-Minimization (XRM) to address this issue. XRM trains twin networks, each learning from one random half of the training data, while imitating confident held-out mistakes made by its sibling. XRM provides a recipe for hyper-parameter tuning, does not require early-stopping, and can discover environments for all training and validation data. Algorithms built on top of XRM environments achieve oracle worst-group-accuracy, addressing a long-standing challenge in OOD generalization. Code available at \\url{https://github.com/facebookresearch/XRM}.","url_abs":"https://arxiv.org/abs/2309.16748v2","url_pdf":"https://arxiv.org/pdf/2309.16748v2.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":"discovering-environments-with-xrm","repo_url":"https://github.com/facebookresearch/XRM","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":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2309.16748","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2309.16748"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/XRM","reach":null}],"summary":{"ran":2,"ran_draft_wrong":3},"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":"4860ec38df3adff5","entry":"ERM","repo":"facebookresearch/XRM","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/facebookresearch/XRM/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"4860ec38df3adff5"}},{"code_sha256_prefix":"4e3c4f6443b259e3","entry":"XRM","repo":"facebookresearch/XRM","repo_kind":"official","path":"algorithms.py","file_url":"https://github.com/facebookresearch/XRM/blob/HEAD/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"4e3c4f6443b259e3"}},{"code_sha256_prefix":"d53300f71fc533bb","entry":"get_acc","repo":"facebookresearch/xrm","repo_kind":"official","path":"quick_run.py","file_url":"https://github.com/facebookresearch/xrm/blob/HEAD/quick_run.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"d53300f71fc533bb"}},{"code_sha256_prefix":"73f5361e660d0ff0","entry":"groups","repo":"facebookresearch/xrm","repo_kind":"official","path":"quick_run.py","file_url":"https://github.com/facebookresearch/xrm/blob/HEAD/quick_run.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"73f5361e660d0ff0"}},{"code_sha256_prefix":"a256db304c08ba95","entry":"worst_acc","repo":"facebookresearch/xrm","repo_kind":"official","path":"quick_run.py","file_url":"https://github.com/facebookresearch/xrm/blob/HEAD/quick_run.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"a256db304c08ba95"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}