SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2023.findings-emnlp.107 · EMNLP Findings · 2023

Global Structure Knowledge-Guided Relation Extraction Method for Visually-Rich Document

Juncheng Li, Siliang Tang, Xiaozhong Liu, Xiangnan Chen, Qian Xiao, Duo Dong, Jun Lin

Open in the Atlas

Code that ran

7 of 7 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, 0 violated it and 4 have no contract verdict; 2 failures of our instrument; 0 no recorded run), measured 2026-11-24; 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/2023.findings-emnlp.107.json · badge: /api/ran/2023.findings-emnlp.107.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
chenxn2020/GOSE canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
FunctionStatusWhere it lives
calc_cross Ran
ran on a synthesized input
chenxn2020/GOSE/GOSEfinetune/evaluation.py
code served (permissive licence) · get_code("41a31f58ac11fb41")
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.

# Analyze the function: calc_cross takes pred_links and gt_links
# These appear to be sets of links where each link is a tuple of two points
# Each point is a tuple of (x, y) coordinates

# The function performs set operations (&, -) so pred_links and gt_links must be sets
# Each element in the set is a link represented as a tuple of two tuples: ((x1, y1), (x2, y2))

# Create sample link data
# Links are represented as tuples of two points, where each point is a tuple (x, y)
link1 = ((0, 0), (1, 1))
link2 = ((2, 2), (3, 3))
link3 = ((0.5, 0), (0.5, 2))  # This crosses link1
link4 = ((4, 4), (5, 5))
link5 = ((1, 0), (1, 2))  # This crosses link2

# Create sets of links
# pred_links: predicted links (larger set)
# gt_links: ground truth links (subset of predictions)
pred_links = {link1, link2, link3, link4, link5}
gt_links = {link1, link2}

ARGS = {
    "pred_links": pred_links,
    "gt_links": gt_links,
}
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 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
count_cross Ran
ran on a synthesized input
chenxn2020/GOSE/GOSEfinetune/evaluation.py
code served (permissive licence) · get_code("713e10de85a7d944")
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

class Point:
    def __init__(self, point):
        x, y = point
        self.x = x
        self.y = y

def cross(p1, p2, p3):
    x1 = p2.x - p1.x
    y1 = p2.y - p1.y
    x2 = p3.x - p1.x
    y2 = p3.y - p1.y
    return x1 * y2 - x2 * y1

def IsIntersec(p1, p2, p3, p4):
    if max(p1.x, p2.x) >= min(p3.x, p4.x) and max(p3.x, p4.x) >= min(p1.x, p2.x) and (max(p1.y, p2.y) >= min(p3.y, p4.y)) and (max(p3.y, p4.y) >= min(p1.y, p2.y)):
        if cross(p1, p2, p3) * cross(p1, p2, p4) < 0 and cross(p3, p4, p1) * cross(p3, p4, p2) < 0:
            D = True
        else:
            D = False
    else:
        D = False
    return D

def count_cross(false_links, total_links):
    count = 0
    for false_link in false_links:
        is_cross = False
        for link in total_links:
            if false_link == link:
                continue
            p1 = Point(false_link[0])
            p2 = Point(false_link[1])
            p3 = Point(link[0])
            p4 = Point(link[1])
            if IsIntersec(p1, p2, p3, p4):
                is_cross = True
                break
        if is_cross:
            count += 1
    return count

# Create test data: each link is a tuple of two coordinate tuples (x, y)
false_links = [
    ((0, 0), (2, 2)),
    ((1, 1), (3, 3)),
]

total_links = [
    ((0, 0), (2, 2)),
    ((0, 2), (2, 0)),
    ((1, 0), (1, 3)),
]

ARGS = {
    "false_links": false_links,
    "total_links": total_links,
}
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
create_position_ids_from_input_ids Ran
ran; our contract draft was wrong, not the code
chenxn2020/GOSE/GOSEfinetune/models/LiLTRobertaLike/modeling_LiLTRobertaLike.py
code served (permissive licence) · get_code("da1c54dffed5d60c")
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) and returned Tensor, ndim 2, dtype family int, shape (2, 4) 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)

# Create input_ids tensor with shape (batch_size=2, seq_length=4)
# Values should include some padding tokens and some non-padding tokens
input_ids = torch.tensor([
    [0, 1, 2, 0],      # batch 1: has padding_idx (0) at positions 0 and 3
    [1, 2, 0, 1]       # batch 2: has padding_idx (0) at position 2
])

# padding_idx is the token ID that represents padding
padding_idx = 0

# past_key_values_length represents how many tokens were processed before
past_key_values_length = 0

ARGS = {
    "input_ids": input_ids,
    "padding_idx": padding_idx,
    "past_key_values_length": past_key_values_length
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 int, shape (2, 4) — shape (2, 4) 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_last_checkpoint Ran
ran; our contract draft was wrong, not the code
chenxn2020/GOSE/GOSEfinetune/evaluation.py
pointer only (licence: MIT); the stored copy get_code serves, from rucaibox/figa, is pointer only (licence: NONE) · get_code("9f1130d32c6430f8")
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 rucaibox/figa, 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.

get_relative_position_index Ran
ran, honoured the contract we drafted
chenxn2020/GOSE/GOSEfinetune/modules/decoders/gose.py
code served (permissive licence) · get_code("2e62acbb2e8ec0a9")
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 int, shape (12, 12) 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)

# The function takes window height and width as integers
# and returns a tensor of relative position indices
# We'll use small integer values for the window dimensions

ARGS = {
    "win_h": 3,
    "win_w": 4,
}
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 int, shape (12, 12) — shape (12, 12) 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
update_config Ran
ran on a synthesized input
chenxn2020/GOSE/run_xfun_re.py
code served (permissive licence) · get_code("d824178e14d8569c")
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 Config. 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 argparse

torch.manual_seed(0)

# Create a simple config object
class Config:
    def __init__(self):
        self.existing_attr = "original_value"
        self.learning_rate = 0.001

config = Config()

# Create args with some attributes that exist in config and some that don't
args = argparse.Namespace()
args.existing_attr = "updated_value"  # This exists in config, will update it
args.new_param = "new_value"  # This doesn't exist in config, will be added
args.batch_size = 32  # Another new attribute

ARGS = {
    "config": config,
    "args": args
}
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 Config — a Config output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Config 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
window_reverse Ran
ran on a synthesized input
chenxn2020/GOSE/GOSEfinetune/modules/decoders/gose.py
code served (permissive licence) · get_code("b5e93671bd3d90cd")
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 3, dtype family float, shape (2, 196, 4) 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)

# The function expects:
# - windows: a tensor of shape [B * num_windows, window_size[0] * window_size[1], C]
# - original_size: tuple (H, W)
# - window_size: tuple (window_h, window_w), default (7, 7)

# Let's construct a realistic scenario:
# - original_size = (14, 14) - a 14x14 feature map
# - window_size = (7, 7) - we partition into 7x7 windows
# - This gives us (14/7) * (14/7) = 4 windows total
# - B = 2 (batch size)
# - So total windows tensor should have shape: [2 * 4, 7*7, C] = [8, 49, C]

H, W = 14, 14
window_h, window_w = 7, 7
B = 2
C = 4  # channels

# Number of windows in each dimension
num_windows_h = H // window_h
num_windows_w = W // window_w
total_windows = num_windows_h * num_windows_w

# Create windows tensor: [B * total_windows, window_h * window_w, C]
windows = torch.randn(B * total_windows, window_h * window_w, C)

ARGS = {
    "windows": windows,
    "original_size": (H, W),
    "window_size": (window_h, window_w)
}
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 3, dtype family float, shape (2, 196, 4) — shape (2, 196, 4) 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

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 2 later) and 3 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
create_position_ids_from_input_ids 28 other papers
12 dated earlier, 10 later, 6 same year, order not determinable
2107.00910 (2021-07)
Learned Token Pruning for Transformers
2107.14035 (2021-07)
ProtoTransformer: A Meta-Learning Approach to Providing Student Feedback
2201.11732 (2022-01)
IGLUE: A Benchmark for Transfer Learning across Modalities, Tasks, and Languages
and 25 more not named here
get_last_checkpoint 4 other papers
2 dated earlier, 2 same year, order not determinable
2202.13669 (2022-02)
LiLT: A Simple yet Effective Language-Independent Layout Transformer for Structured Document Understanding
2212.02623 (2022-12)
Unifying Vision, Text, and Layout for Universal Document Processing
2305.11846 (2023-05)
Any-to-Any Generation via Composable Diffusion
and 1 more not named here
get_relative_position_index 3 other papers
2 dated earlier, 1 later
2204.01697 (2022-04)
MaxViT: Multi-Axis Vision Transformer
2207.05557 (2022-07)
LightViT: Towards Light-Weight Convolution-Free Vision Transformers
2505.19813 (2025-05)
GoLF-NRT: Integrating Global Context and Local Geometry for Few-Shot View Synthesis *
window_reverse 1 other paper
1 dated earlier
2207.05557 (2022-07)
LightViT: Towards Light-Weight Convolution-Free Vision Transformers

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

Visual Relation Extraction (VRE) is a powerful means of discovering relationships between entities within visually-rich documents. Existing methods often focus on manipulating entity features to find pairwise relations, yet neglect the more fundamental structural information that links disparate entity pairs together. The absence of global structure information may make the model struggle to learn longrange relations and easily predict conflicted results. To alleviate such limitations, we propose a GlObal Structure knowledge-guided relation Extraction (GOSE) framework. GOSE initiates by generating preliminary relation predictions on entity pairs extracted from a scanned image of the document. Subsequently, global structural knowledge is captured from the preceding iterative predictions, which are then incorporated into the representations of the entities. This "generate-capture-incorporate" cycle is repeated multiple times, allowing entity representations and global structure knowledge to be mutually reinforced. Extensive experiments validate that GOSE not only outperforms existing methods in the standard fine-tuning setting but also reveals superior cross-lingual learning capabilities; indeed, even yields stronger data-efficient performance in the low-resource setting. The code for GOSE will be available at https://github.com/chenxn2020/GOSE.

For agents

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

get_harvested_code_for_paper("2023.findings-emnlp.107")
get_code_for_paper("2023.findings-emnlp.107")
have("2023.findings-emnlp.107")

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

curl https://syntology.ai/api/ran/2023.findings-emnlp.107.json

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

[![Syntology run record](https://syntology.ai/api/ran/2023.findings-emnlp.107.svg)](https://syntology.ai/paper/2023.findings-emnlp.107)

Connect an agent — have() is free.