SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2022.findings-naacl.170 · NAACL Findings · 2022

D2GCLF: Document-to-Graph Classifier for Legal Document Classification

Qiqi Wang, Kaiqi Zhao, Robert Amor, Benjamin Liu, Ruofan Wang

Open in the Atlas

Code that ran

9 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 8 have no contract verdict; 1 failure of our instrument; 1 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/2022.findings-naacl.170.json · badge: /api/ran/2022.findings-naacl.170.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
GChrysostomou/tasc canonical (classifier label)
classifier basis: census
9 ran · 1 no recorded run
FunctionStatusWhere it lives
bert_padder Ran
ran on a synthesized input
GChrysostomou/tasc/modules/utils.py
code served (permissive licence) · get_code("b860ba28fa5f7841")
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)

# Analyze the function:
# bert_padder takes two parameters:
# - x: a list (used with len(), indexing, +=, slicing)
# - max_len: an integer (converted to int, used in comparisons and arithmetic)

# Create test arguments
x = [101, 2054, 2003, 2054]  # List of token IDs (typical BERT input)
max_len = 8  # Maximum sequence length

ARGS = {
    "x": x,
    "max_len": max_len
}
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
bertify Ran
ran on a synthesized input
GChrysostomou/tasc/modules/utils.py
code served (permissive licence) · get_code("56253a343a3ac65c")
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

torch.manual_seed(0)

# The function bertify takes a string x and processes it word by word
# It replaces '<UNKN>' with '[UNK]', filters out words in not_include list,
# and joins the remaining words back together

ARGS = {
    'x': 'hello <UNKN> world <SOS> test <EOS> foo',
    'not_include': ['<SOS>', '<EOS>']
}
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 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
capture_all_flip Ran
ran on a synthesized input
GChrysostomou/tasc/produce_graphs.py
code served (permissive licence) · get_code("e9cfeb31faddd112")
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
import os
import tempfile
import shutil

# Create a temporary directory structure with mock CSV files
temp_dir = tempfile.mkdtemp()
results_subdir = os.path.join(temp_dir, 'results')
os.makedirs(results_subdir, exist_ok=True)

# Create mock CSV files for each combination
datasets = ['dataset1', 'dataset2']
encoders = ['encoder1', 'encoder2']
tasc_approaches = ['', 'lin_', 'feat_']
mechanisms = ['Multi', 'Single']

for tasc_ in tasc_approaches:
    for dataset in datasets:
        dataset_dir = os.path.join(results_subdir, tasc_ + dataset)
        os.makedirs(dataset_dir, exist_ok=True)
        
        for encoder in encoders:
            for mechanism in mechanisms:
                file_name = encoder + '_' + mechanism + 'Attention_decision-flip-single-summary.csv'
                file_path = os.path.join(dataset_dir, file_name)
                
                # Create a mock CSV with the expected structure
                data = {
                    'Unnamed: 0': ['attention', 'random_source', 'attention gradients', 'scaled attention'],
                    'True': [0.8, 0.5, 0.7, 0.75]
                }
                df = pd.DataFrame(data)
                df.to_csv(file_path, index=False)

# Change to temp directory to ensure relative paths work
original_cwd = os.getcwd()
os.chdir(temp_dir)

ARGS = {
    'results_dir': 'results',
    'datasets': ['dataset1', 'dataset2'],
    'encoders': ['encoder1', 'encoder2'],
    'tasc_approach': ['', 'lin_', 'feat_'],
    'mechanisms': ['Multi', 'Single']
}
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
capture_all_fraction Ran
ran on a synthesized input
GChrysostomou/tasc/produce_graphs.py
code served (permissive licence) · get_code("bf2fcd03c0a2de02")
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
import os
import tempfile

# Create a temporary directory structure with mock CSV files
temp_dir = tempfile.mkdtemp()
results_base = os.path.join(temp_dir, 'results')
os.makedirs(results_base, exist_ok=True)

# Create mock CSV files for each combination
datasets = ['dataset1', 'dataset2']
encoders = ['encoder1', 'encoder2']
tasc_approaches = ['', 'lin_']
mechanisms = ['multi', 'single']

# Create the necessary directory structure and CSV files
for tasc_ in tasc_approaches:
    for dataset in datasets:
        dir_path = os.path.join(results_base, tasc_ + dataset)
        os.makedirs(dir_path, exist_ok=True)
        
        for encoder in encoders:
            for mechanism in mechanisms:
                file_name = encoder + '_' + mechanism + 'Attention_decision-flip-set-summary.csv'
                file_path = os.path.join(dir_path, file_name)
                
                # Create mock CSV with required columns
                mock_data = {
                    'Unnamed: 0': ['attention', 'random', 'attention gradients', 'scaled attention', 'grad', 'omission', 'ig'],
                    'mean percentage': [0.75, 0.25, 0.65, 0.70, 0.80, 0.60, 0.55]
                }
                df = pd.DataFrame(mock_data)
                df.to_csv(file_path, index=False)

# Change to temp directory so relative paths work
original_cwd = os.getcwd()
os.chdir(temp_dir)

ARGS = {
    'results_dir': 'results',
    'datasets': ['dataset1', 'dataset2'],
    'encoders': ['encoder1', 'encoder2'],
    'tasc_approach': ['', 'lin_'],
    'mechanisms': ['multi', 'single']
}
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
maxim Ran
ran on a synthesized input
GChrysostomou/tasc/modules/experiments_bc/eval_utils.py
code served (permissive licence) · get_code("ec2ec95473ee3531")
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 1, dtype family int, shape (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)

# The function maxim takes a tensor and finds the index of the maximum value
# along the last dimension (dim=-1)
# We need to construct a valid tensor argument

# Create a small tensor with shape (2, 4) - batch size 2, dimension 4
tensor = torch.randn(2, 4)

ARGS = {
    "tensor": tensor
}
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 1, dtype family int, shape (2,) — shape (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
operation Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
GChrysostomou/tasc/modules/model_components_bc/tasc.py
code served (permissive licence) · get_code("aabd023020e2e00f")
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 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)

# Create a small scaled_embeddings tensor
# Shape: (batch_size=2, sequence_length=3, embedding_dim=4)
scaled_embeddings = torch.randn(2, 3, 4)

# Define approach as one of the valid options
approach = 'sum-over'

# Define dim parameter
dim = -1

ARGS = {
    'scaled_embeddings': scaled_embeddings,
    'approach': approach,
    'dim': dim
}
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 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
padder Ran
ran on a synthesized input
GChrysostomou/tasc/modules/utils.py
code served (permissive licence) · get_code("f7c7b6ae1302e30a")
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 torch

torch.manual_seed(0)

# ix_document: a list of documents, where each document is a list of integers
# The function pads each document to pad_len length
ix_document = [
    [1, 2, 3],           # shorter than pad_len
    [5, 6, 7, 8, 9],     # longer than pad_len
    [10, 11],            # shorter than pad_len
    []                   # empty document
]

# pad_len: the target padding length
pad_len = 4

ARGS = {
    "ix_document": ix_document,
    "pad_len": pad_len
}
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 — 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
stat Ran
ran on a synthesized input
GChrysostomou/tasc/modules/experiments_bc/eval_utils.py
code served (permissive licence) · get_code("2a6c3ff66b9f6e20")
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 statistics

torch_seed = 0

# Analyze the function:
# - results: tuple with (cors, sig_fracs)
#   - cors: sequence of numeric values (converted to float)
#   - sig_fracs: sequence used with len()
# - name: string used for storage
# - sig_thresh: numeric with default, but not used in function body

# Construct results tuple
cors = [0.5, 0.7, 0.45, 0.82, 0.61]  # List of correlation values
sig_fracs = [0.5, 0.7, 0.82]  # Subset representing significant fractions

results = (cors, sig_fracs)

# Construct name
name = "test_metric"

# Construct sig_thresh (has default, but we can pass it)
sig_thresh = 0.33

ARGS = {
    "results": results,
    "name": name,
    "sig_thresh": sig_thresh
}
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
tvd Ran
ran on a synthesized input
GChrysostomou/tasc/modules/experiments_bc/eval_utils.py
code served (permissive licence) · get_code("67d3532b4f7b9e9b")
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 1, dtype family float, shape (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)

# The function tvd takes two arguments: a and b
# It converts them to float, computes absolute difference, sums over last dimension, and divides by 2
# Both a and b should be tensors

a = torch.randint(0, 10, (2, 4))
b = torch.randint(0, 10, (2, 4))

ARGS = {
    "a": a,
    "b": b
}
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 1, dtype family float, shape (2,) — shape (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
optimiser_fun Not yet run
unverified (harvested, no recorded run)
GChrysostomou/tasc/modules/run_binary_classification.py
code served (permissive licence) · get_code("68c0448d3089bafc")
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 (1 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.

FunctionAlso present inEarliest-datedOthers named
operation 1 other paper
1 dated earlier
2105.02657 (2021-05)
Improving the Faithfulness of Attention-based Explanations with Task-specific Information for Text Classification

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

Legal document classification is an essential task in law intelligence to automate the laborintensive law case filing process. Unlike traditional document classification problems, legal documents should be classified by reasons and facts instead of topics. We propose a Document-to-Graph Classifier (D2GCLF), which extracts facts as relations between key participants in the law case and represents a legal document with four relation graphs. Each graph is responsible for capturing different relations between the litigation participants. We further develop a graph attention network on top of the four relation graphs to classify the legal documents. Experiments on a real-world legal document dataset show that D2GCLF outperforms the state-of-the-art methods in terms of accuracy.

For agents

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

get_harvested_code_for_paper("2022.findings-naacl.170")
get_code_for_paper("2022.findings-naacl.170")
have("2022.findings-naacl.170")

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

curl https://syntology.ai/api/ran/2022.findings-naacl.170.json

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

[![Syntology run record](https://syntology.ai/api/ran/2022.findings-naacl.170.svg)](https://syntology.ai/paper/2022.findings-naacl.170)

Connect an agent — have() is free.