Sequence to Sequence (seq2seq) is a model that compresses an input sequence into a fixed-length vector with one LSTM (the encoder) and then generates the output sequence from that vector one word at a time with another LSTM (the decoder). Proposed by Sutskever et al. in 2014, it showed on English-to-French machine translation that purely neural translation could, for the first time, beat conventional (phrase-based) statistical machine translation on a large-scale task.
A plain RNN works for tasks where each input time step maps one-to-one to an output time step (such as tagging each word with its part of speech). In translation, however, the input and output differ in length and the word order changes. A plain RNN could not be applied directly to tasks where it is not known in advance which input word corresponds to which output word.
seq2seq solves this problem in two stages.
- Encoder: reads the entire input sequence and uses its last hidden state as a "fixed-length vector representing the input", .
- Decoder: starts from as its initial state and, like a language model, generates the output sequence one word at a time. It stops when it emits
<EOS>, the end-of-sentence symbol.
In the same year, Cho et al. also proposed an "RNN Encoder–Decoder" consisting of two RNNs, an encoder and a decoder (the GRU was introduced in that paper). However, Cho et al. used their model to score candidates produced by an existing translation system, whereas Sutskever et al. used a deep LSTM to generate the translation itself directly.
The seq2seq framework of "splitting the model into an encoder and a decoder" was carried forward through additive attention to the Transformer.

