SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.10678 · 2022

Towards Realistic Low-resource Relation Extraction: A Benchmark with Empirical Baseline Study

arXiv · PDF · Open in the Atlas

Code that ran

8 of 13 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 3 have no contract verdict; 5 failures of our instrument; 5 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-21; 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/2210.10678.json · badge: /api/ran/2210.10678.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
zjunlp/KnowPrompt canonical (classifier label)
classifier basis not recorded on the link
6 ran · 5 no recorded run
zjunlp/lrebench canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
whitespace_tokenize Ran
ran; our contract draft was wrong, not the code
zjunlp/KnowPrompt/models/bert/tokenization_bert.py
code served (permissive licence) · get_code("cf9ffa02a42184af")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-05T02:55:57Z). 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

def whitespace_tokenize(text):
    """Runs basic whitespace cleaning and splitting on a piece of text."""
    text = text.strip()
    if not text:
        return []
    tokens = text.split()
    return tokens

# Setup code
torch.manual_seed(0)

# The function takes a single parameter: text (a string)
# It performs basic whitespace cleaning and splitting
# We need to provide a valid string argument

ARGS = {
    "text": "  hello world  this is a test  "
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
acc Ran
ran on a synthesized input
zjunlp/KnowPrompt/lit_models/util.py
code served (permissive licence) · get_code("e5c96daa2363c6ff")
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 float64, ndim 0, 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 numpy as np

# Create sample logits and labels
# logits: shape (batch_size, num_classes)
# The function uses np.argmax(logits, axis=-1) to get predictions
# and compares with labels, so labels should have shape (batch_size,)

batch_size = 2
num_classes = 4

logits = np.random.randn(batch_size, num_classes).astype(np.float32)
labels = np.array([0, 2], dtype=np.int64)

ARGS = {
    "logits": logits,
    "labels": labels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
decode Ran
ran on a synthesized input
zjunlp/KnowPrompt/lit_models/transformer.py
code served (permissive licence) · get_code("c178ab3e6d9537ee")
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)

class SimpleTokenizer:
    """Minimal tokenizer that implements the decode method."""
    def decode(self, token_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False):
        # Convert token ids to strings
        decoded = " ".join([f"token_{id}" for id in token_ids])
        return decoded

tokenizer = SimpleTokenizer()

# Create output_ids as a list of token id sequences
# Each element represents decoded output from a model
output_ids = [
    [101, 2054, 2003, 102],  # First sequence
    [101, 1045, 2572, 102],  # Second sequence
]

ARGS = {
    "tokenizer": tokenizer,
    "output_ids": output_ids,
}
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_labels Ran
ran; our contract draft was wrong, not the code
zjunlp/KnowPrompt/generate_k_shot.py
pointer only (licence: MIT); the stored copy get_code serves, from Facico/MVRE, is pointer only (licence: NONE) · get_code("108aa80124e0d67f")
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 Facico/MVRE, 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.

load_vocab Ran
ran; our contract draft was wrong, not the code
zjunlp/KnowPrompt/models/bert/tokenization_bert.py
code served (permissive licence) · get_code("e7fbc7a74a3457c7")
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 OrderedDict. 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 collections
import tempfile
import os

# Create a temporary vocabulary file
temp_dir = tempfile.mkdtemp()
vocab_file = os.path.join(temp_dir, 'vocab.txt')

# Write some sample tokens to the vocab file
sample_tokens = ['[PAD]', '[UNK]', '[CLS]', '[SEP]', 'the', 'quick', 'brown', 'fox']
with open(vocab_file, 'w', encoding='utf-8') as f:
    for token in sample_tokens:
        f.write(token + '\n')

ARGS = {
    'vocab_file': vocab_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 OrderedDict — a OrderedDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OrderedDict 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
merge Ran
ran; our contract draft was wrong, not the code
zjunlp/lrebench/DA.py
code served (permissive licence) · get_code("9f7a364b023cf31f")
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 list, 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 deque

# Analyze the function:
# - merge() takes sent_dict as parameter
# - sent_dict is accessed with keys: 'sent1', 'ent1', 'sent2', 'ent2', 'sent3'
# - Each value in sent_dict should be iterable (used in for loops)
# - The function iterates through sent_dict values and builds combinations
# - Each element is treated as a "postfix" that gets appended to lists

# Create a minimal sent_dict with the required keys
# Each value should be a list of items (strings work fine as minimal stand-ins)
sent_dict = {
    'sent1': ['sentence_one', 'sentence_one_alt'],
    'ent1': ['entity_one', 'entity_one_alt'],
    'sent2': ['sentence_two'],
    'ent2': ['entity_two'],
    'sent3': ['sentence_three', 'sentence_three_alt']
}

ARGS = {
    'sent_dict': sent_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 list, ndim 2, 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
multilabel_categorical_crossentropy Ran
ran on a synthesized input
zjunlp/KnowPrompt/lit_models/transformer.py
code served (permissive licence) · get_code("d235c954a3acaf08")
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 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

torch.manual_seed(0)

# Create small tensors for multilabel classification
# y_pred: predicted logits/scores for multilabel classification
# y_true: binary labels (0 or 1) for multilabel classification

batch_size = 2
num_labels = 4

# Predictions: logits for each label (batch_size x num_labels)
y_pred = torch.randn(batch_size, num_labels)

# Ground truth: binary labels for each label (batch_size x num_labels)
y_true = torch.randint(0, 2, (batch_size, num_labels)).float()

ARGS = {
    "y_pred": y_pred,
    "y_true": y_true
}
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 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
read_dataset Ran
ran; our contract draft was wrong, not the code
zjunlp/lrebench/DA.py
code served (permissive licence) · get_code("91ecdc93072606d6")
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 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 json
import tempfile
import os

# Create a temporary file with JSONL data
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.jsonl')
temp_fname = temp_file.name

# Write some sample JSONL data
sample_data = [
    {"id": 1, "text": "hello world"},
    {"id": 2, "text": "foo bar"},
    {"id": 3, "text": "test data"}
]

for item in sample_data:
    temp_file.write(json.dumps(item) + '\n')

temp_file.close()

ARGS = {
    'fname': temp_fname
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
tqdm — 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
compute_f1 Not yet run
unverified (harvested, no recorded run)
zjunlp/KnowPrompt/lit_models/util.py
code served (permissive licence) · get_code("526185d23747e06f")
How it ran

no invocation recorded.

f1_eval Not yet run
unverified (harvested, no recorded run)
zjunlp/KnowPrompt/lit_models/util.py
code served (permissive licence) · get_code("0d1aa602358c71ac")
How it ran

no invocation recorded.

get_trie Not yet run
unverified (harvested, no recorded run)
zjunlp/KnowPrompt/models/trie.py
code served (permissive licence) · get_code("ff15928b8b33b40f")
How it ran

no invocation recorded.

load_tf_weights_in_bert Not yet run
unverified (harvested, no recorded run)
zjunlp/KnowPrompt/models/bert/modeling_bert.py
pointer only (licence: MIT); the stored copy get_code serves, from CSU-NLP-Group/MARE, is pointer only (licence: NONE) · get_code("efbb0f3903b5f779")
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 CSU-NLP-Group/MARE, 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. No invocation recorded.

mask_hook Not yet run
unverified (harvested, no recorded run)
zjunlp/KnowPrompt/lit_models/transformer.py
code served (permissive licence) · get_code("6a897796e2310e3b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 6 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 2 the same month, 4 later) and 7 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
whitespace_tokenize 43 other papers
23 dated earlier, 20 later
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1906.01698 (2019-06)
Open Sesame: Getting Inside BERT's Linguistic Knowledge
and 40 more not named here
load_vocab 29 other papers
11 dated earlier, 18 later
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1909.11942 (2019-09)
ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
2004.09297 (2020-04)
MPNet: Masked and Permuted Pre-training for Language Understanding
and 26 more not named here
load_tf_weights_in_bert 8 other papers
7 later, 1 same year, order not determinable
Dou_An_Empirical_Study_of_Training_End-to-End_Vision-and-Language_Transformers_CVPR_2022_paper (2022 (year only))
An Empirical Study of Training End-to-End Vision-and-Language Transformers
2023.acl-long.182 (2023 (year only))
HyPe: Better Pre-trained Language Model Fine-tuning with Hidden Representation Perturbation
2024.findings-acl.164 (2024 (year only))
Selective Prefix Tuning for Pre-trained Language Models
and 5 more not named here
acc 1 other paper
1 the same month
2210.00312 (2022-10)
Multimodal Analogical Reasoning over Knowledge Graphs
get_labels 1 other paper
1 later
2312.17267 (2023-12)
Enhancing Low-Resource Relation Representations through Multi-View Decoupling
multilabel_categorical_crossentropy 1 other paper
1 the same month
2210.00312 (2022-10)
Multimodal Analogical Reasoning over Knowledge Graphs

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-21.

Repositories linked to this paper

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

Abstract

This paper presents an empirical study to build relation extraction systems in low-resource settings. Based upon recent pre-trained language models, we comprehensively investigate three schemes to evaluate the performance in low-resource settings: (i) different types of prompt-based methods with few-shot labeled data; (ii) diverse balancing methods to address the long-tailed distribution issue; (iii) data augmentation technologies and self-training to generate more labeled in-domain data. We create a benchmark with 8 relation extraction (RE) datasets covering different languages, domains and contexts and perform extensive comparisons over the proposed schemes with combinations. Our experiments illustrate: (i) Though prompt-based tuning is beneficial in low-resource RE, there is still much potential for improvement, especially in extracting relations from cross-sentence contexts with multiple relational triples; (ii) Balancing methods are not always helpful for RE with long-tailed distribution; (iii) Data augmentation complements existing baselines and can bring much performance gain, while self-training may not consistently achieve advancement to low-resource RE. Code and datasets are in https://github.com/zjunlp/LREBench.

For agents

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

get_harvested_code_for_paper("2210.10678")
get_code_for_paper("2210.10678")
have("2210.10678")

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

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

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

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

Connect an agent — have() is free.