SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.16042 · ICLR · 2024

Towards Best Practices of Activation Patching in Language Models: Metrics and Methods

Fred Zhang, Neel Nanda, John Mary

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 6 functions out of this paper's own repositories and ran 5 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
redwoodresearch/Easy-Transformer canonical 5 of 6
FunctionStatusWhere it lives
cst_fn Ran redwoodresearch/Easy-Transformer/easy_transformer/experiments.py
code served (permissive licence) · get_code("7cc9d58376c94a83")
get_corner Ran redwoodresearch/Easy-Transformer/easy_transformer/utils.py
code served (permissive licence) · get_code("1f5a0cbe7a2e0eac")
get_sample_from_dataset Ran redwoodresearch/Easy-Transformer/easy_transformer/utils.py
code served (permissive licence) · get_code("0f4a0aa12ed98682")
neg_fn Ran redwoodresearch/Easy-Transformer/easy_transformer/experiments.py
code served (permissive licence) · get_code("d3b030e4dd0ab13d")
zero_fn Ran redwoodresearch/Easy-Transformer/easy_transformer/experiments.py
code served (permissive licence) · get_code("5e871c5d5f468bff")
download_file_from_hf Not yet run redwoodresearch/Easy-Transformer/easy_transformer/utils.py
code served (permissive licence) · get_code("b05aad9a321cedec")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2309.16042")
get_code_for_paper("2309.16042")
have("2309.16042")

Connect an agent — have() is free.