How does attention work, mechanically?
Every token entering a Transformer layer is projected into three vectors: a query (what this token is looking for), a key (what this token offers) and a value (what this token contributes if selected). The model scores every query against every key, normalizes the scores with softmax into weights that sum to one, and produces a weighted blend of the values. A token representing 'it' in a sentence scores highly against the noun it refers to; a token in a question about pricing scores highly against tokens near currency figures.
Multi-head attention runs many of these operations in parallel with different projections, so one head can track subject-object relations while another tracks numbers and a third tracks negation. Stacked across dozens of layers, this lets the model build increasingly abstract representations: from words, to phrases, to claims, to the rhetorical role a passage plays.
Why was attention designed this way?
The design solves three problems at once. Long-range dependency: a fact at the start of a document can directly inform a token at the end, without passing through a chain of intermediate memory. Parallelism: all pairwise scores are computed as matrix operations, which modern chips execute efficiently — this is what made large-scale training economical. And interpretability of a sort: attention weights show, at least partially, which tokens influenced which, giving engineers a window into model behavior.
Attention is also content-agnostic. It does not know what a 'brand' or a 'fact' is; it learns statistical patterns of which tokens tend to be relevant to which. This is why clear, conventional information structure — definitions near the terms they define, numbers near the entities they quantify — is so reliably effective: it matches the patterns attention was trained on.
What this means for GEO
When an engine retrieves your page, attention is what reads it. The practical consequences:
- Facts near their anchors win. A number is most usable when the entity it describes and the date it applies to sit in the same sentence or the immediately adjacent one. 'Revenue grew' with no subject in reach is dead weight; the model must guess the referent or skip the claim.
- Headings act as context anchors. Tokens under a heading attend to it. Descriptive headings ('Pricing plans and billing terms') give the passage below them a frame; clever headings ('The fun part') give none. See answer block writing.
- Passages compete for attention inside the context window. Retrieved chunks from many sources are blended by the same mechanism. Dense, single-claim passages with explicit entities survive this competition; diluted passages contribute noise. See context windows.
- Negation and hedging are read literally. Attention tracks modifiers well; vague hedges around a fact lower the confidence with which it is reused, while clean attributed claims get quoted. This is the writing side of grounding consistency.
Actionable implications: a checklist
- Put entity, metric and date in one sentence: 'ChinaGEO tracked 300,000 keywords in February 2026' beats scattering the three across a paragraph.
- Re-state the subject at every paragraph start instead of chaining pronouns — extracted passages must be self-contained.
- Lead each section with its conclusion; attention-weighted extraction favors passages whose first sentence summarizes the rest.
- Keep one claim per paragraph. Multi-claim paragraphs force the model to split attention across competing assertions.
- Use tables for spec-like facts: row-column structure gives keys and values an explicit alignment attention resolves cleanly. See structured data deep dive.
Can you see attention working?
Not directly in production engines — no major engine exposes its attention maps. But the outputs betray the mechanism: answers quote the sentence where entity, number and date coincide; they paraphrase headings into framing; they skip passages whose referents are ambiguous. The discipline that emerges — write for extraction — is the same one behind query fan-out: engines decompose a question, retrieve passages, and let attention decide what survives. Your job is to make survival easy.