Token Attention Map
Click any token to inspect its Query vectorComputation Flow
Each token embedding $X_i$ is multiplied by weight matrices $W_Q, W_K, W_V$ to yield Query ($Q$), Key ($K$), and Value ($V$).
Scores how strongly the selected token seeks information from every other token.
The new contextual representation is the weighted sum: Σ (Weight_j × V_j). Words gain context-aware meaning dynamically.
Why Self-Attention?
Unlike RNNs that process text sequentially, self-attention processes all tokens in parallel, capturing long-range dependencies instantly.
Multi-Head Architecture
Multiple attention heads allow the model to simultaneously focus on syntax, grammatical relationships, and deep semantic links.
Feed-Forward & Stacking
Attention layers are interleaved with multi-layer perceptrons (FFN) and residual layer normalization across deep transformer stacks.