Choose a sentence, select a token, and watch its query compare with every token key. The resulting attention weights mix value vectors into a context-aware representation.
Follow the glowing streams into the selected query token: each source token contributes information according to its attention weight. Brighter, thicker routes carry more weight.
Small vectors are shown for teaching. Real models use learned projection matrices and much larger vectors.
One row of the attention matrix: the selected query token distributes 100% of its attention across the available tokens. Brighter cells carry more weight. Select a cell to make that token the new query.
This simplified view illustrates repeated contextual mixing, not a dump of a trained model's hidden states.
Each block receives the representations from the block below. Attention mixes information across tokens; the MLP transforms each token's representation; residual paths help preserve and refine the signal.
Tokens become vectors and receive positional information before entering the first Transformer block.