The complete model (including encoder) is trained, analogously to a neural language model, to minimize the cross-entropy loss at each time-step while conditioning on the gold history in the training data.
the model is trained to minimize − ln T t=1 p(y t |y 1:t−1 , x).