Such an attentional mechanism has proven to be an effective technique in text generation tasks such as machine translation<cite> [Bahdanau et al., 2015</cite>; Luong et al., 2015] and image caption generation [Xu et al., 2015] . The encoder-decoder framework [Kalchbrenner and Blunsom, 2013; Cho et al., 2014; Sutskever et al., 2014;<cite> Bahdanau et al., 2015]</cite> usually uses a recurrent neural network (RNN) to encode the source sentence into a sequence of hidden states h = h 1 , . . . , h m , . . . , h M : where h m is the hidden state of the m-th source word and f is a non-linear function.