A transformer architecture processes sequential data, such as text, primarily by selectively attending to relevant input segments instead of relying on strictly word-by-word reading. Attention assigns relevance scores that help preserve context throughout a sequence. section 11.3.2
Attention supports several practical goals:
- Prioritize the input parts most relevant to predicting each word. section 11.3.2
- Maintain and propagate context from the beginning to the end of long sequences. section 11.3.2
- Reduce confusion caused by long sentences and complex phrases. section 11.3.2
Reading a long sentence
A conventional sequence model reads a sentence in order and may lose its initial context by the end. A transformer can focus on different parts of the sentence as it predicts each word, dynamically emphasizing the most relevant relationships. section 11.3.2
Figure 11.10 Multi-head attention with H = 3 heads by node 5. α52, α54, and α55 are the attention coefficients between the nodes. The aggregated features from each head are averaged to obtain the final embedding of the node.
Inspect multi-head attention coefficients to see how separate attention heads weight relationships before combining their aggregated features. section 11.3.2



























