Skip to content
ginsberg.si

How AI Chatbots Actually Work · Part 2 of 5

How AI Reads: Attention, Explained Without the Math

How a large language model reads, in plain English: attention is close reading, several heads at once, and each layer adds a note instead of erasing the page.

11 Nov 2026

Layered notebook revisions under a diagram of layer 1 through layer n, with blue ribbons crossing a sentence in an open book.

Each layer revises a running draft of what the context means — like margin notes that accumulate rather than a page that is erased and rewritten.

Inside the stack, two kinds of work alternate. Attention lets each position look at other positions and borrow from them — a soft, weighted close reading. A feed-forward network then processes each position alone, like consulting a vast key–value memory of patterns and facts. Residual connections add each block's contribution back onto a shared stream; normalization keeps those numbers from exploding or vanishing.

Similarity is the primitive. A score of how aligned two lists of numbers are becomes a way to ask: given what I am focusing on, which earlier words seem relevant? Attention builds three views of each token — query, key, and value. Queries ask; keys advertise; values carry what will be mixed in. Softmax turns match scores into weights that sum to one. Multi-head attention runs several such readings in parallel.

Attention as close reading

Focusing on mat: most attention falls on cat (35%) and sat (25%).

Click a word. Blue intensity shows how much that position looks back — a toy pattern. Causal masking means later words are not yet visible.

Order matters. Modern models often encode position by rotating pairs of numbers in the query and key views (rotary position embeddings), so relative distance shapes the matches. Causal masking ensures that when predicting the next token, the model cannot peek at the future.

Stacked handwritten notes about a residual stream: each note adds to the argument instead of replacing the page.
The residual stream as a running margin note
The Eiffel Tower is in the city of ___
L0: tokens land as points in a shared space
L1: early layers gather grammar and local ties
L2: middle layers bind entities and relations

Each layer adds a revision; it does not erase the page.

Most parameters often live in the feed-forward layers. One useful picture treats them as memory addressed by the residual stream: patterns that match strongly write particular directions back. Attention moves information between places in the sentence; feed-forward layers enrich what each place contains.