{"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/refining-neural-networks-with-compositional","title":"Refining Language Models with Compositional Explanations","arxiv_id":"2103.10415","date":"2021-03-18","proceeding":"NeurIPS 2021 12","authors":["Huihan Yao","Ying Chen","Qinyuan Ye","Xisen Jin","Xiang Ren"],"abstract":"Pre-trained language models have been successful on text classification tasks, but are prone to learning spurious correlations from biased datasets, and are thus vulnerable when making inferences in a new domain. Prior work reveals such spurious patterns via post-hoc explanation algorithms which compute the importance of input features. Further, the model is regularized to align the importance scores with human knowledge, so that the unintended model behaviors are eliminated. However, such a regularization technique lacks flexibility and coverage, since only importance scores towards a pre-defined list of features are adjusted, while more complex human knowledge such as feature interaction and pattern generalization can hardly be incorporated. In this work, we propose to refine a learned language model for a target domain by collecting human-provided compositional explanations regarding observed biases. By parsing these explanations into executable logic rules, the human-specified refinement advice from a small set of explanations can be generalized to more training examples. We additionally introduce a regularization term allowing adjustments for both importance and interaction of features to better rectify model behavior. We demonstrate the effectiveness of the proposed approach on two text classification tasks by showing improved performance in target domain as well as improved model fairness after refinement.","url_abs":"https://arxiv.org/abs/2103.10415v3","url_pdf":"https://arxiv.org/pdf/2103.10415v3.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":"refining-neural-networks-with-compositional","repo_url":"https://github.com/INK-USC/expl-refinement","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"fairness","task_name":"Fairness"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"text-classification","task_name":"Text Classification"},{"task_slug":"text-classification-1","task_name":"text-classification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2103.10415","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2103.10415"}},"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/INK-USC/expl-refinement","reach":null}],"summary":{"ran":1,"ran_fixture":2,"unverified":2},"by_repo_kind":{"official":{"samples":5,"ran":3,"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":"a42ef5d950b7cf42","entry":"_SamplingAndOcclusionBaseAlgo","repo":"INK-USC/expl-refinement","repo_kind":"official","path":"expl-reg/hiex/soc_algo.py","file_url":"https://github.com/INK-USC/expl-refinement/blob/HEAD/expl-reg/hiex/soc_algo.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":"a42ef5d950b7cf42"}},{"code_sha256_prefix":"8e2029fe34283e24","entry":"acc_and_f1","repo":"ink-usc/expl-refinement","repo_kind":"official","path":"expl-reg/run_model.py","file_url":"https://github.com/ink-usc/expl-refinement/blob/HEAD/expl-reg/run_model.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8e2029fe34283e24"}},{"code_sha256_prefix":"3e02f7733fe044f3","entry":"compute_fprd","repo":"ink-usc/expl-refinement","repo_kind":"official","path":"expl-reg/run_model.py","file_url":"https://github.com/ink-usc/expl-refinement/blob/HEAD/expl-reg/run_model.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3e02f7733fe044f3"}},{"code_sha256_prefix":"23f929ee51fb3360","entry":"_SamplingAndOcclusionAlgo","repo":"INK-USC/expl-refinement","repo_kind":"official","path":"expl-reg/hiex/soc_algo.py","file_url":"https://github.com/INK-USC/expl-refinement/blob/HEAD/expl-reg/hiex/soc_algo.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":"23f929ee51fb3360"}},{"code_sha256_prefix":"3c241ecfe3749a6d","entry":"simple_accuracy","repo":"ink-usc/expl-refinement","repo_kind":"official","path":"expl-reg/run_model.py","file_url":"https://github.com/ink-usc/expl-refinement/blob/HEAD/expl-reg/run_model.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":"3c241ecfe3749a6d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}