Attention Routing & Weights Layer 4 · Head 0
$\text{Attention}(Q, K, V) = \text{Softmax}\left(\frac{Q K^T}{\sqrt{d_k}}\right) V$
Self-Attention Operator
Query Token ($Q_i$) it [idx 7]
Key Token ($K_j$) animal [idx 1]
Scaled Dot-Product 6.42
Softmax Weight ($\alpha_{ij}$) 0.84

1. Parallel Self-Attention

Unlike Recurrent Neural Networks (RNNs) that process word by word sequentially, Transformers ingest the entire sequence simultaneously. Every token computes direct pairwise relationships with all other tokens via Query-Key-Value interactions.

QK^T computes similarity; V routes information.

2. Positional Encodings

Because self-attention is permutation-invariant (order-blind), deterministic sinusoidal frequencies or learned positional embeddings are added directly to the input vectors so the network understands word order.

PE(pos, 2i) = sin(pos / 10000^{2i/d})

3. Residual Highways & MLPs

Skip connections allow gradients to flow cleanly through hundreds of layers without vanishing. Each attention step aggregates cross-token relationships, while the two-layer MLP retrieves factual knowledge stored in network weights.

Output = LayerNorm(x + FFN(x))
Enjoy this tool? Build your own with Super
```