{"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/predict-then-interpolate-a-simple-algorithm","title":"Predict then Interpolate: A Simple Algorithm to Learn Stable Classifiers","arxiv_id":"2105.12628","date":"2021-05-26","proceeding":null,"authors":["Yujia Bao","Shiyu Chang","Regina Barzilay"],"abstract":"We propose Predict then Interpolate (PI), a simple algorithm for learning correlations that are stable across environments. The algorithm follows from the intuition that when using a classifier trained on one environment to make predictions on examples from another environment, its mistakes are informative as to which correlations are unstable. In this work, we prove that by interpolating the distributions of the correct predictions and the wrong predictions, we can uncover an oracle distribution where the unstable correlation vanishes. Since the oracle interpolation coefficients are not accessible, we use group distributionally robust optimization to minimize the worst-case risk across all such interpolations. We evaluate our method on both text classification and image classification. Empirical results demonstrate that our algorithm is able to learn robust classifiers (outperforms IRM by 23.85% on synthetic environments and 12.41% on natural environments). Our code and data are available at https://github.com/YujiaBao/Predict-then-Interpolate.","url_abs":"https://arxiv.org/abs/2105.12628v1","url_pdf":"https://arxiv.org/pdf/2105.12628v1.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":"predict-then-interpolate-a-simple-algorithm","repo_url":"https://github.com/YujiaBao/Predict-then-Interpolate","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"text-classification","task_name":"Text Classification"},{"task_slug":"image-classification","task_name":"image-classification"},{"task_slug":"text-classification-1","task_name":"text-classification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2105.12628","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2105.12628"}},"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/YujiaBao/Predict-then-Interpolate","reach":null}],"summary":{"ran":7,"unverified":7},"by_repo_kind":{"official":{"samples":14,"ran":7,"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":0,"samples":[{"code_sha256_prefix":"ca25c33b3ca5cfdf","entry":"CNN","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ca25c33b3ca5cfdf"}},{"code_sha256_prefix":"f7ae688015090bda","entry":"EnvSampler","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"f7ae688015090bda"}},{"code_sha256_prefix":"4abbc1fe2ff8fe59","entry":"MLP","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4abbc1fe2ff8fe59"}},{"code_sha256_prefix":"6db576db849cbc06","entry":"TextCNN","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"6db576db849cbc06"}},{"code_sha256_prefix":"293739fa3f3d2442","entry":"get_worst_acc","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"293739fa3f3d2442"}},{"code_sha256_prefix":"7a36ba56dd14524a","entry":"train_dro_loop","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"7a36ba56dd14524a"}},{"code_sha256_prefix":"d20003ab7073cb3f","entry":"train_loop","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"d20003ab7073cb3f"}},{"code_sha256_prefix":"ebd9154ebe926d64","entry":"Resnet50","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"ebd9154ebe926d64"}},{"code_sha256_prefix":"b58c9caa079f744b","entry":"get_model","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"b58c9caa079f744b"}},{"code_sha256_prefix":"07ef6f8504081267","entry":"ours","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"07ef6f8504081267"}},{"code_sha256_prefix":"d6e4cdf35a01a72d","entry":"print_group_stats","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"d6e4cdf35a01a72d"}},{"code_sha256_prefix":"a0f178bab1948c23","entry":"print_pretrain_res","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"a0f178bab1948c23"}},{"code_sha256_prefix":"a4a4e5dc0293f2f0","entry":"print_res","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"a4a4e5dc0293f2f0"}},{"code_sha256_prefix":"5f76e1e3b6bc10e1","entry":"test_loop","repo":"YujiaBao/Predict-then-Interpolate","repo_kind":"official","path":"src/training/ours.py","file_url":"https://github.com/YujiaBao/Predict-then-Interpolate/blob/HEAD/src/training/ours.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":"5f76e1e3b6bc10e1"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}