A contextualized representation is a token representation updated with information from surrounding tokens. It gives the model a better representation of the prompt before prediction. section 1.20
From token to context
For a token such as “bark,” attention weighs nearby tokens by relevance. Information from relevant words shapes its embedding, while an irrelevant token such as “’s” contributes little. Feed-forward processing then produces an improved representation. The same process contextualizes every token in the prompt. section 1.20
The representation is built in stages:
- Attention compares tokens within the context window and determines their relative relevance. section 1.20
- Feed-forward processing updates the embeddings, and repeated transformer layers refine them further. section 1.20
- Projections over the resulting representations produce probabilities for every possible next token. section 1.21
Figure 1.10 The attention mechanism calculates the relative relevance of all tokens in the context window to contextualize or disambiguate the last token.
Use the attention diagram to see how tokens in the context window help contextualize or disambiguate another token. section 1.20

