下图演示了如何使用基于循环神经网络的编码器—解码器来训练将上述英语句子翻译成法语句子。首先将英语句子的句号替换成结束符“<EOS>”(end of sentence)后输入到编码循环神经网络来得到结束符输出的隐藏状态。接着我们使用以它为初始隐藏状态的解码循环神经网络来进行翻译。我们依次将开始符“<BOS>”(begin of sentence)和对应的法语句子输入到解码器中,期望解码器能输出正确的输入单词的下一词。
[1] Cho, K., Van Merriënboer, B., Gulcehre, C., Bahdanau, D., Bougares, F., Schwenk, H., & Bengio, Y. (2014). Learning phrase representations using RNN encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078.
[2] Sutskever, I., Vinyals, O., & Le, Q. V. (2014). Sequence to sequence learning with neural networks. In Advances in neural information processing systems (pp. 3104-3112).