SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2504.04022 · 2025

Rethinking Reflection in Pre-Training

arXiv · PDF · Open in the Atlas

Code that ran

11 of 12 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; 0 honoured the contract we drafted, 0 violated it and 11 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2504.04022.json · badge: /api/ran/2504.04022.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
Essential-AI/reflection canonical (classifier label)
classifier basis not recorded on the link
11 ran · 1 no recorded run
FunctionStatusWhere it lives
answer_in_string Ran
ran on a synthesized input
Essential-AI/reflection/tasks/triviaqa_adv/preprocess.py
code served (permissive licence) · get_code("82ae48da7fcb7018")
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 bool, 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

torch.manual_seed(0)

ARGS = {
    "answer": "hello world",
    "generation": "Hello World is a common phrase used in programming.",
}
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 bool, 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
doc_to_target Ran
ran on a synthesized input
Essential-AI/reflection/tasks/bbh_adv/_utils.py
code served (permissive licence) · get_code("97fdc71e82dddfcd")
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 1, dtype family int, shape (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)

# The function extracts doc['target'], so doc needs to be a dict with a 'target' key
doc = {
    'target': torch.tensor([1, 2, 3, 4]),
    'other_field': 'some_data'
}

ARGS = {
    'doc': doc
}
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 1, dtype family int, shape (4,) — shape (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
doc_to_target Ran
ran on a synthesized input
Essential-AI/reflection/tasks/gsm8k-platinum_adv/preprocess_gsm8k-platinum_adv.py
code served (permissive licence) · get_code("3de260f5b0a4efe5")
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)

# The function doc_to_target takes a 'doc' parameter and accesses doc['answer']
# It concatenates the string '</s>' to it and returns the result

# Create a simple dict with an 'answer' key
doc = {
    'answer': 'The capital of France is Paris'
}

ARGS = {
    'doc': doc
}
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
doc_to_text Ran
ran on a synthesized input
Essential-AI/reflection/tasks/bbh_adv/_utils.py
code served (permissive licence) · get_code("e120c0ae5f3c53dc")
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

ARGS = {
    'doc': {
        'input': 'What is 2 + 2?',
        'wrong_cot': 'I think the answer is 5 because'
    }
}
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
doc_to_text Ran
ran on a synthesized input
Essential-AI/reflection/tasks/gsm8k-platinum_adv/preprocess_gsm8k-platinum_adv.py
code served (permissive licence) · get_code("f1f7920ca55dcbef")
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

torch.manual_seed(0)

# Analyze the function to see what it expects:
# - doc is a dict
# - doc['question'] is a string (concatenated with +)
# - doc['messy_cot'] is a string with indexing and rfind() called on it
# The function extracts a substring from messy_cot up to the last occurrence of '\n####'

doc = {
    'question': 'What is 2 + 2?',
    'messy_cot': 'First, we add 2 to 2.\n2 + 2 = 4.\nSo the answer is 4.\n####\nThis is extra text after the marker.'
}

ARGS = {
    'doc': doc
}
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
doc_to_text Ran
ran on a synthesized input
Essential-AI/reflection/tasks/triviaqa_adv/preprocess.py
code served (permissive licence) · get_code("b304d3198fbed9b4")
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

# Construct a minimal doc dictionary that satisfies the function's needs
# The function accesses doc['question'] and calls .replace() on it
doc = {
    'question': 'Hints: What is the capital of France?'
}

ARGS = {
    'doc': doc
}
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
parse_prediction Ran
ran on a synthesized input
Essential-AI/reflection/tasks/cruxeval_i_adv/utils.py
code served (permissive licence) · get_code("6e4bd898334a1efd")
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 re

def parse_prediction(pred: str) -> str:
    if '[/ANSWER]' in pred:
        pred = pred.rsplit('[/ANSWER]', 1)[0].strip()
    if '[ANSWER]' in pred:
        pred = pred.rsplit('[ANSWER]', 1)[1].strip()
    if '==' in pred:
        pred = pred.rsplit('==', 1)[0].strip()
    regex_tighter_extract = re.search('\\bf\\((.*)\\)', pred)
    regex_looser_extract = re.search('\\((.*?)\\)', pred)
    if regex_tighter_extract:
        pred = regex_tighter_extract.group(1)
    elif regex_looser_extract:
        pred = regex_looser_extract.group(1)
    return pred

ARGS = {
    'pred': 'f(x + y) == 5'
}
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 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
parse_prediction Ran
ran on a synthesized input
Essential-AI/reflection/tasks/cruxeval_o_adv/utils.py
code served (permissive licence) · get_code("d1de549b64358608")
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 parse_prediction(pred: str) -> str:
    if '[/ANSWER]' in pred:
        pred = pred.split('[/ANSWER]')[0].strip()
    if '[ANSWER]' in pred:
        pred = pred.split('[ANSWER]')[1].strip()
    if '==' in pred:
        pred = pred.split('==')[1].strip()
    return pred

# The function takes a single string parameter 'pred'
# It processes the string by splitting on markers and extracting portions
# Let's create a valid test case

ARGS = {
    'pred': '[ANSWER]42[/ANSWER]'
}
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
parse_reference Ran
ran on a synthesized input
Essential-AI/reflection/tasks/cruxeval_i_adv/utils.py
code served (permissive licence) · get_code("a4d1baddfe680367")
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 dict. 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 re

def parse_reference(ref: str) -> dict:
    pattern = 'CODE:(.*?)\\nINPUT:(.*?)\\nOUTPUT(.*)'
    match_ref = re.match(pattern, ref, re.DOTALL)
    ref_code = match_ref.group(1)
    ref_inp = match_ref.group(2)
    ref_output = match_ref.group(3)
    return {'code': ref_code, 'input': ref_inp, 'output': ref_output}


# Construct valid argument
ref_string = """CODE:def add(a, b):
    return a + b
INPUT:a=1, b=2
OUTPUT:3"""

ARGS = {
    'ref': ref_string
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
process_results Ran
ran on a synthesized input
Essential-AI/reflection/tasks/triviaqa_adv/preprocess.py
code served (permissive licence) · get_code("1a7350c092246e7e")
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 dict. 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:
# process_results takes:
#   - doc: a dict with keys 'answer' (list), 'adversarial_answer' (str)
#   - pred_str: a sequence/list where pred_str[0] is accessed (a string)

# Create a valid doc dict
doc = {
    'answer': ['correct answer', 'another correct answer'],
    'adversarial_answer': 'wrong answer'
}

# Create a valid pred_str - it's indexed with [0], so list of strings
pred_str = ['The correct answer is here', 'other generation']

ARGS = {
    'doc': doc,
    'pred_str': pred_str
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
run_pass_fail_code Ran
ran on a synthesized input
Essential-AI/reflection/tasks/cruxeval_i_adv/utils.py
code served (permissive licence) · get_code("af21a1bbfd13ff00")
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 bool, 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 subprocess
import sys

# The function takes a code_to_execute parameter which is a string containing
# Python code to be executed in a subprocess. We need to provide valid Python code
# that will execute successfully (return code 0).

# Create a simple, valid Python code string that will execute without errors
code_to_execute = """
import sys
print('Hello, World!')
x = 42
y = x + 8
assert y == 50
"""

ARGS = {
    'code_to_execute': code_to_execute
}
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 bool, 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
create_olmo_consolidated_plot Not yet run
unverified (harvested, no recorded run)
Essential-AI/reflection/results/plot_results.py
code served (permissive licence) · get_code("7f310ddc714b0ca6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 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.

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

A language model's ability to reflect on its own reasoning provides a key advantage for solving complex problems. While most recent research has focused on how this ability develops during reinforcement learning, we show that it actually begins to emerge much earlier - during the model's pre-training. To study this, we introduce deliberate errors into chains-of-thought and test whether the model can still arrive at the correct answer by recognizing and correcting these mistakes. By tracking performance across different stages of pre-training, we observe that this self-correcting ability appears early and improves steadily over time. For instance, an OLMo2-7B model pre-trained on 4 trillion tokens displays self-correction on our six self-reflection tasks.

For agents

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

get_harvested_code_for_paper("2504.04022")
get_code_for_paper("2504.04022")
have("2504.04022")

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

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

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

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

Connect an agent — have() is free.