{"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/the-missing-invariance-principle-found-the","title":"The Missing Invariance Principle Found -- the Reciprocal Twin of Invariant Risk Minimization","arxiv_id":"2205.14546","date":"2022-05-29","proceeding":null,"authors":["Dongsung Huh","Avinash Baidya"],"abstract":"Machine learning models often generalize poorly to out-of-distribution (OOD) data as a result of relying on features that are spuriously correlated with the label during training. Recently, the technique of Invariant Risk Minimization (IRM) was proposed to learn predictors that only use invariant features by conserving the feature-conditioned label expectation $\\mathbb{E}_e[y|f(x)]$ across environments. However, more recent studies have demonstrated that IRM-v1, a practical version of IRM, can fail in various settings. Here, we identify a fundamental flaw of IRM formulation that causes the failure. We then introduce a complementary notion of invariance, MRI, based on conserving the label-conditioned feature expectation $\\mathbb{E}_e[f(x)|y]$, which is free of this flaw. Further, we introduce a simplified, practical version of the MRI formulation called MRI-v1. We prove that for general linear problems, MRI-v1 guarantees invariant predictors given sufficient number of environments. We also empirically demonstrate that MRI-v1 strongly out-performs IRM-v1 and consistently achieves near-optimal OOD generalization in image-based nonlinear problems.","url_abs":"https://arxiv.org/abs/2205.14546v2","url_pdf":"https://arxiv.org/pdf/2205.14546v2.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":"the-missing-invariance-principle-found-the","repo_url":"https://github.com/ibm/mri","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2205.14546","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2205.14546"}},"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/ibm/mri","reach":null}],"summary":{"ran":7,"ran_draft_wrong":3,"ran_honours":2,"ran_fixture":1,"unverified":8},"by_repo_kind":{"official":{"samples":20,"ran":13,"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":"60d5898728b2ef53","entry":"Algorithm","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"60d5898728b2ef53"}},{"code_sha256_prefix":"1389f95d1fb9f67e","entry":"Classifier","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1389f95d1fb9f67e"}},{"code_sha256_prefix":"f0e9d2dc26748363","entry":"Identity","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f0e9d2dc26748363"}},{"code_sha256_prefix":"1a73afa879cb603b","entry":"LeNet5","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1a73afa879cb603b"}},{"code_sha256_prefix":"ff54592da5080e3a","entry":"ST_ConvNet","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ff54592da5080e3a"}},{"code_sha256_prefix":"79dcc6f470520bde","entry":"complex2real","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"79dcc6f470520bde"}},{"code_sha256_prefix":"9821d3e2333fe81b","entry":"complexify","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9821d3e2333fe81b"}},{"code_sha256_prefix":"0c216d63456de1ec","entry":"get_grad_norm","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0c216d63456de1ec"}},{"code_sha256_prefix":"79a63acaa13df2ea","entry":"get_loss_fn","repo":"ibm/mri","repo_kind":"official","path":"domainbed/algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/domainbed/algorithms.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"79a63acaa13df2ea"}},{"code_sha256_prefix":"f98e24eb0d2d32cf","entry":"get_optimizer","repo":"ibm/mri","repo_kind":"official","path":"domainbed/algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/domainbed/algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f98e24eb0d2d32cf"}},{"code_sha256_prefix":"c6faf56a6ad7ccbc","entry":"get_weight_norm","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c6faf56a6ad7ccbc"}},{"code_sha256_prefix":"23db9d78066152ca","entry":"output_modification","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"23db9d78066152ca"}},{"code_sha256_prefix":"6a052df58baa9181","entry":"real2complex","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6a052df58baa9181"}},{"code_sha256_prefix":"5aebea4d4ebff0d4","entry":"ERM","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5aebea4d4ebff0d4"}},{"code_sha256_prefix":"28f76c5b44ed54e5","entry":"Featurizer","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"28f76c5b44ed54e5"}},{"code_sha256_prefix":"d374678281d0659c","entry":"IRM","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d374678281d0659c"}},{"code_sha256_prefix":"15b92d3235dcbfd7","entry":"MRI","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"15b92d3235dcbfd7"}},{"code_sha256_prefix":"f795ad5cd9b0e0fe","entry":"ResNet","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f795ad5cd9b0e0fe"}},{"code_sha256_prefix":"dde6698ef323ba28","entry":"get_Featurizer_dict","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"dde6698ef323ba28"}},{"code_sha256_prefix":"b0bc80b1655a6802","entry":"get_algorithm_class","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"b0bc80b1655a6802"}},{"code_sha256_prefix":"90ee0fb395848111","entry":"get_network","repo":"ibm/mri","repo_kind":"official","path":"custom_algorithms.py","file_url":"https://github.com/ibm/mri/blob/HEAD/custom_algorithms.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"90ee0fb395848111"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}