SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1508.04025 · 2015

Effective Approaches to Attention-based Neural Machine Translation

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 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 5 have no contract verdict; 1 failure of our instrument; 1 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/1508.04025.json · badge: /api/ran/1508.04025.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
riversdie/chatbot community (classifier label)
classifier basis not recorded on the link
5 ran · 1 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 0 no recorded run
FunctionStatusWhere it lives
binaryMatrix Ran
ran on a synthesized input
riversdie/chatbot/dataload.py
code served (permissive licence) · get_code("b6b872f7d5584b69")
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 2, 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 torch
import numpy as np

torch.manual_seed(0)

# The function takes:
# l: a list of sequences (each sequence is iterable of tokens)
# value: a value to compare against (the padding token value)

# Create a simple list of sequences where each sequence contains token values
# The function will create a mask where padding tokens (matching 'value') become 0,
# and non-padding tokens become 1

l = [
    [1, 2, 3, 0],      # sequence 1: contains one padding token (0)
    [5, 0, 0, 0]       # sequence 2: contains three padding tokens (0)
]

value = 0  # The padding token value to mask

ARGS = {
    "l": l,
    "value": value
}
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 list, ndim 2, 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
count_parameters Ran
ran, honoured the contract we drafted
this paper's copy was not recorded; identical code first harvested from hnt4499/seq2seq
pointer only · get_code("0f26a596e83c5565")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

create_collate_fn Ran
ran on a synthesized input
riversdie/chatbot/dataload.py
code served (permissive licence) · get_code("7cb03e0b055a9dc9")
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 function. 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
import itertools

torch.manual_seed(0)

# The function create_collate_fn takes two parameters:
# 1. padding: an integer index representing the padding token
# 2. eos: an integer index representing the end-of-sequence token

# These are used in the returned collate_fn function:
# - padding is passed to zeroPadding as fillvalue
# - padding is passed to binaryMatrix as value
# - eos is not actually used in the provided code

# Create simple integer indices for padding and EOS tokens
padding_idx = 0  # Typically PAD token index
eos_idx = 1      # Typically EOS token index

ARGS = {
    "padding": padding_idx,
    "eos": eos_idx,
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
generate Ran
ran on a synthesized input
riversdie/chatbot/train_eval.py
code served (permissive licence) · get_code("d69ad61c90b8b0e6")
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 (1, 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)

# Define a minimal searcher that satisfies the function's usage
class MinimalSearcher(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, sos, eos, input_batch, input_lengths, max_length, device):
        # input_batch shape: (seq_len, batch_size)
        # Return tokens and scores as expected
        batch_size = input_batch.shape[1]
        tokens = torch.randint(0, 10, (batch_size, max_length), dtype=torch.long)
        scores = torch.randn(batch_size, max_length)
        return tokens, scores

# Define a minimal options/config object
class Options:
    def __init__(self):
        self.device = torch.device('cpu')
        self.max_generate_length = 5

# Create the arguments
input_seq = [1, 2, 3]  # A sequence of token indices
searcher = MinimalSearcher()
sos = 0  # Start of sequence token
eos = 1  # End of sequence token
opt = Options()

ARGS = {
    'input_seq': input_seq,
    'searcher': searcher,
    'sos': sos,
    'eos': eos,
    'opt': opt
}
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 (1, 5) — shape (1, 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
maskNLLLoss Ran
ran on a synthesized input
riversdie/chatbot/train_eval.py
code served (permissive licence) · get_code("191c9a860107527f")
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

torch.manual_seed(0)

# inp: shape [batch_size, voc_length]
# batch_size = 2, voc_length = 4
batch_size = 2
voc_length = 4
inp = torch.rand(batch_size, voc_length)
# Ensure values are valid probabilities (between 0 and 1, and sum to 1 along vocab dim)
inp = torch.softmax(inp, dim=1)

# target: shape [batch_size]
# Contains indices into the vocabulary (0 to voc_length-1)
target = torch.tensor([1, 2], dtype=torch.long)

# mask: shape [batch_size]
# Boolean mask to select which samples contribute to loss
mask = torch.tensor([True, True], dtype=torch.bool)

ARGS = {
    "inp": inp,
    "target": target,
    "mask": mask
}
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 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
parse_arguments Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from hnt4499/seq2seq
pointer only · get_code("2a74b7a19b47b566")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

zeroPadding Ran
ran on a synthesized input
riversdie/chatbot/dataload.py
code served (permissive licence) · get_code("ca2ca3da0d6d55cf")
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 2, 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 itertools
import torch

torch.manual_seed(0)

# The function takes a list of sequences of different lengths
# and pads them to the same length using zip_longest
# l: list of sequences (each sequence is a list or iterable)
# fillvalue: the value to use for padding

# Create sample sentences/sequences of different lengths
seq1 = [1, 2, 3, 4, 5]  # length 5
seq2 = [10, 20]         # length 2
seq3 = [100, 200, 300]  # length 3

l = [seq1, seq2, seq3]
fillvalue = 0

ARGS = {
    "l": l,
    "fillvalue": fillvalue
}
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 list, ndim 2, 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
train_by_batch Not yet run
unverified (harvested, no recorded run)
riversdie/chatbot/train_eval.py
code served (permissive licence) · get_code("7b6afaedcd708676")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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
count_parameters 2 other papers
2 dated earlier
1409.0473 (2014-09)
Neural Machine Translation by Jointly Learning to Align and Translate
1409.3215 (2014-09)
Sequence to Sequence Learning with Neural Networks
parse_arguments 2 other papers
2 dated earlier
1409.0473 (2014-09)
Neural Machine Translation by Jointly Learning to Align and Translate
1409.3215 (2014-09)
Sequence to Sequence Learning with Neural Networks

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

More are linked than shown here.

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

An attentional mechanism has lately been used to improve neural machine translation (NMT) by selectively focusing on parts of the source sentence during translation. However, there has been little work exploring useful architectures for attention-based NMT. This paper examines two simple and effective classes of attentional mechanism: a global approach which always attends to all source words and a local one that only looks at a subset of source words at a time. We demonstrate the effectiveness of both approaches over the WMT translation tasks between English and German in both directions. With local attention, we achieve a significant gain of 5.0 BLEU points over non-attentional systems which already incorporate known techniques such as dropout. Our ensemble model using different attention architectures has established a new state-of-the-art result in the WMT'15 English to German translation task with 25.9 BLEU points, an improvement of 1.0 BLEU points over the existing best system backed by NMT and an n-gram reranker.

For agents

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

get_harvested_code_for_paper("1508.04025")
get_code_for_paper("1508.04025")
have("1508.04025")

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

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

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

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

Connect an agent — have() is free.