There are some similarities between the sequence to sequence machines translation model and language models.
In a language models, we take the input and at every step we predict the next word of the output. A language helps us calculate the probability of a sentence. We take the initial activation and the first word of the input sequence as input of the first part of the model. This gives us the prediction and the new activation . In the next part we use the previous prediction as input and the new activation to generate the next output word.
The machine translation model works almost in the same way. Here we input the initial activation and the first word of the input sequence. Then instead of giving an output prediction as in language models, here only the activation is calculated. This is done till we input all input sequence words. This is called the encoding network. Later the last activation generated by the encoding network is given to the decoding network which at each stage like the language models gives a output prediction and those prediction are used as input for further predictions.
Machine language model used to translate from French to English help us to calculate the probability of an English sentence conditions on an input French sentence which is why it is also called a conditional language model. Instead of doing sampling at random from this distribution we would like to find the English sentence which can maximize the conditional probability.
Now in order to find the appropriate sentence we use the Beam Search Algorithm.