SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.02378 · 2022

DiT: Self-supervised Pre-training for Document Image Transformer

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 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 9 have no contract verdict; 0 failures of our instrument; 2 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/2203.02378.json · badge: /api/ran/2203.02378.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
thibaultvt/Diard community (classifier label)
classifier basis not recorded on the link
9 ran · 2 no recorded run
FunctionStatusWhere it lives
cells_to_dataframe Ran
ran on a synthesized input
thibaultvt/Diard/modules/tables.py
code served (permissive licence) · get_code("9cf91b6b320054a8")
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 DataFrame. 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 pandas as pd

# Construct valid cells data structure
# Each cell is a dict with 'column', 'content', and bounding box coordinates
cells = [
    {'column': 'Name', 'content': 'Alice', 'x': 10, 'y': 20, 'width': 50, 'height': 30},
    {'column': 'Name', 'content': 'Bob', 'x': 10, 'y': 60, 'width': 50, 'height': 30},
    {'column': 'Age', 'content': '25', 'x': 70, 'y': 20, 'width': 40, 'height': 30},
    {'column': 'Age', 'content': '30', 'x': 70, 'y': 60, 'width': 40, 'height': 30},
    {'column': 'City', 'content': 'NYC', 'x': 120, 'y': 20, 'width': 60, 'height': 30},
    {'column': 'City', 'content': 'LA', 'x': 120, 'y': 60, 'width': 60, 'height': 30},
]

ARGS = {
    'cells': cells
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
get_cells Ran
ran on a synthesized input
thibaultvt/Diard/modules/tables.py
code served (permissive licence) · get_code("97d74784c54ea294")
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 torch

torch.manual_seed(0)

# Create sample prediction objects with table row and column labels
objs = [
    {'label': 'table column', 'bbox': [10, 5, 50, 100]},
    {'label': 'table column', 'bbox': [60, 5, 100, 100]},
    {'label': 'table column', 'bbox': [110, 5, 150, 100]},
    {'label': 'table row', 'bbox': [5, 20, 160, 40]},
    {'label': 'table row', 'bbox': [5, 50, 160, 70]},
    {'label': 'table row', 'bbox': [5, 80, 160, 95]},
    {'label': 'other', 'bbox': [0, 0, 10, 10]},
]

ARGS = {
    'objs': objs
}
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 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_html_span_by_type Ran
ran on a synthesized input
thibaultvt/Diard/modules/export.py
code served (permissive licence) · get_code("4acc3b8aed360e21")
How it ran

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

import torch
import pandas as pd
from io import StringIO

class MockBlock:
    """Mock TextBlock object with required attributes"""
    def __init__(self, block_type, text_content, coordinates):
        self.type = block_type
        self.text = text_content
        self.block = MockBlockCoordinates(coordinates)

class MockBlockCoordinates:
    """Mock block coordinates object"""
    def __init__(self, coords):
        self.coordinates = coords

# Create test blocks for different types
text_block = MockBlock(
    block_type='text',
    text_content='This is a paragraph of text content.',
    coordinates=(0, 0, 100, 50)
)

title_block = MockBlock(
    block_type='title',
    text_content='Document Title',
    coordinates=(0, 0, 200, 80)
)

list_block = MockBlock(
    block_type='list',
    text_content='Item 1\nItem 2\nItem 3',
    coordinates=(0, 0, 150, 100)
)

figure_block = MockBlock(
    block_type='figure',
    text_content='/path/to/image.jpg',
    coordinates=(10, 20, 310, 220)
)

table_text = "Name,Age,City\nAlice,30,NYC\nBob,25,LA"
table_block = MockBlock(
    block_type='table',
    text_content=table_text,
    coordinates=(0, 0, 400, 300)
)

section_num = 1

ARGS = {
    'block': text_block,
    'section': section_num
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_layout_json_dims Ran
ran on a synthesized input
thibaultvt/Diard/load_from_json.py
code served (permissive licence) · get_code("e59657355a3639c1")
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

torch.manual_seed(0)

# Test case 1: Simple nested list
nested_list = [[[1, 2, 3]]]

# Test case 2: Flat list (should return 1)
flat_list = [1, 2, 3]

# Test case 3: Single element (should return 0)
single_element = 5

ARGS = {
    "l": nested_list,
    "dims": 0
}
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 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
get_ratio Ran
ran on a synthesized input
thibaultvt/Diard/modules/sections.py
code served (permissive licence) · get_code("4777134b6ed19f10")
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

ARGS = {
    "coords": (10, 20, 110, 80),
    "text": "Sample Title\nSecond Line"
}
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
get_rows_and_columns Ran
ran on a synthesized input
thibaultvt/Diard/modules/tables.py
code served (permissive licence) · get_code("07c58b9d07ef40c7")
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

torch.manual_seed(0)

ARGS = {
    'objs': [
        {'label': 'table column', 'bbox': [10, 20, 100, 30]},
        {'label': 'table row', 'bbox': [5, 15, 95, 80]},
        {'label': 'table column', 'bbox': [5, 20, 50, 30]},
        {'label': 'table row', 'bbox': [5, 15, 95, 120]},
    ]
}
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 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
map_jenks_labels Ran
ran on a synthesized input
thibaultvt/Diard/modules/sections.py
code served (permissive licence) · get_code("58375cbcbe5207af")
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 torch
import numpy as np

# Analyze the function:
# - ratios: a list of numeric values, accessed by index (ratios[...])
# - labels: a list where each element is used as a dict key and iterated with enumerate
# - label_map: a dict with integer keys (0, 1, 2) mapping to string values
# The function treats labels as integers (0, 1, 2) that serve as keys

# Create small test data
ratios = [0.1, 0.5, 0.8, 0.3, 0.9, 0.2]
labels = [0, 1, 2, 0, 1, 2]
label_map = {0: 'heading', 1: 'sub', 2: 'random'}

ARGS = {
    'ratios': ratios,
    'labels': labels,
    'label_map': label_map,
}
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 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
numbered_filenames_check Ran
ran on a synthesized input
thibaultvt/Diard/modules/document.py
code served (permissive licence) · get_code("fc8daa551fdc9c9e")
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

# Test case 1: all filenames are numbered with extensions
filenames_numbered = ["123.txt", "456.pdf", "789.jpg"]

# Test case 2: filenames with numbers and extensions (valid)
filenames_numbered_2 = ["001.dat", "002.csv", "999.bin"]

# We'll use the first test case
ARGS = {
    "filenames": filenames_numbered
}
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
overlap_check Ran
ran on a synthesized input
thibaultvt/Diard/modules/document.py
code served (permissive licence) · get_code("d0c31fd953920835")
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.

class Rectangle:
    """Stand-in for layoutparser.elements.Rectangle"""
    def __init__(self, x_1, y_1, x_2, y_2):
        self.x_1 = x_1
        self.y_1 = y_1
        self.x_2 = x_2
        self.y_2 = y_2


# Create two rectangles that overlap
r1 = Rectangle(x_1=10, y_1=20, x_2=50, y_2=60)
r2 = Rectangle(x_1=30, y_1=40, x_2=70, y_2=80)

ARGS = {
    "r1": r1,
    "r2": r2,
}
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 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
get_layout_html Not yet run
unverified (harvested, no recorded run)
thibaultvt/Diard/modules/export.py
code served (permissive licence) · get_code("0babed10124ceff7")
How it ran

no invocation recorded.

get_layouts_html Not yet run
unverified (harvested, no recorded run)
thibaultvt/Diard/modules/export.py
code served (permissive licence) · get_code("150d26752650ccb1")
How it ran

no invocation recorded.

Also present in other papers' code

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

Image Transformer has recently achieved significant progress for natural image understanding, either using supervised (ViT, DeiT, etc.) or self-supervised (BEiT, MAE, etc.) pre-training techniques. In this paper, we propose \textbf{DiT}, a self-supervised pre-trained \textbf{D}ocument \textbf{I}mage \textbf{T}ransformer model using large-scale unlabeled text images for Document AI tasks, which is essential since no supervised counterparts ever exist due to the lack of human-labeled document images. We leverage DiT as the backbone network in a variety of vision-based Document AI tasks, including document image classification, document layout analysis, table detection as well as text detection for OCR. Experiment results have illustrated that the self-supervised pre-trained DiT model achieves new state-of-the-art results on these downstream tasks, e.g. document image classification (91.11 $\rightarrow$ 92.69), document layout analysis (91.0 $\rightarrow$ 94.9), table detection (94.23 $\rightarrow$ 96.55) and text detection for OCR (93.07 $\rightarrow$ 94.29). The code and pre-trained models are publicly available at \url{https://aka.ms/msdit}.

For agents

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

get_harvested_code_for_paper("2203.02378")
get_code_for_paper("2203.02378")
have("2203.02378")

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

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

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

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

Connect an agent — have() is free.