Neural Machine Translation by Jointly Learning to Align and Translate
- Paper: Neural Machine Translation by Jointly Learning to Align and Translate
- Authors: Dzmitry Bahdanau, Kyunghyun Cho, Yoshua Bengio
- Lab, year: Jacobs University Bremen and Université de Montréal, 2014 (ICLR 2015)
- Video: YouTube Short coming on 18 Dec 2026 on Backprop Daily
Summary
The paper adds an attention mechanism to the neural encoder–decoder for translation. Instead of compressing the source sentence into one fixed-length vector, the encoder, a recurrent neural network (RNN), produces one annotation per source word, and for every target word the decoder takes a weighted average of the annotations, with weights from a learned alignment model. On WMT’14 English→French, RNNsearch-50 scored 26.75 BLEU (a score of word overlap with reference translations) against 17.82 for the plain encoder–decoder (RNNencdec-50), and a longer-trained RNNsearch-50 reached 28.45; on sentences without unknown words it scored 36.15 against 35.63 for the phrase-based Moses system (Section 5.1, Table 1).
What Problem Does It Solve
The basic encoder–decoder “needs to be able to compress all the necessary information of a source sentence into a fixed-length vector”, which makes long sentences hard (Section 1). In the paper’s experiments the encoder–decoder’s BLEU score “dramatically drops as the length of the sentences increases”, while RNNsearch-50 “shows no performance deterioration even with sentences of length 50 or more” (Section 5.1, Figure 2).
Core Idea
For target position i, an alignment model scores each source annotation h_j against the decoder’s previous state: e_ij = a(s_{i−1}, h_j). A softmax over j gives weights α_ij, and the context vector is c_i = Σ_j α_ij h_j (Section 3.1, Eqs. 5–6). The decoder state and the output then depend on a different c_i for every target word. The alignment model is a feedforward network trained jointly with the rest of the model, and the paper describes this as “a mechanism of attention in the decoder” (Section 3.1).
Key Method Details
- Encoder: a bidirectional RNN; each annotation h_j concatenates the forward and backward states, so it summarises the words before and after position j (Section 3.2).
- Alignment model: e_ij = v_aᵀ tanh(W_a s_{i−1} + U_a h_j) (Appendix A.1.2).
- Sizes: forward and backward encoder RNNs with 1000 gated hidden units each, a decoder with 1000 hidden units, and a single maxout hidden layer before the output softmax (Section 4.2).
- Data: WMT’14 English→French, reduced to 348M words, with a 30,000-word shortlist per language; models trained on sentences of up to 30 or 50 words (Sections 4.1 and 4.2).
- Training: minibatch SGD with Adadelta, 80 sentences per minibatch, about 5 days per model; beam search at test time (Section 4.2).
Simplifications in This Notebook
- Task: synthetic date normalisation (“March 5 2020” → “05/03/2020”) at character level, with 20,000 generated dates from 1900 to 2009, instead of English→French translation. Inputs are 10 to 17 characters.
- Model: bidirectional GRU encoder with 256 units per direction, additive attention and a GRU decoder (1,346,190 parameters). The decoder starts from the mean of the encoder’s final states (paper: tanh(W_s h←_1)) and uses a linear output layer instead of maxout.
- Training: Adam (learning rate 10⁻³), teacher forcing on half of the steps, 15 epochs, greedy decoding.
- No baseline: there is no encoder–decoder without attention to compare against.
What the Notebook Result Shows
- The toy task is solved: 100.0% exact match on all 2,000 held-out dates. This does not reproduce the paper’s BLEU scores.
- Attention lands on the matching field: the largest attention weight of each year digit falls on the input year for 100.0% of year digits (97.6% on the exact matching digit); 85.1% of day digits attend to the day and 84.6% of month digits to the month name.
- No generalisation outside the training years: ‘March 5 2020’ became ‘05/03/2002’, ‘October 31 2050’ became ‘31/10/2005’ and ‘July 4 1776’ became ‘04/07/17766’.
- The long-sentence result is not tested: accuracy is 100.0% for both short and long inputs, but the longest input is 17 characters.
Influence
Google’s 2016 neural translation system connected its encoder and decoder with an attention module (GNMT paper, Google Research blog), and the Transformer (Attention Is All You Need) built a whole model from attention. The PyTorch seq2seq tutorial implements Bahdanau attention. OpenAlex lists about 28,200 citations (28,240 when checked on 3 December 2026).
Resources
| File | Description |
|---|---|
| README.md | This overview — a 5-minute read covering the paper’s summary, core idea, key method details, influence, and a plain-English explanation of the problem it solves |
| solution.ipynb | From-scratch PyTorch bidirectional-GRU encoder, additive attention and GRU decoder on a synthetic date-normalisation task, with attention heatmaps and an alignment check |
| CODE_ARCHITECTURE.md | Section-by-section breakdown of the notebook — what each cell does, data flow, tensor shapes, and key design decisions |
| TALK.md | Press coverage, Q&A (answers from the paper), citations, and common misconceptions about the paper |