SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2011.06132 · EMNLP · 2020

Incorporating a Local Translation Mechanism into Non-autoregressive Translation

Xiang Kong, Eduard Hovy, Zhisong Zhang

arXiv · PDF · Open in the Atlas

Code that ran

3 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 1 failure of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2011.06132.json · badge: /api/ran/2011.06132.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
shawnkx/NAT-with-Local-AT marked official in Papers with Code
Papers with Code archive
3 ran · 2 no recorded run
FunctionStatusWhere it lives
MSeg Ran
ran on a synthesized input · constructed an object; no result was computed
shawnkx/NAT-with-Local-AT/Mask-Predict/nat_merge.py
code served (permissive licence) · get_code("c6109769dc8bd5e7")
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 an instance of its own class, MSeg: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
from typing import List

class MToken:

    def __init__(self, item, id, score):
        self.item = item
        self.ids = [id]
        self.scores = [score]
        self.flag_conflict = False
        self.flag_gap = 0
        self.flag_link = False
        self.flag_delete = False
        self._cached_score = None

    @property
    def score(self):
        if self._cached_score is None:
            self._cached_score = max(self.scores)
        return self._cached_score

    def get_score_with_penalties(self, penalty_conflict, penalty_gap, penalty_link):
        return self.score + penalty_conflict * int(self.flag_conflict) + penalty_gap * int(self.flag_gap != 0) + penalty_link * int(self.flag_link)

    def add(self, id, score):
        self.ids.append(id)
        self.scores.append(score)
        self._cached_score = None

    def link(self, t1: 'MToken', flag_link=True):
        assert self.item == t1.item
        self.ids.extend(t1.ids)
        self.scores.extend(t1.scores)
        if flag_link:
            self.flag_link = True
        self._cached_score = None

    def flag_string(self):
        gap_s = '-' if self.flag_gap < 0 else '+'
        return ''.join([s if f else '' for f, s in zip([self.flag_conflict, self.flag_gap, self.flag_link], f'C{gap_s}L')])

    def to_string(self, verbose=False):
        flag_str = self.flag_string()
        ret = str(self.item)
        if flag_str:
            ret += f'[{flag_str}]'
        return ret

    def __repr__(self):
        return self.to_string()


class MSeg:

    def __init__(self, tokens: List[MToken]):
        self.tokens = tokens

    def __repr__(self):
        return str(self.tokens)

    def concat(self, new_seq: List[MToken]) -> bool:
        new_len = len(new_seq)
        align_start = max(-new_len, -len(self.tokens))
        assert align_start < 0, 'Sth wrong since align_start is not negative!!'
        self_items = [z.item for z in self.tokens[align_start:]]
        new_items = [z.item for z in new_seq[:-align_start]]
        while align_start < 0:
            if self_items[align_start:] == new_items[:-align_start]:
                for ii, ss in enumerate(new_seq[:-align_start]):
                    self.tokens[align_start + ii].link(ss, flag_link=False)
                self.tokens.extend(new_seq[-align_start:])
                return True
            align_start += 1
        return False


token1 = MToken("hello", 0, 0.9)
token2 = MToken("world", 1, 0.8)
token3 = MToken("foo", 2, 0.7)

tokens_list = [token1, token2, token3]

ARGS = {
    "tokens": tokens_list
}
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 MSeg — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MSeg 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
MToken Ran
ran on a synthesized input · constructed an object; no result was computed
shawnkx/NAT-with-Local-AT/Mask-Predict/nat_merge.py
code served (permissive licence) · get_code("1b9e99abb1911bf4")
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 an instance of its own class, MToken: the run constructed the object and did not call it, so no result was computed. 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)

ARGS = {
    "item": "token_value",
    "id": 42,
    "score": 0.95
}
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 MToken — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MToken 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
align_matches Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
shawnkx/NAT-with-Local-AT/Mask-Predict/nat_merge.py
code served (permissive licence) · get_code("1876669b20a0b5f4")
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 numpy as np

# Create a small match score array
# Shape: (len1, len2) = (4, 3) to have distinct dimensions
match_score_arr = np.array([
    [0.9, 0.5, 0.3],
    [0.7, 0.8, 0.2],
    [0.4, 0.6, 0.9],
    [0.5, 0.4, 0.7]
], dtype=np.float32)

# order_scores can be None (uses default) or a tuple of scores
order_scores = (0, 1, 2)

ARGS = {
    "match_score_arr": match_score_arr,
    "order_scores": order_scores
}
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 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
GreedyMerger Not yet run
unverified (harvested, no recorded run)
shawnkx/NAT-with-Local-AT/Mask-Predict/nat_merge.py
code served (permissive licence) · get_code("88bb8df4f9581dcc")
How it ran

no invocation recorded.

align_seqs Not yet run
unverified (harvested, no recorded run)
shawnkx/NAT-with-Local-AT/Mask-Predict/nat_merge.py
code served (permissive licence) · get_code("8cd7292585b347b6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 5 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.

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

In this work, we introduce a novel local autoregressive translation (LAT) mechanism into non-autoregressive translation (NAT) models so as to capture local dependencies among target outputs. Specifically, for each target decoding position, instead of only one token, we predict a short sequence of tokens in an autoregressive way. We further design an efficient merging algorithm to align and merge the output pieces into one final output sequence. We integrate LAT into the conditional masked language model (CMLM;Ghazvininejad et al., 2019) and similarly adopt iterative decoding. Empirical results on five translation tasks show that compared with CMLM, our method achieves comparable or better performance with fewer decoding iterations, bringing a 2.5x speedup. Further analysis indicates that our method reduces repeated translations and performs better at longer sentences. The code for our model is available at https://github. com/shawnkx/NAT-with-Local-AT.

For agents

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

get_harvested_code_for_paper("2011.06132")
get_code_for_paper("2011.06132")
have("2011.06132")

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

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

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

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

Connect an agent — have() is free.