SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2010.06138 · NeurIPS · 2020

Incorporating BERT into Parallel Sequence Decoding with Adapters

Enhong Chen, Junliang Guo, Zhirui Zhang, Linli Xu, Hao-Ran Wei, Boxing Chen

arXiv · PDF · Open in the Atlas

Code that ran

8 of 13 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 2 have no contract verdict; 5 failures of our instrument; 5 no recorded run); 2 of them were also run on the host, not in the jail, by the peer-agreement lane that set their level, measured 2026-11-22; 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/2010.06138.json · badge: /api/ran/2010.06138.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
lemmonation/abnet canonical (classifier label)
classifier basis: census
8 ran · 5 no recorded run
FunctionStatusWhere it lives
swish Ran
ran; our contract draft was wrong, not the code
lemmonation/abnet/bert/modeling.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
whitespace_tokenize Ran
ran; our contract draft was wrong, not the code
lemmonation/abnet/bert/tokenization.py
code served (permissive licence) · get_code("cf9ffa02a42184af")
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 list, ndim 1, dtype family float; no output shape is stated. 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-05T02:55:57Z). 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 torch
import numpy as np

def whitespace_tokenize(text):
    """Runs basic whitespace cleaning and splitting on a piece of text."""
    text = text.strip()
    if not text:
        return []
    tokens = text.split()
    return tokens

# Setup code
torch.manual_seed(0)

# The function takes a single parameter: text (a string)
# It performs basic whitespace cleaning and splitting
# We need to provide a valid string argument

ARGS = {
    "text": "  hello world  this is a test  "
}
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 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
dataset_dest_prefix Ran
ran on a synthesized input
lemmonation/abnet/preprocess.py
code served (permissive licence) · get_code("9eda7f80331d658c")
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 torch

class Args:
    def __init__(self):
        self.destdir = '/data/output'
        self.source_lang = 'en'
        self.target_lang = 'fr'

ARGS = {
    'args': Args(),
    'output_prefix': 'train',
    'lang': 'src'
}
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 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
gelu Ran
ran, honoured the contract we drafted
lemmonation/abnet/bert/modeling.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.

load_checkpoint Ran
ran on a synthesized input
lemmonation/abnet/fairseq/checkpoint_utils.py
code served (permissive licence) · get_code("336077aca45a1da4")
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 tuple, 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 torch
import torch.nn as nn
import collections
import tempfile
import os

torch.manual_seed(0)

# Create a minimal trainer mock
class MockTrainer:
    def __init__(self):
        self.num_updates = 0
    
    def get_num_updates(self):
        return self.num_updates
    
    def save_checkpoint(self, path, extra_state):
        # Mock save - just create an empty file
        os.makedirs(os.path.dirname(path), exist_ok=True)
        with open(path, 'w') as f:
            f.write('')
    
    def load_checkpoint(self, checkpoint_path, reset_optimizer, reset_lr_scheduler, 
                       optimizer_overrides, reset_meters=False, warmup_from_nmt=False, 
                       use_adapter_bert=False):
        extra_state = {
            'train_iterator': {'epoch': 0, 'iterations_in_epoch': 0},
            'val_loss': 0.5,
            'best': 0.45
        }
        return extra_state
    
    def get_train_iterator(self, epoch=0):
        return MockEpochItr(epoch)
    
    def lr_step(self, epoch):
        pass

# Create a minimal epoch iterator mock
class MockEpochItr:
    def __init__(self, epoch=0):
        self.epoch = epoch
        self._end_of_epoch = False
    
    def end_of_epoch(self):
        return self._end_of_epoch
    
    def state_dict(self):
        return {'epoch': self.epoch, 'iterations_in_epoch': 0}
    
    def load_state_dict(self, state):
        self.epoch = state.get('epoch', 0)

# Create a mock distributed_utils
class MockDistributedUtils:
    @staticmethod
    def is_master(args):
        return True

# Create a mock for args
class Args:
    def __init__(self, tmpdir):
        self.no_save = False
        self.save_dir = tmpdir
        self.no_epoch_checkpoints = False
        self.save_interval = 1
        self.save_interval_updates = 0
        self.keep_interval_updates = 0
        self.keep_last_epochs = 0
        self.distributed_rank = 0
        self.warmup_from_nmt = False
        self.warmup_nmt_file = 'warmup.pt'
        self.restore_file = 'checkpoint_last.pt'
        self.reset_optimizer = False
        self.reset_lr_scheduler = False
        self.optimizer_overrides = '{}'
        self.reset_meters = False
        self.reset_dataloader = False

# Setup
tmpdir = tempfile.mkdtemp()
trainer = MockTrainer()
epoch_itr = MockEpochItr(epoch=0)

# Create dummy checkpoint file for load_checkpoint
checkpoint_path = os.path.join(tmpdir, 'checkpoint_last.pt')
os.makedirs(tmpdir, exist_ok=True)
with open(checkpoint_path, 'w') as f:
    f.write('')

args = Args(tmpdir)

ARGS = {
    'args': args,
    'trainer': trainer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
fairseq, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
load_vocab Ran
ran; our contract draft was wrong, not the code
lemmonation/abnet/bert/tokenization.py
code served (permissive licence) · get_code("a4e183f24a5ad1a7")
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
import tempfile
import os

# Create a temporary vocabulary file
temp_dir = tempfile.mkdtemp()
vocab_file = os.path.join(temp_dir, "vocab.txt")

# Write sample vocabulary to the file
vocab_content = """hello
world
python
test
token
sample
"""

with open(vocab_file, 'w', encoding='utf-8') as f:
    f.write(vocab_content)

ARGS = {
    "vocab_file": vocab_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 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
safe_readline Ran
ran; our contract draft was wrong, not the code
lemmonation/abnet/fairseq/binarizer.py
pointer only (licence: MIT); the stored copy get_code serves, from agi-content-generation/EKD, is pointer only (licence: NOASSERTION) · get_code("82bdf940665aeeb4")
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 agi-content-generation/EKD, 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.

url_to_filename Ran
ran; our contract draft was wrong, not the code
lemmonation/abnet/bert/file_utils.py
code served (permissive licence) · get_code("5eff22fa0a651276")
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.

from hashlib import sha256

ARGS = {
    "url": "https://example.com/model/checkpoint.bin",
    "etag": "abc123def456"
}
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 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
cached_path Not yet run
unverified (harvested, no recorded run)
lemmonation/abnet/bert/file_utils.py
code served (permissive licence) · get_code("cf9c448c96f48428")
How it ran

no invocation recorded.

filename_to_url Not yet run
unverified (harvested, no recorded run)
lemmonation/abnet/bert/file_utils.py
code served (permissive licence) · get_code("a6aab787fcf8b10d")
How it ran

no invocation recorded.

load_checkpoint_to_cpu Not yet run
unverified (harvested, no recorded run)
lemmonation/abnet/fairseq/checkpoint_utils.py
code served (permissive licence) · get_code("c6a6a0734f184953")
How it ran

no invocation recorded.

load_model_ensemble Not yet run
unverified (harvested, no recorded run)
lemmonation/abnet/fairseq/checkpoint_utils.py
code served (permissive licence) · get_code("b2d82a49dbc70999")
How it ran

no invocation recorded.

load_tf_weights_in_bert Not yet run
unverified (harvested, no recorded run)
lemmonation/abnet/bert/modeling.py
pointer only (licence: MIT); the stored copy get_code serves, from sreyan88/toxicity-detection-in-spoken-utterances, is pointer only (licence: NONE) · get_code("b1a7180868dd8d6a")
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 sreyan88/toxicity-detection-in-spoken-utterances, 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. No invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 11 are also present in other papers whose code we hold (11 with at least one paper dated earlier, 8 the same month, 11 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
swish 206 other papers
47 dated earlier, 5 the same month, 153 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
57 dated earlier, 4 the same month, 135 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
safe_readline 66 other papers
13 dated earlier, 53 later
1610.02424 (2016-10)
Diverse Beam Search: Decoding Diverse Solutions from Neural Sequence Models
1802.06901 (2018-02)
Deterministic Non-Autoregressive Neural Sequence Modeling by Iterative Refinement
1904.01038 (2019-04)
FAIRSEQ: A Fast, Extensible Toolkit for Sequence Modeling
and 63 more not named here
url_to_filename 48 other papers
18 dated earlier, 1 the same month, 29 later · 8 only as an assembly brick
1610.02424 (2016-10)
Diverse Beam Search: Decoding Diverse Solutions from Neural Sequence Models
1809.11096 (2018-09)
Large Scale GAN Training for High Fidelity Natural Image Synthesis
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
and 45 more not named here
whitespace_tokenize 43 other papers
9 dated earlier, 1 the same month, 33 later
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1906.01698 (2019-06)
Open Sesame: Getting Inside BERT's Linguistic Knowledge
and 40 more not named here
cached_path 27 other papers
13 dated earlier, 1 the same month, 13 later · 5 only as an assembly brick
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
1908.02265 (2019-08)
ViLBERT: Pretraining Task-Agnostic Visiolinguistic Representations for Vision-and-Language Tasks
and 24 more not named here
filename_to_url 18 other papers
7 dated earlier, 1 the same month, 10 later
1908.09355 (2019-08)
Patient Knowledge Distillation for BERT Model Compression
1909.02209 (2019-09)
Semantics-aware BERT for Language Understanding
1911.02896 (2019-11)
Contextualized Sparse Representations for Real-Time Open-Domain Question Answering
and 15 more not named here
load_tf_weights_in_bert 15 other papers
7 dated earlier, 1 the same month, 5 later, 2 same year, order not determinable
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1908.09355 (2019-08)
Patient Knowledge Distillation for BERT Model Compression
1911.00720 (2019-11)
ZEN: Pre-training Chinese Text Encoder Enhanced by N-gram Representations
and 12 more not named here
load_vocab 11 other papers
3 dated earlier, 1 the same month, 7 later
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1906.01698 (2019-06)
Open Sesame: Getting Inside BERT's Linguistic Knowledge
2004.07453 (2020-04)
The Right Tool for the Job: Matching Model and Instance Complexities
and 8 more not named here
dataset_dest_prefix 7 other papers
4 dated earlier, 3 later
1904.01038 (2019-04)
FAIRSEQ: A Fast, Extensible Toolkit for Sequence Modeling
1904.11660 (2019-04)
Transformers with convolutional context for ASR
1911.06136 (2019-11)
KEPLER: A Unified Model for Knowledge Embedding and Pre-trained Language Representation
and 4 more not named here
load_checkpoint_to_cpu 7 other papers
5 dated earlier, 2 later
1904.01038 (2019-04)
FAIRSEQ: A Fast, Extensible Toolkit for Sequence Modeling
1911.06136 (2019-11)
KEPLER: A Unified Model for Knowledge Embedding and Pre-trained Language Representation
2003.09229 (2020-03)
Learning to Encode Position for Transformer with Continuous Dynamical Model
and 4 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-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

While large scale pre-trained language models such as BERT [5] have achieved great success on various natural language understanding tasks, how to efficiently and effectively incorporate them into sequence-to-sequence models and the corresponding text generation tasks remains a non-trivial problem. In this paper, we propose to address this problem by taking two different BERT models as the encoder and decoder respectively, and fine-tuning them by introducing simple and lightweight adapter modules, which are inserted between BERT layers and tuned on the task-specific dataset. In this way, we obtain a flexible and efficient model which is able to jointly leverage the information contained in the source-side and targetside BERT models, while bypassing the catastrophic forgetting problem. Each component in the framework can be considered as a plug-in unit, making the framework flexible and task agnostic. Our framework is based on a parallel sequence decoding algorithm named Mask-Predict [8] considering the bi-directional and conditional independent nature of BERT, and can be adapted to traditional autoregressive decoding easily. We conduct extensive experiments on neural machine translation tasks where the proposed method consistently outperforms autoregressive baselines while reducing the inference latency by half, and achieves 36.49/33.57 BLEU scores on IWSLT14 German-English/WMT14 German-English translation. When adapted to autoregressive decoding, the proposed method achieves 30.60/43.56 BLEU scores on WMT14 English-German/English-French translation, on par with the state-of-the-art baseline models.

For agents

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

get_harvested_code_for_paper("2010.06138")
get_code_for_paper("2010.06138")
have("2010.06138")

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

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

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

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

Connect an agent — have() is free.