{"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/towards-best-practices-of-activation-patching","title":"Towards Best Practices of Activation Patching in Language Models: Metrics and Methods","arxiv_id":"2309.16042","date":"2023-09-27","proceeding":null,"authors":["Fred Zhang","Neel Nanda"],"abstract":"Mechanistic interpretability seeks to understand the internal mechanisms of machine learning models, where localization -- identifying the important model components -- is a key step. Activation patching, also known as causal tracing or interchange intervention, is a standard technique for this task (Vig et al., 2020), but the literature contains many variants with little consensus on the choice of hyperparameters or methodology. In this work, we systematically examine the impact of methodological details in activation patching, including evaluation metrics and corruption methods. In several settings of localization and circuit discovery in language models, we find that varying these hyperparameters could lead to disparate interpretability results. Backed by empirical observations, we give conceptual arguments for why certain metrics or methods may be preferred. Finally, we provide recommendations for the best practices of activation patching going forwards.","url_abs":"https://arxiv.org/abs/2309.16042v2","url_pdf":"https://arxiv.org/pdf/2309.16042v2.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":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2309.16042","atlas_url":"https://app.syntology.ai/?focus=2309.16042","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2309.16042"}},"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/redwoodresearch/Easy-Transformer","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":5,"unverified":1},"by_repo_kind":{"found_in_text":{"samples":6,"ran":5,"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":"7cc9d58376c94a83","entry":"cst_fn","repo":"redwoodresearch/Easy-Transformer","repo_kind":"found_in_text","path":"easy_transformer/experiments.py","file_url":"https://github.com/redwoodresearch/Easy-Transformer/blob/HEAD/easy_transformer/experiments.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":"7cc9d58376c94a83"}},{"code_sha256_prefix":"1f5a0cbe7a2e0eac","entry":"get_corner","repo":"redwoodresearch/Easy-Transformer","repo_kind":"found_in_text","path":"easy_transformer/utils.py","file_url":"https://github.com/redwoodresearch/Easy-Transformer/blob/HEAD/easy_transformer/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1f5a0cbe7a2e0eac"}},{"code_sha256_prefix":"0f4a0aa12ed98682","entry":"get_sample_from_dataset","repo":"redwoodresearch/Easy-Transformer","repo_kind":"found_in_text","path":"easy_transformer/utils.py","file_url":"https://github.com/redwoodresearch/Easy-Transformer/blob/HEAD/easy_transformer/utils.py","link_basis":"harvester_set","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":"0f4a0aa12ed98682"}},{"code_sha256_prefix":"d3b030e4dd0ab13d","entry":"neg_fn","repo":"redwoodresearch/Easy-Transformer","repo_kind":"found_in_text","path":"easy_transformer/experiments.py","file_url":"https://github.com/redwoodresearch/Easy-Transformer/blob/HEAD/easy_transformer/experiments.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d3b030e4dd0ab13d"}},{"code_sha256_prefix":"5e871c5d5f468bff","entry":"zero_fn","repo":"redwoodresearch/Easy-Transformer","repo_kind":"found_in_text","path":"easy_transformer/experiments.py","file_url":"https://github.com/redwoodresearch/Easy-Transformer/blob/HEAD/easy_transformer/experiments.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5e871c5d5f468bff"}},{"code_sha256_prefix":"b05aad9a321cedec","entry":"download_file_from_hf","repo":"redwoodresearch/Easy-Transformer","repo_kind":"found_in_text","path":"easy_transformer/utils.py","file_url":"https://github.com/redwoodresearch/Easy-Transformer/blob/HEAD/easy_transformer/utils.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":"b05aad9a321cedec"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}