SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.19521 · 2024

Interpreting Key Mechanisms of Factual Recall in Transformer-Based Language Models

arXiv · PDF · Open in the Atlas

Code that ran

12 of 14 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 11 failures of our instrument; 2 no recorded run), measured 2026-11-24; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2403.19521.json · badge: /api/ran/2403.19521.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
trestad/factual-recall-mechanism canonical (classifier label)
classifier basis: census
12 ran · 2 no recorded run
FunctionStatusWhere it lives
gen_flipped_prompts Ran
ran; our contract draft was wrong, not the code
trestad/factual-recall-mechanism/easy_transformer/fact_dataset.py
pointer only (licence: NONE) · get_code("bf14a58ad9daa314")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

gen_prompt_uniform Ran
ran; our contract draft was wrong, not the code
trestad/factual-recall-mechanism/easy_transformer/fact_dataset.py
pointer only (licence: NONE) · get_code("0e748f7b2746f129")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_corner Ran
ran; our contract draft was wrong, not the code
trestad/factual-recall-mechanism/easy_transformer/utils.py
pointer only (licence: NONE) · get_code("1f5a0cbe7a2e0eac")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_hook_tuple Ran
ran; our contract draft was wrong, not the code
trestad/factual-recall-mechanism/easy_transformer/utils_circuit_discovery.py
pointer only (licence: NONE) · get_code("c3e96952330b24b6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_sample_from_dataset Ran
ran; our contract draft was wrong, not the code
trestad/factual-recall-mechanism/easy_transformer/utils.py
pointer only (licence: NONE) · get_code("0f4a0aa12ed98682")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

list_diff Ran
ran; our contract draft was wrong, not the code
trestad/factual-recall-mechanism/easy_transformer/fact_circuit_extraction.py
pointer only (licence: NONE) · get_code("c3075c10972d3c04")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

max_2d Ran
ran; our contract draft was wrong, not the code
trestad/factual-recall-mechanism/easy_transformer/fact_utils.py
pointer only (licence: NONE) · get_code("34f3624167c77416")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

patch_all Ran
ran, honoured the contract we drafted
trestad/factual-recall-mechanism/easy_transformer/utils_circuit_discovery.py
pointer only (licence: NONE) · get_code("a08c9fa456b3584d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

patch_positions Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
trestad/factual-recall-mechanism/easy_transformer/utils_circuit_discovery.py
pointer only (licence: NONE) · get_code("6bc19a4e655618d7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

process_heads_and_mlps Ran
ran; our contract draft was wrong, not the code
trestad/factual-recall-mechanism/easy_transformer/fact_circuit_extraction.py
pointer only (licence: NONE) · get_code("6275c5441a2e89af")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

remove_prefix Ran
ran; our contract draft was wrong, not the code
trestad/factual-recall-mechanism/easy_transformer/fact_dataset.py
pointer only (licence: NONE) · get_code("09c5e6ff142680cd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

turn_keep_into_rmv Ran
ran; our contract draft was wrong, not the code
trestad/factual-recall-mechanism/easy_transformer/fact_circuit_extraction.py
pointer only (licence: NONE) · get_code("168eb8501c7db28f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

download_file_from_hf Not yet run
unverified (harvested, no recorded run)
trestad/factual-recall-mechanism/easy_transformer/utils.py
pointer only (licence: NONE) · get_code("b05aad9a321cedec")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

show_tokens Not yet run
unverified (harvested, no recorded run)
trestad/factual-recall-mechanism/easy_transformer/fact_utils.py
pointer only (licence: NONE) · get_code("7726d0418a0ec986")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, trestad/factual-recall-mechanism when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 0 later) and 11 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
download_file_from_hf 1 other paper
1 dated earlier
2309.16042 (2023-09)
Towards Best Practices of Activation Patching in Language Models: Metrics and Methods
get_corner 1 other paper
1 dated earlier
2309.16042 (2023-09)
Towards Best Practices of Activation Patching in Language Models: Metrics and Methods
get_sample_from_dataset 1 other paper
1 dated earlier
2309.16042 (2023-09)
Towards Best Practices of Activation Patching in Language Models: Metrics and Methods

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

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

Abstract

In this paper, we delve into several mechanisms employed by Transformer-based language models (LLMs) for factual recall tasks. We outline a pipeline consisting of three major steps: (1) Given a prompt ``The capital of France is,'' task-specific attention heads extract the topic token, such as ``France,'' from the context and pass it to subsequent MLPs. (2) As attention heads' outputs are aggregated with equal weight and added to the residual stream, the subsequent MLP acts as an ``activation,'' which either erases or amplifies the information originating from individual heads. As a result, the topic token ``France'' stands out in the residual stream. (3) A deep MLP takes ``France'' and generates a component that redirects the residual stream towards the direction of the correct answer, i.e., ``Paris.'' This procedure is akin to applying an implicit function such as ``get\_capital($X$),'' and the argument $X$ is the topic token information passed by attention heads. To achieve the above quantitative and qualitative analysis for MLPs, we proposed a novel analytic method aimed at decomposing the outputs of the MLP into components understandable by humans. Additionally, we observed a universal anti-overconfidence mechanism in the final layer of models, which suppresses correct predictions. We mitigate this suppression by leveraging our interpretation to improve factual recall confidence. The above interpretations are evaluated across diverse tasks spanning various domains of factual knowledge, using various language models from the GPT-2 families, 1.3B OPT, up to 7B Llama-2, and in both zero- and few-shot setups.

For agents

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

get_harvested_code_for_paper("2403.19521")
get_code_for_paper("2403.19521")
have("2403.19521")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2403.19521.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2403.19521.svg)](https://syntology.ai/paper/2403.19521)

Connect an agent — have() is free.