SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.03823 · ACL · 2023

Linguistic representations for fewer-shot relation extraction across domains

Ritam Dutt, Carolyn Rosé, Sireesh Gururaja, Tinglong Liao

arXiv · PDF · Open in the Atlas

Code that ran

10 of 12 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 0 have no contract verdict; 10 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/2307.03823.json · badge: /api/ran/2307.03823.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
ShoRit/flow_graphs canonical (classifier label)
classifier basis: census
10 ran · 2 no recorded run
FunctionStatusWhere it lives
add_evaluation_context Ran
ran; our contract draft was wrong, not the code
ShoRit/flow_graphs/code/evaluation.py
code served (permissive licence) · get_code("a4338ddc4d9fefe7")
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 torch
import numpy as np
import pandas as pd
from collections import defaultdict

torch.manual_seed(0)

# Create a minimal tokenizer stand-in that has a decode method
class MinimalTokenizer:
    def decode(self, token_ids):
        # Convert tensor to list and return a simple string representation
        if isinstance(token_ids, torch.Tensor):
            token_list = token_ids.tolist()
        else:
            token_list = token_ids
        return f"entity_{hash(tuple(token_list)) % 1000}"

# Create a minimal AMR data object with masks
class MinimalAMRData:
    def __init__(self):
        self.n1_mask = torch.tensor([1, 0, 1, 0])
        self.n2_mask = torch.tensor([0, 1, 1, 0])

# Create test DataFrame with all required columns
df_data = {
    'arg1_ids': [
        [True, False, True, False],
        [False, True, False, True]
    ],
    'arg2_ids': [
        [False, True, False, True],
        [True, False, True, False]
    ],
    'tokens': [
        torch.tensor([101, 2054, 2003, 102]),
        torch.tensor([101, 3231, 2057, 102])
    ],
    'tok_range': [
        torch.tensor([[0, 1], [1, 2], [2, 3], [3, 4]]),
        torch.tensor([[0, 1], [1, 2], [2, 3], [3, 4]])
    ],
    'sent': [
        "This is a test sentence",
        "Another test example"
    ],
    'label': [0, 1],
    'predictions': [0.9, 0.2],
    'amr_data': [
        MinimalAMRData(),
        MinimalAMRData()
    ]
}

df = pd.DataFrame(df_data)

# Create minimal tokenizer
tokenizer = MinimalTokenizer()

ARGS = {
    'df': df,
    'tokenizer': tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, torch — 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
create_mini_batch Ran
ran; our contract draft was wrong, not the code
ShoRit/flow_graphs/code/dataloader.py
code served (permissive licence) · get_code("e862ce41c308f4c8")
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 torch
from torch_geometric.data import Data

torch.manual_seed(0)

# Create small sample dictionaries matching the expected structure
sample1 = {
    'tokens': torch.tensor([1, 2, 3, 0]),
    'segments': torch.tensor([0, 0, 1, 0]),
    'e1_mask': torch.tensor([1, 0, 0, 0]),
    'e2_mask': torch.tensor([0, 1, 0, 0]),
    'label': torch.tensor(0),
    'graph_data': Data(x=torch.randn(3, 4), edge_index=torch.tensor([[0, 1], [1, 2]])),
    'dep_data': Data(x=torch.randn(3, 4), edge_index=torch.tensor([[0, 1], [1, 2]])),
    'amr_data': Data(x=torch.randn(3, 4), edge_index=torch.tensor([[0, 1], [1, 2]]))
}

sample2 = {
    'tokens': torch.tensor([4, 5, 0, 0]),
    'segments': torch.tensor([0, 1, 0, 0]),
    'e1_mask': torch.tensor([0, 1, 0, 0]),
    'e2_mask': torch.tensor([1, 0, 0, 0]),
    'label': torch.tensor(1),
    'graph_data': Data(x=torch.randn(2, 4), edge_index=torch.tensor([[0], [1]])),
    'dep_data': Data(x=torch.randn(2, 4), edge_index=torch.tensor([[0], [1]])),
    'amr_data': Data(x=torch.randn(2, 4), edge_index=torch.tensor([[0], [1]]))
}

samples = [sample1, sample2]

ARGS = {
    'samples': samples
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torch_geometric — 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
get_case Ran
ran; our contract draft was wrong, not the code
ShoRit/flow_graphs/code/modeling/metadata_utils.py
code served (permissive licence) · get_code("fd1263cea7785bb2")
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 numpy as np

torch.manual_seed(0)

# Based on the function body, it checks:
# - if graph_data_source is None
# - uses graph_connection_type in an f-string
# Both are simple values that need to be either None or strings

ARGS = {
    'graph_data_source': 'database',
    'graph_connection_type': 'direct',
}
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 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_experiment_config_from_filename Ran
ran; our contract draft was wrong, not the code
ShoRit/flow_graphs/code/modeling/metadata_utils.py
code served (permissive licence) · get_code("06352740042a8bcb")
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 os
import re

INDOMAIN_CHECKPOINT_RE = re.compile('indomain-(?P<dataset_name>.*?)-(?P<case>.*?)-(?P<gnn>.*?)-depth_(?P<gnn_depth>.*?)-seed_(?P<seed>.*?)-lr_(?P<lr>.*?).pt')

def get_experiment_config_from_filename(filename):
    match = INDOMAIN_CHECKPOINT_RE.fullmatch(os.path.basename(filename))
    if match is None:
        raise AssertionError(f'Passed filename does not validate as an indomain filename!\nPassed filename: {filename}')
    case = match.group('case')
    if 'amr_residual' in case:
        return 'amr_residual'
    elif 'dep_residual' in case:
        return 'dep_residual'
    elif 'amr' in case:
        return 'amr'
    elif 'dep' in case:
        return 'dep'
    elif 'plaintext' in case:
        return 'baseline'
    else:
        raise AssertionError('Unable to identify experiment config from passed file name!')

# Test with a valid filename that matches the pattern
ARGS = {
    'filename': 'indomain-mydataset-amr_residual-gcn-depth_3-seed_42-lr_0.001.pt'
}
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 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_transfer_checkpoint_filename Ran
ran; our contract draft was wrong, not the code
ShoRit/flow_graphs/code/modeling/metadata_utils.py
code served (permissive licence) · get_code("ea2da938a6597622")
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 torch.nn as nn

torch.manual_seed(0)

# Construct arguments for get_transfer_checkpoint_filename
ARGS = {
    'src_dataset_name': 'source_dataset',
    'tgt_dataset_name': 'target_dataset',
    'fewshot': 5,
    'case': 'case_1',
    'graph_connection_type': 'full',
    'gnn': 'gcn',
    'gnn_depth': 3,
    'seed': 42,
    'lr': 0.001
}
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
load_amr_rel2id Ran
ran; our contract draft was wrong, not the code
ShoRit/flow_graphs/code/dataloading_utils.py
code served (permissive licence) · get_code("9ee0b1fa45ecb649")
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 tempfile
import os

# Create a temporary directory and file for the test
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, 'amr_rel2id.json')

# Create a sample AMR relation-to-ID mapping
sample_rel2id = {
    'instance': 0,
    'ARG0': 1,
    'ARG1': 2,
    'ARG2': 3,
    'location': 4,
    'time': 5,
    'manner': 6
}

# Write the JSON file
with open(temp_file, 'w') as f:
    json.dump(sample_rel2id, f)

ARGS = {
    'path': temp_file
}
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
load_deprels Ran
ran; our contract draft was wrong, not the code
ShoRit/flow_graphs/code/dataloading_utils.py
code served (permissive licence) · get_code("60f6752e6b70b47a")
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 tempfile
import os

# Create a temporary file with sample dependency relations data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, 'enh_dep_rel.txt')

with open(temp_file, 'w') as f:
    f.write('nsubj\n')
    f.write('nsubj:pass\n')
    f.write('obj\n')
    f.write('iobj\n')
    f.write('csubj\n')
    f.write('ccomp\n')
    f.write('xcomp\n')
    f.write('obl\n')
    f.write('obl:tmod\n')
    f.write('acl\n')

ARGS = {
    'path': temp_file,
    'enhanced': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tqdm — 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
load_glove Ran
ran; our contract draft was wrong, not the code
ShoRit/flow_graphs/code/dataloading_utils.py
code served (permissive licence) · get_code("7eaf87d77923564b")
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 tempfile
import os

# Create a temporary file with GloVe-format data
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("the 0.1 0.2 0.3 0.4\n")
temp_file.write("hello 0.5 0.6 0.7 0.8\n")
temp_file.write("world 0.9 1.0 1.1 1.2\n")
temp_file.close()

ARGS = {
    'path': temp_file.name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tqdm — 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
sample_fraction Ran
ran; our contract draft was wrong, not the code
ShoRit/flow_graphs/code/dataloader.py
code served (permissive licence) · get_code("8599b1cb2086c2f2")
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 random
import torch

# Create a simple dataset - a list that supports len() and enumeration
# The function will enumerate it and sample from it
dataset = ['item_0', 'item_1', 'item_2', 'item_3', 'item_4']

# Set random seed for reproducibility
random.seed(42)

# Define arguments for sample_fraction
ARGS = {
    'dataset': dataset,
    'fraction': 0.6  # Sample 60% of the dataset
}
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
stratified_sample Ran
ran; our contract draft was wrong, not the code
ShoRit/flow_graphs/code/dataloader.py
code served (permissive licence) · get_code("e17310578b0210f1")
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.

from collections import defaultdict
import random

# Set seed for reproducibility
random.seed(42)

# Create a small dataset with instances that have 'label' keys
dataset = [
    {'label': 0, 'text': 'example 0a', 'id': 0},
    {'label': 0, 'text': 'example 0b', 'id': 1},
    {'label': 0, 'text': 'example 0c', 'id': 2},
    {'label': 1, 'text': 'example 1a', 'id': 3},
    {'label': 1, 'text': 'example 1b', 'id': 4},
    {'label': 2, 'text': 'example 2a', 'id': 5},
    {'label': 2, 'text': 'example 2b', 'id': 6},
    {'label': 2, 'text': 'example 2c', 'id': 7},
]

n_per_class = 2

ARGS = {
    'dataset': dataset,
    'n_per_class': n_per_class,
}
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 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
get_labels_and_model_predictions Not yet run
unverified (harvested, no recorded run)
ShoRit/flow_graphs/code/evaluation.py
code served (permissive licence) · get_code("962a5b07a9931a3d")
How it ran

no invocation recorded.

seen_eval Not yet run
unverified (harvested, no recorded run)
ShoRit/flow_graphs/code/evaluation.py
code served (permissive licence) · get_code("44053179e1c00586")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Recent work has demonstrated the positive impact of incorporating linguistic representations as additional context and scaffolding on the in-domain performance of several NLP tasks. We extend this work by exploring the impact of linguistic representations on cross-domain performance in a few-shot transfer setting. An important question is whether linguistic representations enhance generalizability by providing features that function as cross-domain pivots. We focus on the task of relation extraction on three datasets of procedural text in two domains, cooking and materials science. Our approach augments a popular transformerbased architecture by alternately incorporating syntactic and semantic graphs constructed by freely available off-the-shelf tools. We examine their utility for enhancing generalization, and investigate whether earlier findings, e.g. that semantic representations can be more helpful than syntactic ones, extend to relation extraction in multiple domains. We find that while the inclusion of these graphs results in significantly higher performance in few-shot transfer, both types of graph exhibit roughly equivalent utility.

For agents

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

get_harvested_code_for_paper("2307.03823")
get_code_for_paper("2307.03823")
have("2307.03823")

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

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

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

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

Connect an agent — have() is free.