# Neural Machine Translation by Jointly Learning to Align and Translate

Dzmitry Bahdanau, Kyunghyun Cho, Yoshua Bengio · arXiv · 2014-9-1

- **Problem** A basic encoder–decoder must squeeze a whole source sentence into one fixed-length vector, which makes long sentences hard to handle.
- **Method** RNNsearch gives the decoder a separate context vector for each target word, a weighted sum of bidirectional encoder annotations, with weights from a jointly trained alignment model.

## Why one fixed-length vector limits translation

A basic encoder–decoder reads a source sentence with an encoder and maps it to a single fixed-length vector, from which a decoder writes the translation. Everything the decoder can use about the source has to fit into that vector, whatever the sentence length. Earlier work reported that such a model degrades quickly once inputs grow longer than the sentences seen in training.

The proposed model drops the single-vector assumption. It encodes the source as one annotation per word and lets the decoder choose among those annotations at each output step. The authors report that the gain is larger for long sentences but also appears for sentences of any length.

## The encoder–decoder baseline

The encoder runs an RNN over the source word vectors, with each hidden state given by \\( h\_t = f(x\_t, h\_{t-1}) \\), and the context c is a function q of all the hidden states. One example in that line of work takes q to return only the last hidden state, so c is that final state.

The decoder factorizes the translation probability into ordered conditionals, \\\[ p(\\mathbf{y}) = \\prod\_{t=1}^{T} p(y\_t \\mid y\_1,\\dots,y\_{t-1}, c) \\\] Each conditional is computed by a nonlinear function g of the previous word, the decoder state and c, so every target word sees the same single vector c.

## Soft alignment and the per-word context vector

The change is that each target word y\_i gets its own context vector c\_i, so the conditional becomes \\\[ p(y\_i \\mid y\_1,\\dots,y\_{i-1}, x) = g(y\_{i-1}, s\_i, c\_i), \\quad s\_i = f(s\_{i-1}, y\_{i-1}, c\_i) \\\] Figure 1 shows the proposed model producing the t-th target word from a source sentence x1 to xT.

The context vector is a weighted sum of the annotations, \\( c\_i = \\sum\_{j=1}^{T\_x} \\alpha\_{ij} h\_j \\). Each weight is a softmax over scores, \\( \\alpha\_{ij} = \\exp(e\_{ij}) / \\sum\_{k=1}^{T\_x} \\exp(e\_{ik}) \\), where e\_ij measures how well the inputs around source position j match output position i. The score depends on the decoder state s\_{i-1} from just before y\_i is emitted and on the annotation h\_j.

The alignment model that produces these scores is a feedforward network trained together with the rest of the system.

Because the alignment is a set of continuous weights rather than a discrete latent choice, gradients of the cost can flow through it. This lets the alignment model and the translation model be trained together. The authors read c\_i as an expected annotation, where alpha\_ij is the probability that y\_i is aligned to source word x\_j.

The weights act as attention: the decoder decides which source positions to focus on at each step. Since information is spread across the annotations and retrieved selectively, the encoder no longer has to pack every detail into one vector.

## Bidirectional annotations for each source word

A plain RNN reads the source in order, so its state at a word summarizes only the words before it. The model needs each annotation to reflect the words that follow as well, so it uses a bidirectional RNN: a forward RNN reads from x1 to xTx and a backward RNN reads from xTx to x1.

The annotation for word j concatenates the two states, \\\[ h\_j = \\left\[\\overrightarrow{h}\_j^{\\top};\\overleftarrow{h}\_j^{\\top}\\right\]^{\\top} \\\] Because RNNs represent recent inputs more strongly, each annotation stays focused on the words around its own position while still carrying context from both sides. The decoder and the alignment model both read these annotations.

## Data, models and training setup

Training uses the WMT '14 English-French parallel corpora, which total 850M words; a data selection step reduces the combined corpus to 348M words. No monolingual data beyond these parallel corpora is used. Development uses news-test-2012 and news-test-2013, and evaluation uses news-test-2014, which has 3003 sentences absent from the training data.

A shortlist of the 30,000 most frequent words in each language is kept, other words map to \[UNK\], and no lowercasing or stemming is applied.

Two model types are trained, RNNencdec and RNNsearch, each twice: once on sentences up to 30 words and once on sentences up to 50 words. RNNencdec has 1000 hidden units in its encoder and in its decoder, and the RNNsearch encoder has a forward and a backward RNN of 1000 hidden units each, with a 1000-unit decoder. Both model types use a single maxout hidden layer to compute the probability of each target word.

In the paper, 'hidden unit' always means the gated hidden unit.

Training uses minibatch stochastic gradient descent with Adadelta, with each update computed from 80 sentences, and each model was trained for about 5 days. At test time a beam search approximately finds the translation with the highest conditional probability.

Moses is the conventional phrase-based reference system, and it draws on a separate monolingual corpus of 418M words in addition to the parallel data.

## BLEU on news-test-2014

The starred RNNsearch-50 variant, trained much longer until development performance stopped improving, reached 28.45 on all sentences.

The second column counts only sentences without unknown words, and the models were not allowed to emit \[UNK\] tokens for that column. On that subset RNNsearch-50 scored 34.16 and RNNsearch-50 starred scored 36.15, against 35.63 for Moses. On all sentences, Moses scored 33.30, above the 26.75 and 28.45 of the two RNNsearch-50 variants.

Moses used an extra monolingual corpus of 418M words, so the near-match on the subset does not come from identical training data. The table gives single scores without any spread estimate.

## Sentence length and degradation

Figure 2 plots BLEU against source sentence length on the full test set, which includes sentences with unknown words. The BLEU of RNNencdec drops dramatically as sentences get longer.

According to the authors, both RNNsearch-30 and RNNsearch-50 are more robust to length, and RNNsearch-50 shows no deterioration at 50 words or more. RNNsearch-30 scores higher than RNNencdec-50 overall, 21.50 against 17.82.

## Long sentences translated side by side

On one test sentence about admitting privileges, RNNencdec-50 translated correctly up to a medical centre and then departed from the source meaning. RNNsearch-50 kept the full meaning without omitting details.

On a second sentence, about Disney's efforts, RNNencdec-50 began to deviate after about 30 words, and its output degraded, including a missing closing quotation mark. RNNsearch-50 translated the whole sentence correctly. The authors connect this to the model needing to encode accurately only the parts of the input around each word, not the whole sentence perfectly.

## What the alignment weights show

Figure 3 shows four sample alignments from RNNsearch-50, with the English source on one axis and the French translation on the other. The first is an arbitrary sentence; the other three were drawn at random from test sentences with no unknown words and 10 to 20 words in length. The weights lie mostly along the diagonal, so the alignment is largely monotonic, with some non-monotonic cases where adjectives and nouns swap order.

For European Economic Area translated as zone économique européenne, the model aligned zone to Area, skipping the two earlier words, and then moved back one word at a time.

For the man translated as l'homme, a hard alignment would map the to l' and man to homme, yet choosing l' depends on the following noun. The authors report similar behavior across the presented cases, which are four samples and not a full evaluation of alignment.

## Relation to earlier neural translation work

Earlier neural work mostly supplied a single feature to a statistical system or reranked its candidate translations. The authors aim at a full neural translator that generates translations directly, which they call a radical departure from those earlier uses.

Graves (2013) used a similar alignment idea for handwriting synthesis, but there the alignment locations could only move in one direction. The authors note that translation often needs long-distance reordering, so this restriction would be a severe limitation there.

## Limitations

Each translation word needs an annotation weight for every source word. The authors judge this acceptable for translation, where sentences are usually 15 to 40 words, but say it may limit use on other tasks.

Handling unknown or rare words is left as an open challenge. Experiments cover one language pair, English-to-French, one test set and length limits of 30 and 50 words. The Moses row uses extra monolingual data, and the starred RNNsearch-50 row was trained longer, so neither is a same-budget comparison.

## Paper info

- **Authors**: Dzmitry Bahdanau, Kyunghyun Cho, Yoshua Bengio
- **Venue**: arXiv · Preprint
- **First published**: 2014-9-1
- **Added**: 2026-10-20
- **Updated**: 2016-5-19
- **Version**: v7
- **arXiv**: 1409.0473
- **Category**: cs.CL · cs.LG · cs.NE · stat.ML
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1409.0473v7) · [PDF ↗](https://arxiv.org/pdf/1409.0473v7)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Dzmitry Bahdanau, Kyunghyun Cho, Yoshua Bengio (2014). Neural Machine Translation by Jointly Learning to Align and Translate. arXiv:1409.0473v7. https://arxiv.org/abs/1409.0473v7

**BibTeX**

```
@misc{bahdanau2014neural,
  title = {{Neural Machine Translation by Jointly Learning to Align and Translate}},
  author = {Dzmitry Bahdanau and Kyunghyun Cho and Yoshua Bengio},
  year = {2014},
  eprint = {1409.0473},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1409.0473v7}
}
```

## Other paper commentary

- [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://refivu.com/en/papers/037751cf-a504-48c3-b08a-868e3ab40b26-bert-pre-training-of-deep-bidirectional-transformers-for.md)
- [Looped Models are Fast Multi-Token Predictors](https://refivu.com/en/papers/753aee4a-f281-45ed-9e03-84eb93c47b6d-looped-models-are-fast-multi-token-predictors.md)
- [FIDEL: Abugida-Aware Pre-tokenization for Ethiopic Languages](https://refivu.com/en/papers/ddcebe56-3d04-41f8-b252-f5f305a78bc1-fidel-abugida-aware-pre-tokenization-for-ethiopic-languages.md)
- [Meaning Reaches Object Choice but Not Completion: Where Is a VLA Vulnerable to Landmark Synonyms?](https://refivu.com/en/papers/defc7d50-8eb3-4076-bf41-f9d85534ab4c-meaning-reaches-object-choice-but-not-completion-where.md)
- [Quantifying the added value of human forecaster discussions for tropical cyclone intensity prediction](https://refivu.com/en/papers/ebc948f3-4b88-46c9-989e-efcb0d97c1eb-quantifying-the-added-value-of-human-forecaster-discussions.md)
- [AuXSpec: Learning to Autoformalize Program Specifications via Executable Postconditions](https://refivu.com/en/papers/d6ae6e57-c73c-4909-b2a8-0a7a84033d1f-auxspec-learning-to-autoformalize-program-specifications-via.md)
- [Deep Residual Learning for Image Recognition](https://refivu.com/en/papers/19d6446d-fd9a-4e80-b535-a4e333cad216-deep-residual-learning-for-image-recognition.md)
- [Adam: A Method for Stochastic Optimization](https://refivu.com/en/papers/1e4ce3cf-c297-4440-9078-a86a09a9caca-adam-a-method-for-stochastic-optimization.md)
- [Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift](https://refivu.com/en/papers/bd3e1105-da91-407a-8b28-4217cd2afedf-batch-normalization-accelerating-deep-network-training-by.md)
- [Attention Is All You Need](https://refivu.com/en/papers/9645c9a1-cc92-404a-bc65-1ec437b1deab-attention-is-all-you-need.md)
- [FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://refivu.com/en/papers/177a3817-56f7-448e-964a-a2e688dc7c81-flashattention-2-faster-attention-with-better-parallelism.md)
- [Instance Normalization: The Missing Ingredient for Fast Stylization](https://refivu.com/en/papers/d30fae5e-d1ad-4ef1-9b41-da9a7a9f25cf-instance-normalization-the-missing-ingredient-for-fast.md)

## Terms in this paper

- [Stochastic Gradient Descent](https://refivu.com/en/terms/a49650824022-stochastic-gradient-descent)
- [BLEU](https://refivu.com/en/terms/42cd9b97719e-bleu)
- [beam search](https://refivu.com/en/terms/3e449f8f713b-beam-search)
- [Adadelta](https://refivu.com/en/terms/f8ccffb7eddb-adadelta)
- [alignment model](https://refivu.com/en/terms/59b46939d361-alignment-model)
- [Moses](https://refivu.com/en/terms/7ec6fd928e49-moses)
- [RNNsearch](https://refivu.com/en/terms/83d9bbdf5979-rnnsearch)
- [bidirectional RNN](https://refivu.com/en/terms/9f80d248ad96-bidirectional-rnn)
- [English-to-French translation](https://refivu.com/en/terms/611c40d7dec4-english-to-french-translation)
- [gated hidden unit](https://refivu.com/en/terms/721510f1565c-gated-hidden-unit)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/d3733cd4-18bb-4ef7-881b-d6d27baee015-neural-machine-translation-by-jointly-learning-to-align)
