 The decoder functions in a similar fashion to the encoder, but an additional attention mechanism is inserted which instead draws relevant information from the encodings generated by the encoders.Like the first encoder, the first decoder takes positional information and embeddings of the output sequence as its input, rather than encodings.Since the transformer should not use the current or future output to predict an output though, the output sequence must be partially masked to prevent this reverse information flow.