SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.15962 · 2025

Pre-training Limited Memory Language Models with Internal and External Knowledge

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 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 7 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-24; 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.15962.json · badge: /api/ran/2505.15962.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
kilian-group/lmlm canonical (classifier label)
classifier basis not recorded on the link
7 ran · 1 no recorded run
FunctionStatusWhere it lives
add_shared_context_ids Ran
ran on a synthesized input
kilian-group/lmlm/src/lmlm/annotate/utils.py
code served (permissive licence) · get_code("95803855c12113ac")
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 MockDataset. 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 collections import defaultdict, Counter

class MockDataset:
    def __init__(self, examples):
        self.examples = examples
        self.columns = {}
    
    def __iter__(self):
        return iter(self.examples)
    
    def add_column(self, name, values):
        self.columns[name] = values
        return self

dataset = MockDataset([
    {'context': 'ctx1', 'id': 'id1'},
    {'context': 'ctx1', 'id': 'id2'},
    {'context': 'ctx2', 'id': 'id3'},
])

ARGS = {
    'dataset': dataset
}
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 MockDataset — a MockDataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockDataset 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
chunk_wiki_text Ran
ran on a synthesized input
kilian-group/lmlm/src/lmlm/annotate/utils.py
code served (permissive licence) · get_code("a26579611bac7338")
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 torch
import numpy as np

# Construct small test data for chunk_wiki_text function
texts = [
    "This is a sample wikipedia text that contains multiple words and will be split into chunks based on the maximum length parameter.",
    "Another text here with some content that should also be chunked appropriately when processed by the function."
]

ids = [
    "wiki_001",
    "wiki_002"
]

max_len = 10

ARGS = {
    "texts": texts,
    "ids": ids,
    "max_len": max_len
}
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 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
extract_database Ran
ran on a synthesized input
kilian-group/lmlm/src/lmlm/database/database_manager.py
code served (permissive licence) · get_code("802c4b89ef2911cc")
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 Dataset. 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 datasets import Dataset

# Create a minimal dataset with annotated_text column
dataset = Dataset.from_dict({
    'annotated_text': [
        '[dblookup(person, age) -> 25]',
        "[dblookup('city', 'population') -> 1000000]",
        '<|db_entity|>product<|db_relationship|>price<|db_return|>99.99<|db_end|>'
    ]
})

ARGS = {
    'dataset': dataset
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
datasets — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Dataset — a Dataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Dataset output the recorded ndim 1 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
extract_lookups Ran
ran on a synthesized input
kilian-group/lmlm/src/lmlm/database/database_manager.py
code served (permissive licence) · get_code("1c4a4ce0a56f09bb")
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 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 re

def extract_lookups(text, pattern=None):
    """Extract (entity, attribute, answer) triplets from annotated text."""
    if pattern is None:
        pattern_lst = ['\\[dblookup\\(([^,]+),\\s*([^,]+)\\)\\s*->\\s*(.*?)\\]', "\\[dblookup\\('(.+?)',\\s*'(.+?)'\\)\\s*->\\s*(.+?)\\]", '\\s?<\\|db_entity\\|>(.+?)<\\|db_relationship\\|>(.+?)<\\|db_return\\|>(.+?)<\\|db_end\\|>']
    matches = []
    for p in pattern_lst:
        matches.extend(re.findall(p, text, re.DOTALL))
    matches = list({tuple(match) for match in matches})
    return [[item.strip("'").strip('"').strip() for item in match] for match in matches]


# Setup code
text_with_lookups = """
[dblookup(user_id, name) -> John]
[dblookup('product_id', 'price') -> 29.99]
<|db_entity|>order<|db_relationship|>total<|db_return|>150.00<|db_end|>
"""

ARGS = {
    "text": text_with_lookups,
    "pattern": None
}
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 2, 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
register_dataset Ran
ran on a synthesized input
kilian-group/lmlm/src/lmlm/annotate/dataloader.py
code served (permissive licence) · get_code("a5fa7fed5e977268")
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 function. 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 torch.nn as nn

# Initialize the registry that the decorator will populate
_DATASET_REGISTRY = {}

# Setup for register_dataset decorator
# The function only takes a 'name' parameter (string)
# and returns a decorator that registers the function in _DATASET_REGISTRY

# Create a simple dataset preparation function to use with the decorator
def prepare_test_dataset(split="train", subset_ids=None, **kwargs):
    """Example dataset preparation function"""
    texts = ["sample text 1", "sample text 2"]
    ids = [0, 1]
    return texts, ids

# The ARGS dict for register_dataset function
ARGS = {
    "name": "test_dataset"
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
truncate_sample_length Ran
ran on a synthesized input
kilian-group/lmlm/src/lmlm/annotate/utils.py
code served (permissive licence) · get_code("0dd1a961e4577e50")
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)

ARGS = {
    'example': {
        'text': 'the quick brown fox jumps over the lazy dog and runs through the forest with great speed and agility'
    },
    'max_length': 1024
}
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
update_atomic_knowledge Ran
ran on a synthesized input
kilian-group/lmlm/src/lmlm/database/database_manager.py
code served (permissive licence) · get_code("ef77276b20d6ebaf")
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 extract_lookups(text, pattern=None):
    """Extract (entity, attribute, answer) triplets from annotated text."""
    if pattern is None:
        pattern_lst = ['\\[dblookup\\(([^,]+),\\s*([^,]+)\\)\\s*->\\s*(.*?)\\]', "\\[dblookup\\('(.+?)',\\s*'(.+?)'\\)\\s*->\\s*(.+?)\\]", '\\s?<\\|db_entity\\|>(.+?)<\\|db_relationship\\|>(.+?)<\\|db_return\\|>(.+?)<\\|db_end\\|>']
    matches = []
    for p in pattern_lst:
        matches.extend(re.findall(p, text, re.DOTALL))
    matches = list({tuple(match) for match in matches})
    return [[item.strip("'").strip('"').strip() for item in match] for match in matches]

def update_atomic_knowledge(example, current_version=1):
    triplets = extract_lookups(example['annotated_text'])
    example.update({'atomic_knowledge': triplets})
    return example

# Build example dict with annotated_text field containing various dblookup patterns
example = {
    'annotated_text': (
        '[dblookup(entity1, attr1) -> answer1] '
        "[dblookup('entity2', 'attr2') -> answer2] "
        '<|db_entity|>entity3<|db_relationship|>attr3<|db_return|>answer3<|db_end|>'
    )
}

ARGS = {
    'example': example,
    'current_version': 1
}
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_and_filter_dataset Not yet run
unverified (harvested, no recorded run)
kilian-group/lmlm/src/lmlm/database/extract_database.py
code served (permissive licence) · get_code("4dce5964827c7959")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

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

Abstract

Neural language models are black-boxes--both linguistic patterns and factual knowledge are distributed across billions of opaque parameters. This entangled encoding makes it difficult to reliably inspect, verify, or update specific facts. We introduce Limited Memory Language Models (LMLM), a new class of language models that externalizes factual knowledge to external database during pre-training rather than memorizing them. Our pre-training approach strategically masks externally retrieved factual values from the training loss, thereby teaching the model to perform targeted lookups rather than relying on memorization in model weights. Our experiments demonstrate that LMLMs achieve competitive performance compared to significantly larger LLMs on standard benchmarks, while offering the advantages of explicit, editable, and verifiable knowledge bases.

For agents

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

get_harvested_code_for_paper("2505.15962")
get_code_for_paper("2505.15962")
have("2505.15962")

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

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

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

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

Connect an agent — have() is free.