SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2311.06761 · EMNLP · 2023

Learning Knowledge-Enhanced Contextual Language Representations for Domain Natural Language Understanding

Weining Qian, Cen Chen, Taolin Zhang, Chengyu Wang, Dawei Cheng, Xiaofeng He, Minghui Qiu, Zhongjie Duan, Ruyao Xu, Cd-19 Fever

arXiv · PDF · Open in the Atlas

Code that ran

9 of 10 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, 2 violated it and 0 have no contract verdict; 7 failures of our instrument; 1 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/2311.06761.json · badge: /api/ran/2311.06761.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
alibaba/EasyNLP canonical (classifier label)
classifier basis: census
9 ran · 1 no recorded run
FunctionStatusWhere it lives
check_number_comma Ran
ran, violated the contract we drafted
alibaba/EasyNLP/easynlp/modelzoo/convert_slow_tokenizer.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from UW-Madison-Lee-Lab/looped-tf, is pointer only (licence: NONE) · get_code("a727df5fd2f5599a")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from UW-Madison-Lee-Lab/looped-tf, 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.

gelu_fast Ran
ran; our contract draft was wrong, not the code
alibaba/EasyNLP/easynlp/modelzoo/activations.py
code served (permissive licence) · get_code("a4475703ff58ecf9")
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 Tensor, ndim 2, dtype family float, shape (2, 4) 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)

# gelu_fast takes a single parameter 'x' which is used in arithmetic operations
# It should be a tensor that supports multiplication, addition, and tanh operations
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
gelu_new Ran
ran; our contract draft was wrong, not the code
alibaba/EasyNLP/easynlp/modelzoo/activations.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from astro-jon/LCWL, is pointer only (licence: NONE) · get_code("45bb87451230d5e8")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from astro-jon/LCWL, 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.

get_linear_schedule_with_warmup Ran
ran; our contract draft was wrong, not the code
alibaba/EasyNLP/easynlp/core/optimizers.py
code served (permissive licence) · get_code("a3af4655933264d7")
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 LambdaLR. 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
from torch.optim import SGD

torch.manual_seed(0)

# Create a simple model
model = nn.Linear(4, 3)

# Create an optimizer
optimizer = SGD(model.parameters(), lr=0.1)

# Define arguments for get_linear_schedule_with_warmup
ARGS = {
    "optimizer": optimizer,
    "num_warmup_steps": 100,
    "num_training_steps": 1000,
    "last_epoch": -1
}
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 LambdaLR — a LambdaLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LambdaLR 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_model_predictor Ran
ran; our contract draft was wrong, not the code
alibaba/EasyNLP/easynlp/core/predictor.py
code served (permissive licence) · get_code("f761e4504b526823")
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 PyModelPredictor. 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
import torch.nn as nn
from unittest.mock import MagicMock

torch.manual_seed(0)

# Create a minimal PyTorch model class that has from_pretrained method
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, inputs):
        # inputs is a dict with keys from input_keys
        x = inputs['input_tensor']
        output = self.linear(x)
        return {
            'output_tensor': output
        }
    
    @classmethod
    def from_pretrained(cls, pretrained_model_name_or_path):
        # Return an instance of the model
        return cls()

# Define input_keys as list of tuples (key_name, tensor_constructor)
input_keys = [
    ('input_tensor', lambda x: torch.tensor(x, dtype=torch.float32))
]

# Define output_keys
output_keys = ['output_tensor']

# Model directory (won't be used since we're mocking, but needs to be provided)
model_dir = '/fake/model/path'

# Create the ARGS dictionary
ARGS = {
    'model_dir': model_dir,
    'input_keys': input_keys,
    'output_keys': output_keys,
    'model_cls': MinimalModel,
    'use_tf': None
}
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 PyModelPredictor — a PyModelPredictor output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PyModelPredictor 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
is_remote_url Ran
ran, violated the contract we drafted
alibaba/EasyNLP/easynlp/modelzoo/file_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from vis-nlp/ChartQA, is pointer only (licence: GPL-3.0) · get_code("899d1e2736236351")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from vis-nlp/ChartQA, and GPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. 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.

quick_gelu Ran
ran; our contract draft was wrong, not the code
alibaba/EasyNLP/easynlp/modelzoo/activations.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from openai/summarize-from-feedback, is pointer only (licence: NOASSERTION) · get_code("e21f72f1a9834aef")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from openai/summarize-from-feedback, and GitHub could not classify the licence of that repository (NOASSERTION). 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.

replace_return_docstrings Ran
ran; our contract draft was wrong, not the code
alibaba/EasyNLP/easynlp/modelzoo/file_utils.py
code served (permissive licence) · get_code("108f25573123b007")
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 function. 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
import re


class MockOutputType:
    """Mock output type class for testing."""
    __module__ = "transformers.modeling_outputs"
    __name__ = "BaseModelOutput"
    __doc__ = """
    Base class for model's outputs.

    Args:
        last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
            Sequence of hidden-states at the output of the last layer of the model.
        hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed):
            Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer,
            + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.
        attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed):
            Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, sequence_length)`.
    """


class MockTFOutputType:
    """Mock TensorFlow output type class for testing."""
    __module__ = "transformers.modeling_tf_outputs"
    __name__ = "TFBaseModelOutput"
    __doc__ = """
    Base class for TF model's outputs.

    Args:
        last_hidden_state (`tf.Tensor` of shape `(batch_size, sequence_length, hidden_size)`):
            Sequence of hidden-states at the output of the last layer of the model.
        hidden_states (`tuple(tf.Tensor)`, *optional*, returned when `output_hidden_states=True` is passed):
            Tuple of `tf.Tensor` (one for the output of the embeddings, if the model has an embedding layer,
            + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.
    """


def mock_function_with_docstring():
    """
    A test function.

    Args:
        input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
            Indices of input sequence tokens.

    Returns:
        Output object
    """
    pass


ARGS = {
    "output_type": MockOutputType,
    "config_class": "BertConfig"
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
torch_only_method Ran
ran; our contract draft was wrong, not the code
alibaba/EasyNLP/easynlp/modelzoo/file_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from miccunifi/ScanTalk, is pointer only (licence: NOASSERTION) · get_code("56ffa4b32330ceab")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from miccunifi/ScanTalk, and GitHub could not classify the licence of that repository (NOASSERTION). 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_slow_tokenizer Not yet run
unverified (harvested, no recorded run)
alibaba/EasyNLP/easynlp/modelzoo/convert_slow_tokenizer.py
code served (permissive licence) · get_code("9339ca51cea1f469")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 8 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 0 the same month, 8 later) and 2 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
gelu_new 24 other papers
17 dated earlier, 7 later
2004.10964 (2020-04)
Don't Stop Pretraining: Adapt Language Models to Domains and Tasks
2104.08066 (2021-04)
Effect of Visual Extensions on Natural Language Understanding in Vision-and-Language Models
2104.08400 (2021-04)
Structure-Aware Abstractive Conversation Summarization via Discourse and Action Graphs
and 21 more not named here
gelu_fast 22 other papers
15 dated earlier, 7 later
2010.03957 (2020-10)
Transformers for Modeling Physical Systems
2104.08066 (2021-04)
Effect of Visual Extensions on Natural Language Understanding in Vision-and-Language Models
2104.08400 (2021-04)
Structure-Aware Abstractive Conversation Summarization via Discourse and Action Graphs
and 19 more not named here
get_linear_schedule_with_warmup 21 other papers
9 dated earlier, 12 later
2004.10964 (2020-04)
Don't Stop Pretraining: Adapt Language Models to Domains and Tasks
2011.07430 (2020-11)
Audio-Visual Event Recognition through the lens of Adversary
2109.04912 (2021-09)
ReasonBERT: Pre-trained to Reason with Distant Supervision
and 18 more not named here
is_remote_url 14 other papers
11 dated earlier, 3 later
1905.00641 (2019-05)
RetinaFace: Single-stage Dense Face Localisation in the Wild
1910.13461 (2019-10)
BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension
2004.10964 (2020-04)
Don't Stop Pretraining: Adapt Language Models to Domains and Tasks
and 11 more not named here
check_number_comma 13 other papers
10 dated earlier, 3 later
2007.07779 (2020-07)
AdapterHub: A Framework for Adapting Transformers
2107.00910 (2021-07)
Learned Token Pruning for Transformers
2111.00160 (2021-11)
DSEE: Dually Sparsity-embedded Efficient Tuning of Pre-trained Language Models
and 10 more not named here
convert_slow_tokenizer 13 other papers
10 dated earlier, 3 later
2007.07779 (2020-07)
AdapterHub: A Framework for Adapting Transformers
2107.00910 (2021-07)
Learned Token Pruning for Transformers
2111.00160 (2021-11)
DSEE: Dually Sparsity-embedded Efficient Tuning of Pre-trained Language Models
and 10 more not named here
quick_gelu 6 other papers
4 dated earlier, 2 later
2110.04366 (2021-10)
Towards a Unified View of Parameter-Efficient Transfer Learning
2111.00160 (2021-11)
DSEE: Dually Sparsity-embedded Efficient Tuning of Pre-trained Language Models
2111.05498 (2021-11)
Attention Approximates Sparse Distributed Memory
and 3 more not named here
torch_only_method 3 other papers
2 dated earlier, 1 later
2104.08066 (2021-04)
Effect of Visual Extensions on Natural Language Understanding in Vision-and-Language Models
2305.01938 (2023-05)
Doc2SoarGraph: Discrete Reasoning over Visually-Rich Table-Text Documents via Semantic-Oriented Hierarchical Graphs
2403.10942 (2024-03)
ScanTalk: 3D Talking Heads from Unregistered Scans

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

Knowledge-Enhanced Pre-trained Language Models (KEPLMs) improve the performance of various downstream NLP tasks by injecting knowledge facts from large-scale Knowledge Graphs (KGs). However, existing methods for pre-training KEPLMs with relational triples are difficult to be adapted to close domains due to the lack of sufficient domain graph semantics. In this paper, we propose a Knowledgeenhanced lANGuAge Representation learning framework for various clOsed dOmains (KAN-GAROO) via capturing the implicit graph structure among the entities. Specifically, since the entity coverage rates of closed-domain KGs can be relatively low and may exhibit the global sparsity phenomenon for knowledge injection, we consider not only the shallow relational representations of triples but also the hyperbolic embeddings of deep hierarchical entityclass structures for effective knowledge fusion. Moreover, as two closed-domain entities under the same entity-class often have locally dense neighbor subgraphs counted by max point biconnected component, we further propose a data augmentation strategy based on contrastive learning over subgraphs to construct hard negative samples of higher quality. It makes the underlying KELPMs better distinguish the semantics of these neighboring entities to further complement the global semantic sparsity. In the experiments, we evaluate KANGAROO over various knowledge-aware and general NLP tasks in both full and few-shot learning settings, outperforming various KEPLM training paradigms performance in closed-domains significantly. 1 * T. Zhang and R. Xu contributed equally to this work. † Co-corresponding authors. 1 All the codes and model checkpoints have been released to public in the EasyNLP framework (Wang et al., 2022). URL: https://github.com/alibaba/EasyNLP. 2 The detailed analysis of entity coverage ratios and max point biconnected component is described in Sec. 2 Closed Domain The symptoms of COVID-19 in humans include respiratory infections and fever. Pre-training Corpus 15.73% 48.43% Entity Coverage Ratio 41.48% 25.37% Entity Max Point Biconnected Comp.

For agents

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

get_harvested_code_for_paper("2311.06761")
get_code_for_paper("2311.06761")
have("2311.06761")

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

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

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

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

Connect an agent — have() is free.