-
Book Overview & Buying
-
Table Of Contents
Deep Learning with C++
By :
Here is a complete architecture from the original paper. The left part is known as the encoder and the right half of the neural network is known as the decoder.

Figure 9.5: Encoder-Decoder based Transformer Architecture
As shown in the image, both the encoder and decoder share similar building blocks: embedding layers, positional encoding, and multi-headed attention. The masked multi-headed attention component, unique to the decoder, will be explained in the decoder section below.
Understanding the Transformer architecture requires viewing it through the lens of sequence-to-sequence (Seq-2-Seq) models. Just as Seq-2-Seq models pass latent representations from encoder to decoder for generation, the Transformer sends encoder output to the decoder’s multi-headed attention block with one key modification: only the key and value pairs from the encoder feed into the decoder, while queries come from the decoder itself.
Transformers...