Bahdanau Attention — Talks, Press, and Discussion

Press & Blog Coverage

  1. A Neural Network for Machine Translation, at Production Scale, Google Research blog (2016). How Google Translate moved to a neural system with attention between encoder and decoder.

  2. Google’s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation, arXiv (2016). The paper behind that system.

  3. Attention and Augmented Recurrent Neural Networks, Distill (2016). An interactive explanation of attention in RNNs that cites this paper.

  4. NLP From Scratch: Translation with a Sequence to Sequence Network and Attention, PyTorch tutorials. A French→English tutorial that implements Bahdanau (additive) attention.

  5. Neural Machine Translation by Jointly Learning to Align and Translate, arXiv:1409.0473. The paper itself (ICLR 2015).

Q&A (answers from the paper)

Q1: What was wrong with the basic encoder–decoder? “A neural network needs to be able to compress all the necessary information of a source sentence into a fixed-length vector. This may make it difficult for the neural network to cope with long sentences” (Section 1).

Q2: How is the context vector computed? c_i = Σ_j α_ij h_j, where α_ij is a softmax over e_ij = a(s_{i−1}, h_j), an alignment model that “scores how well the inputs around position j and the output at position i match” (Section 3.1, Eqs. 5–6). The paper uses a(s_{i−1}, h_j) = v_aᵀ tanh(W_a s_{i−1} + U_a h_j) (Appendix A.1.2).

Q3: Why is the alignment not a latent variable as in traditional MT? “The alignment model directly computes a soft alignment, which allows the gradient of the cost function to be backpropagated through”, so the alignment and translation models are trained jointly (Section 3.1).

Q4: Why a bidirectional encoder? So that “the annotation of each word” summarises “not only the preceding words, but also the following words” (Section 3.2).

Q5: How much better was it? On WMT’14 English→French test sentences, RNNsearch-50 scored 26.75 BLEU against 17.82 for RNNencdec-50. RNNsearch-50⋆, trained until the development score stopped improving, scored 28.45. On sentences without unknown words it scored 36.15 against 35.63 for Moses (Section 5.1, Table 1).

Q6: What happens on long sentences? RNNencdec’s 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).

Common Misconceptions

  1. “It beat phrase-based translation.” Correction: on all test sentences Moses scored 33.30 BLEU and the best RNNsearch 28.45. Only on sentences without unknown words was RNNsearch-50⋆ higher, 36.15 against 35.63 (Table 1).

  2. “Attention needs hard alignments.” Correction: the paper computes soft alignments. In Section 5.2.1, translating “the man” as “l’ homme” needs the word after “the” to choose between le, la, les and l’; the soft alignment lets the model look at both “the” and “man”.

  3. “The attention scores use the current decoder state.” Correction: e_ij uses s_{i−1}, the state just before emitting y_i (Section 3.1).

  4. “The notebook reproduces the paper’s translation results.” Correction: the notebook trains on synthetic date normalisation, not translation. It reaches 100.0% exact match on dates from the training years but fails on years outside 1900–2009, and its inputs are at most 17 characters, so it does not test the long-sentence claim.