Learn AI · Level 2 · How AI works · step 4 of 12 · word 3 of 7

What is attention in AI?

Attention is the technique that lets an AI model weigh how much each word in a passage matters to every other word, so it can work out meaning from context.

Added 27 Oct 2026

In plain English

When you read “I went to the bank to fish”, you know at once that “bank” means a riverbank, because of the word “fish”. Attention gives an AI model a similar ability. For every word (strictly, every token) in the text, the model calculates how strongly it should “pay attention” to each of the other words, and blends in their meaning accordingly. Words that help explain each other get high scores; unrelated words get low ones.

A model does this many times over, in many layers and from several “angles” at once, so it can track grammar, who did what to whom, and the topic of a paragraph all at the same time.

Why it matters

Attention is the key idea inside the transformer, the design behind ChatGPT, Claude, Gemini and most modern AI. The 2017 paper that introduced the transformer was even called “Attention Is All You Need”. Before attention, models struggled to connect words that were far apart; with it, they can link a question at the end of a long document to the answer near the start.

An example

You paste a long contract into a chatbot and ask, “Who pays if the delivery is late?” The model’s attention links “late delivery” in your question to the penalty clause on page 4 and to the company named in the first paragraph, and pulls them together into one answer.

What to watch out for

Attention has a cost: every word is compared with every other word, so the work grows quickly as text gets longer. That is a big reason models have a context window limit, and why very long chats can get slower or more expensive. It also means a model can “attend” to the wrong part of a document and answer confidently from it, so check important answers against the source.

← All terms