Attention: cat looks back
Cat compares its question with every name tag, turns the matches into shares, and mixes the messages.
Hover or tap a word or a cell to follow it. Tap empty space to reset.
A high number means “this word has what I'm looking for”. Words can't look at later words.
Scores = Q · Kᵀ (4×3 · 3×4 = 4×4). Grey cells = causal mask.
Three small moves turn any four numbers into four shares that add up to 100%.
This is softmax(scores / √d), with d = 3. The result is cat's attention weights.
Cat takes that share of each word's message, adds them up, and adds the result to its own row.
z = shares · V; h = x + z. Keeping x is the residual connection.
The same three moves happen for every row in one go, giving a new 4 × 3 table.
H = X + softmax(mask(Q·Kᵀ / √3)) · V. One attention head.