SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.10427 · ACL · 2023

Accelerating Transformer Inference for Translation via Parallel Decoding

Valentino Maiorca, Emanuele Rodolà, Emilian Postolache, Michele Mancusi, Andrea Santilli, Riccardo Marin, Silvio Severino

arXiv · PDF · Open in the Atlas

Code that ran

5 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; 1 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 0 failures of our instrument; 5 no recorded run), measured 2026-11-23; 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/2305.10427.json · badge: /api/ran/2305.10427.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
teelinsan/parallel-decoding canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
hao-ai-lab/lookaheaddecoding community
Papers with Code archive
0 ran · 4 no recorded run
hao-ai-lab/Consistency_LLM community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
check_stop_cond Ran
ran on a synthesized input
teelinsan/parallel-decoding/src/ipi/stopping_condition.py
code served (permissive licence) · get_code("0ca9c56c259031c2")
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 int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function checks if an eos (end-of-sequence) token exists in tensor[0]
# and returns its position if found, otherwise returns -1
# tensor needs to be indexable with [0] and support the == operator and nonzero()
# eos needs to be comparable with tensor elements

# Create a small tensor with shape (2, 4) to match "batch 2, dim 4"
# First row will contain an eos token, second row won't
tensor = torch.tensor([
    [1, 2, 3, 4],
    [5, 6, 7, 8]
], dtype=torch.long)

# eos token - we'll use 2, which exists in tensor[0]
eos = 2

ARGS = {
    "tensor": tensor,
    "eos": eos
}
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 int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
generate_target Ran
ran on a synthesized input
teelinsan/parallel-decoding/src/ipi/decoders/mt_decoding.py
code served (permissive licence) · get_code("b3326122212147a3")
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 int, shape (2, 5) 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)

# Minimal tokenizer stand-in
class MinimalTokenizer:
    def __init__(self):
        self.pad_token_id = 0
        self.cur_lang_code_id = 2
    
    def as_target_tokenizer(self):
        # Context manager that does nothing
        return self
    
    def __enter__(self):
        return self
    
    def __exit__(self, *args):
        pass

# Minimal model that generates sequences
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def generate(self, input_ids, attention_mask, num_beams=1, do_sample=False, forced_bos_token_id=None):
        # Return a simple generated tensor of shape (batch_size, seq_len)
        batch_size = input_ids.shape[0]
        seq_len = 5
        # Generate token ids in range [1, 10], avoiding pad_token_id=0
        output = torch.randint(1, 11, (batch_size, seq_len))
        return output

tokenizer = MinimalTokenizer()
model = MinimalModel()
input_ids = torch.randint(1, 10, (2, 4))
attention_mask = torch.ones((2, 4), dtype=torch.long)

ARGS = {
    'tokenizer': tokenizer,
    'model': model,
    'input_ids': input_ids,
    'attention_mask': attention_mask,
    'is_mbart': False,
    'decoding_method': 'greedy',
    'remove_padding': False
}
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 int, shape (2, 5) — shape (2, 5) 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_electra_train_flops Ran
ran, honoured the contract we drafted
teelinsan/parallel-decoding/exp/flops_calculator.py
code served (permissive licence) · get_code("38a5a87b00d0d865")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Setup for get_electra_train_flops function
# The function takes:
# h_d: hidden size for discriminator
# l_d: number of layers for discriminator
# h_g: hidden size for generator
# l_g: number of layers for generator
# batch_size: batch size for training
# train_steps: number of training steps
# tied_embeddings: whether embeddings are tied (boolean)
# e: embedding size (optional)
# s: sequence length (optional, default 512)
# output_frac: output fraction (optional, default 0.15625)

ARGS = {
    "h_d": 768,           # discriminator hidden size
    "l_d": 12,            # discriminator number of layers
    "h_g": 256,           # generator hidden size
    "l_g": 12,            # generator number of layers
    "batch_size": 32,     # batch size
    "train_steps": 100,   # number of training steps
    "tied_embeddings": True,  # whether embeddings are tied
    "e": None,            # embedding size (None means use h_d)
    "s": 512,             # sequence length
    "output_frac": 0.15625  # output fraction
}
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 float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
limit_past_key_values Ran
ran on a synthesized input
teelinsan/parallel-decoding/src/ipi/stopping_condition.py
code served (permissive licence) · get_code("3dca968fd18bbcc2")
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 6, 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

torch.manual_seed(0)

# The function expects past_key_values to be an iterable of tuples/lists
# where each element has at least 2 items that are tensors with shape
# (batch, heads, seq_len, head_dim)
# It slices [:, :, :limit, :] on the first two elements

# Create sample past_key_values with distinct dimensions for clarity
batch_size = 2
num_heads = 3
seq_len = 5
head_dim = 4
limit = 2

# Create two layers worth of past_key_values (keys and values)
past_key_values = (
    (
        torch.randn(batch_size, num_heads, seq_len, head_dim),
        torch.randn(batch_size, num_heads, seq_len, head_dim),
    ),
    (
        torch.randn(batch_size, num_heads, seq_len, head_dim),
        torch.randn(batch_size, num_heads, seq_len, head_dim),
    ),
)

ARGS = {
    "past_key_values": past_key_values,
    "limit": limit,
}
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 tuple, ndim 6, 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
stopping_criterion Ran
ran on a synthesized input
teelinsan/parallel-decoding/src/ipi/stopping_condition.py
code served (permissive licence) · get_code("5f4c2e11347eb5a8")
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. 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

torch.manual_seed(0)

# Create two identical tensors with shape (batch_size=2, seq_len=4)
# These tensors will be compared for equality in the function
past_tensor = torch.tensor([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=torch.long)
current_tensor = torch.tensor([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=torch.long)

# eos can be None or an integer token ID representing end-of-sequence
eos = 3

ARGS = {
    "past_tensor": past_tensor,
    "current_tensor": current_tensor,
    "eos": eos,
}
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 tuple — a tuple output has no array shape of its own; none is 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
append_new_generated_pool Not yet run
unverified (harvested, no recorded run)
hao-ai-lab/lookaheaddecoding/lade/decoding.py
code served (permissive licence) · get_code("c1a277b44d064673")
How it ran

no invocation recorded.

fill_pool_with_prompt Not yet run
unverified (harvested, no recorded run)
hao-ai-lab/lookaheaddecoding/lade/decoding.py
code served (permissive licence) · get_code("7c3d0baab443d8d8")
How it ran

no invocation recorded.

jacobi_forward Not yet run
unverified (harvested, no recorded run)
hao-ai-lab/Consistency_LLM/cllm/cllm_llama_modeling.py
code served (permissive licence) · get_code("6325980f1e2ddbb3")
How it ran

no invocation recorded.

jacobi_greedy_search_multilevel Not yet run
unverified (harvested, no recorded run)
hao-ai-lab/lookaheaddecoding/lade/decoding.py
code served (permissive licence) · get_code("069151ed3da2a52d")
How it ran

no invocation recorded.

update_token_map Not yet run
unverified (harvested, no recorded run)
hao-ai-lab/lookaheaddecoding/lade/decoding.py
code served (permissive licence) · get_code("521d2c89634e3413")
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, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 9 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
get_electra_train_flops 2 other papers
2 dated earlier
1906.05474 (2019-06)
Transfer Learning in Biomedical Natural Language Processing: An Evaluation of BERT and ELMo on Ten Benchmarking Datasets
2003.10555 (2020-03)
ELECTRA: PRE-TRAINING TEXT ENCODERS AS DISCRIMINATORS RATHER THAN GENERATORS

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

Autoregressive decoding limits the efficiency of transformers for Machine Translation (MT). The community proposed specific network architectures and learning-based methods to solve this issue, which are expensive and require changes to the MT model, trading inference speed at the cost of the translation quality. In this paper, we propose to address the problem from the point of view of decoding algorithms, as a less explored but rather compelling direction. We propose to reframe the standard greedy autoregressive decoding of MT with a parallel formulation leveraging Jacobi and Gauss-Seidel fixed-point iteration methods for fast inference. This formulation allows to speed up existing models without training or modifications while retaining translation quality. We present three parallel decoding algorithms and test them on different languages and models showing how the parallelization introduces a speedup up to 38% w.r.t. the standard autoregressive decoding and nearly 2x when scaling the method on parallel resources. Finally, we introduce a decoding dependency graph visualizer (DDGviz) that let us see how the model has learned the conditional dependence between tokens and inspect the decoding procedure.

For agents

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

get_harvested_code_for_paper("2305.10427")
get_code_for_paper("2305.10427")
have("2305.10427")

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

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

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

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

Connect an agent — have() is free.