cd /news/artificial-intelligence/attention-decides-where-to-look-valu… · home topics artificial-intelligence article
[ARTICLE · art-58223] src=pub.towardsai.net ↗ pub= topic=artificial-intelligence verified=true sentiment=· neutral

Attention Decides Where to Look. Values Decide What Comes Back.

A technical breakdown manually computes the attention mechanism inside GPT-2 for a four-word sentence, tracing every number from raw score to contextual embedding to demystify the arithmetic behind transformer attention.

read1 min views1 publishedJul 14, 2026
Attention Decides Where to Look. Values Decide What Comes Back.
Image: Pub (auto-discovered)

Member-only story

One token, four numbers, and the arithmetic that turns raw attention scores into a contextual embedding inside GPT-2.

Article 1- https://medium.com/p/5807f169db30 Where we are headed. Four weights, one target. draw leans on I six times harder than on itself. The rest of this piece derives those numbers by hand.

“Attention” sounds like the hard part of a transformer. It is the part everyone name-drops and almost nobody computes on paper. Strip away the branding and what remains is arithmetic a spreadsheet could run: exponentiate a handful of numbers, divide by their sum, and take a weighted average.

The mechanics of that average are the easy part. The question worth sitting with is what gets averaged, and why the two ingredients — the weights and the values — are produced by different machinery inside the model. Get that split clear and the whole block stops being magic.

So we will not describe attention. We will run it. One four-word sentence, one target token, and every number followed from raw score to the embedding that leaves the block.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @gpt-2 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/attention-decides-wh…] indexed:0 read:1min 2026-07-14 ·