SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1905.07129 · 2019

ERNIE: Enhanced Language Representation with Informative Entities

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 1 failure of our instrument; 0 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.07129.json · badge: /api/ran/1905.07129.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
thunlp/ERNIE canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
accuracy Ran
ran, honoured the contract we drafted
this paper's copy was not recorded; identical code first harvested from xuyige/BERT4doc-Classification
pointer only · get_code("eb725d5794b15f6b")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

convert_examples_to_features Ran
ran; our contract draft was wrong, not the code
thunlp/ERNIE/code/run_fewrel.py
code served (permissive licence) · get_code("c248635dec6d8a67")
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 logging
import tempfile
import os

logging.basicConfig(level=logging.INFO)

# Create a minimal tokenizer stand-in
class MockTokenizer:
    def tokenize(self, text, entities):
        # Return tokens and entity labels
        tokens = text.split()
        entity_labels = ['UNK'] * len(tokens)
        # Mark first two non-UNK entities
        ent_count = 0
        for i, ent in enumerate(entities):
            if ent_count < 2 and i < len(entity_labels):
                entity_labels[i] = f'Q{i}'
                ent_count += 1
        return tokens, entity_labels
    
    def convert_tokens_to_ids(self, tokens):
        # Simple mapping: each token gets a unique ID
        return [hash(token) % 1000 for token in tokens]

# Create a minimal example class
class MockExample:
    def __init__(self, guid, text_a, text_b, label):
        self.guid = guid
        self.text_a = text_a
        self.text_b = text_b
        self.label = label

# Create entity2id.txt file
entity2id_content = """10
Q0	0
Q1	1
Q2	2
Q3	3
Q4	4
Q5	5
Q6	6
Q7	7
Q8	8
Q9	9
"""

temp_dir = tempfile.mkdtemp()
kg_embed_dir = os.path.join(temp_dir, 'kg_embed')
os.makedirs(kg_embed_dir, exist_ok=True)
entity2id_path = os.path.join(kg_embed_dir, 'entity2id.txt')
with open(entity2id_path, 'w') as f:
    f.write(entity2id_content)

# Change to temp directory so the function can find kg_embed/entity2id.txt
original_dir = os.getcwd()
os.chdir(temp_dir)

# Create example data
examples = [
    MockExample(
        guid='test_0',
        text_a=['The quick brown fox jumps over the lazy dog', [[0, 4, 9], [26, 30, 33]]],
        text_b=['Additional context text', [[0, 10, 18]]],
        label='relation1'
    ),
    MockExample(
        guid='test_1',
        text_a=['Another example sentence here', [[8, 15, 22], [23, 28, 32]]],
        text_b=None,
        label='relation2'
    ),
]

label_list = ['relation1', 'relation2']
max_seq_length = 32
tokenizer = MockTokenizer()
threshold = 0.5

ARGS = {
    'examples': examples,
    'label_list': label_list,
    'max_seq_length': max_seq_length,
    'tokenizer': tokenizer,
    'threshold': threshold,
}
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 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
warmup_linear Ran
ran, honoured the contract we drafted
thunlp/ERNIE/code/run_pretrain.py
code served (permissive licence) · get_code("43676c538c76c491")
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 float, 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
import numpy as np

torch.manual_seed(0)

# The function warmup_linear takes two parameters:
# - x: a numeric value (float or int) representing a step/progress value
# - warmup: a float representing the warmup threshold (default 0.002)
# The function compares x with warmup and returns a scaled value

ARGS = {
    "x": 0.001,
    "warmup": 0.002
}
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 float, 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

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 2 later) and 1 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
accuracy 21 other papers
5 dated earlier, 2 the same month, 14 later
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.08746 (2019-01)
BioBERT: a pre-trained biomedical language representation model for biomedical text mining
1904.03323 (2019-04)
Publicly Available Clinical BERT Embeddings
and 18 more not named here
warmup_linear 1 other paper
1 later
2012.15022 (2020-12)
ERICA: Improving Entity and Relation Understanding for Pre-trained Language Models via Contrastive Learning

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

Neural language representation models such as BERT pre-trained on large-scale corpora can well capture rich semantic patterns from plain text, and be fine-tuned to consistently improve the performance of various NLP tasks. However, the existing pre-trained language models rarely consider incorporating knowledge graphs (KGs), which can provide rich structured knowledge facts for better language understanding. We argue that informative entities in KGs can enhance language representation with external knowledge. In this paper, we utilize both large-scale textual corpora and KGs to train an enhanced language representation model (ERNIE), which can take full advantage of lexical, syntactic, and knowledge information simultaneously. The experimental results have demonstrated that ERNIE achieves significant improvements on various knowledge-driven tasks, and meanwhile is comparable with the state-of-the-art model BERT on other common NLP tasks. The source code of this paper can be obtained from https://github.com/thunlp/ERNIE.

For agents

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

get_harvested_code_for_paper("1905.07129")
get_code_for_paper("1905.07129")
have("1905.07129")

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

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

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

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

Connect an agent — have() is free.