SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.21785 · NeurIPS · 2025

Born a Transformer -Always a Transformer? On the Effect of Pretraining on Architectural Abilities

Vera Demberg, Ellie Pavlick, Yash Sarrof, Yana Veitsman, Michael Hahn, Mayank Jobanputra, Aleksandra Bakalova

arXiv · PDF · Open in the Atlas

Code that ran

10 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 10 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/2505.21785.json · badge: /api/ran/2505.21785.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
lacoco-lab/always_a_transformer canonical (classifier label)
classifier basis not recorded on the link
10 ran · 2 no recorded run
FunctionStatusWhere it lives
compute_means_stds Ran
ran on a synthesized input
lacoco-lab/always_a_transformer/copying/evaluation.py
code served (permissive licence) · get_code("8e508289d57d70e2")
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 tuple, ndim 2, 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 pandas as pd
import numpy as np

# Create a sample DataFrame with the structure expected by compute_means_stds
np.random.seed(0)

tasks = ['task_a', 'task_b', 'task_c']
models = ['model_x', 'model_y']
prompt_types = ['prompt_1', 'prompt_2']
seeds = [0, 1, 2]

data = []
for task in tasks:
    for model in models:
        for prompt_type in prompt_types:
            for seed in seeds:
                for _ in range(5):  # Multiple samples per combination
                    correct = np.random.randint(0, 2)  # Binary correct/incorrect
                    data.append({
                        'task': task,
                        'model': model,
                        'prompt_type': prompt_type,
                        'seed': seed,
                        'correct': correct
                    })

df = pd.DataFrame(data)

ARGS = {
    'df': df
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple 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
eval_collator Ran
ran on a synthesized input
lacoco-lab/always_a_transformer/finetuning/copy_str/finetune_copy.py
code served (permissive licence) · get_code("fbf6b639efd24db3")
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

torch.manual_seed(0)

# Create example dictionaries that match what eval_collator expects
examples = [
    {
        'input_ids': torch.tensor([101, 2054, 2003, 102], dtype=torch.long),
        'attention_mask': torch.tensor([1, 1, 1, 1], dtype=torch.long),
        'context_length': 3,
        'target_str': 'hello'
    },
    {
        'input_ids': torch.tensor([101, 1045, 2572, 102], dtype=torch.long),
        'attention_mask': torch.tensor([1, 1, 1, 1], dtype=torch.long),
        'context_length': 2,
        'target_str': 'world test'
    }
]

ARGS = {
    'examples': examples
}
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 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
find_adjacent_characters Ran
ran on a synthesized input
lacoco-lab/always_a_transformer/finetuning/inductionhead/generate_data.py
code served (permissive licence) · get_code("68af3b0107b96e33")
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 tuple, 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 string

def find_adjacent_characters(string_arg, position):
    """
    Find the immediately adjacent characters to the left and right of a given position.

    Args:
        string_arg (str): The input string
        position (int): The position of the character

    Returns:
        tuple: (left_char, right_char) where each may be None if at an edge
    """
    left_char = string_arg[position - 1] if position > 0 else None
    right_char = string_arg[position + 1] if position < len(string_arg) - 1 else None
    return (left_char, right_char)


ARGS = {
    "string": "hello world",
    "position": 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 tuple, ndim 1, dtype family float — a tuple 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
generate_string Ran
ran on a synthesized input
lacoco-lab/always_a_transformer/finetuning/inductionhead/generate_data.py
code served (permissive licence) · get_code("3270771efda2e25f")
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 random
import string

# Set seed for reproducibility
random.seed(42)

# Define arguments for generate_string function
ARGS = {
    "length": 10
}
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
generate_valid_sample Ran
ran on a synthesized input
lacoco-lab/always_a_transformer/finetuning/inductionhead/generate_data.py
code served (permissive licence) · get_code("f1360f0d8bfa8542")
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 random
import string
from collections import Counter

# Set random seed for reproducibility
random.seed(42)

# Define ARGS dictionary with all parameters for generate_valid_sample
ARGS = {
    'min_length': 5,
    'max_length': 15,
    'answer_type': 'left'
}
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
load_adv_accuracies Ran
ran on a synthesized input
lacoco-lab/always_a_transformer/visualisations/finetune_ood.py
code served (permissive licence) · get_code("478f3d6762fd9674")
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 pathlib
import tempfile
import json

# Create a temporary directory structure with test JSONL files
temp_dir = tempfile.TemporaryDirectory()
data_dir = pathlib.Path(temp_dir.name)

# Create subdirectories and test files
(data_dir / "subdir1").mkdir()
(data_dir / "subdir2").mkdir()

# Create test JSONL files with different patterns
test_files = [
    ("first_left_results.jsonl", [
        {"correct": True},
        {"correct": False},
        {"correct": True},
    ]),
    ("first_right_results.jsonl", [
        {"prediction": "A", "target": "A"},
        {"prediction": "B", "target": "C"},
    ]),
    ("last_left_results.jsonl", [
        {"correct": True},
    ]),
    ("nb_results.jsonl", [
        {"prediction": "X", "target": "X"},
        {"prediction": "Y", "target": "Y"},
        {"prediction": "Z", "target": "Z"},
    ]),
]

for filename, entries in test_files:
    filepath = data_dir / "subdir1" / filename
    with open(filepath, 'w') as f:
        for entry in entries:
            f.write(json.dumps(entry) + '\n')

# Create an OOD file that should be skipped
ood_file = data_dir / "subdir2" / "ood_first_left.jsonl"
with open(ood_file, 'w') as f:
    f.write(json.dumps({"correct": True}) + '\n')

ARGS = {
    "data_dir": data_dir,
}
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
load_data_from_file Ran
ran on a synthesized input
lacoco-lab/always_a_transformer/finetuning/copy_str/finetune_copy.py
code served (permissive licence) · get_code("a9ad18c47c5a8531")
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 json
import logging
import tempfile
from pathlib import Path

logging.basicConfig(level=logging.INFO)

# Create a temporary file with valid JSON lines
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.jsonl')
temp_file_path = Path(temp_file.name)

# Write some valid examples with required fields
valid_examples = [
    {'input': 'What is 2+2?', 'golden_answer': '4'},
    {'input': 'What is the capital of France?', 'golden_answer': 'Paris'},
    {'input': 'Explain machine learning', 'golden_answer': 'ML is a field of AI...'},
]

# Write some invalid examples
invalid_examples = [
    'not valid json {',
    '{"input": "missing golden_answer"}',
    '{"golden_answer": "missing input"}',
]

# Write all examples to the temp file
for example in valid_examples:
    temp_file.write(json.dumps(example) + '\n')

for example in invalid_examples:
    temp_file.write(example + '\n')

temp_file.close()

ARGS = {
    'file_path': temp_file_path,
}
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
load_data_from_file Ran
ran on a synthesized input
lacoco-lab/always_a_transformer/finetuning/flipflop/finetune_flipflop.py
code served (permissive licence) · get_code("ac35274d97750578")
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 json
import logging
from pathlib import Path
import tempfile
import os

# Set up logging to see the function's log output
logging.basicConfig(level=logging.INFO)

# Create a temporary directory and file with test data
temp_dir = tempfile.mkdtemp()
temp_file = Path(temp_dir) / "test_data.jsonl"

# Write valid and invalid examples to the file
with open(temp_file, 'w') as f:
    # Valid examples
    f.write(json.dumps({"input": "What is 2+2?", "golden_answer": "4"}) + "\n")
    f.write(json.dumps({"input": "What is the capital of France?", "golden_answer": "Paris"}) + "\n")
    
    # Invalid example (missing golden_answer)
    f.write(json.dumps({"input": "Invalid example"}) + "\n")
    
    # Invalid example (malformed JSON)
    f.write("{ this is not valid json }\n")
    
    # Another valid example
    f.write(json.dumps({"input": "What is 5+3?", "golden_answer": "8"}) + "\n")

ARGS = {
    "file_path": temp_file
}
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
read_accuracy Ran
ran on a synthesized input
lacoco-lab/always_a_transformer/visualisations/finetune_ood.py
code served (permissive licence) · get_code("5e41c7d3af1343c9")
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 json
import pathlib
import tempfile

# Create temporary directory and JSONL files
temp_dir = tempfile.TemporaryDirectory()
temp_path = pathlib.Path(temp_dir.name)

# Create first JSONL file with 'correct' field entries
file1 = temp_path / "results1.jsonl"
with file1.open('w') as f:
    f.write(json.dumps({"correct": True}) + "\n")
    f.write(json.dumps({"correct": False}) + "\n")
    f.write(json.dumps({"correct": True}) + "\n")

# Create second JSONL file with 'prediction' and 'target' field entries
file2 = temp_path / "results2.jsonl"
with file2.open('w') as f:
    f.write(json.dumps({"prediction": "cat", "target": "cat"}) + "\n")
    f.write(json.dumps({"prediction": "dog", "target": "cat"}) + "\n")

# Create file list
file_list = [file1, file2]

ARGS = {
    "file_list": file_list
}
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
task_from_filename Ran
ran on a synthesized input
lacoco-lab/always_a_transformer/visualisations/finetune_ood.py
code served (permissive licence) · get_code("fe46d9a5ad18a011")
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

PATTERNS = {'first_left': 'NLFirst', 'first_right': 'NRFirst', 'last_left': 'NLLast', 'last_right': 'NRLast', 'nb': 'NB', 'nf': 'NF'}

def task_from_filename(name: str):
    for pat, task in PATTERNS.items():
        if pat in name:
            return task
    return None

# The function takes a single string parameter and checks if any pattern key is contained in it
# We'll provide a filename string that contains one of the patterns

ARGS = {
    'name': 'model_first_left_checkpoint.pt'
}
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
load_all_models Not yet run
unverified (harvested, no recorded run)
lacoco-lab/always_a_transformer/copying/evaluation.py
code served (permissive licence) · get_code("ac77a3c20a83e890")
How it ran

no invocation recorded.

load_and_prepare_data Not yet run
unverified (harvested, no recorded run)
lacoco-lab/always_a_transformer/finetuning/flipflop/finetune_flipflop.py
code served (permissive licence) · get_code("d2f2fdec627fb1b5")
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-23.

Repositories linked to this paper

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

Abstract

Transformers have theoretical limitations in modeling certain sequence-to-sequence tasks, yet it remains largely unclear if these limitations play a role in large-scale pretrained LLMs, or whether LLMs might effectively overcome these constraints in practice due to the scale of both the models themselves and their pretraining data. We explore how these architectural constraints manifest after pretraining, by studying a family of retrieval and copying tasks inspired by Liu et al. [2024a]. We use a recently proposed framework for studying length generalization [Huang et al., 2025] to provide guarantees for each of our settings. Empirically, we observe an induction-versus-anti-induction asymmetry, where pretrained models are better at retrieving tokens to the right (induction) rather than the left (anti-induction) of a query token. This asymmetry disappears upon targeted fine-tuning if lengthgeneralization is guaranteed by theory. Mechanistic analysis reveals that this asymmetry is connected to the differences in the strength of induction versus anti-induction circuits within pretrained transformers. We validate our findings through practical experiments on real-world tasks demonstrating reliability risks. Our results highlight that pretraining selectively enhances certain transformer capabilities, but does not overcome fundamental length-generalization limits 1 .

For agents

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

get_harvested_code_for_paper("2505.21785")
get_code_for_paper("2505.21785")
have("2505.21785")

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

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

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

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

Connect an agent — have() is free.