Skip to content
AI-grafen
CBuilderTransformer architecture· about 30 min· fundamentals that rarely change· verified 2026-09-20· EN

Attention: how words influence each other

Identify which words in a sentence are crucial for interpreting a specific word.

Prerequisites

Intuition

"The bank lay by the river." — Which bank is meant? The word river decides: it is a riverbank, not an office. To understand "the bank", you must look at the river, not at "lay" or "by".

A language model does this with attention: for every word, it calculates how much it should "look at" every other word. "The bank" → high attention on "the river", low attention on "by".

The word it in "The customer called support until it got tired" — who got tired? Attention decides, and it can be wrong — just like for us.

Interactive

Draw arrows: Write a sentence on a piece of paper. Choose a word. Draw arrows to the words needed to understand it; thicker arrow = more important.

"The boss gave the employee the report because she wanted to read it."

  • "she" → arrow to employee (likely — but "boss" is possible).
  • "it" → arrow to report.

Do the same with "... because she was done with it". Now "she" likely points to the boss. Same word, different context, different arrow. This is exactly what attention calculates.

Mastery means

  • Identifies which words influence the interpretation of a given word
  • Explains that the model assigns different weights to words depending on context

Sign in to do the exercises and build your mastery up.

Sources

All the sources and licences