MediumDeep learning
Walk through the transformer architecture. What does each part do?
Tokens become embeddings, with position information added because attention alone ignores order. Each layer has two sub-layers: multi-head self-attention, where every token gathers information from the others, and a feed-forward network applied to each token separately; each is wrapped in a residual connection and layer normalisation, which keep deep stacks trainable. The original model stacked 6 encoder and 6 decoder layers; the decoder adds masked self-attention and attention over the encoder’s output, and a final linear layer and softmax give next-token probabilities.
Say your answer out loud first. Then check ours.