{"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/learning-stable-classifiers-by-transferring","title":"Learning Stable Classifiers by Transferring Unstable Features","arxiv_id":"2106.07847","date":"2021-06-15","proceeding":null,"authors":["Yujia Bao","Shiyu Chang","Regina Barzilay"],"abstract":"While unbiased machine learning models are essential for many applications, bias is a human-defined concept that can vary across tasks. Given only input-label pairs, algorithms may lack sufficient information to distinguish stable (causal) features from unstable (spurious) features. However, related tasks often share similar biases -- an observation we may leverage to develop stable classifiers in the transfer setting. In this work, we explicitly inform the target classifier about unstable features in the source tasks. Specifically, we derive a representation that encodes the unstable features by contrasting different data environments in the source task. We achieve robustness by clustering data of the target task according to this representation and minimizing the worst-case risk across these clusters. We evaluate our method on both text and image classifications. Empirical results demonstrate that our algorithm is able to maintain robustness on the target task for both synthetically generated environments and real-world environments. Our code is available at https://github.com/YujiaBao/Tofu.","url_abs":"https://arxiv.org/abs/2106.07847v4","url_pdf":"https://arxiv.org/pdf/2106.07847v4.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":"learning-stable-classifiers-by-transferring","repo_url":"https://github.com/YujiaBao/Tofu","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"transfer-learning","task_name":"Transfer Learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2106.07847","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2106.07847"}},"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/YujiaBao/Tofu","reach":null},{"provenance":"deterministic:regex_extraction","url":"https://github.com/facebookresearch/DomainBed","reach":null}],"summary":{"ran_honours":1,"ran_draft_wrong":1,"ran_fixture":3,"unverified":3},"by_repo_kind":{"official":{"samples":7,"ran":5,"repositories":1},"found_in_text":{"samples":1,"ran":0,"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":"700c01294a7fec4e","entry":"compute_l2","repo":"YujiaBao/Tofu","repo_kind":"official","path":"src/tofu/partition.py","file_url":"https://github.com/YujiaBao/Tofu/blob/HEAD/src/tofu/partition.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"700c01294a7fec4e"}},{"code_sha256_prefix":"baef20e5a997fba1","entry":"squeeze_batch","repo":"YujiaBao/Tofu","repo_kind":"official","path":"src/tofu/partition.py","file_url":"https://github.com/YujiaBao/Tofu/blob/HEAD/src/tofu/partition.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":"baef20e5a997fba1"}},{"code_sha256_prefix":"adc6863235236e3b","entry":"test_partition_loop","repo":"YujiaBao/Tofu","repo_kind":"official","path":"src/tofu/partition.py","file_url":"https://github.com/YujiaBao/Tofu/blob/HEAD/src/tofu/partition.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"adc6863235236e3b"}},{"code_sha256_prefix":"74b1657df849913d","entry":"to_cuda","repo":"YujiaBao/Tofu","repo_kind":"official","path":"src/tofu/partition.py","file_url":"https://github.com/YujiaBao/Tofu/blob/HEAD/src/tofu/partition.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"74b1657df849913d"}},{"code_sha256_prefix":"05430ad3df65e1b7","entry":"train_partition_loop","repo":"YujiaBao/Tofu","repo_kind":"official","path":"src/tofu/partition.py","file_url":"https://github.com/YujiaBao/Tofu/blob/HEAD/src/tofu/partition.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"05430ad3df65e1b7"}},{"code_sha256_prefix":"dfeb27642b0d47c1","entry":"Transfer","repo":"facebookresearch/DomainBed","repo_kind":"found_in_text","path":"domainbed/algorithms.py","file_url":"https://github.com/facebookresearch/DomainBed/blob/HEAD/domainbed/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":"dfeb27642b0d47c1"}},{"code_sha256_prefix":"c88898ab5483d71f","entry":"print_partition_res","repo":"YujiaBao/Tofu","repo_kind":"official","path":"src/tofu/partition.py","file_url":"https://github.com/YujiaBao/Tofu/blob/HEAD/src/tofu/partition.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":"c88898ab5483d71f"}},{"code_sha256_prefix":"ce0be0da6677ca80","entry":"train_partition","repo":"YujiaBao/Tofu","repo_kind":"official","path":"src/tofu/partition.py","file_url":"https://github.com/YujiaBao/Tofu/blob/HEAD/src/tofu/partition.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":"ce0be0da6677ca80"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}