{"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/counterfactual-generative-networks-1","title":"Counterfactual Generative Networks","arxiv_id":"2101.06046","date":"2021-01-15","proceeding":"ICLR 2021 1","authors":["Axel Sauer","Andreas Geiger"],"abstract":"Neural networks are prone to learning shortcuts -- they often model simple correlations, ignoring more complex ones that potentially generalize better. Prior works on image classification show that instead of learning a connection to object shape, deep classifiers tend to exploit spurious correlations with low-level texture or the background for solving the classification task. In this work, we take a step towards more robust and interpretable classifiers that explicitly expose the task's causal structure. Building on current advances in deep generative modeling, we propose to decompose the image generation process into independent causal mechanisms that we train without direct supervision. By exploiting appropriate inductive biases, these mechanisms disentangle object shape, object texture, and background; hence, they allow for generating counterfactual images. We demonstrate the ability of our model to generate such images on MNIST and ImageNet. Further, we show that the counterfactual images can improve out-of-distribution robustness with a marginal drop in performance on the original classification task, despite being synthetic. Lastly, our generative model can be trained efficiently on a single GPU, exploiting common pre-trained models as inductive biases.","url_abs":"https://arxiv.org/abs/2101.06046v1","url_pdf":"https://arxiv.org/pdf/2101.06046v1.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":"counterfactual-generative-networks-1","repo_url":"https://github.com/autonomousvision/counterfactual_generative_networks","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"classification-1","task_name":"Classification"},{"task_slug":null,"task_name":"GPU"},{"task_slug":"classification","task_name":"General Classification"},{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"object","task_name":"Object"},{"task_slug":null,"task_name":"counterfactual"},{"task_slug":"image-classification","task_name":"image-classification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2101.06046","atlas_url":"https://app.syntology.ai/?focus=2101.06046","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2101.06046"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/autonomousvision/counterfactual","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/autonomousvision/counterfactual_generative_networks","reach":null}],"summary":{"ran_draft_wrong":2,"unverified":3},"by_repo_kind":{"official":{"samples":5,"ran":2,"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":"7952987e7786816f","entry":"UpsampleBlock","repo":"autonomousvision/counterfactual_generative_networks","repo_kind":"official","path":"mnists/models/cgn.py","file_url":"https://github.com/autonomousvision/counterfactual_generative_networks/blob/HEAD/mnists/models/cgn.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7952987e7786816f"}},{"code_sha256_prefix":"f7e7cc4488181908","entry":"texture_layers","repo":"autonomousvision/counterfactual_generative_networks","repo_kind":"official","path":"mnists/models/cgn.py","file_url":"https://github.com/autonomousvision/counterfactual_generative_networks/blob/HEAD/mnists/models/cgn.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f7e7cc4488181908"}},{"code_sha256_prefix":"7492734918f2607e","entry":"CGN","repo":"autonomousvision/counterfactual_generative_networks","repo_kind":"official","path":"mnists/models/cgn.py","file_url":"https://github.com/autonomousvision/counterfactual_generative_networks/blob/HEAD/mnists/models/cgn.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":"7492734918f2607e"}},{"code_sha256_prefix":"48821b3a246628ed","entry":"Reshape","repo":"autonomousvision/counterfactual_generative_networks","repo_kind":"official","path":"mnists/models/cgn.py","file_url":"https://github.com/autonomousvision/counterfactual_generative_networks/blob/HEAD/mnists/models/cgn.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":"48821b3a246628ed"}},{"code_sha256_prefix":"59fab3188ca4bc1e","entry":"shape_layers","repo":"autonomousvision/counterfactual_generative_networks","repo_kind":"official","path":"mnists/models/cgn.py","file_url":"https://github.com/autonomousvision/counterfactual_generative_networks/blob/HEAD/mnists/models/cgn.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":"59fab3188ca4bc1e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}