{"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/leace-perfect-linear-concept-erasure-in","title":"LEACE: Perfect linear concept erasure in closed form","arxiv_id":"2306.03819","date":"2023-06-06","proceeding":"NeurIPS 2023 11","authors":["Nora Belrose","David Schneider-Joseph","Shauli Ravfogel","Ryan Cotterell","Edward Raff","Stella Biderman"],"abstract":"Concept erasure aims to remove specified features from an embedding. It can improve fairness (e.g. preventing a classifier from using gender or race) and interpretability (e.g. removing a concept to observe changes in model behavior). We introduce LEAst-squares Concept Erasure (LEACE), a closed-form method which provably prevents all linear classifiers from detecting a concept while changing the embedding as little as possible, as measured by a broad class of norms. We apply LEACE to large language models with a novel procedure called \"concept scrubbing,\" which erases target concept information from every layer in the network. We demonstrate our method on two tasks: measuring the reliance of language models on part-of-speech information, and reducing gender bias in BERT embeddings. Code is available at https://github.com/EleutherAI/concept-erasure.","url_abs":"https://arxiv.org/abs/2306.03819v4","url_pdf":"https://arxiv.org/pdf/2306.03819v4.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":"leace-perfect-linear-concept-erasure-in","repo_url":"https://github.com/eleutherai/concept-erasure","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"leace-perfect-linear-concept-erasure-in","repo_url":"https://github.com/FairUnlearn/detoxai","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"fairness","task_name":"Fairness"},{"task_slug":"form","task_name":"Form"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2306.03819","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2306.03819"}},"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/FairUnlearn/detoxai","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/eleutherai/concept-erasure","reach":null}],"summary":{"ran_draft_wrong":2,"ran_honours":1,"unverified":11},"by_repo_kind":{"official":{"samples":3,"ran":3,"repositories":1},"listed":{"samples":11,"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":"203f94a4b5a85512","entry":"g","repo":"eleutherai/concept-erasure","repo_kind":"official","path":"experiments/fleace.py","file_url":"https://github.com/eleutherai/concept-erasure/blob/HEAD/experiments/fleace.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"203f94a4b5a85512"}},{"code_sha256_prefix":"531027e767080721","entry":"relu_eraser","repo":"eleutherai/concept-erasure","repo_kind":"official","path":"experiments/fleace.py","file_url":"https://github.com/eleutherai/concept-erasure/blob/HEAD/experiments/fleace.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"531027e767080721"}},{"code_sha256_prefix":"615d0b76d8de9c0d","entry":"v_transform","repo":"eleutherai/concept-erasure","repo_kind":"official","path":"experiments/fleace.py","file_url":"https://github.com/eleutherai/concept-erasure/blob/HEAD/experiments/fleace.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":"615d0b76d8de9c0d"}},{"code_sha256_prefix":"2169d858bb0d8420","entry":"compute_cav","repo":"FairUnlearn/detoxai","repo_kind":"listed","path":"src/detoxai/cavs/cav.py","file_url":"https://github.com/FairUnlearn/detoxai/blob/HEAD/src/detoxai/cavs/cav.py","link_basis":"harvester_set","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":"2169d858bb0d8420"}},{"code_sha256_prefix":"39a9a55630bed817","entry":"compute_mass_mean_probe","repo":"FairUnlearn/detoxai","repo_kind":"listed","path":"src/detoxai/cavs/mass_mean_probe.py","file_url":"https://github.com/FairUnlearn/detoxai/blob/HEAD/src/detoxai/cavs/mass_mean_probe.py","link_basis":"harvester_set","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":"39a9a55630bed817"}},{"code_sha256_prefix":"b32c03649dd0c3ec","entry":"construct_metrics_config","repo":"FairUnlearn/detoxai","repo_kind":"listed","path":"src/detoxai/core/interface_helpers.py","file_url":"https://github.com/FairUnlearn/detoxai/blob/HEAD/src/detoxai/core/interface_helpers.py","link_basis":"harvester_set","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":"b32c03649dd0c3ec"}},{"code_sha256_prefix":"375ff94b7f4a2397","entry":"evaluate_model","repo":"FairUnlearn/detoxai","repo_kind":"listed","path":"src/detoxai/core/evaluation.py","file_url":"https://github.com/FairUnlearn/detoxai/blob/HEAD/src/detoxai/core/evaluation.py","link_basis":"harvester_set","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":"375ff94b7f4a2397"}},{"code_sha256_prefix":"cca0703f7f2a9c0e","entry":"get_all_layers","repo":"FairUnlearn/detoxai","repo_kind":"listed","path":"src/detoxai/cavs/extract_activations.py","file_url":"https://github.com/FairUnlearn/detoxai/blob/HEAD/src/detoxai/cavs/extract_activations.py","link_basis":"harvester_set","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":"cca0703f7f2a9c0e"}},{"code_sha256_prefix":"d33f71007b5dc457","entry":"get_layer_by_name","repo":"FairUnlearn/detoxai","repo_kind":"listed","path":"src/detoxai/cavs/extract_activations.py","file_url":"https://github.com/FairUnlearn/detoxai/blob/HEAD/src/detoxai/cavs/extract_activations.py","link_basis":"harvester_set","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":"d33f71007b5dc457"}},{"code_sha256_prefix":"abe7aa13cf16aede","entry":"infer_layers","repo":"FairUnlearn/detoxai","repo_kind":"listed","path":"src/detoxai/core/interface_helpers.py","file_url":"https://github.com/FairUnlearn/detoxai/blob/HEAD/src/detoxai/core/interface_helpers.py","link_basis":"harvester_set","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":"abe7aa13cf16aede"}},{"code_sha256_prefix":"72eb626f8906d540","entry":"is_pareto_efficient","repo":"FairUnlearn/detoxai","repo_kind":"listed","path":"src/detoxai/core/mcda_helpers.py","file_url":"https://github.com/FairUnlearn/detoxai/blob/HEAD/src/detoxai/core/mcda_helpers.py","link_basis":"harvester_set","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":"72eb626f8906d540"}},{"code_sha256_prefix":"7c2b37a6331c6391","entry":"load_activations","repo":"FairUnlearn/detoxai","repo_kind":"listed","path":"src/detoxai/cavs/extract_activations.py","file_url":"https://github.com/FairUnlearn/detoxai/blob/HEAD/src/detoxai/cavs/extract_activations.py","link_basis":"harvester_set","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":"7c2b37a6331c6391"}},{"code_sha256_prefix":"b73ffc8f530e3ef6","entry":"parse_methods_config","repo":"FairUnlearn/detoxai","repo_kind":"listed","path":"src/detoxai/core/interface.py","file_url":"https://github.com/FairUnlearn/detoxai/blob/HEAD/src/detoxai/core/interface.py","link_basis":"harvester_set","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":"b73ffc8f530e3ef6"}},{"code_sha256_prefix":"24a3cfc38554b47a","entry":"resolve_layer","repo":"FairUnlearn/detoxai","repo_kind":"listed","path":"src/detoxai/core/interface_helpers.py","file_url":"https://github.com/FairUnlearn/detoxai/blob/HEAD/src/detoxai/core/interface_helpers.py","link_basis":"harvester_set","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":"24a3cfc38554b47a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}