SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1905.08284 · 2019

Enriching Pre-trained Language Model with Entity Information for Relation Classification

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 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; 4 failures of our instrument; 1 no recorded run), 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/1905.08284.json · badge: /api/ran/1905.08284.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
chielingyueh/anaphora_resolution_chemical_patents community (classifier label)
classifier basis not recorded on the link
4 ran · 1 no recorded run
monologg/R-BERT reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
onehaitao/R-BERT-relation-extraction reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_metrics Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
chielingyueh/anaphora_resolution_chemical_patents/utils.py
code served (permissive licence) · get_code("77ec489744adb0c1")
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 numpy as np
from sklearn.metrics import f1_score

# Looking at the compute_metrics function:
# - It takes preds and labels
# - Asserts they have the same length
# - Calls acc_and_f1(preds, labels) which:
#   - Calls simple_accuracy(preds, labels) which does (preds == labels).mean()
#   - Calls macro_f1(preds, labels) which calls f1_score(labels, preds, average='macro')
# 
# Both functions expect array-like inputs that support:
# - len() operation
# - == comparison
# - .mean() method (or numpy broadcasting)
# - Passing to f1_score (sklearn compatible)
#
# For a classification task, preds and labels should be 1D arrays of class indices

np.random.seed(0)

# Create small prediction and label arrays for a multi-class classification task
# Using 2 samples with 3 possible classes (0, 1, 2)
preds = np.array([0, 1, 2, 1])
labels = np.array([0, 1, 1, 1])

ARGS = {
    'preds': preds,
    'labels': labels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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
convert_examples_to_features Ran
ran on a synthesized input
chielingyueh/anaphora_resolution_chemical_patents/data_loader.py
code served (permissive licence) · get_code("858f5413d0c58846")
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 logging

logging.basicConfig(level=logging.INFO)

class MockExample:
    def __init__(self, text_a, label, guid):
        self.text_a = text_a
        self.label = label
        self.guid = guid

class MockTokenizer:
    def tokenize(self, text):
        return text.split()
    
    def convert_tokens_to_ids(self, tokens):
        token_to_id = {
            '[CLS]': 101,
            '[SEP]': 102,
            '$': 103,
            '#': 104,
            'this': 2054,
            'is': 2003,
            'a': 1037,
            'test': 3231,
            'sentence': 6251,
            'with': 2007,
            'entities': 5961,
        }
        return [token_to_id.get(token, 100) for token in tokens]

examples = [
    MockExample(
        text_a="this is <e1> a </e1> test <e2> sentence </e2> with entities",
        label="0",
        guid="example_1"
    ),
    MockExample(
        text_a="another <e1> example </e1> here <e2> with </e2> two entities",
        label="1",
        guid="example_2"
    ),
]

ARGS = {
    'examples': examples,
    'max_seq_len': 32,
    'tokenizer': MockTokenizer(),
    'cls_token': '[CLS]',
    'cls_token_segment_id': 0,
    'sep_token': '[SEP]',
    'pad_token': 0,
    'pad_token_segment_id': 0,
    'sequence_a_segment_id': 0,
    'add_sep_token': False,
    'mask_padding_with_zero': True,
}
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 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_args Ran
ran; our contract draft was wrong, not the code
monologg/R-BERT/predict.py
code served (permissive licence) · get_code("107869d936646d01")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 os
import tempfile
import torch

# Create a temporary directory to act as model_dir
temp_dir = tempfile.mkdtemp()

# Create a dummy training_args object to save
training_args = {
    'learning_rate': 0.001,
    'batch_size': 32,
    'epochs': 10,
    'model_name': 'test_model'
}

# Save the training_args to the temporary directory
torch.save(training_args, os.path.join(temp_dir, 'training_args.bin'))

# Create a stand-in config class with model_dir attribute
class PredConfig:
    def __init__(self, model_dir):
        self.model_dir = model_dir

pred_config = PredConfig(model_dir=temp_dir)

ARGS = {'pred_config': pred_config}
Setup block drafted by
a language model, Claude Sonnet 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 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_device Ran
ran; our contract draft was wrong, not the code
monologg/R-BERT/predict.py
code served (permissive licence) · get_code("88395eef09dea094")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned str. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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

class PredConfig:
    def __init__(self, no_cuda=False):
        self.no_cuda = no_cuda

pred_config = PredConfig(no_cuda=False)

ARGS = {
    'pred_config': pred_config
}
Setup block drafted by
a language model, Claude Sonnet 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 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_label Ran
ran on a synthesized input
chielingyueh/anaphora_resolution_chemical_patents/utils.py
code served (permissive licence) · get_code("0f7620720c0761a8")
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 os
import tempfile

# Create a temporary directory and label file for testing
temp_dir = tempfile.mkdtemp()
label_file = "labels.txt"
label_path = os.path.join(temp_dir, label_file)

# Write some sample labels to the file
with open(label_path, 'w', encoding='utf-8') as f:
    f.write("label1\n")
    f.write("  label2  \n")
    f.write("label3\n")

# Create a simple args object
class Args:
    def __init__(self, data_dir, label_file):
        self.data_dir = data_dir
        self.label_file = label_file

ARGS = {
    'args': Args(data_dir=temp_dir, label_file=label_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 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
read_tsv_to_df Ran
ran on a synthesized input
chielingyueh/anaphora_resolution_chemical_patents/answer_keys.py
code served (permissive licence) · get_code("6090cfd8fbd27924")
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 tempfile
import os

# Create a temporary TSV file with sample data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test_data.tsv")

with open(temp_file, 'w') as f:
    f.write("positive\tThis is a great movie\n")
    f.write("negative\tThis is a terrible film\n")

ARGS = {
    'input_file': temp_file
}
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
semeval_scorer Ran
ran; our contract draft was wrong, not the code
onehaitao/R-BERT-relation-extraction/evaluate.py
code served (permissive licence) · get_code("b31fd07675860198")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned float32, 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 numpy as np

# Create sample predictions and true labels
# The function uses math.ceil(label / 2) to get indices, so labels should be in range [0, 19] for class_num=10
# (since ceil(19/2) = 10, but we want indices 0-9, so labels should be in [0, 18])
# Actually, looking at the code, ceil(0/2)=0, ceil(1/2)=1, ceil(2/2)=1, ceil(3/2)=2, ceil(4/2)=2, etc.
# So for class_num=10, we need labels that when divided by 2 and ceiled give 0-9
# ceil(0/2)=0, ceil(1/2)=1, ceil(2/2)=1, ceil(3/2)=2, ceil(4/2)=2, ..., ceil(18/2)=9, ceil(19/2)=10
# So labels should be in range [0, 18] to get indices [0, 9]

np.random.seed(42)
predict_label = np.array([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 1, 3, 5, 7, 9], dtype=np.float32)
true_label = np.array([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 2, 4, 6, 8, 10], dtype=np.float32)

ARGS = {
    'predict_label': predict_label,
    'true_label': true_label,
    'class_num': 10
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float32, 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
load_tokenizer Not yet run
unverified (harvested, no recorded run)
chielingyueh/anaphora_resolution_chemical_patents/utils.py
code served (permissive licence) · get_code("057777fc1e9365c2")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 5 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
compute_metrics 4 other papers
4 later
2010.07835 (2020-10)
Fine-Tuning Pre-trained Language Model with Weak Supervision: A Contrastive-Regularized Self-Training Approach
2301.03726 (2023-01)
Neighborhood-Regularized Self-Training for Learning with Few Labels
2306.15895 (2023-06)
Large Language Model as Attributed Training Data Generator: A Tale of Diversity and Bias
and 1 more not named here
get_label 2 other papers
1 dated earlier, 1 later
1901.08746 (2019-01)
BioBERT: a pre-trained biomedical language representation model for biomedical text mining
2010.07835 (2020-10)
Fine-Tuning Pre-trained Language Model with Weak Supervision: A Contrastive-Regularized Self-Training Approach
get_args 1 other paper
1 dated earlier
1902.10909 (2019-02)
BERT for Joint Intent Classification and Slot Filling
get_device 1 other paper
1 dated earlier
1902.10909 (2019-02)
BERT for Joint Intent Classification and Slot Filling
semeval_scorer 1 other paper
1 dated earlier
1504.06580 (2015-04)
Classifying Relations by Ranking with Convolutional Neural Networks

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

Relation classification is an important NLP task to extract relations between entities. The state-of-the-art methods for relation classification are primarily based on Convolutional or Recurrent Neural Networks. Recently, the pre-trained BERT model achieves very successful results in many NLP classification / sequence labeling tasks. Relation classification differs from those tasks in that it relies on information of both the sentence and the two target entities. In this paper, we propose a model that both leverages the pre-trained BERT language model and incorporates information from the target entities to tackle the relation classification task. We locate the target entities and transfer the information through the pre-trained architecture and incorporate the corresponding encoding of the two entities. We achieve significant improvement over the state-of-the-art method on the SemEval-2010 task 8 relational dataset.

For agents

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

get_harvested_code_for_paper("1905.08284")
get_code_for_paper("1905.08284")
have("1905.08284")

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

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

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

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

Connect an agent — have() is free.