In the previous article , we generated the first output word from the transformer.
So far, the translation is correct. However, the decoder does not stop until it produces an <EOS> token .
Feeding the Output Back into the Decoder
Now, we take the translated word “vamos” and feed it back into a copy of the decoder’s embedding layer to continue the process.
Just like before, we repeat the same steps:
Get the word embeddings for vamos
Add positional encoding
Calculate self-attention values using the same weights used for the <EOS> token
Add residual connections
Compute encoder–decoder attention using the same set of weights
Add another set of residual connections
Generating the Next Word
Next, we pass the values representing “vamos” through the same fully connected layer and softmax function that we used earlier.
This time, the decoder outputs the <EOS> token , which signals the end of the sentence.
Final Output
At this point, the decoding process is complete.
We have successfully translated the…