Sequence to Sequence Learning with Neural Networks
Sequence to Sequence Learning with Neural Networks
Motivation and Proposal
Motivation
- Conventional DNNs show good performance when handling inputs and outputs as fixed-dimensional vectors, but they were difficult to use when the length of input and output sequences is variable, as in Sequence to Sequence tasks.
- However, sequence mapping is required in important tasks such as speech recognition, machine translation, and question answering.
- Previously, for the translation task, statistical approaches (SMT) were the most dominant.
- Moreover, for successful Seq2Seq, a method to solve the long term dependency problem that arises in RNNs is needed.
Proposal
- Proposes a new Seq2Seq learning approach: using LSTM to convert an input sequence → a fixed-dimensional vector → predict the output sequence.
- Improves model performance and facilitates optimization by inputting and training the words of the source sentence in reverse order.
The Model

- The model architecture is a combination of a part serving as the Encoder + a part serving as the Decoder.
- Here, the LSTM is configured as a deep LSTM with a 4-layer structure to improve performance.
deep LSTM, multi-layer LSTM

: A structure that stacks multiple LSTM units. At each time step t, the LSTM is connected to the next layer and to the next time step, respectively.
- Since LSTM handles long term dependency well, the gradient descent problem is alleviated compared to using vanilla RNN units, and it therefore performs well even on longer sequences.
- Using LSTM, the input sequence is mapped to a fixed-dimensional vector → the Conditional Probability of the output sequence is computed.
- By mapping the input sequence to a fixed-dimensional vector, the model learns well even when the length of the input-output sequences is variable.
- The order of computing the conditional probability is as follows:
- Obtain the fixed dimensional vector representation \(v\) of the input sequence \((x_1, … , x_T)\) from the last hidden state of the LSTM.
-
Compute the probability of \(y_1, … y_{T’}\) conditioned on the initial hidden state \(v\) in the decoder using the standard LSTM-LM formula:
\[p(y_1,\ldots,y_{T'}\vert x_1,\ldots,x_T)=\prod_{t=1}^{T'}p(y_t\vert v,y_1,\ldots,y_{t-1})\]
- Use of the
token - As an end-of-sentence symbol, it lets the model know the end of a sequence.
- It serves as an indicator for the decoder model to stop generating the sentence, and in the encoder stage it lets the model recognize the end of the input sequence.
- Also, the
token in the encoder stage serves to indicate the starting point of the decoder stage. - This is included in the probability distribution computation.
- The words of the source sentence are input in reverse order; for example, if A B C is the original order in the image of Fig 1, the input is given in the order C B A.
Experiments
Dataset
- Filtered the WMT’14 English to French Dataset.
- Training: 160,000, Target: used a vocab of 80,000.
- Fixed vocab of high frequency.
- Out-of-Vocabulary handling: all replaced with a token called “UNK”.
Decoding and Rescoring
: Training proceeds in the direction of maximizing the log probability of the correct translation T given the source sentence S.
-
Objective function:
\[1/\vert \mathcal{S}\vert \sum_{(T,S)\in\mathcal{S}} \log p(T\vert S)\] -
After training is complete, the translation is generated by finding the most likely translation:
\[\hat{T} = \arg\max_{T} p(T\vert S)\]- Here, Beam Search is performed in the decoder to efficiently search for the best translation. The paper states that a beam size of 2 was most effective.
Beam Search
: Rather than considering all possible translations, this method searches while keeping only the top \(B\) translation candidates at each step. It enables efficient search, where \(B\) refers to the beam size.
- When \(B\) = 1, it is the Greedy search method.
Reversing the Source Sentences
- The performance of the LSTM improved greatly when the Source Sentence was arranged in reverse order.
- perplexity: 5.8 → 4.7
- BLEU score: 25.9 → 30.6
-
Why?
: The authors speculate that reversing the word order places the first word of the source sentence and its translation closer together. Accordingly, in the decoder stage, the last word of the source sentence, which is the first word of the sentence, is processed first, greatly reducing the minimal time lag, and thereby making it easier to find short-term dependency patterns.
Training Details
- Structure of the LSTM model
- deep LSTM of 4 layers, 1000 cells at each layer
- 1000 dimensional word embeddings
- Input vocab of 160,000 & output vocab of 80,000
- 384M parameters
- 32M for encoder, 32M for decoder
- LSTM Parameter Initialization
- Uniform distribution between (-0.08, 0.08)
- Optimization
- SGD Momentum Optimizer
- Fixed learning rate: 0.7
- After 5 epochs, halved the learning rate every half epoch
- Total of 7.5 epoch
- Batch Size: batches of 128 sequences
- Handling Gradient Explosion problems
- Gradient Clipping, threshold = 5
- Managed the sentences in a minibatch to be roughly of the same length
Parallelization
- Parallelized the model using 8 GPUs.
- Each LSTM layer runs on a different GPU, and after the activations of one layer are computed, they are passed to the next layer.
- The processing speed increased significantly from about 1,700 words per second in single-GPU training to about 6,300 words per second.
- Accordingly, the entire training took about 10 days.
Results

- Use of ensemble
- Among the translations predicted by each LSTM for the same input sequence, they are combined into the translation with the highest probability.
- Experiments were conducted by varying whether the word order was reversed in the single LSTM model, and by varying the beam size and the number of ensembled models in the ensemble model.
- As a result, the highest BLEU score was achieved with 5 reversed ensembled LSTM models and a beam size of 12.
- Also, compared to SMT, it recorded a higher BLEU score despite the vocabulary restriction.

- It was confirmed that while the model is sensitive to word order, sentences with the same meaning are embedded into vectors at similar positions even when active/passive voice differs.

- It was confirmed that performance degradation is not large for long sentences.
- Performance degradation was also not large for sentences containing low-frequency vocabulary.
Conclusion
Contributions
- Proposal of a general architecture and training method for Seq2Seq.
- And it shows performance surpassing conventional SMT.
- Proposal of the technique of reversing the word order of the source sentence.
- Greatly improves the performance of the LSTM model with a simple approach.
- Compensates for performance degradation when handling long sentences.
- It is significant in that it proposes a machine translation model using purely a Neural Network without the help of SMT, while showing better performance.