SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2604.08554 · 2026

Drift and selection in LLM text ecosystems

Søren Riis

arXiv · PDF · Open in the Atlas

Code that ran

23 of 27 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; 6 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 16 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/2604.08554.json · badge: /api/ran/2604.08554.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
SR123/LLM-text-ecosystems canonical (classifier label)
classifier basis: census
23 ran · 4 no recorded run
FunctionStatusWhere it lives
clean_literary_text Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/corpus.py
code served (permissive licence) · get_code("8e5fc93aea48cae9")
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 clean_literary_text(text: str) -> str:
    """Lightly normalize text while preserving punctuation and case."""
    text = text.replace('\r\n', '\n').replace('\r', '\n')
    text = re.sub('[ \\t]+', ' ', text)
    text = re.sub('\\n{3,}', '\n\n', text)
    return text.strip() + '\n'

ARGS = {
    'text': "It was the best of times,\r\nit was the worst of times.\n\n\nIt was   the age of wisdom,\tit was the age of foolishness."
}
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
clean_text Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/cleaning.py
code served (permissive licence) · get_code("1b6456251fc3b160")
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 strip_gutenberg_boilerplate(text: str) -> str:
    start_markers = ['*** START OF THE PROJECT GUTENBERG EBOOK', '***START OF THE PROJECT GUTENBERG EBOOK']
    end_markers = ['*** END OF THE PROJECT GUTENBERG EBOOK', '***END OF THE PROJECT GUTENBERG EBOOK']
    lower = text
    start_idx = 0
    for marker in start_markers:
        i = lower.find(marker)
        if i != -1:
            start_idx = i + len(marker)
            break
    end_idx = len(text)
    for marker in end_markers:
        i = lower.find(marker)
        if i != -1:
            end_idx = min(end_idx, i)
    return text[start_idx:end_idx]

def normalize_text(text: str) -> str:
    text = text.replace('\r\n', '\n').replace('\r', '\n')
    text = re.sub('[\\t\\f\\v]+', ' ', text)
    text = re.sub(' +', ' ', text)
    text = re.sub('\\n{3,}', '\n\n', text)
    return text.strip() + '\n'

def clean_text(text: str) -> str:
    return normalize_text(strip_gutenberg_boilerplate(text))

sample_text = """
*** START OF THE PROJECT GUTENBERG EBOOK Sample Book ***

This is the actual content of the book.
It has multiple    spaces   and
weird	tab	characters.


Multiple newlines should be reduced.

*** END OF THE PROJECT GUTENBERG EBOOK Sample Book ***
"""

ARGS = {
    "text": sample_text
}
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
distinct_n Ran
ran, honoured the contract we drafted
SR123/LLM-text-ecosystems/src/drift_selection/metrics.py
code served (permissive licence) · get_code("3192911a149d9849")
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

# Set seed for reproducibility
torch.manual_seed(0)

# Test case 1: list of strings (space-separated tokens)
sequences_strings = [
    "the quick brown fox",
    "the quick fox",
    "brown fox jumps"
]

# Test case 2: list of lists of integers
sequences_ints = [
    [1, 2, 3, 2, 3],
    [1, 2, 3, 4],
    [2, 3, 4, 5]
]

# Test case 3: list of lists of strings
sequences_list_str = [
    ["the", "quick", "brown"],
    ["the", "quick", "fox"],
    ["brown", "fox", "jumps"]
]

# Use one of the test cases
sequences = sequences_strings
n = 2

ARGS = {
    "sequences": sequences,
    "n": n
}
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
doob_h_transform Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SR123/LLM-text-ecosystems/src/drift_selection/markov.py
code served (permissive licence) · get_code("9d574c3fb904a4c1")
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 ndarray, ndim 2, dtype family float, shape (4, 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 numpy as np
from typing import Sequence

# Create a small transition matrix (4x4)
# This represents state transitions in a Markov chain
P = np.array([
    [0.5, 0.3, 0.2, 0.0],
    [0.1, 0.4, 0.3, 0.2],
    [0.0, 0.0, 0.6, 0.4],
    [0.25, 0.25, 0.25, 0.25]
], dtype=float)

# Create a harmonic function h (must be positive for alive states)
h = np.array([2.0, 3.0, 1.5, 2.5], dtype=float)

# Create an alive mask - indicates which states are alive (True) or absorbing (False)
alive = [True, True, False, True]

ARGS = {
    "P": P,
    "h": h,
    "alive": alive
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 4) — shape (4, 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
environment_summary Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/environments.py
code served (permissive licence) · get_code("07331ada1aa91236")
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

# Create a minimal tokenizer stand-in with a decode method
class MinimalTokenizer:
    def decode(self, token_ids):
        return ' '.join(f'tok_{id}' for id in token_ids)

# Create another tokenizer with sp attribute (like sentencepiece)
class SentencePieceTokenizer:
    class SPDecoder:
        def decode(self, token_ids):
            return ''.join(f'[{id}]' for id in token_ids)
    
    def __init__(self):
        self.sp = self.SPDecoder()

# Create token_ids list
token_ids = [1, 2, 3, 4, 5, 2, 3, 1, 4, 5] * 20  # 100 tokens with some repetition

# Create tokenizer
tokenizer = MinimalTokenizer()

ARGS = {
    'token_ids': token_ids,
    'tokenizer': tokenizer
}
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_project_root Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/ngram_regeneration_lab.py
code served (permissive licence) · get_code("56564335fd7b8444")
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 PosixPath. 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.

from pathlib import Path
import tempfile
import os

# Create a temporary directory structure for testing
temp_dir = tempfile.mkdtemp()
temp_path = Path(temp_dir)

# Test case 1: start with None (will use current working directory)
# This is the default case
start_none = None

# Test case 2: start with a specific Path object
start_path = temp_path

ARGS = {
    'start': start_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 PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath 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_environment_tokens Ran
ran, honoured the contract we drafted
SR123/LLM-text-ecosystems/src/drift_selection/environments.py
code served (permissive licence) · get_code("47eaf6cae2094346")
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 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 tempfile
from pathlib import Path
import numpy as np

# Create a temporary numpy file with integer data
with tempfile.NamedTemporaryFile(suffix='.npy', delete=False) as tmp:
    tmp_path = Path(tmp.name)
    arr = np.array([1, 2, 3, 4, 5], dtype=np.int32)
    np.save(tmp_path, arr)

ARGS = {
    'path': tmp_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
load_json Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/checkpoints.py
code served (permissive licence) · get_code("84a5e93fb6de5139")
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 json
from pathlib import Path
import tempfile

# Create a temporary JSON file
temp_dir = Path(tempfile.mkdtemp())
json_file = temp_dir / "test.json"

# Write valid JSON content to the file
test_data = {"key1": "value1", "key2": [1, 2, 3], "key3": {"nested": True}}
json_file.write_text(json.dumps(test_data), encoding='utf-8')

ARGS = {
    "path": json_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 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_json_checkpoint Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/checkpoints.py
code served (permissive licence) · get_code("4a5ed63cca3d14bd")
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 json
from pathlib import Path
import tempfile
import os

# Create a temporary directory and file for testing
temp_dir = tempfile.mkdtemp()
temp_json_path = Path(temp_dir) / "checkpoint.json"

# Create a valid JSON file with sample checkpoint data
checkpoint_data = {
    "model_state": {"layer1": [1, 2, 3], "layer2": [4, 5, 6]},
    "optimizer_state": {"lr": 0.001},
    "epoch": 42
}

temp_json_path.write_text(json.dumps(checkpoint_data), encoding='utf-8')

ARGS = {
    "path": temp_json_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 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_manifest Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/manifests.py
code served (permissive licence) · get_code("2bb9b3fd39a07247")
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 json
from pathlib import Path
import tempfile
import os

# Create a temporary directory and files for testing
temp_dir = tempfile.mkdtemp()

# Create a JSON manifest file
json_path = Path(temp_dir) / "manifest.json"
json_content = {"key": "value", "nested": {"data": 42}}
json_path.write_text(json.dumps(json_content), encoding='utf-8')

# Create a YAML manifest file
yaml_path = Path(temp_dir) / "manifest.yaml"
yaml_content = "key: value\nnested:\n  data: 42\n"
yaml_path.write_text(yaml_content, encoding='utf-8')

# Test with JSON path
ARGS = {
    "path": json_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 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_text_file Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/corpus.py
code served (permissive licence) · get_code("190ae407f3792fbb")
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 tempfile
from pathlib import Path

# Create a temporary text file with some content
with tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False, encoding='utf-8') as f:
    f.write("Hello, this is a test file.\nIt contains multiple lines.\n")
    temp_file_path = f.name

ARGS = {
    '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 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
manifest_with_hashes Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/manifests.py
code served (permissive licence) · get_code("503006c62a3e8bb1")
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 hashlib
from pathlib import Path
import tempfile
import os

# Create temporary files for testing
temp_dir = tempfile.mkdtemp()

# Create some test files with known content
test_file_1 = Path(temp_dir) / "test1.txt"
test_file_1.write_text("Hello, World!")

test_file_2 = Path(temp_dir) / "test2.txt"
test_file_2.write_text("Another test file with some content.")

test_file_3 = Path(temp_dir) / "test3.bin"
test_file_3.write_bytes(b"\x00\x01\x02\x03\x04\x05")

# Create a non-existent file path to test the exists() check
non_existent_file = Path(temp_dir) / "does_not_exist.txt"

# Build the files list with a mix of existing and non-existing files
files = [test_file_1, test_file_2, test_file_3, non_existent_file]

ARGS = {
    'files': files
}
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
normalize_rows Ran
ran, violated the contract we drafted
SR123/LLM-text-ecosystems/src/drift_selection/markov.py
code served (permissive licence) · get_code("65b509daa33381f3")
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 ndarray, ndim 2, dtype family float, shape (4, 3) 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 numpy as np

# Create a small test matrix with distinct dimensions
# Using 4 rows and 3 columns to make dimensions unambiguous
matrix = np.array([
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0],
    [0.0, 0.0, 0.0],
    [2.0, 2.0, 2.0]
], dtype=float)

ARGS = {
    "matrix": matrix
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 3) — shape (4, 3) 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
normalize_text Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/cleaning.py
code served (permissive licence) · get_code("7987ba488637f64c")
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 normalize_text(text: str) -> str:
    text = text.replace('\r\n', '\n').replace('\r', '\n')
    text = re.sub('[\\t\\f\\v]+', ' ', text)
    text = re.sub(' +', ' ', text)
    text = re.sub('\\n{3,}', '\n\n', text)
    return text.strip() + '\n'

# Test input with various whitespace patterns
test_text = "Hello\r\nworld\t\ttest\n\n\n\nmore   spaces  here\r\nend"

ARGS = {
    "text": test_text
}
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
register_run Ran
ran, honoured the contract we drafted
SR123/LLM-text-ecosystems/src/drift_selection/database.py
code served (permissive licence) · get_code("f6f4cde455f4fb61")
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 sqlite3
import tempfile
import json
from pathlib import Path

# Create a temporary directory for the database
temp_dir = tempfile.mkdtemp()
db_path = Path(temp_dir) / "experiment_registry.db"

# Define metadata dictionary with all expected fields
metadata = {
    'timestamp_start': '2024-01-15T10:00:00',
    'timestamp_end': '2024-01-15T10:30:00',
    'git_version': 'abc123def456',
    'corpus': 'test_corpus',
    'model_family': 'bert',
    'selection_rule': 'random',
    'seed': 42,
    'output_dir': '/tmp/output',
    'metrics_summary': '{"accuracy": 0.95}',
    'status': 'completed',
    'extra_field': 'extra_value'
}

ARGS = {
    'db_path': db_path,
    'run_name': 'test_run_001',
    'script_or_notebook': 'train.py',
    'config_path': '/path/to/config.yaml',
    'metadata': metadata
}
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 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
repetition_n Ran
ran, honoured the contract we drafted
SR123/LLM-text-ecosystems/src/drift_selection/metrics.py
code served (permissive licence) · get_code("de6ef20b34337186")
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 `repetition_n` takes two parameters:
# 1. sequences: list[list[int]] | list[str]
# 2. n: int (default=4)

# Looking at the function body:
# - sequences is passed to distinct_n and then _normalize_sequences
# - _normalize_sequences handles: list[list[int]], list[str], or list[list[str]]
# - For list[str], it splits each string by whitespace
# - For list[list[int]] or list[list[str]], it converts to list
# - n is used as an integer parameter

# Create test data: list of strings (each string will be split into words)
sequences_test = [
    "the quick brown fox",
    "the lazy dog",
    "the quick brown dog"
]

# Alternative: list of lists of integers
sequences_test_alt = [
    [1, 2, 3, 4, 5],
    [1, 2, 3, 4, 6],
    [1, 2, 3, 7, 8]
]

ARGS = {
    "sequences": sequences_test,
    "n": 2
}
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
resume_generation_state Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/checkpoints.py
code served (permissive licence) · get_code("63fc35dc28e4afca")
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 tempfile
import json
from pathlib import Path

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()
out_dir = Path(temp_dir)

# Create a generation_state.json file
generation_state = {
    "step": 100,
    "epoch": 5,
    "model_checkpoint": "model.pt",
    "optimizer_state": {"lr": 0.001}
}

state_file = out_dir / 'generation_state.json'
state_file.write_text(json.dumps(generation_state), encoding='utf-8')

ARGS = {
    "out_dir": out_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
save_environment_tokens Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/environments.py
code served (permissive licence) · get_code("8c87d68d800d586f")
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 tempfile
from pathlib import Path
import numpy as np

# Create a minimal tokenizer with decode method
class MinimalTokenizer:
    def decode(self, token_ids):
        return f"decoded_tokens_{len(token_ids)}"

# Create another tokenizer variant with sp attribute
class SentencepieceTokenizer:
    class SP:
        def decode(self, token_ids):
            return f"sp_decoded_{len(token_ids)}"
    
    def __init__(self):
        self.sp = self.SP()

# Set up arguments
temp_dir = tempfile.mkdtemp()

ARGS = {
    'out_dir': Path(temp_dir),
    'env_name': 'test_environment',
    'token_ids': [1, 2, 3, 4, 5, 10, 20, 100],
    'tokenizer': MinimalTokenizer()
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
snapshot_path Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/ngram_regeneration_lab.py
code served (permissive licence) · get_code("fd2d7bf93d16321f")
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 PosixPath. 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.

from pathlib import Path

ARGS = {
    'state_dir': Path('/tmp/state'),
    'generation': 42,
}
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 PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath 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
strip_gutenberg_boilerplate Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/cleaning.py
code served (permissive licence) · get_code("ea5df48f840de685")
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.

# Setup code for strip_gutenberg_boilerplate

ARGS = {
    "text": """*** START OF THE PROJECT GUTENBERG EBOOK ***
This is the main content of the book.
Some text goes here.
*** END OF THE PROJECT GUTENBERG EBOOK ***
Some trailing boilerplate after the end marker."""
}
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
support_dropout_rate Ran
ran, honoured the contract we drafted
SR123/LLM-text-ecosystems/src/drift_selection/ngram.py
code served (permissive licence) · get_code("dbd466fd97fcf021")
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 random
from collections import Counter, defaultdict

class NgramModel:
    def __init__(self, order=3):
        if order < 1:
            raise ValueError('order must be >= 1')
        self.order = order
        self.counts = defaultdict(Counter)
        self.totals = Counter()

    def fit(self, tokens):
        seq = list(tokens)
        if len(seq) < self.order:
            return
        for i in range(self.order - 1, len(seq)):
            ctx = tuple(seq[i - self.order + 1:i])
            nxt = seq[i]
            self.counts[ctx][nxt] += 1
            self.totals[ctx] += 1

    def context_distribution(self, context):
        if context in self.counts and self.totals[context] > 0:
            total = float(self.totals[context])
            return {tok: c / total for tok, c in self.counts[context].items()}
        if len(context) > 0:
            return self.context_distribution(context[1:])
        merged = Counter()
        for c in self.counts.values():
            merged.update(c)
        total = float(sum(merged.values()) or 1)
        return {tok: c / total for tok, c in merged.items()} if merged else {'.': 1.0}

    def sample_next(self, context, rng=None):
        rng = rng or random.Random()
        dist = self.context_distribution(context)
        items = list(dist.items())
        r = rng.random()
        acc = 0.0
        for tok, p in items:
            acc += p
            if r <= acc:
                return tok
        return items[-1][0]

    def generate(self, seed_tokens, length, rng=None):
        rng = rng or random.Random()
        out = list(seed_tokens)
        while len(out) < length:
            ctx_len = self.order - 1
            ctx = tuple(out[-ctx_len:]) if ctx_len > 0 else tuple()
            out.append(self.sample_next(ctx, rng=rng))
        return out

    def support_size(self, context):
        return len(self.context_distribution(context))


# Create source NgramModel with some training data
source = NgramModel(order=3)
source_tokens = ['the', 'cat', 'sat', 'on', 'the', 'mat', 'the', 'cat', 'ran']
source.fit(source_tokens)

# Create sampled NgramModel that has some overlapping and some missing contexts
sampled = NgramModel(order=3)
sampled_tokens = ['the', 'cat', 'sat', 'on', 'a', 'rug']
sampled.fit(sampled_tokens)

ARGS = {
    'source': source,
    'sampled': sampled,
}
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
support_rate Ran
ran, honoured the contract we drafted
SR123/LLM-text-ecosystems/src/drift_selection/metrics.py
code served (permissive licence) · get_code("4ed08b3715922160")
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

torch.manual_seed(0)

ARGS = {
    "nonzero_items": 5,
    "total_items": 10
}
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 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
survival_probabilities Ran
ran; our contract draft was wrong, not the code
SR123/LLM-text-ecosystems/src/drift_selection/markov.py
code served (permissive licence) · get_code("ff10d1918cbb28d2")
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 ndarray, ndim 2, dtype family float, shape (4, 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 numpy as np

# Set up the transition matrix P (4x4)
# This represents transition probabilities between states
P = np.array([
    [0.5, 0.3, 0.2, 0.0],
    [0.1, 0.4, 0.3, 0.2],
    [0.0, 0.2, 0.5, 0.3],
    [0.0, 0.0, 0.0, 1.0]
], dtype=float)

# Set up alive mask - which entities are initially alive (4 entities)
alive = [True, True, False, True]

# Set up horizon - number of time steps to simulate
horizon = 3

ARGS = {
    "P": P,
    "alive": alive,
    "horizon": horizon
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 4) — shape (4, 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
default_output_root Not yet run
unverified (harvested, no recorded run)
SR123/LLM-text-ecosystems/src/drift_selection/ngram_regeneration_lab.py
code served (permissive licence) · get_code("ab35f17bdda388e6")
How it ran

no invocation recorded.

file_sha256 Not yet run
unverified (harvested, no recorded run)
SR123/LLM-text-ecosystems/src/drift_selection/manifests.py
code served (permissive licence) · get_code("1e3d2b319c17f814")
How it ran

no invocation recorded.

load_text_files Not yet run
unverified (harvested, no recorded run)
SR123/LLM-text-ecosystems/src/drift_selection/corpus.py
code served (permissive licence) · get_code("30acd7161d4a8d38")
How it ran

no invocation recorded.

run_figure3_reproduction Not yet run
unverified (harvested, no recorded run)
SR123/LLM-text-ecosystems/src/drift_selection/conan_doyle_figure3.py
code served (permissive licence) · get_code("9fc8299e527871b4")
How it ran

no invocation recorded.

Also present in other papers' code

Of 27 samples lifted from this paper's linked repositories, 27 carry a function identity and 0 do not. Of the 27 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 27 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

The public text record-the material from which both people and AI systems now learn-is increasingly shaped by its own outputs. Generated text enters the public record, later agents learn from it, and the cycle repeats. Here we develop an exactly solvable mathematical framework for this recursive process, based on variable-order n-gram agents, and separate two forces acting on the public corpus. The first is drift: unfiltered reuse progressively removes rare forms, and in the infinite-corpus limit we characterise the stable distributions exactly. The second is selection: publication, ranking and verification filter what enters the record, and the outcome depends on what is selected. When publication merely reflects the statistical status quo, the corpus converges to a shallow state in which further lookahead brings no benefit. When publication is normative-rewarding quality, correctness or novelty-deeper structure persists, and we establish an optimal upper bound on the resulting divergence from shallow equilibria. The framework therefore identifies when recursive publication compresses public text and when selective filtering sustains richer structure, with implications for the design of AI training corpora.

For agents

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

get_harvested_code_for_paper("2604.08554")
get_code_for_paper("2604.08554")
have("2604.08554")

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

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

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

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

Connect an agent — have() is free.