In Part 5, the LSTM learned to remember across 1,000 steps. In 2014, two teams put it to work on translation: Sutskever and team built seq2seq, and Bahdanau, Cho and Bengio added attention. We show the bottleneck they hit and the look-back that fixed it.
1. One vector must hold the whole sentence
The encoder reads a sentence word by word and squeezes it into one vector of fixed size. A short sentence fits. A long one does not, and the detail that falls out is the detail the decoder needs most.
2. Read first, then write
Sutskever, Vinyals and Le used one LSTM to read the English sentence and a second LSTM to write the French one. On WMT14 English to French it scored BLEU 34.8, ahead of the best phrase-based system at 33.3.
3. Attention looks back at every word
Bahdanau let the decoder score every source word before writing each target word, then take a weighted mix of the best matches. Writing chat, it looks hardest at cat, with a weight of 0.72, and almost ignores the rest.
4. Three years to the Transformer
Attention lifted BLEU from 17.82 to 26.75 on the same test, and the score held steady on sentences of 50 words or more. Luong simplified the scoring in 2015, and in 2017 the Transformer dropped the RNN and kept attention alone.
Key takeaway
Seq2seq proved a neural network could translate end to end, but one fixed vector could not hold a long sentence. Attention fixed that by letting the decoder look back at every word, and that look-back became the core idea of the Transformer.
What is Next in This Series
Next is Part 7, The Transformer, Visualized, where attention runs the whole model and the RNN disappears. To see the memory attention was built on, read Part 5, LSTM: The Gates That Taught Networks to Remember. For how these ideas grew into modern LLMs, see How LLMs Actually Work.
Originally published on LogicStack. Run the code examples right in your browser with our free interactive Python and SQL playgrounds — no setup, no sign-up.
Top comments (0)