SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2607.21936 · 2026

Leveraging External Knowledge for Historical Document Restoration via Retrieval-Augmented Large Language Models

Kyeongpil Kang, Gabeen Kim

arXiv · PDF · Open in the Atlas

Code that ran

12 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; 1 honoured the contract we drafted, 2 violated it and 0 have no contract verdict; 9 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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/2607.21936.json · badge: /api/ran/2607.21936.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
EvelynKimm/ARI canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
rapidfuzz/RapidFuzz canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
FunctionStatusWhere it lives
are_sentences_equal Ran
ran, violated the contract we drafted
EvelynKimm/ARI/src/hanja_llm/retrieve_documents.py
pointer only (licence: NONE) · get_code("dadc05557c635473")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, EvelynKimm/ARI when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

build_ner_vocab Ran
ran; our contract draft was wrong, not the code
EvelynKimm/ARI/src/data_preprocessing/build_dataset.py
pointer only (licence: NONE) · get_code("f36ba373f73f6632")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, EvelynKimm/ARI when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

common_prefix Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
rapidfuzz/RapidFuzz/src/rapidfuzz/_common_py.py
code served (permissive licence) · get_code("520f1779b6da8094")
How it ran

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

import torch
import numpy as np
from collections.abc import Hashable, Sequence

torch.manual_seed(0)

# Create two sequences of hashable objects to test the common_prefix function
s1 = [1, 2, 3, 4, 5]
s2 = [1, 2, 3, 6, 7]

ARGS = {
    "s1": s1,
    "s2": s2,
}
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 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
conv_sequence Ran
ran, honoured the contract we drafted
rapidfuzz/RapidFuzz/src/rapidfuzz/_common_py.py
code served (permissive licence) · get_code("55d4a0bbaeac08af")
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.

from array import array
from collections.abc import Sequence, Hashable

# Test case 1: string input
test_str = "hello"

# Test case 2: bytes input
test_bytes = b"world"

# Test case 3: array with typecode 'u' (unicode, will convert to ord)
test_array_u = array('u', 'abc')

# Test case 4: array with typecode 'i' (int, will return as-is)
test_array_i = array('i', [1, 2, 3])

# Test case 5: list with mixed elements (strings, ints, hashable objects)
test_list = ['a', 'b', -1, 42, ('tuple', 'obj')]

# Test case 6: None input
test_none = None

# Choose one test case for ARGS
ARGS = {
    "s": test_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 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
conv_sequences Ran
ran; our contract draft was wrong, not the code
rapidfuzz/RapidFuzz/src/rapidfuzz/_common_py.py
code served (permissive licence) · get_code("e94eb51a98ee6ca2")
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.

from array import array
from collections.abc import Sequence, Hashable

# Test case 1: Two strings
s1_strings = "hello"
s2_strings = "world"

# Test case 2: Two bytes objects
s1_bytes = b"hello"
s2_bytes = b"world"

# Test case 3: Two lists with mixed hashable elements
s1_list = ["a", "b", 1, -1, "x"]
s2_list = ["c", 2, -1, "y", "z"]

# Test case 4: Two lists with various hashable types
s1_mixed = [1, "q", -1, 42]
s2_mixed = ["r", 2, -1, 100]

# Select one test case for ARGS
ARGS = {
    "s1": s1_strings,
    "s2": s2_strings,
}
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
default_process Ran
ran; our contract draft was wrong, not the code
rapidfuzz/RapidFuzz/src/rapidfuzz/utils_py.py
code served (permissive licence) · get_code("116c6961c1a7cb9d")
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

_alnum_regex = re.compile('(?ui)\\W')

def default_process(sentence: str) -> str:
    """
    This function preprocesses a string by:

    * removing all non alphanumeric characters

    * trimming whitespaces

    * converting all characters to lower case

    Parameters
    ----------
    sentence : str
        String to preprocess

    Returns
    -------
    processed_string : str
        processed string
    """
    string_out = _alnum_regex.sub(' ', sentence)
    return string_out.strip().lower()


ARGS = {
    "sentence": "Hello, World! This is a TEST string with 123 numbers."
}
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
format_documents Ran
ran; our contract draft was wrong, not the code
EvelynKimm/ARI/src/data_preprocessing/build_dataset.py
pointer only (licence: NONE) · get_code("c03245770c31ab0d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, EvelynKimm/ARI when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

is_none Ran
ran, violated the contract we drafted
rapidfuzz/RapidFuzz/src/rapidfuzz/_utils.py
code served (permissive licence) · get_code("eabd22370da53c9e")
How it ran

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

import torch
import numpy as np
from math import isnan

torch.manual_seed(0)

# The function is_none takes a single parameter 's' of type Any
# It checks if s is None, pandas_NA, or a float NaN value
# We need to provide a test value for this parameter

ARGS = {
    "s": None
}
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 bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
map_damage_tokens Ran
ran; our contract draft was wrong, not the code
EvelynKimm/ARI/src/data_preprocessing/mask.py
pointer only (licence: NONE) · get_code("186e9ea55cd44b2e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, EvelynKimm/ARI when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

process_ner_texts Ran
ran; our contract draft was wrong, not the code
EvelynKimm/ARI/src/data_preprocessing/utils.py
pointer only (licence: NONE) · get_code("101c741af20a43b0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, EvelynKimm/ARI when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

process_text Ran
ran; our contract draft was wrong, not the code
EvelynKimm/ARI/src/data_preprocessing/utils.py
pointer only (licence: NONE) · get_code("ce507b21d8786f36")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, EvelynKimm/ARI when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

remove_damage_patterns Ran
ran; our contract draft was wrong, not the code
EvelynKimm/ARI/src/hanja_llm/retrieve_documents.py
pointer only (licence: NONE) · get_code("f0625b92678c3db4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, EvelynKimm/ARI when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is 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

Historical documents act as invaluable knowledge archives but often suffer from illegibility due to physical deterioration and damage. While existing restoration methods based on masked language modeling effectively utilize local context, they struggle to restore named entities that require external historical knowledge. To address this limitation, we introduce a novel framework for historical document restoration that leverages large language models with retrieval-augmented generation (RAG). By combining the implicit knowledge of pretrained LLMs with explicitly retrieved external context, our model ARI effectively mitigates the challenge of inferring context-dependent proper nouns. Extensive experiments on Korean historical documents demonstrate that our approach significantly outperforms baselines, achieving substantial gains in restoring both general characters and named entities. Furthermore, comprehensive evaluations including expert assessments confirm that ARI serves as a practical tool for domain experts, promising to accelerate the analysis of historical records.

For agents

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

get_harvested_code_for_paper("2607.21936")
get_code_for_paper("2607.21936")
have("2607.21936")

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

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

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

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

Connect an agent — have() is free.