{"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/counterfactually-fair-representation","title":"Counterfactually Fair Representation","arxiv_id":"2311.05420","date":"2023-11-09","proceeding":"NeurIPS 2023 11","authors":["Zhiqun Zuo","Mohammad Mahdi Khalili","Xueru Zhang"],"abstract":"The use of machine learning models in high-stake applications (e.g., healthcare, lending, college admission) has raised growing concerns due to potential biases against protected social groups. Various fairness notions and methods have been proposed to mitigate such biases. In this work, we focus on Counterfactual Fairness (CF), a fairness notion that is dependent on an underlying causal graph and first proposed by Kusner \\textit{et al.}~\\cite{kusner2017counterfactual}; it requires that the outcome an individual perceives is the same in the real world as it would be in a \"counterfactual\" world, in which the individual belongs to another social group. Learning fair models satisfying CF can be challenging. It was shown in \\cite{kusner2017counterfactual} that a sufficient condition for satisfying CF is to \\textbf{not} use features that are descendants of sensitive attributes in the causal graph. This implies a simple method that learns CF models only using non-descendants of sensitive attributes while eliminating all descendants. Although several subsequent works proposed methods that use all features for training CF models, there is no theoretical guarantee that they can satisfy CF. In contrast, this work proposes a new algorithm that trains models using all the available features. We theoretically and empirically show that models trained with this method can satisfy CF\\footnote{The code repository for this work can be found in \\url{https://github.com/osu-srml/CF_Representation_Learning}}.","url_abs":"https://arxiv.org/abs/2311.05420v1","url_pdf":"https://arxiv.org/pdf/2311.05420v1.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":"counterfactually-fair-representation","repo_url":"https://github.com/osu-srml/cf_representation_learning","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"fairness","task_name":"Fairness"},{"task_slug":null,"task_name":"counterfactual"}],"methods":[{"method_slug":"focus","method_name":"Focus"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2311.05420","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2311.05420"}},"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/osu-srml/cf_representation_learning","reach":{"status":"ok"}}],"summary":{"ran_violates":1,"ran":5},"by_repo_kind":{"official":{"samples":6,"ran":6,"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":6,"samples":[{"code_sha256_prefix":"b8e95809ca2c17c9","entry":"sigmoid","repo":"osu-srml/cf_representation_learning","repo_kind":"official","path":"CVAE/fair_classifier_d.py","file_url":"https://github.com/osu-srml/cf_representation_learning/blob/HEAD/CVAE/fair_classifier_d.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":2,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b8e95809ca2c17c9"}},{"code_sha256_prefix":"e0a46babceb34647","entry":"compute_kernel","repo":"osu-srml/cf_representation_learning","repo_kind":"official","path":"CVAE/utils.py","file_url":"https://github.com/osu-srml/cf_representation_learning/blob/HEAD/CVAE/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e0a46babceb34647"}},{"code_sha256_prefix":"449871daccdb32f8","entry":"compute_mmd","repo":"osu-srml/cf_representation_learning","repo_kind":"official","path":"CVAE/utils.py","file_url":"https://github.com/osu-srml/cf_representation_learning/blob/HEAD/CVAE/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"449871daccdb32f8"}},{"code_sha256_prefix":"fc2bc2cea3e84d0c","entry":"custom_objective","repo":"osu-srml/cf_representation_learning","repo_kind":"official","path":"CVAE/fair_classifier_d.py","file_url":"https://github.com/osu-srml/cf_representation_learning/blob/HEAD/CVAE/fair_classifier_d.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fc2bc2cea3e84d0c"}},{"code_sha256_prefix":"e0c65afd06207c9b","entry":"custom_regularization","repo":"osu-srml/cf_representation_learning","repo_kind":"official","path":"CVAE/fair_classifier_d.py","file_url":"https://github.com/osu-srml/cf_representation_learning/blob/HEAD/CVAE/fair_classifier_d.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e0c65afd06207c9b"}},{"code_sha256_prefix":"9fedb529a0b04ef9","entry":"loss_function","repo":"osu-srml/cf_representation_learning","repo_kind":"official","path":"CVAE/utils.py","file_url":"https://github.com/osu-srml/cf_representation_learning/blob/HEAD/CVAE/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9fedb529a0b04ef9"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}