Nib asked, and Nib — askNib's tutor — drew the answer live at a whiteboard. This is the spoken transcript; enable JavaScript to watch it drawn.
How do AI language models like ChatGPT actually work? (for a curious adult who uses chatbots but has never studied computing). Cover, in this order: How does ChatGPT work?; How does it read your words?; How does it learn which words come next?; How does it know which earlier words matter?; Why do AI chatbots hallucinate?; Why does it forget what you said earlier?; How did a text predictor learn to follow instructions?; Does it understand, and how much should you trust it? — page 4: Attention: Weighing Earlier Words
Take the word "it". To a machine it is just one fixed number, the same everywhere it appears. Alone, it tells the machine almost nothing yet.
Each token looks at every other token and scores how much it helps: bright arrows for useful ones, faint for useless ones.
For "it," the trophy and suitcase light up, and "big" weighs in too. Training taught it which clues usually point to the right noun.
Then "it" absorbs information from the words it weighted, in proportion. Now the token carries meaning from this particular sentence, not a generic one.
Every token does this at once, and the whole thing repeats through many layers. By the end, the last token is ready to guess next.
So when a chatbot gets "it" right, it's not looking up a meaning: every word has weighed the others, and context decided.