› Attention Engine
Free · no account · nothing to type
Look-back
looks at the word right before it
Noun finder
looks at the closest naming word
Describer
a naming word looks for its describing word
Where ball looks
- Look-back looks hardest at red, 89%.
- Noun finder looks hardest at ball (itself), 83%.
- Describer looks hardest at red, 96%.
Each row of a heatmap is one word's look, split into shares that add up to 100%. Hatched squares are words the mask hides.
Swap ball for another word
Try it: in “bot finds ball then kicks it”, swap it for bot, or ball for red, and watch the Noun finder.
heatmap.png is the three heatmaps for this sentence, mask on. weights.json holds every number the heads use, the word bank, and this sentence's shares.
Every word looks at the others
A transformer, the T in GPT, reads all the words at once. In each head, every word sends out a question (its query) and holds up a label (its key). The better a word's key matches your question, the bigger its share of your look. Each row of a heatmap is one word's look, split into shares that add up to 100%. A word that asks nothing spreads its look evenly.
Every number in this transformer was set by hand so each head has one job you can check. A real model learns its numbers from billions of sentences, has many heads in each of many layers, and its heads' jobs are messy and only sometimes this neat. Our words carry only what kind of word they are and which slot they sit in, so to this model “cat” and “dog” are the same word. And we show only the looking part of one layer: a real layer also blends what each word looks at and runs a small network after it.
The causal mask hides the words that come later. A chatbot writes one word at a time, guessing the next word from the words so far, so while it learns it may not peek. With the mask on, the first word can only see itself. Turn it off and the Noun finder sends every word to the last noun, even the words that come before it. Play the same rule on paper in the Next Word game, build the mask in bricks with the free Attention mask starter in Brick Builder, or see it inside a whole Transformer build.
Try the trap: in “kite hits bot then it flies”, the Noun finder sends “it” to bot, the closest noun, though kites are what fly. This head only knows “closest noun”. Real models learn what words mean too, and they still get “it” wrong sometimes.
A model first cuts text into tokens in the Tokenizer Engine, gives each token a list of numbers like the ones in the Embedding Engine, then attention lets every token look at the others.
Share this
Send the page with a link that remembers how it was shared.
Nothing you make leaves this device. Every number here was written by hand for Hi, Bot. More engines →