SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2002.01808 · 2020

K-Adapter: Infusing Knowledge into Pre-Trained Models with Adapters

arXiv · PDF · Open in the Atlas

Code that ran

11 of 14 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; 1 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 6 failures of our instrument; 3 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/2002.01808.json · badge: /api/ran/2002.01808.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
microsoft/K-Adapter community (classifier label)
classifier basis not recorded on the link
11 ran · 3 no recorded run
FunctionStatusWhere it lives
swish Ran
ran; our contract draft was wrong, not the code
microsoft/K-Adapter/pytorch_transformers/modeling_bert.py
code served (permissive licence) · get_code("0f786c407fb1ee4c")
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 Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. 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-04T22:33:52Z). 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)

# The function swish takes a single parameter 'x' which is used with:
# - torch.sigmoid(x) - requires a tensor
# - x * ... - requires a tensor that supports multiplication
# So x should be a tensor

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
accuracy Ran
ran on a synthesized input
microsoft/K-Adapter/lin-adapter.py
code served (permissive licence) · get_code("743523b60fbbb166")
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 outputs and labels for the accuracy function
# outputs: predicted class labels (shape: batch_size,)
# labels: ground truth class labels (shape: batch_size,)

outputs = np.array([0, 1, 1, 0, 2, 1])
labels = np.array([0, 1, 0, 0, 2, 1])

ARGS = {
    "outputs": outputs,
    "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
build_tf_to_pytorch_map Ran
ran; our contract draft was wrong, not the code
microsoft/K-Adapter/pytorch_transformers/modeling_transfo_xl.py
code served (permissive licence) · get_code("35ef111fc00c21b4")
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 torch
import torch.nn as nn

torch.manual_seed(0)

class Config:
    def __init__(self):
        self.tie_projs = [False]
        self.tie_weight = True
        self.untie_r = False

class LayerNorm(nn.Module):
    def __init__(self, dim):
        super().__init__()
        self.weight = nn.Parameter(torch.randn(dim))
        self.bias = nn.Parameter(torch.randn(dim))

class DecAttn(nn.Module):
    def __init__(self, d_model=4, d_head=2):
        super().__init__()
        self.layer_norm = LayerNorm(d_model)
        self.o_net = nn.Linear(d_model, d_model)
        self.qkv_net = nn.Linear(d_model, 3 * d_model)
        self.r_net = nn.Linear(d_model, d_model)
        self.r_r_bias = nn.Parameter(torch.randn(d_model))
        self.r_w_bias = nn.Parameter(torch.randn(d_model))

class PosFeedForward(nn.Module):
    def __init__(self, d_model=4, d_ff=8):
        super().__init__()
        self.layer_norm = LayerNorm(d_model)
        self.CoreNet = nn.Sequential(
            nn.Linear(d_model, d_ff),
            nn.ReLU(),
            nn.Linear(d_ff, d_ff),
            nn.Linear(d_ff, d_model)
        )

class TransformerLayer(nn.Module):
    def __init__(self, d_model=4):
        super().__init__()
        self.dec_attn = DecAttn(d_model)
        self.pos_ff = PosFeedForward(d_model)

class WordEmb(nn.Module):
    def __init__(self, vocab_size=100, d_model=4, n_cutoffs=1):
        super().__init__()
        self.emb_layers = nn.ModuleList([nn.Embedding(vocab_size, d_model) for _ in range(n_cutoffs)])
        self.emb_projs = nn.ModuleList([nn.Linear(d_model, d_model) for _ in range(n_cutoffs)])

class AdaptiveSoftmax(nn.Module):
    def __init__(self, vocab_size=100, d_model=4, n_cutoffs=1):
        super().__init__()
        self.cluster_weight = nn.Parameter(torch.randn(n_cutoffs, d_model))
        self.cluster_bias = nn.Parameter(torch.randn(n_cutoffs))
        self.out_layers = nn.ModuleList([nn.Linear(d_model, vocab_size) for _ in range(n_cutoffs)])
        self.out_projs = nn.ModuleList([nn.Linear(d_model, d_model) for _ in range(n_cutoffs)])

class Transformer(nn.Module):
    def __init__(self, d_model=4, n_layers=2, n_cutoffs=1):
        super().__init__()
        self.word_emb = WordEmb(vocab_size=100, d_model=d_model, n_cutoffs=n_cutoffs)
        self.layers = nn.ModuleList([TransformerLayer(d_model) for _ in range(n_layers)])
        self.r_r_bias = nn.Parameter(torch.randn(d_model))
        self.r_w_bias = nn.Parameter(torch.randn(d_model))

class Model(nn.Module):
    def __init__(self, d_model=4, n_layers=2, n_cutoffs=1):
        super().__init__()
        self.transformer = Transformer(d_model=d_model, n_layers=n_layers, n_cutoffs=n_cutoffs)
        self.crit = AdaptiveSoftmax(vocab_size=100, d_model=d_model, n_cutoffs=n_cutoffs)

config = Config()
model = Model(d_model=4, n_layers=2, n_cutoffs=1)

ARGS = {
    'model': model,
    'config': config
}
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 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
evaluate Ran
ran on a synthesized input
microsoft/K-Adapter/fac-adapter.py
code served (permissive licence) · get_code("264258aac6e8741c")
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 torch
import torch.nn as nn
import os
import tempfile
from torch.utils.data import TensorDataset

torch.manual_seed(0)

# Create temporary directory for output
temp_dir = tempfile.mkdtemp()

# Define minimal models that match the function's usage
class PretrainedModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 8)
    
    def forward(self, input_ids, attention_mask, token_type_ids=None, labels=None, 
                subj_special_start_id=None, obj_special_start_id=None):
        # Return hidden states as output
        batch_size = input_ids.shape[0]
        return torch.randn(batch_size, 4, 8)

class AdapterModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(8, 3)  # 3 classes for classification
    
    def forward(self, pretrained_outputs, input_ids, attention_mask, token_type_ids=None, 
                labels=None, subj_special_start_id=None, obj_special_start_id=None):
        logits = self.linear(pretrained_outputs.mean(dim=1))
        loss = nn.CrossEntropyLoss()(logits, labels)
        return loss, logits

# Create minimal tokenizer stand-in
class Tokenizer:
    pass

# Create arguments object
class Args:
    def __init__(self):
        self.per_gpu_eval_batch_size = 2
        self.n_gpu = 1
        self.local_rank = -1
        self.device = torch.device('cpu')
        self.model_type = 'bert'
        self.output_dir = temp_dir
        self.my_model_name = 'test_model'

# Create validation dataset
batch_size = 2
seq_length = 4
num_samples = 6
num_classes = 3

input_ids = torch.randint(0, 100, (num_samples, seq_length))
attention_mask = torch.ones(num_samples, seq_length)
token_type_ids = torch.zeros(num_samples, seq_length)
labels = torch.randint(0, num_classes, (num_samples,))
subj_special_start_id = torch.randint(0, seq_length, (num_samples,))
obj_special_start_id = torch.randint(0, seq_length, (num_samples,))

val_dataset = TensorDataset(
    input_ids, 
    attention_mask, 
    token_type_ids, 
    labels, 
    subj_special_start_id, 
    obj_special_start_id
)

# Create models
pretrained_model = PretrainedModel()
adapter_model = AdapterModel()

# Create tokenizer
tokenizer = Tokenizer()

# Create args
args = Args()

ARGS = {
    'args': args,
    'val_dataset': val_dataset,
    'model': [pretrained_model, adapter_model],
    'tokenizer': tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
sklearn, 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
evaluate Ran
ran on a synthesized input
microsoft/K-Adapter/lin-adapter.py
code served (permissive licence) · get_code("0e86198a445a228c")
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 torch
import numpy as np
import os
import tempfile
from torch import nn
from torch.utils.data import TensorDataset

torch.manual_seed(0)

# Create a temporary directory for output
temp_dir = tempfile.mkdtemp()

# Create mock args object
class Args:
    def __init__(self):
        self.per_gpu_eval_batch_size = 2
        self.n_gpu = 1
        self.local_rank = -1
        self.device = 'cpu'
        self.model_type = 'bert'
        self.output_dir = temp_dir
        self.my_model_name = 'test_model'

args = Args()

# Create validation dataset
# batch[0]: input_ids, batch[1]: attention_mask, batch[2]: token_type_ids, batch[3]: labels
batch_size = 2
seq_length = 5
num_labels = 3

input_ids = torch.randint(0, 100, (batch_size, seq_length))
attention_mask = torch.ones(batch_size, seq_length)
token_type_ids = torch.zeros(batch_size, seq_length, dtype=torch.long)
labels = torch.randint(0, num_labels, (batch_size, seq_length))

val_dataset = TensorDataset(input_ids, attention_mask, token_type_ids, labels)

# Create pretrained model (returns embeddings)
class PretrainedModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding = nn.Embedding(100, 4)
    
    def forward(self, input_ids, attention_mask, token_type_ids=None, labels=None):
        return self.embedding(input_ids)

# Create adapter model
class AdapterModel(nn.Module):
    def __init__(self, hidden_size=4, num_labels=3):
        super().__init__()
        self.classifier = nn.Linear(hidden_size, num_labels)
        self.attention_classifier = nn.Linear(hidden_size, num_labels)
    
    def forward(self, pretrained_outputs, input_ids=None, attention_mask=None, token_type_ids=None, labels=None):
        # pretrained_outputs is (batch_size, seq_length, hidden_size)
        logits = self.classifier(pretrained_outputs)  # (batch_size, seq_length, num_labels)
        attention_prob = self.attention_classifier(pretrained_outputs)  # (batch_size, seq_length, num_labels)
        
        loss = None
        if labels is not None:
            loss_fn = nn.CrossEntropyLoss()
            loss = loss_fn(logits.view(-1, logits.size(-1)), labels.view(-1))
        
        return loss, logits, attention_prob

pretrained_model = PretrainedModel()
adapter_model = AdapterModel()
model = [pretrained_model, adapter_model]

# Create mock tokenizer
tokenizer = None

ARGS = {
    'args': args,
    'val_dataset': val_dataset,
    'model': model,
    'tokenizer': tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
gelu Ran
ran; our contract draft was wrong, not the code
microsoft/K-Adapter/pytorch_transformers/modeling_gpt2.py
code served (permissive licence) · get_code("8d23fbe2b99b840b")
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
import math

torch.manual_seed(0)

# Create a small tensor for testing
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 Ran
ran, honoured the contract we drafted
microsoft/K-Adapter/pytorch_transformers/modeling_bert.py
pointer only (licence: MIT); the stored copy get_code serves, from tanmay1618/text_to_sql_bert, is pointer only (licence: NONE) · get_code("fdc64f4c72036ae4")
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 tanmay1618/text_to_sql_bert, 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 Ran
ran; our contract draft was wrong, not the code
microsoft/K-Adapter/pytorch_transformers/modeling_distilbert.py
code served (permissive licence) · get_code("69c6d14de8190cfb")
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 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 math
import torch

torch.manual_seed(0)

# The function gelu takes a single parameter x which is used with:
# - multiplication operator (*)
# - torch.erf() function
# - division operator (/)
# This suggests x should be a torch.Tensor

x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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 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
get_property2idx_dict Ran
ran on a synthesized input
microsoft/K-Adapter/fac-adapter.py
code served (permissive licence) · get_code("6b8a0eeef9e90879")
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 json
import tempfile
import os

# Create a temporary JSON file with a property2idx dictionary
property_data = {
    "color": 0,
    "size": 1,
    "shape": 2,
    "material": 3
}

# Create a temporary file
temp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.json', delete=False)
json.dump(property_data, temp_file)
temp_file.close()

try:
    ARGS = {
        "file": temp_file.name
    }
finally:
    # Note: In production, you'd want to clean up with os.unlink(temp_file.name)
    # but we keep the file around so the function can read it
    pass
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 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
load_tf_weights_in_bert Ran
ran; our contract draft was wrong, not the code
microsoft/K-Adapter/pytorch_transformers/modeling_bert.py
pointer only (licence: MIT); the stored copy get_code serves, from tanmay1618/text_to_sql_bert, is pointer only (licence: NONE) · get_code("0c145728a35789fa")
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 tanmay1618/text_to_sql_bert, 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.

sample_logits Ran
ran; our contract draft was wrong, not the code
microsoft/K-Adapter/pytorch_transformers/modeling_transfo_xl_utilities.py
code served (permissive licence) · get_code("93228a3eb5c4d179")
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 3, dtype family float, shape (2, 3, 6) 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 torch.nn as nn

torch.manual_seed(0)

# Small embedding layer
n_vocab = 20
n_emb = 4
embedding = nn.Embedding(n_vocab, n_emb)

# Bias vector
bias = torch.randn(n_vocab)

# Labels: [b1, b2] with valid vocab indices
b1, b2 = 2, 3
labels = torch.randint(0, n_vocab, (b1, b2))

# Inputs: [b1, b2, n_emb]
inputs = torch.randn(b1, b2, n_emb)

# Sampler that implements the sample() method
class LogUniformSampler:
    def __init__(self, n_vocab, n_sample=5):
        self.n_vocab = n_vocab
        self.n_sample = n_sample
    
    def sample(self, labels):
        # Sample negative samples
        neg_samples = torch.randint(0, self.n_vocab, (self.n_sample,))
        
        # Log probabilities
        true_log_probs = torch.randn(labels.size(0), labels.size(1))
        samp_log_probs = torch.randn(self.n_sample)
        
        return true_log_probs, samp_log_probs, neg_samples

sampler = LogUniformSampler(n_vocab=n_vocab, n_sample=5)

ARGS = {
    "embedding": embedding,
    "bias": bias,
    "labels": labels,
    "inputs": inputs,
    "sampler": sampler
}
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 3, dtype family float, shape (2, 3, 6) — shape (2, 3, 6) 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_tf_weights_in_gpt2 Not yet run
unverified (harvested, no recorded run)
microsoft/K-Adapter/pytorch_transformers/modeling_gpt2.py
code served (permissive licence) · get_code("654e91efc679fe84")
How it ran

no invocation recorded.

load_tf_weights_in_openai_gpt Not yet run
unverified (harvested, no recorded run)
microsoft/K-Adapter/pytorch_transformers/modeling_openai.py
code served (permissive licence) · get_code("42ee168c3ae12e60")
How it ran

no invocation recorded.

load_tf_weights_in_transfo_xl Not yet run
unverified (harvested, no recorded run)
microsoft/K-Adapter/pytorch_transformers/modeling_transfo_xl.py
code served (permissive licence) · get_code("23d246e59ef9447b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 10 are also present in other papers whose code we hold (9 with at least one paper dated earlier, 3 the same month, 10 later) and 4 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
swish 206 other papers
27 dated earlier, 178 later, 1 same year, order not determinable · 44 only as an assembly brick
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1805.12114 (2018-05)
Deep Reinforcement Learning in a Handful of Trials using Probabilistic Dynamics Models
1809.01357 (2018-09)
Zero Shot Learning for Code Education: Rubric Sampling with Deep Learning Inference
and 203 more not named here
gelu 198 other papers
36 dated earlier, 1 the same month, 159 later, 2 same year, order not determinable · 32 only as an assembly brick
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.10125 (2019-01)
Glyce: Glyph-vectors for Chinese Character Representations
and 195 more not named here
gelu 51 other papers
11 dated earlier, 1 the same month, 39 later · 8 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
and 48 more not named here
load_tf_weights_in_bert 19 other papers
3 dated earlier, 1 the same month, 15 later
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1902.01069 (2019-02)
A Comprehensive Exploration on WikiSQL with Table-Aware Word Contextualization
1909.11942 (2019-09)
ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
and 16 more not named here
gelu 17 other papers
4 dated earlier, 13 later
1905.12790 (2019-05)
A Generalized Framework of Sequence Generation with Application to Undirected Sequence Models
1906.08237 (2019-06)
XLNet: Generalized Autoregressive Pretraining for Language Understanding
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
and 14 more not named here
sample_logits 14 other papers
5 dated earlier, 9 later · 2 only as an assembly brick
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
1906.08237 (2019-06)
XLNet: Generalized Autoregressive Pretraining for Language Understanding
1908.09355 (2019-08)
Patient Knowledge Distillation for BERT Model Compression
and 11 more not named here
build_tf_to_pytorch_map 10 other papers
5 dated earlier, 5 later
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
1906.08237 (2019-06)
XLNet: Generalized Autoregressive Pretraining for Language Understanding
1908.09355 (2019-08)
Patient Knowledge Distillation for BERT Model Compression
and 7 more not named here
load_tf_weights_in_openai_gpt 8 other papers
2 dated earlier, 6 later
1906.08237 (2019-06)
XLNet: Generalized Autoregressive Pretraining for Language Understanding
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
2004.03829 (2020-04)
Exploring Versatile Generative Language Model Via Parameter-Efficient Transfer Learning
and 5 more not named here
load_tf_weights_in_gpt2 6 other papers
6 later
2004.03829 (2020-04)
Exploring Versatile Generative Language Model Via Parameter-Efficient Transfer Learning
2010.05607 (2020-10)
The elephant in the interpretability room: Why use attention as explanation when we have saliency methods?
2201.06885 (2022-01)
Evidence-aware Fake News Detection with Graph Neural Networks
and 3 more not named here
load_tf_weights_in_transfo_xl 6 other papers
2 dated earlier, 4 later
1906.08237 (2019-06)
XLNet: Generalized Autoregressive Pretraining for Language Understanding
1909.05311 (2019-09)
Graph-Based Reasoning over Heterogeneous External Knowledge for Commonsense Question Answering
2004.03829 (2020-04)
Exploring Versatile Generative Language Model Via Parameter-Efficient Transfer Learning
and 3 more not named here

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

We study the problem of injecting knowledge into large pre-trained models like BERT and RoBERTa. Existing methods typically update the original parameters of pre-trained models when injecting knowledge. However, when multiple kinds of knowledge are injected, the historically injected knowledge would be flushed away. To address this, we propose K-Adapter, a framework that retains the original parameters of the pre-trained model fixed and supports the development of versatile knowledge-infused model. Taking RoBERTa as the backbone model, K-Adapter has a neural adapter for each kind of infused knowledge, like a plug-in connected to RoBERTa. There is no information flow between different adapters, thus multiple adapters can be efficiently trained in a distributed way. As a case study, we inject two kinds of knowledge in this work, including (1) factual knowledge obtained from automatically aligned text-triplets on Wikipedia and Wikidata and (2) linguistic knowledge obtained via dependency parsing. Results on three knowledge-driven tasks, including relation classification, entity typing, and question answering, demonstrate that each adapter improves the performance and the combination of both adapters brings further improvements. Further analysis indicates that K-Adapter captures versatile knowledge than RoBERTa.

For agents

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

get_harvested_code_for_paper("2002.01808")
get_code_for_paper("2002.01808")
have("2002.01808")

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

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

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

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

Connect an agent — have() is free.