ATTENTION · TRANSFORMER SIMULATION

Everything called the creativity of a language model comes down to dividing every score by a number T before the softmax. A small T sharpens the distribution into a spike, the top token wins nearly every time and the prose turns confident but monotone; a large T flattens it, unlikely tokens get their chance and the prose grows varied but prone to derailing. Before that, each token emits a query and a key, and how well they match becomes an attention weight through softmax, enough for a pronoun at the end of a sentence to reach straight back to a noun at its start. The model looks nothing up: it predicts the next token, appends it, and predicts again.

▸ Cutting the sentence into tokens & loading the vocabulary…
▸ Looking up an embedding for each token
▸ Producing Query · Key · Value for self-attention
▸ Computing softmax(Q·Kᵀ/√d) weights · multiple heads
▸ Calibrating temperature & the next-token sampler…
▸ Ready — Online. ✅
0%
⌂ Mind & Machine

Simulation room Attention & Transformer

Attention & LLM
Online
token · softmax · word prediction
Model state
💬 Attention & word prediction
Tokens—
Query token—
Next guess—
Top probability—
Temperature T—
Attention heads—
Notes
An LLM like ChatGPT reads a sentence as tokens, each token ‘attends’ to others to understand context, then predicts the next token by probability. This is a simplified intuition of attention — not the full architecture.
—
Pick a ‘Scenario’ to change the view (attention links · matrix · multi-head · text generation · temperature · long-range context) · drag Temperature to see the distribution sharpen/flatten · click a concept for details
Your browser has canvas disabled.
Top-token probability & temperature over time top probabilitytemperature T
About Attention / LLM

Everything called the creativity of a language model comes down to dividing every score by a number T before the softmax. A small T sharpens the distribution into a spike, the top token wins nearly every time and the prose turns confident but monotone; a large T flattens it, unlikely tokens get their chance and the prose grows varied but prone to derailing. Before that, each token emits a query and a key, and how well they match becomes an attention weight through softmax, enough for a pronoun at the end of a sentence to reach straight back to a noun at its start. The model looks nothing up: it predicts the next token, appends it, and predicts again.

Related topics in Mind & Machine