← Back to Workshop Hub PRE-READ 4 · THE TRANSFORMER

How AI Decides What Matters

How the AI behind Amazon Quick works out which words in your text relate to each other. Plain language, no maths.

01 · The problem

What does “it” mean?

You know instantly. The AI has to work it out from the other words. Watch it check each candidate.

“it” now carries the meaning of “equipment”
Step 1

Thicker line = stronger link
Attention means each word looks at all the others and gives more weight to the ones that help.
Tell me more

Why it was hard before. Older AI read one word at a time, left to right, and tended to forget earlier words in a long sentence. The transformer design reads the whole text at once, so “it” can look straight at “equipment”.

Three moves, repeated. Look at every word. Decide how much each one matters. Blend the useful ones into the word you are working on. The model repeats this many times in a row, each pass adding more context.

Where the name comes from. The design was introduced in a 2017 research paper called “Attention Is All You Need”. The “T” in GPT stands for transformer.

02 · The method

Ask a question, match the labels, collect the answers

Behind each link is a simple three-part routine. Every word plays all three roles.

Q The question

“it” asks: what can fail an inspection?

“it” now carries the meaning of “equipment”
vendorKlabel: a company that supplies thingsMATCHVanswer: what “vendor” means
equipmentKlabel: a thing that can be inspectedMATCHVanswer: what “equipment” means
inspectionKlabel: a check or auditMATCHVanswer: what “inspection” means
Step 1 · Ask

Match strengths are illustrative
Ask a question, find the best-matching labels, then take the answers from those words.
Tell me more

The official names. In AI books Q, K and V are called Query, Key and Value. They are three different views of the same word, and the model learns them during training.

Many questions at once. A sentence has many kinds of links: pronouns to things, verbs to their subjects, dates to events. The model runs several of these ask-and-match passes side by side, each one free to specialise in a different kind of link. This is called multi-head attention.

03 · The pattern

See what each word looks at

Hover or tap any word. The arcs show which other words it pays attention to.

Share of attention · illustrative values, not real model output

Looking at

Every word spreads its attention across the sentence. A few links get most of it.
See the full grid

Each row is a word asking. Each column is a word being looked at. Darker means more attention. Values are illustrative and shown as a share of each row. Click a row name to select that word.

04 · The stack

The same two moves, many times over

The model repeats attention and a thinking step, layer after layer. Click a stop to see what it does.

Stop 1 · Words in

Each pass adds a little more context, so by the last layer every word reflects the whole text.
Why is there a limit on how much text fits?

Every word looks at every other word, so the work grows quickly as the text gets longer. That is why each AI tool has a context window, a ceiling on how much it can take in at once.

When you ask Amazon Quick about a big document, it does not hand the whole file to the model. It finds the relevant passages first, which is what the next pre-read (RAG) covers. Always ask: did the model actually see what I think it saw?

05 · The output

Writing is one word at a time

After all that attention, the model scores every possible next word and picks one. Then it does it again.

Summarise this leave application ?

What could come next · illustrative odds · click a word to pick it

The model predicts one word, adds it, and repeats. That is how a whole reply gets written.
Tell me more

Variety. Always taking the top pick gives steady, repeatable text, which suits pulling out facts. Allowing variety gives more natural, different drafts each time, which suits brainstorming. AI tools call this setting temperature.

A reminder. The model picks words that are likely, not words that are checked. Review anything that matters before you rely on it.

Continue to RAG →