{"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/deep-backtracking-counterfactuals-for","title":"Deep Backtracking Counterfactuals for Causally Compliant Explanations","arxiv_id":"2310.07665","date":"2023-10-11","proceeding":null,"authors":["Klaus-Rudolf Kladny","Julius von Kügelgen","Bernhard Schölkopf","Michael Muehlebach"],"abstract":"Counterfactuals answer questions of what would have been observed under altered circumstances and can therefore offer valuable insights. Whereas the classical interventional interpretation of counterfactuals has been studied extensively, backtracking constitutes a less studied alternative where all causal laws are kept intact. In the present work, we introduce a practical method called deep backtracking counterfactuals (DeepBC) for computing backtracking counterfactuals in structural causal models that consist of deep generative components. We propose two distinct versions of our method--one utilizing Langevin Monte Carlo sampling and the other employing constrained optimization--to generate counterfactuals for high-dimensional data. As a special case, our formulation reduces to methods in the field of counterfactual explanations. Compared to these, our approach represents a causally compliant, versatile and modular alternative. We demonstrate these properties experimentally on a modified version of MNIST and CelebA.","url_abs":"https://arxiv.org/abs/2310.07665v4","url_pdf":"https://arxiv.org/pdf/2310.07665v4.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":"deep-backtracking-counterfactuals-for","repo_url":"https://github.com/rudolfwilliam/deepbc","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"philosophy","task_name":"Philosophy"},{"task_slug":null,"task_name":"counterfactual"}],"methods":[{"method_slug":"counterfactuals","method_name":"Counterfactuals"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2310.07665","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2310.07665"}},"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/rudolfwilliam/deepbc","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":4,"unverified":3},"by_repo_kind":{"official":{"samples":7,"ran":4,"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":"03018b4279ef7731","entry":"bc_loss","repo":"rudolfwilliam/deepbc","repo_kind":"official","path":"src/deepbc/optim/backtrack.py","file_url":"https://github.com/rudolfwilliam/deepbc/blob/HEAD/src/deepbc/optim/backtrack.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":"03018b4279ef7731"}},{"code_sha256_prefix":"e20448cca1573ade","entry":"freeze_model","repo":"rudolfwilliam/deepbc","repo_kind":"official","path":"src/deepbc/utils.py","file_url":"https://github.com/rudolfwilliam/deepbc/blob/HEAD/src/deepbc/utils.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":"e20448cca1573ade"}},{"code_sha256_prefix":"61ded7f89d716301","entry":"generate_checkpoint_callback","repo":"rudolfwilliam/deepbc","repo_kind":"official","path":"src/deepbc/utils.py","file_url":"https://github.com/rudolfwilliam/deepbc/blob/HEAD/src/deepbc/utils.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":"61ded7f89d716301"}},{"code_sha256_prefix":"a3559acb11cbd04f","entry":"generate_early_stopping_callback","repo":"rudolfwilliam/deepbc","repo_kind":"official","path":"src/deepbc/utils.py","file_url":"https://github.com/rudolfwilliam/deepbc/blob/HEAD/src/deepbc/utils.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":"a3559acb11cbd04f"}},{"code_sha256_prefix":"f3c63854182020cc","entry":"backtrack_gradient","repo":"rudolfwilliam/deepbc","repo_kind":"official","path":"src/deepbc/optim/backtrack.py","file_url":"https://github.com/rudolfwilliam/deepbc/blob/HEAD/src/deepbc/optim/backtrack.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":"f3c63854182020cc"}},{"code_sha256_prefix":"7e5d06e4f64e59ce","entry":"backtrack_linearize","repo":"rudolfwilliam/deepbc","repo_kind":"official","path":"src/deepbc/optim/backtrack.py","file_url":"https://github.com/rudolfwilliam/deepbc/blob/HEAD/src/deepbc/optim/backtrack.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":"7e5d06e4f64e59ce"}},{"code_sha256_prefix":"4fcd981ea9374b01","entry":"langevin_mc","repo":"rudolfwilliam/deepbc","repo_kind":"official","path":"src/deepbc/sampling/sample.py","file_url":"https://github.com/rudolfwilliam/deepbc/blob/HEAD/src/deepbc/sampling/sample.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":"4fcd981ea9374b01"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}