SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1710.01329 · 2017

Improving Lexical Choice in Neural Machine Translation

arXiv · PDF · Open in the Atlas

Code that ran

5 of 9 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 1 has no contract verdict; 3 failures of our instrument; 4 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/1710.01329.json · badge: /api/ran/1710.01329.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
tnq177/improving_lexical_choice_in_nmt canonical (classifier label)
classifier basis: census
1 ran · 2 no recorded run
prachetaphadnis/NMT_Seq2Seq_LexicalModel community (classifier label)
classifier basis not recorded on the link
4 ran · 2 no recorded run
FunctionStatusWhere it lives
compute_types_and_tokens Ran
ran, honoured the contract we drafted
prachetaphadnis/NMT_Seq2Seq_LexicalModel/data_exploration.py
code served (permissive licence) · get_code("2528a36338102ff2")
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 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 numpy as np

# Create a simple dataset
# The function expects data_set[i][0] to be iterable (contains words/tokens)
# Each element should be a sequence of items that can be used as dict keys

data_set = [
    (["apple", "banana", "apple"],),
    (["cherry", "date"],),
    (["apple", "elderberry"],),
]

ARGS = {
    "data_set": data_set
}
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, ndim 1, dtype family int — 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
get_logger Ran
ran on a synthesized input
tnq177/improving_lexical_choice_in_nmt/nmt/utils.py
code served (permissive licence) · get_code("039e3fb281ed1d58")
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 Logger. 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 logging
import tempfile
import os

# Create a temporary directory for the log file
temp_dir = tempfile.mkdtemp()
logfile_path = os.path.join(temp_dir, 'test_debug.log')

ARGS = {
    'logfile': logfile_path
}
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 Logger — a Logger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Logger 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_data Ran
ran; our contract draft was wrong, not the code
prachetaphadnis/NMT_Seq2Seq_LexicalModel/data_exploration.py
code served (permissive licence) · get_code("b6ec5393a30d6ce7")
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 os
import tempfile
import shutil

# Create a temporary directory and file for testing
temp_dir = tempfile.mkdtemp()
raw_data_dir = os.path.join(temp_dir, 'raw_data')
os.makedirs(raw_data_dir, exist_ok=True)

# Create a test data file
test_data_file = os.path.join(raw_data_dir, 'test_dataset.txt')
with open(test_data_file, 'w') as f:
    f.write('hello world from python\n')
    f.write('this is a test\n')
    f.write('another line with several words\n')

# Change to the temporary directory so the function can find the file
original_cwd = os.getcwd()
os.chdir(temp_dir)

try:
    ARGS = {
        'data_set': 'test_dataset.txt'
    }
finally:
    # Note: In actual execution, you'd want to clean up after, but we define ARGS first
    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
move_to_cuda Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
prachetaphadnis/NMT_Seq2Seq_LexicalModel/seq2seq/utils.py
code served (permissive licence) · get_code("00b1604d04daae7a")
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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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)

# Test with a single tensor
sample_tensor = torch.randn(2, 4)

# Test with a list of tensors
sample_list = [torch.randn(2, 4), torch.randn(3, 5)]

# Test with a dict containing tensors
sample_dict = {
    "x": torch.randn(2, 4),
    "y": torch.randn(3, 5),
    "nested": {
        "z": torch.randn(2, 3)
    }
}

# Test with mixed types (tensor, list, dict, and non-tensor)
sample_mixed = {
    "tensor": torch.randn(2, 4),
    "list": [torch.randn(2, 4), torch.randn(3, 5)],
    "string": "hello",
    "number": 42
}

# The function takes a single 'sample' parameter
# We'll test with the mixed case which exercises all code paths
ARGS = {
    "sample": sample_mixed
}
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
word_tokenize Ran
ran; our contract draft was wrong, not the code
prachetaphadnis/NMT_Seq2Seq_LexicalModel/preprocess.py
code served (permissive licence) · get_code("b8a4984a4b3089b5")
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 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 re

SPACE_NORMALIZER = re.compile('\\s+')

def word_tokenize(line):
    line = SPACE_NORMALIZER.sub(' ', line)
    line = line.strip()
    return line.split()

ARGS = {
    'line': '  hello   world  \t test  '
}
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 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
get_lstm_cell Not yet run
unverified (harvested, no recorded run)
tnq177/improving_lexical_choice_in_nmt/nmt/utils.py
code served (permissive licence) · get_code("aa13bf076ec9c1b1")
How it ran

no invocation recorded.

load_checkpoint Not yet run
unverified (harvested, no recorded run)
prachetaphadnis/NMT_Seq2Seq_LexicalModel/seq2seq/utils.py
code served (permissive licence) · get_code("c0d7740d9c0e6556")
How it ran

no invocation recorded.

load_embedding Not yet run
unverified (harvested, no recorded run)
prachetaphadnis/NMT_Seq2Seq_LexicalModel/seq2seq/utils.py
code served (permissive licence) · get_code("e2578d93913154ab")
How it ran

no invocation recorded.

tensor_to_lstm_state Not yet run
unverified (harvested, no recorded run)
tnq177/improving_lexical_choice_in_nmt/nmt/utils.py
code served (permissive licence) · get_code("b7c064b311a0eb1d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 8 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_logger 1 other paper
1 later
2021.naacl-srw.7 (2021 (year only))
Syntax-Based Attention Masking for Neural Machine Translation

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

We explore two solutions to the problem of mistranslating rare words in neural machine translation. First, we argue that the standard output layer, which computes the inner product of a vector representing the context with all possible output word embeddings, rewards frequent words disproportionately, and we propose to fix the norms of both vectors to a constant value. Second, we integrate a simple lexical module which is jointly trained with the rest of the model. We evaluate our approaches on eight language pairs with data sizes ranging from 100k to 8M words, and achieve improvements of up to +4.3 BLEU, surpassing phrase-based translation in nearly all settings.

For agents

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

get_harvested_code_for_paper("1710.01329")
get_code_for_paper("1710.01329")
have("1710.01329")

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

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

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

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

Connect an agent — have() is free.