Open Agent School · Public worked example

Attention: meaning and example

Welcome! Take one idea with you today.

Attention computes how much information to combine from different positions. In a common form, a query is compared with keys to produce scores; normalized scores become weights used to mix value vectors. A transformer learns the projections that create queries, keys, and values.

Picture it: A note says, "The blue crate is fragile; move it gently." A toy display gives different weights to information positions while forming a new value. You can inspect how emphasizing one value changes the mixture, but cannot infer from the toy that a model has understood what "it" refers to.

What is easy to mix up?

A weight records one internal mixing operation. Other heads, layers, and pathways contribute; a causal explanation requires additional evidence and interventions.

Teaching example by Open Agent School. Source: Vaswani et al. - Attention Is All You Need.