1. Scaled Dot-Product Attention Heatmap
Head 1: Syntactic DependenciesHead 1 (Syntactic Dependencies): Specializes in linking prepositions and determiners with their head nouns (e.g. "of" → "bank", "river" → "bank").
Head 1 (Syntactic Dependencies): Specializes in linking prepositions and determiners with their head nouns (e.g. "of" → "bank", "river" → "bank").
A single Transformer block consists of tokenization, positional embeddings, multi-head self-attention, residual stream additions, layer normalization, and a two-layer feed-forward network. Select any stage to inspect its transformation:
Transformers have no recurrence (unlike RNNs) and process all tokens in parallel. Because permutation invariance would erase word order, fixed sinusoidal waves or learned positional vectors are added to each token's static semantic embedding vector:
This ensures that "bank" at position 1 carries a mathematically distinct vector signature from "bank" at position 8, allowing attention heads to compute relative distances.
Decoder-only models (like GPT-4 and Llama) use causal masking so tokens can only attend to prior positions. Click "Generate Next Token" to compute probabilities and step forward: