SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1904.09223 · 2019

ERNIE: Enhanced Representation through Knowledge Integration

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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 6 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/1904.09223.json · badge: /api/ran/1904.09223.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
PaddlePaddle/ERNIE canonical (classifier label)
classifier basis: classifier_2025
0 ran · 1 no recorded run
nghuyong/ERNIE-Pytorch community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
lyqcom/emotect community (classifier label)
classifier basis not recorded on the link
2 ran · 0 no recorded run
LaiXinyi823/emotect community (classifier label)
classifier basis not recorded on the link
1 ran · 0 no recorded run
FunctionStatusWhere it lives
build_params_map Ran
ran on a synthesized input
LaiXinyi823/emotect/src/convert.py
code served (permissive licence) · get_code("8844bed4da5fe428")
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 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

def build_params_map(attention_num=12):
    """
    build params map from paddle-paddle's ERNIE to transformer's ernie
    """
    weight_map = collections.OrderedDict({'word_embedding': 'ernie.ernie.ernie_embedding_lookup.embedding_table', 'pos_embedding': 'ernie.ernie.ernie_embedding_postprocessor.full_position_embedding.embedding_table', 'sent_embedding': 'ernie.ernie.ernie_embedding_postprocessor.token_type_embedding.embedding_table', 'pre_encoder_layer_norm_scale': 'ernie.ernie.ernie_embedding_postprocessor.layernorm.gamma', 'pre_encoder_layer_norm_bias': 'ernie.ernie.ernie_embedding_postprocessor.layernorm.beta'})
    for i in range(attention_num):
        weight_map[f'encoder_layer_{i}_multi_head_att_query_fc.w_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.attention.attention.query_layer.weight'
        weight_map[f'encoder_layer_{i}_multi_head_att_query_fc.b_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.attention.attention.query_layer.bias'
        weight_map[f'encoder_layer_{i}_multi_head_att_key_fc.w_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.attention.attention.key_layer.weight'
        weight_map[f'encoder_layer_{i}_multi_head_att_key_fc.b_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.attention.attention.key_layer.bias'
        weight_map[f'encoder_layer_{i}_multi_head_att_value_fc.w_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.attention.attention.value_layer.weight'
        weight_map[f'encoder_layer_{i}_multi_head_att_value_fc.b_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.attention.attention.value_layer.bias'
        weight_map[f'encoder_layer_{i}_multi_head_att_output_fc.w_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.attention.output.dense.weight'
        weight_map[f'encoder_layer_{i}_multi_head_att_output_fc.b_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.attention.output.dense.bias'
        weight_map[f'encoder_layer_{i}_post_att_layer_norm_scale'] = f'ernie.ernie.ernie_encoder.layers.{i}.attention.output.layernorm.gamma'
        weight_map[f'encoder_layer_{i}_post_att_layer_norm_bias'] = f'ernie.ernie.ernie_encoder.layers.{i}.attention.output.layernorm.beta'
        weight_map[f'encoder_layer_{i}_ffn_fc_0.w_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.intermediate.weight'
        weight_map[f'encoder_layer_{i}_ffn_fc_0.b_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.intermediate.bias'
        weight_map[f'encoder_layer_{i}_ffn_fc_1.w_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.output.dense.weight'
        weight_map[f'encoder_layer_{i}_ffn_fc_1.b_0'] = f'ernie.ernie.ernie_encoder.layers.{i}.output.dense.bias'
        weight_map[f'encoder_layer_{i}_post_ffn_layer_norm_scale'] = f'ernie.ernie.ernie_encoder.layers.{i}.output.layernorm.gamma'
        weight_map[f'encoder_layer_{i}_post_ffn_layer_norm_bias'] = f'ernie.ernie.ernie_encoder.layers.{i}.output.layernorm.beta'
    weight_map.update({'pooled_fc.w_0': 'ernie.ernie.dense.weight', 'pooled_fc.b_0': 'ernie.ernie.dense.bias', 'cls_out_w': 'ernie.dense_1.weight', 'cls_out_b': 'ernie.dense_1.bias'})
    return weight_map


ARGS = {
    'attention_num': 12
}
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 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
build_params_map Ran
ran on a synthesized input
nghuyong/ERNIE-Pytorch/convert_ernie_gram.py
code served (permissive licence) · get_code("7b2aeabe0e46a532")
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 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

def build_params_map(attention_num=12):
    """
    build params map from paddle-paddle's ERNIE to transformer's BERT
    :return:
    """
    weight_map = collections.OrderedDict({'ernie_gram.embeddings.word_embeddings.weight': 'ernie.embeddings.word_embeddings.weight', 'ernie_gram.embeddings.position_embeddings.weight': 'ernie.embeddings.position_embeddings.weight', 'ernie_gram.embeddings.token_type_embeddings.weight': 'ernie.embeddings.token_type_embeddings.weight', 'ernie_gram.embeddings.task_type_embeddings.weight': 'ernie.embeddings.task_type_embeddings.weight', 'ernie_gram.embeddings.layer_norm.weight': 'ernie.embeddings.LayerNorm.gamma', 'ernie_gram.embeddings.layer_norm.bias': 'ernie.embeddings.LayerNorm.beta'})
    for i in range(attention_num):
        weight_map[f'ernie_gram.encoder.layers.{i}.self_attn.q_proj.weight'] = f'ernie.encoder.layer.{i}.attention.self.query.weight'
        weight_map[f'ernie_gram.encoder.layers.{i}.self_attn.q_proj.bias'] = f'ernie.encoder.layer.{i}.attention.self.query.bias'
        weight_map[f'ernie_gram.encoder.layers.{i}.self_attn.k_proj.weight'] = f'ernie.encoder.layer.{i}.attention.self.key.weight'
        weight_map[f'ernie_gram.encoder.layers.{i}.self_attn.k_proj.bias'] = f'ernie.encoder.layer.{i}.attention.self.key.bias'
        weight_map[f'ernie_gram.encoder.layers.{i}.self_attn.v_proj.weight'] = f'ernie.encoder.layer.{i}.attention.self.value.weight'
        weight_map[f'ernie_gram.encoder.layers.{i}.self_attn.v_proj.bias'] = f'ernie.encoder.layer.{i}.attention.self.value.bias'
        weight_map[f'ernie_gram.encoder.layers.{i}.self_attn.out_proj.weight'] = f'ernie.encoder.layer.{i}.attention.output.dense.weight'
        weight_map[f'ernie_gram.encoder.layers.{i}.self_attn.out_proj.bias'] = f'ernie.encoder.layer.{i}.attention.output.dense.bias'
        weight_map[f'ernie_gram.encoder.layers.{i}.norm1.weight'] = f'ernie.encoder.layer.{i}.attention.output.LayerNorm.gamma'
        weight_map[f'ernie_gram.encoder.layers.{i}.norm1.bias'] = f'ernie.encoder.layer.{i}.attention.output.LayerNorm.beta'
        weight_map[f'ernie_gram.encoder.layers.{i}.linear1.weight'] = f'ernie.encoder.layer.{i}.intermediate.dense.weight'
        weight_map[f'ernie_gram.encoder.layers.{i}.linear1.bias'] = f'ernie.encoder.layer.{i}.intermediate.dense.bias'
        weight_map[f'ernie_gram.encoder.layers.{i}.linear2.weight'] = f'ernie.encoder.layer.{i}.output.dense.weight'
        weight_map[f'ernie_gram.encoder.layers.{i}.linear2.bias'] = f'ernie.encoder.layer.{i}.output.dense.bias'
        weight_map[f'ernie_gram.encoder.layers.{i}.norm2.weight'] = f'ernie.encoder.layer.{i}.output.LayerNorm.gamma'
        weight_map[f'ernie_gram.encoder.layers.{i}.norm2.bias'] = f'ernie.encoder.layer.{i}.output.LayerNorm.beta'
    weight_map.update({'ernie_gram.pooler.dense.weight': 'ernie.pooler.dense.weight', 'ernie_gram.pooler.dense.bias': 'ernie.pooler.dense.bias'})
    return weight_map

ARGS = {
    'attention_num': 12
}
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 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
build_params_map Ran
ran on a synthesized input
nghuyong/ERNIE-Pytorch/convert_ernie_health.py
code served (permissive licence) · get_code("c08862d5ef3ecb1c")
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 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

def build_params_map(attention_num=12):
    """
    build params map from paddle-paddle's ERNIE to transformer's BERT
    :return:
    """
    weight_map = collections.OrderedDict({'electra.embeddings.word_embeddings.weight': 'ernie.embeddings.word_embeddings.weight', 'electra.embeddings.position_embeddings.weight': 'ernie.embeddings.position_embeddings.weight', 'electra.embeddings.token_type_embeddings.weight': 'ernie.embeddings.token_type_embeddings.weight', 'electra.embeddings.task_type_embeddings.weight': 'ernie.embeddings.task_type_embeddings.weight', 'electra.embeddings.layer_norm.weight': 'ernie.embeddings.LayerNorm.gamma', 'electra.embeddings.layer_norm.bias': 'ernie.embeddings.LayerNorm.beta'})
    for i in range(attention_num):
        weight_map[f'electra.encoder.layers.{i}.self_attn.q_proj.weight'] = f'ernie.encoder.layer.{i}.attention.self.query.weight'
        weight_map[f'electra.encoder.layers.{i}.self_attn.q_proj.bias'] = f'ernie.encoder.layer.{i}.attention.self.query.bias'
        weight_map[f'electra.encoder.layers.{i}.self_attn.k_proj.weight'] = f'ernie.encoder.layer.{i}.attention.self.key.weight'
        weight_map[f'electra.encoder.layers.{i}.self_attn.k_proj.bias'] = f'ernie.encoder.layer.{i}.attention.self.key.bias'
        weight_map[f'electra.encoder.layers.{i}.self_attn.v_proj.weight'] = f'ernie.encoder.layer.{i}.attention.self.value.weight'
        weight_map[f'electra.encoder.layers.{i}.self_attn.v_proj.bias'] = f'ernie.encoder.layer.{i}.attention.self.value.bias'
        weight_map[f'electra.encoder.layers.{i}.self_attn.out_proj.weight'] = f'ernie.encoder.layer.{i}.attention.output.dense.weight'
        weight_map[f'electra.encoder.layers.{i}.self_attn.out_proj.bias'] = f'ernie.encoder.layer.{i}.attention.output.dense.bias'
        weight_map[f'electra.encoder.layers.{i}.norm1.weight'] = f'ernie.encoder.layer.{i}.attention.output.LayerNorm.gamma'
        weight_map[f'electra.encoder.layers.{i}.norm1.bias'] = f'ernie.encoder.layer.{i}.attention.output.LayerNorm.beta'
        weight_map[f'electra.encoder.layers.{i}.linear1.weight'] = f'ernie.encoder.layer.{i}.intermediate.dense.weight'
        weight_map[f'electra.encoder.layers.{i}.linear1.bias'] = f'ernie.encoder.layer.{i}.intermediate.dense.bias'
        weight_map[f'electra.encoder.layers.{i}.linear2.weight'] = f'ernie.encoder.layer.{i}.output.dense.weight'
        weight_map[f'electra.encoder.layers.{i}.linear2.bias'] = f'ernie.encoder.layer.{i}.output.dense.bias'
        weight_map[f'electra.encoder.layers.{i}.norm2.weight'] = f'ernie.encoder.layer.{i}.output.LayerNorm.gamma'
        weight_map[f'electra.encoder.layers.{i}.norm2.bias'] = f'ernie.encoder.layer.{i}.output.LayerNorm.beta'
    return weight_map

ARGS = {
    'attention_num': 12
}
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 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
build_params_map Ran
ran on a synthesized input
nghuyong/ERNIE-Pytorch/convert.py
code served (permissive licence) · get_code("f8c635671e91bc15")
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 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

# The function build_params_map takes only one parameter: attention_num
# It's an integer that controls how many attention layers to map
# The function builds and returns an OrderedDict, it doesn't use the parameter
# to do anything complex - just loops through range(attention_num)

ARGS = {
    'attention_num': 12
}
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 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
convert_to_unicode Ran
ran on a synthesized input
lyqcom/emotect/src/reader.py
code served (permissive licence) · get_code("01f2dd1d4afbd7c9")
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 six

# The function convert_to_unicode takes a single parameter 'text'
# It handles string/bytes conversion based on Python version
# We need to provide valid text inputs

# Test with a string (the most common case)
ARGS = {
    'text': 'hello world'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
six — 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
csv_reader Ran
ran on a synthesized input
lyqcom/emotect/src/reader.py
code served (permissive licence) · get_code("2d616c30587d4003")
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 generator. 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 io

# Create a file-like object (fd parameter) with sample CSV data
csv_data = "col1\tcol2\tcol3\nvalue1\tvalue2\tvalue3\nvalue4\tvalue5\tvalue6\nsinglevalue\n"
fd = io.StringIO(csv_data)

# Define arguments for csv_reader
ARGS = {
    'fd': fd,
    'delimiter': '\t'
}
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 generator — a generator output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a generator 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
calc_lm_head_logits Not yet run
unverified (harvested, no recorded run)
PaddlePaddle/ERNIE/ernie/modeling.py
code served (permissive licence) · get_code("f277229b3bab1f59")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 6 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
calc_lm_head_logits 2 other papers
2 later
1907.12412 (2019-07)
ERNIE 2.0: A Continual Pre-training Framework for Language Understanding
2012.15674 (2020-12)
ERNIE-M: Enhanced Multilingual Representation by Aligning Cross-lingual Semantics with Monolingual Corpora

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

Repositories linked to this paper

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

Abstract

We present a novel language representation model enhanced by knowledge called ERNIE (Enhanced Representation through kNowledge IntEgration). Inspired by the masking strategy of BERT, ERNIE is designed to learn language representation enhanced by knowledge masking strategies, which includes entity-level masking and phrase-level masking. Entity-level strategy masks entities which are usually composed of multiple words.Phrase-level strategy masks the whole phrase which is composed of several words standing together as a conceptual unit.Experimental results show that ERNIE outperforms other baseline methods, achieving new state-of-the-art results on five Chinese natural language processing tasks including natural language inference, semantic similarity, named entity recognition, sentiment analysis and question answering. We also demonstrate that ERNIE has more powerful knowledge inference capacity on a cloze test.

For agents

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

get_harvested_code_for_paper("1904.09223")
get_code_for_paper("1904.09223")
have("1904.09223")

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

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

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

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

Connect an agent — have() is free.