SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1901.04112 · 2019

Unsupervised Neural Machine Translation with SMT as Posterior Regularization

arXiv · PDF · Open in the Atlas

Code that ran

7 of 15 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, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 8 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/1901.04112.json · badge: /api/ran/1901.04112.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
Imagist-Shuo/UNMT-SPR canonical (classifier label)
classifier basis: census
7 ran · 8 no recorded run
FunctionStatusWhere it lives
closest_length Ran
ran on a synthesized input
Imagist-Shuo/UNMT-SPR/t2tlight/utils/bleu.py
code served (permissive licence) · get_code("dd985e59ae3a38a4")
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 takes a candidate and references, and calls len() on them
# So they need to be objects with __len__ defined
# They can be lists, strings, tensors, or any sequence

candidate = "hello"
references = ["hi", "goodbye", "world", "testing"]

ARGS = {
    "candidate": candidate,
    "references": references
}
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
infer_shape Ran
ran on a synthesized input
Imagist-Shuo/UNMT-SPR/t2tlight/utils/common.py
code served (permissive licence) · get_code("4e43521417d0c491")
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 list, ndim 1, dtype family int; 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 tensorflow as tf

# Create a small tensor with known shape
x_tensor = tf.constant([[1.0, 2.0, 3.0, 4.0],
                        [5.0, 6.0, 7.0, 8.0]])

ARGS = {
    "x": x_tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — 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 int — 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
infer_shape_invariants Ran
ran on a synthesized input
Imagist-Shuo/UNMT-SPR/t2tlight/utils/common.py
code served (permissive licence) · get_code("9c4f581b38c02557")
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 TensorShape. 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 tensorflow as tf
import numpy as np

# Create a small tensor with a shape that has multiple dimensions
# The function accesses shape.as_list() and modifies middle dimensions to None
tensor = tf.constant(np.random.randn(2, 4, 3, 5), dtype=tf.float32)

ARGS = {
    "tensor": tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TensorShape — a TensorShape output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a TensorShape output the recorded ndim 1 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
layer_process Ran
ran on a synthesized input
Imagist-Shuo/UNMT-SPR/t2tlight/models/transformer.py
code served (permissive licence) · get_code("089d00d36b1ac216")
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 torch
import torch.nn as nn

torch.manual_seed(0)

def layer_norm(x):
    """Stand-in layer_norm function that normalizes across last dimension"""
    mean = x.mean(dim=-1, keepdim=True)
    std = x.std(dim=-1, keepdim=True)
    return (x - mean) / (std + 1e-5)

# Create a small tensor for x parameter
x = torch.randn(2, 4)

# Test with 'none' mode
mode = 'none'

ARGS = {
    'x': x,
    'mode': mode
}
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
merge_first_two_dims Ran
ran on a synthesized input
Imagist-Shuo/UNMT-SPR/t2tlight/utils/common.py
code served (permissive licence) · get_code("d5d767925ad02a85")
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 EagerTensor, ndim 2, dtype family float, shape (6, 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 tensorflow as tf
import numpy as np

# Create a simple tensor with shape (2, 3, 4)
# This allows us to test merging the first two dimensions: (2*3, 4) = (6, 4)
tensor = tf.constant(np.random.randn(2, 3, 4).astype(np.float32))

ARGS = {
    "tensor": tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, dtype family float, shape (6, 4) — shape (6, 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
modified_precision Ran
ran on a synthesized input
Imagist-Shuo/UNMT-SPR/t2tlight/utils/bleu.py
code served (permissive licence) · get_code("9c5e87513bca1bae")
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.

from collections import Counter

def modified_precision(candidate, references, n):
    tngrams = len(candidate) + 1 - n
    counts = Counter([tuple(candidate[i:i + n]) for i in range(tngrams)])
    if len(counts) == 0:
        return (0, 0)
    max_counts = {}
    for reference in references:
        rngrams = len(reference) + 1 - n
        ngrams = [tuple(reference[i:i + n]) for i in range(rngrams)]
        ref_counts = Counter(ngrams)
        for ngram in counts:
            mcount = 0 if ngram not in max_counts else max_counts[ngram]
            rcount = 0 if ngram not in ref_counts else ref_counts[ngram]
            max_counts[ngram] = max(mcount, rcount)
    clipped_counts = {}
    for ngram, count in counts.items():
        clipped_counts[ngram] = min(count, max_counts[ngram])
    return (float(sum(clipped_counts.values())), float(sum(counts.values())))

# Setup: Create valid arguments for modified_precision
# The function expects:
# - candidate: a sequence (list) of tokens/words
# - references: a list of reference sequences
# - n: integer for n-gram size

candidate = [1, 2, 3, 2, 4, 5]
references = [
    [1, 2, 3, 4, 5],
    [1, 2, 2, 4, 5, 6],
]
n = 2

ARGS = {
    "candidate": candidate,
    "references": references,
    "n": n,
}
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 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
shortest_length Ran
ran on a synthesized input
Imagist-Shuo/UNMT-SPR/t2tlight/utils/bleu.py
code served (permissive licence) · get_code("531aab5936f2e596")
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 takes 'references' and iterates through it,
# calling len() on each element. So references should be a list
# of objects that have a length (strings, lists, tensors, etc.)

# Create a list of references with different lengths
references = [
    "hello",           # length 5
    [1, 2, 3],        # length 3
    "ab",             # length 2
    list(range(7))    # length 7
]

ARGS = {
    "references": references
}
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
add_timing_signal Not yet run
unverified (harvested, no recorded run)
Imagist-Shuo/UNMT-SPR/t2tlight/utils/attention.py
code served (permissive licence) · get_code("18db90fc13d2daaf")
How it ran

no invocation recorded.

attention_bias Not yet run
unverified (harvested, no recorded run)
Imagist-Shuo/UNMT-SPR/t2tlight/models/transformer.py
code served (permissive licence) · get_code("47c91b573e2ab18d")
How it ran

no invocation recorded.

beam_search Not yet run
unverified (harvested, no recorded run)
Imagist-Shuo/UNMT-SPR/t2tlight/models/beamsearch.py
code served (permissive licence) · get_code("922e19f82ba4a0c8")
How it ran

no invocation recorded.

create_inference_graph Not yet run
unverified (harvested, no recorded run)
Imagist-Shuo/UNMT-SPR/t2tlight/models/beamsearch.py
code served (permissive licence) · get_code("a0673b256fa86269")
How it ran

no invocation recorded.

ffn_layer Not yet run
unverified (harvested, no recorded run)
Imagist-Shuo/UNMT-SPR/t2tlight/models/transformer.py
code served (permissive licence) · get_code("cf43eb551e544dca")
How it ran

no invocation recorded.

import_params Not yet run
unverified (harvested, no recorded run)
Imagist-Shuo/UNMT-SPR/t2tlight/score.py
code served (permissive licence) · get_code("149a90364d6911d9")
How it ran

no invocation recorded.

merge_parameters Not yet run
unverified (harvested, no recorded run)
Imagist-Shuo/UNMT-SPR/t2tlight/score.py
code served (permissive licence) · get_code("b35787c98409d96f")
How it ran

no invocation recorded.

smoothed_softmax_cross_entropy Not yet run
unverified (harvested, no recorded run)
Imagist-Shuo/UNMT-SPR/t2tlight/utils/layer.py
code served (permissive licence) · get_code("c369402705980a1c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 6 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 2 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
import_params 4 other papers
2 dated earlier, 2 later
1805.00631 (2018-05)
Accelerating Neural Transformer via an Average Attention Network
1810.03581 (2018-10)
Improving the Transformer Translation Model with Document-Level Context
2020.acl-main.320 (2020 (year only))
A Retrieve-and-Rewrite Initialization Method for Unsupervised Machine Translation
and 1 more not named here
add_timing_signal 2 other papers
2 dated earlier
1805.00631 (2018-05)
Accelerating Neural Transformer via an Average Attention Network
1810.03581 (2018-10)
Improving the Transformer Translation Model with Document-Level Context
closest_length 1 other paper
1 dated earlier
1805.00631 (2018-05)
Accelerating Neural Transformer via an Average Attention Network
merge_parameters 1 other paper
1 later
2020.acl-main.320 (2020 (year only))
A Retrieve-and-Rewrite Initialization Method for Unsupervised Machine Translation
modified_precision 1 other paper
1 dated earlier
1805.00631 (2018-05)
Accelerating Neural Transformer via an Average Attention Network
shortest_length 1 other paper
1 dated earlier
1805.00631 (2018-05)
Accelerating Neural Transformer via an Average Attention Network

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

Without real bilingual corpus available, unsupervised Neural Machine Translation (NMT) typically requires pseudo parallel data generated with the back-translation method for the model training. However, due to weak supervision, the pseudo data inevitably contain noises and errors that will be accumulated and reinforced in the subsequent training process, leading to bad translation performance. To address this issue, we introduce phrase based Statistic Machine Translation (SMT) models which are robust to noisy data, as posterior regularizations to guide the training of unsupervised NMT models in the iterative back-translation process. Our method starts from SMT models built with pre-trained language models and word-level translation tables inferred from cross-lingual embeddings. Then SMT and NMT models are optimized jointly and boost each other incrementally in a unified EM framework. In this way, (1) the negative effect caused by errors in the iterative back-translation process can be alleviated timely by SMT filtering noises from its phrase tables; meanwhile, (2) NMT can compensate for the deficiency of fluency inherent in SMT. Experiments conducted on en-fr and en-de translation tasks show that our method outperforms the strong baseline and achieves new state-of-the-art unsupervised machine translation performance.

For agents

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

get_harvested_code_for_paper("1901.04112")
get_code_for_paper("1901.04112")
have("1901.04112")

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

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

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

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

Connect an agent — have() is free.