Papers › Generalization v.s. Memorization: Tracing Language Models' Capabilities Back to...

Generalization v.s. Memorization: Tracing Language Models' Capabilities Back to Pretraining Data

20 Jul 2024arXiv:2407.14985archive 2025-07-28

Xinyi Wang, Antonis Antoniades, Yanai Elazar, Alfonso Amayuelas, Alon Albalak, Kexun Zhang, William Yang Wang

The impressive capabilities of large language models (LLMs) have sparked debate over whether these models genuinely generalize to unseen tasks or predominantly rely on memorizing vast amounts of pretraining data. To explore this issue, we introduce an extended concept of memorization, distributional memorization, which measures the correlation between the LLM output probabilities and the pretraining data frequency. To effectively capture task-specific pretraining data frequency, we propose a novel task-gram language model, which is built by counting the co-occurrence of semantically related n-gram pairs from task inputs and outputs in the pretraining corpus. Using the Pythia models trained on the Pile dataset, we evaluate four distinct tasks: machine translation, factual question answering, world knowledge understanding, and math reasoning. Our findings reveal varying levels of memorization, with the strongest effect observed in factual question answering. Furthermore, while model performance improves across all tasks as LLM size increases, only factual question answering shows an increase in memorization, whereas machine translation and reasoning tasks exhibit greater generalization, producing more novel outputs. This study demonstrates that memorization plays a larger role in simpler, knowledge-intensive tasks, while generalization is the key for harder, reasoning-based tasks, providing a scalable method for analyzing large pretraining corpora in greater depth. We also show the practical implications of our analysis through a novel prompt optimization algorithm.

PaperPDFCode 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="2407.14985")

Code

Syntology Ran 11 of 15 code samples harvested from 1 repository linked to this paper; 4 have no recorded run. Of those that ran: 1 ran · honoured contract; 10 ran with no contract checked.

By repository: found in paper text by Syntology: 15 samples from 1 repository, 11 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

EleutherAI/the-pile found in paper text by SyntologyMIT report

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

15 samples harvested; 11 ran; 1 honoured the contract we drafted; 4 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.

1ran · honoured contract
10ran
4unverified

Licence: 0 of the 15 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 EleutherAI/the-pile. “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.

cont EleutherAI/the-pile/processing_scripts/fix_empty_lines.py found in paper text by Syntology ran fingerprinted MIT (permissive) · 128c815587eb6f9c · report
despace EleutherAI/the-pile/processing_scripts/fix_dm_math.py found in paper text by Syntology ran fingerprinted MIT (permissive) · 400223165519340e · report
fix EleutherAI/the-pile/processing_scripts/fix_dm_math.py found in paper text by Syntology ran MIT (permissive) · 102a3e6041b8359d · report
id EleutherAI/the-pile/the_pile/utils.py found in paper text by Syntology ran fingerprinted MIT (permissive) · 79d53604e4138cba · report
mean EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass2.py found in paper text by Syntology ran fingerprinted MIT (permissive) · 0479fb5f08e12e14 · report
readf EleutherAI/the-pile/processing_scripts/join.py found in paper text by Syntology ran MIT (permissive) · ea45516e7c59d783 · report
rewrite_name EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass2.py found in paper text by Syntology ran fingerprinted MIT (permissive) · 2ce3a6653bbabf47 · report
stableorder EleutherAI/the-pile/the_pile/utils.py found in paper text by Syntology ran MIT (permissive) · 2246bc566da383d9 · report
stddev EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass2.py found in paper text by Syntology ran fingerprinted MIT (permissive) · 2f9c8f709caa01bc · report
take EleutherAI/the-pile/the_pile/pile.py found in paper text by Syntology ran · honoured contract MIT (permissive) · 7ed0726edbb13bb5 · report
utf8len EleutherAI/the-pile/the_pile/utils.py found in paper text by Syntology ran fingerprinted MIT (permissive) · 66211bd1a2260664 · report
analyze EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass1.py found in paper text by Syntology unverified MIT (permissive) · fc867bf5f0532c70 · report
json_parser EleutherAI/the-pile/the_pile/tfds_pile.py found in paper text by Syntology unverified MIT (permissive) · 5d4f4f3f6f2bb5f0 · report
language EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass1.py found in paper text by Syntology unverified MIT (permissive) · c19e7511b7716d16 · report
lengths EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass1.py found in paper text by Syntology unverified MIT (permissive) · 0ada8308c7e8d45e · report

Tasks

Language ModellingMachine TranslationMathMemorizationMultiple-choiceQuestion AnsweringTranslationWorld Knowledge

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

FocusPythia

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