SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.14985 · ICLR · 2025

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

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

arXiv · PDF · Open in the Atlas

Code that ran

11 of 15 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; 3 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 7 failures of our instrument; 4 no recorded run), measured 2026-11-22; 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/2407.14985.json · badge: /api/ran/2407.14985.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
EleutherAI/the-pile canonical (classifier label)
classifier basis: census
11 ran · 4 no recorded run
FunctionStatusWhere it lives
cont Ran
ran; our contract draft was wrong, not the code
EleutherAI/the-pile/processing_scripts/fix_empty_lines.py
code served (permissive licence) · get_code("128c815587eb6f9c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

def cont(x):
    return x.strip()

# The function takes a single parameter 'x' and calls .strip() on it
# This means x must be a string
x_value = "  hello world  "

ARGS = {
    "x": x_value
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
despace Ran
ran; our contract draft was wrong, not the code
EleutherAI/the-pile/processing_scripts/fix_dm_math.py
code served (permissive licence) · get_code("400223165519340e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# - despace takes parameter 'x'
# - It iterates over x with enumerate
# - At odd indices (i % 2 == 1), it checks if char != '\n'
# - At even indices, it appends char to res
# - Returns joined string
# So x should be a string with characters at odd positions being newlines

x = "a\nb\nc\nd"

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
fix Ran
ran; our contract draft was wrong, not the code
EleutherAI/the-pile/processing_scripts/fix_dm_math.py
code served (permissive licence) · get_code("102a3e6041b8359d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bytes. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json

# Analyzing the function `fix`:
# - Parameter `x` is expected to be bytes
# - The function checks if b'DM Mathematics' is in x
# - It tries to parse x as JSON (after decoding)
# - It accesses ob['meta']['pile_set_name']
# - It modifies ob['text'] by calling despace() on it
# - despace() expects a string where odd-indexed characters are '\n' and even-indexed chars are kept
# - The function returns bytes

# Constructing a valid bytes object for x:
# Need to create JSON with:
# - 'meta' dict containing 'pile_set_name' = 'DM Mathematics'
# - 'text' string where every odd-indexed character is '\n'

# Build the text with despace-compatible format: char at index 0, '\n' at index 1, char at index 2, '\n' at index 3, etc.
text_content = "H\ne\nl\nl\no"  # "Hello" with '\n' between each character

json_obj = {
    "meta": {
        "pile_set_name": "DM Mathematics"
    },
    "text": text_content
}

x = (json.dumps(json_obj) + '\n').encode('utf-8')

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bytes — a bytes output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a bytes output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
id Ran
ran, honoured the contract we drafted
EleutherAI/the-pile/the_pile/utils.py
code served (permissive licence) · get_code("79d53604e4138cba")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "x": torch.randn(2, 4)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
mean Ran
ran, violated the contract we drafted
EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass2.py
code served (permissive licence) · get_code("0479fb5f08e12e14")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function mean(x) expects:
# - x: an iterable that supports sum() and len()
# This could be a list of numbers, tensors, or other summable objects

# Create a simple list of numbers
x = [1.0, 2.0, 3.0, 4.0, 5.0]

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
readf Ran
ran; our contract draft was wrong, not the code
EleutherAI/the-pile/processing_scripts/join.py
code served (permissive licence) · get_code("ea45516e7c59d783")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import zstandard
import io
import tempfile
import os

# Create a temporary zstandard-compressed file for testing
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test.zst")

# Create compressed test data
test_data = b"line1\nline2\nline3\n"
cctx = zstandard.ZstdCompressor()
compressed_data = cctx.compress(test_data)

with open(temp_file, 'wb') as fh:
    fh.write(compressed_data)

ARGS = {
    'f': temp_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tqdm, zstandard — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
rewrite_name Ran
ran; our contract draft was wrong, not the code
EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass2.py
code served (permissive licence) · get_code("2ce3a6653bbabf47")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

def rewrite_name(n):
    rewritenames = {'CommonCrawl': 'Pile-CC', 'Bibliotik': 'Books3', 'USPTO': 'USPTO Backgrounds', 'BookCorpus': 'BookCorpus2'}
    if n in rewritenames:
        return rewritenames[n]
    return n

ARGS = {
    'n': 'CommonCrawl'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
stableorder Ran
ran; our contract draft was wrong, not the code
EleutherAI/the-pile/the_pile/utils.py
code served (permissive licence) · get_code("2246bc566da383d9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import hashlib

def sha256str(s):
    h = hashlib.sha256()
    h.update(s)
    return h.hexdigest()

def stableorder(x):
    arr = [(elem, sha256str(elem.encode('utf-8'))) for elem in x]
    arr.sort(key=lambda x: x[1])
    return [elem for elem, _ in arr]

# Construct valid arguments for stableorder
# The function takes a single parameter 'x' which is iterated over
# Each element is expected to be a string (since .encode('utf-8') is called on it)

ARGS = {
    'x': ['zebra', 'apple', 'mango', 'banana']
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
stddev Ran
ran; our contract draft was wrong, not the code
EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass2.py
code served (permissive licence) · get_code("2f9c8f709caa01bc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import math

def mean(x):
    return sum(x) / len(x)

def stddev(x):
    mu = mean(x)
    return math.sqrt(mean([(v - mu) ** 2 for v in x]))

# Setup: stddev takes one parameter 'x' which should be an iterable of numbers
# The function computes mean and then calculates standard deviation
# We need to provide a list of numeric values

x = [1.0, 2.0, 3.0, 4.0, 5.0]

ARGS = {
    'x': x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
take Ran
ran, honoured the contract we drafted
EleutherAI/the-pile/the_pile/pile.py
code served (permissive licence) · get_code("7ed0726edbb13bb5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function takes(n, iter) calls next() on the iterator n times
# and collects results into a list. It needs:
# - n: an integer
# - iter: an iterator (any object with __next__ method)

def simple_iterator():
    """Generator that yields a few values"""
    yield 1
    yield 2
    yield 3
    yield 4
    yield 5

ARGS = {
    "n": 3,
    "iter": simple_iterator()
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
utf8len Ran
ran, honoured the contract we drafted
EleutherAI/the-pile/the_pile/utils.py
code served (permissive licence) · get_code("66211bd1a2260664")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

def utf8len(s):
    return len(s.encode('utf-8'))

# The function takes a single parameter 's' which should be a string
# It encodes the string to UTF-8 bytes and returns the length

ARGS = {
    's': 'Hello, 世界!'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
analyze Not yet run
unverified (harvested, no recorded run)
EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass1.py
code served (permissive licence) · get_code("fc867bf5f0532c70")
How it ran

no invocation recorded.

json_parser Not yet run
unverified (harvested, no recorded run)
EleutherAI/the-pile/the_pile/tfds_pile.py
code served (permissive licence) · get_code("5d4f4f3f6f2bb5f0")
How it ran

no invocation recorded.

language Not yet run
unverified (harvested, no recorded run)
EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass1.py
code served (permissive licence) · get_code("c19e7511b7716d16")
How it ran

no invocation recorded.

lengths Not yet run
unverified (harvested, no recorded run)
EleutherAI/the-pile/processing_scripts/lang_len_analysis_pass1.py
code served (permissive licence) · get_code("0ada8308c7e8d45e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 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, 1 later) and 12 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
mean 2 other papers
1 dated earlier, 1 later
2402.05099 (2024-02)
Hydragen: High-Throughput LLM Inference with Shared Prefixes
2607.26648 (2026-07)
The Sparsity Ceiling: Where Spiking Networks Canand Cannot-Trade Activity for Energy
take 2 other papers
2 dated earlier
2101.00027 (2021-01)
The Pile: An 800GB Dataset of Diverse Text for Language Modeling
2201.07311 (2022-01)
Datasheet for the Pile
id 1 other paper
1 dated earlier
2406.06246 (2024-06)
Data-Efficient Learning with Neural Programs

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-22.

Repositories linked to this paper

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

Abstract

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. 1 * denotes equal contribution.

For agents

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

get_harvested_code_for_paper("2407.14985")
get_code_for_paper("2407.14985")
have("2407.14985")

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

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

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

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

Connect an agent — have() is free.