Papers › Extractive Structures Learned in Pretraining Enable Generalization on Finetuned Facts

Extractive Structures Learned in Pretraining Enable Generalization on Finetuned Facts

5 Dec 2024arXiv:2412.04614archive 2025-07-28

Jiahai Feng, Stuart Russell, Jacob Steinhardt

Pretrained language models (LMs) can generalize to implications of facts that they are finetuned on. For example, if finetuned on ``John Doe lives in Tokyo," LMs can correctly answer ``What language do the people in John Doe's city speak?'' with ``Japanese''. However, little is known about the mechanisms that enable this generalization or how they are learned during pretraining. We introduce extractive structures as a framework for describing how components in LMs (e.g., MLPs or attention heads) coordinate to enable this generalization. The structures consist of informative components that store training facts as weight changes, and upstream and downstream extractive components that query and process the stored information to produce the correct implication. We hypothesize that extractive structures are learned during pretraining when encountering implications of previously known facts. This yields two predictions: a data ordering effect where extractive structures can be learned only if facts precede their implications, and a weight grafting effect where extractive structures can be transferred to predict counterfactual implications. We empirically demonstrate these phenomena in the OLMo-7b, Llama 3-8b, Gemma 2-9b, and Qwen 2-7b models. Of independent interest, our results also indicate that fact learning can occur at both early and late layers, which lead to different forms of generalization.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2412.04614")

Code

Syntology Ran 0 of 8 code samples harvested from 1 repository linked to this paper; 8 have no recorded run.

By repository: official repository: 8 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

8 samples harvested; 0 ran; 0 honoured the contract we drafted; 8 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

8unverified

Licence: 8 of the 8 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from jiahai-feng/extractive-structures. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: 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. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

find_index_of jiahai-feng/extractive-structures/src/extractive_structures/gradients.py official repository unverified no licence file found · pointer only · 6b540f7c3d73eaa2 · report
flatten_parameters jiahai-feng/extractive-structures/src/extractive_structures/gradients.py official repository unverified no licence file found · pointer only · 9db1f497ae54f40c · report
get_layer_names jiahai-feng/extractive-structures/src/extractive_structures/utils.py official repository unverified no licence file found · pointer only · af01c0461cf2887d · report
get_masked_params jiahai-feng/extractive-structures/src/extractive_structures/models.py official repository unverified no licence file found · pointer only · 849e6187f31855b4 · report
hook_model jiahai-feng/extractive-structures/src/exults/hook_utils.py official repository unverified no licence file found · pointer only · cb2a268649a6fedd · report
hook_model_bwd jiahai-feng/extractive-structures/src/exults/hook_utils.py official repository unverified no licence file found · pointer only · 3afaf101741b4238 · report
lookup_module jiahai-feng/extractive-structures/src/exults/hook_utils.py official repository unverified no licence file found · pointer only · f4c662c967c78572 · report
stack_named_parameters jiahai-feng/extractive-structures/src/extractive_structures/gradients.py official repository unverified no licence file found · pointer only · 5702824ebb66ceb5 · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AttentionLLaMASoftmax

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections