Stage 2 · Teens · Foundations

Attention & Transformers

The architecture that lets models weigh context when processing each token.

Early language models processed text mostly left-to-right with limited memory of earlier context. The transformer architecture, introduced in 2017, changed this with a mechanism called self-attention: for every token, the model computes how much it should "attend to" every other token in the input.

Self-Attention
The word "it" attends most strongly to "animal" — that's how the model resolves what "it" refers to.
All lessons in Stage 2: How AI works