A Transformer is a neural-network architecture that processes a sequence while letting each word weigh the importance of every other word. This self-attention builds a rich understanding of context, unlike recurrent networks that compress earlier text into a fixed-size memory. section 11.11
A Transformer block combines attention mechanisms, feed-forward neural networks, and normalization layers. Modern language models may use only the encoder or decoder portion of the original design; GPT models, for example, are decoder-only. section 11.1
Design a Transformer by choosing:
- Vocabulary size: the number of unique tokens after byte-pair encoding merges. section 11.11
- Context window: how many tokens the model can see at once. section 11.11
- Width, depth, attention heads, and feed-forward size: capacity choices that control token detail, processing steps, simultaneous patterns, and neural-network size. section 11.11
A toy language model
A small example can use 34 tokens, a 32-token context window, width 4, two layers, one attention head, and feed-forward layers with 8 and 4 neurons. A larger context window supplies more preceding text, while additional width or depth provides more representational capacity. section 11.11
Figure 11.24 A simplistic overview of the Transformer framework
Use the overview to trace how tokens, attention, feed-forward processing, and normalization fit together in the Transformer framework. section 11.11



























