SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2111.15664 · 2021

OCR-free Document Understanding Transformer

arXiv · PDF · Open in the Atlas

Code that ran

5 of 9 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 5 have no contract verdict; 0 failures of our instrument; 4 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2111.15664.json · badge: /api/ran/2111.15664.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
clovaai/donut canonical (classifier label)
classifier basis not recorded on the link
1 ran · 0 no recorded run
impira/docquery community (classifier label)
classifier basis not recorded on the link
4 ran · 4 no recorded run
FunctionStatusWhere it lives
decode_spans Ran
ran on a synthesized input
impira/docquery/src/docquery/ext/qa_helpers.py
code served (permissive licence) · get_code("5af813087bf4d28a")
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 numpy as np

# Create small test arrays for start and end probabilities
# Shape: (batch_size=1, seq_len=5)
start = np.array([[0.1, 0.9, 0.3, 0.2, 0.4]], dtype=np.float32)
end = np.array([[0.2, 0.3, 0.8, 0.1, 0.5]], dtype=np.float32)

# topk parameter - how many top candidates to return
topk = 2

# max_answer_len - maximum length of answer span
max_answer_len = 3

# undesired_tokens - mask of tokens that should not be in answer spans
# Shape: (seq_len=5,) - True where tokens are undesired, False where desired
undesired_tokens = np.array([False, False, True, False, False], dtype=bool)

ARGS = {
    "start": start,
    "end": end,
    "topk": topk,
    "max_answer_len": max_answer_len,
    "undesired_tokens": undesired_tokens,
}
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 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
donut_token2json Ran
ran on a synthesized input
impira/docquery/src/docquery/ext/pipeline_document_classification.py
code served (permissive licence) · get_code("74ec9de19aac6a0c")
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 re

class MockTokenizer:
    """Mock tokenizer that supports get_added_vocab"""
    def __init__(self):
        self._added_vocab = {
            '<s_name>': 0,
            '<s_value>': 1,
            '</s_name>': 2,
            '</s_value>': 3,
            '<sep/>': 4,
            '<date/>': 5,
        }
    
    def get_added_vocab(self):
        return self._added_vocab


tokenizer = MockTokenizer()

# Simple test case with basic structure
tokens = '<s_name>John Doe</s_name><sep/><s_value>123</s_value>'

ARGS = {
    'tokenizer': tokenizer,
    'tokens': tokens,
    'is_inner_value': False,
}
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
get_logger Ran
ran on a synthesized input
impira/docquery/src/docquery/config.py
code served (permissive licence) · get_code("5df09cd2222c8bdc")
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 Logger. 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 logging

ARGS = {
    "prefix": "test_logger"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pydantic — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Logger — a Logger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Logger 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 Ran
ran on a synthesized input
clovaai/donut/donut/util.py
code served (permissive licence) · get_code("263020461a3e369d")
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
import os
import tempfile

# Create a temporary JSON file for testing
temp_dir = tempfile.mkdtemp()
test_json_path = os.path.join(temp_dir, "test.json")

# Write a valid JSON file
test_data = {
    "key1": "value1",
    "key2": [1, 2, 3],
    "key3": {"nested": "object"}
}

with open(test_json_path, 'w') as f:
    json.dump(test_data, f)

# Define ARGS mapping all parameters
ARGS = {
    "json_path": test_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
normalize_box Ran
ran on a synthesized input
impira/docquery/src/docquery/ext/pipeline_document_question_answering.py
code served (permissive licence) · get_code("ad692f1231b24538")
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 torch
import numpy as np

torch.manual_seed(0)

# The function normalize_box takes:
# - box: a sequence with 4 elements (coordinates)
# - width: a numeric value
# - height: a numeric value

ARGS = {
    "box": [100, 200, 300, 400],
    "width": 640,
    "height": 480
}
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 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
apply_tesseract Not yet run
unverified (harvested, no recorded run)
impira/docquery/src/docquery/ext/pipeline_document_question_answering.py
code served (permissive licence) · get_code("0a993549920c0550")
How it ran

no invocation recorded.

main Not yet run
unverified (harvested, no recorded run)
impira/docquery/src/docquery/cmd/__main__.py
code served (permissive licence) · get_code("67438118b555068e")
How it ran

no invocation recorded.

pipeline Not yet run
unverified (harvested, no recorded run)
impira/docquery/src/docquery/transformers_patch.py
code served (permissive licence) · get_code("c783979082342a7f")
How it ran

no invocation recorded.

select_starts_ends Not yet run
unverified (harvested, no recorded run)
impira/docquery/src/docquery/ext/qa_helpers.py
code served (permissive licence) · get_code("7239c77e40da43e7")
How it ran

no invocation recorded.

Also present in other papers' code

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

Understanding document images (e.g., invoices) is a core but challenging task since it requires complex functions such as reading text and a holistic understanding of the document. Current Visual Document Understanding (VDU) methods outsource the task of reading text to off-the-shelf Optical Character Recognition (OCR) engines and focus on the understanding task with the OCR outputs. Although such OCR-based approaches have shown promising performance, they suffer from 1) high computational costs for using OCR; 2) inflexibility of OCR models on languages or types of document; 3) OCR error propagation to the subsequent process. To address these issues, in this paper, we introduce a novel OCR-free VDU model named Donut, which stands for Document understanding transformer. As the first step in OCR-free VDU research, we propose a simple architecture (i.e., Transformer) with a pre-training objective (i.e., cross-entropy loss). Donut is conceptually simple yet effective. Through extensive experiments and analyses, we show a simple OCR-free VDU model, Donut, achieves state-of-the-art performances on various VDU tasks in terms of both speed and accuracy. In addition, we offer a synthetic data generator that helps the model pre-training to be flexible in various languages and domains. The code, trained model and synthetic data are available at https://github.com/clovaai/donut.

For agents

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

get_harvested_code_for_paper("2111.15664")
get_code_for_paper("2111.15664")
have("2111.15664")

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

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

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

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

Connect an agent — have() is free.