SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.00526 · 2023

Layout and Task Aware Instruction Prompt for Zero-shot Document Image Question Answering

arXiv · PDF · Open in the Atlas

Code that ran

8 of 10 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; 1 failure 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/2306.00526.json · badge: /api/ran/2306.00526.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
wenjinw/latin-prompt canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
deepopinion/anls-star-metric community (classifier label)
classifier basis not recorded on the link
2 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_l2_dist Ran
ran on a synthesized input
wenjinw/latin-prompt/utils/util.py
code served (permissive licence) · get_code("9741f65bce116c5a")
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 Tensor, ndim 2, dtype family float, shape (2, 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 torch

torch.manual_seed(0)

# q: N1xd tensor
q = torch.randn(2, 4)

# s: N2xd tensor
s = torch.randn(3, 4)

ARGS = {
    "q": q,
    "s": s,
}
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 Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 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
construct_nested_dict Ran
ran on a synthesized input
deepopinion/anls-star-metric/src/anls_star/key_scores_utils.py
code served (permissive licence) · get_code("e5d4f184819c330c")
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.

from dataclasses import dataclass, field
from typing import Any

@dataclass
class ScoreNode:
    anls_score: float | None = None
    children: dict[str, Any] = field(default_factory=dict)

# Construct valid arguments for construct_nested_dict
list_of_dicts = [
    {("a",): 3.0},
    {("a", "b", "c"): 1.0},
    {("a", "b", "d"): 2.0},
    {("a", "c", "e"): 3.0},
]

ARGS = {
    "list_of_dicts": list_of_dicts,
}
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
cos_sim Ran
ran on a synthesized input
wenjinw/latin-prompt/utils/util.py
code served (permissive licence) · get_code("c480c7bac03cd36f")
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 Tensor, ndim 2, dtype family float, shape (2, 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 torch

torch.manual_seed(0)

# feat1: P1 x D tensor (current documents features)
feat1 = torch.randn(2, 4)

# feat2: P2 x D tensor (candidate reference documents features)
feat2 = torch.randn(3, 4)

ARGS = {
    "feat1": feat1,
    "feat2": feat2,
}
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 Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 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
document_sim Ran
ran on a synthesized input
wenjinw/latin-prompt/utils/util.py
code served (permissive licence) · get_code("87fed178011a98e9")
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 Tensor, ndim 2, dtype family float, shape (2, 2) 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)

# Parameters for document_sim function
# feat1: B1 x L1 x D - features of current documents
# feat2: B2 x L2 x D - features of candidate reference documents
# mask1: B1 x L1 - masks of current documents
# mask2: B2 x L2 - masks of candidate reference documents

B1 = 2
L1 = 3
B2 = 2
L2 = 4
D = 5

feat1 = torch.randn(B1, L1, D)
feat2 = torch.randn(B2, L2, D)
mask1 = torch.ones(B1, L1)
mask2 = torch.ones(B2, L2)

ARGS = {
    "feat1": feat1,
    "feat2": feat2,
    "mask1": mask1,
    "mask2": mask2,
}
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 Tensor, ndim 2, dtype family float, shape (2, 2) — shape (2, 2) 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
load_image Ran
ran on a synthesized input
wenjinw/latin-prompt/utils/docvqa.py
code served (permissive licence) · get_code("db4bf2624e9f59ae")
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. 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 os
from PIL import Image

# Create a temporary directory for test images
temp_dir = tempfile.mkdtemp()

# Create a small test image
test_image = Image.new('RGB', (100, 80), color='red')
test_image_path = os.path.join(temp_dir, 'test_image.png')
test_image.save(test_image_path)

ARGS = {
    'image_path': test_image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
merge_and_calculate_mean Ran
ran on a synthesized input
deepopinion/anls-star-metric/src/anls_star/key_scores_utils.py
code served (permissive licence) · get_code("a2e70e7ad97878ef")
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

# Construct valid arguments for merge_and_calculate_mean
# The function takes a list of dictionaries where keys are tuples of strings
# and values are floats

# Example 1: Simple case with overlapping and non-overlapping keys
list_of_dicts = [
    {('a', 'b'): 10.0, ('c', 'd'): 20.0},
    {('a', 'b'): 30.0, ('e', 'f'): 40.0},
    {('c', 'd'): 40.0}
]

ARGS = {
    "list_of_dicts": list_of_dicts
}
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
normalize_bbox Ran
ran; our contract draft was wrong, not the code
wenjinw/latin-prompt/utils/docvqa.py
pointer only (licence: MIT); the stored copy get_code serves, from Line-Kite/HGALayoutLM, is pointer only (licence: NONE) · get_code("c23469a99394f25f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from Line-Kite/HGALayoutLM, and GitHub detected no licence in that repository 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.

quad_to_box Ran
ran on a synthesized input
wenjinw/latin-prompt/utils/docvqa.py
code served (permissive licence) · get_code("ec25301365f6d685")
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 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

torch.manual_seed(0)

# Analyzing the function: quad_to_box expects a dict with keys 'x1', 'y1', 'x3', 'y3'
# The function accesses these keys and performs comparisons and tuple operations

quad = {
    'x1': 10,
    'y1': 20,
    'x3': 100,
    'y3': 150
}

ARGS = {
    'quad': quad
}
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 1, dtype family int — 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
openai_chat_completion Not yet run
unverified (harvested, no recorded run)
wenjinw/latin-prompt/utils/openai_api.py
code served (permissive licence) · get_code("f03fda2a07bb8465")
How it ran

no invocation recorded.

openai_completion Not yet run
unverified (harvested, no recorded run)
wenjinw/latin-prompt/utils/openai_api.py
code served (permissive licence) · get_code("430f1617115f7078")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 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.

FunctionAlso present inEarliest-datedOthers named
normalize_bbox 1 other paper
1 later
2407.06904 (2024-07)
Hypergraph based Understanding for Document Semantic Entity Recognition

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

Layout-aware pre-trained models has achieved significant progress on document image question answering. They introduce extra learnable modules into existing language models to capture layout information within document images from text bounding box coordinates obtained by OCR tools. However, extra modules necessitate pre-training on extensive document images. This prevents these methods from directly utilizing off-the-shelf instruction-tuning language foundation models, which have recently shown promising potential in zero-shot learning. Instead, in this paper, we find that instruction-tuning language models like Claude and ChatGPT can understand layout by spaces and line breaks. Based on this observation, we propose the LAyout and Task aware Instruction Prompt (LATIN-Prompt), which consists of layout-aware document content and task-aware instruction. Specifically, the former uses appropriate spaces and line breaks to recover the layout information among text segments obtained by OCR tools, and the latter ensures that generated answers adhere to formatting requirements. Moreover, we propose the LAyout and Task aware Instruction Tuning (LATIN-Tuning) to improve the performance of small instruction-tuning models like Alpaca. Experimental results show that LATIN-Prompt enables zero-shot performance of Claude and ChatGPT to be comparable to the fine-tuning performance of SOTAs on document image question answering, and LATIN-Tuning enhances the zero-shot performance of Alpaca significantly. For example, LATIN-Prompt improves the performance of Claude and ChatGPT on DocVQA by 263% and 20% respectively. LATIN-Tuning improves the performance of Alpaca on DocVQA by 87.7%. Quantitative and qualitative analyses demonstrate the effectiveness of LATIN-Prompt and LATIN-Tuning. We provide the code in supplementary and will release it to facilitate future research.

For agents

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

get_harvested_code_for_paper("2306.00526")
get_code_for_paper("2306.00526")
have("2306.00526")

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

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

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

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

Connect an agent — have() is free.