the.ai

Attention / Core

verified

Self-Attention

Self-attention is attention pointed at its own input: the queries, keys and values all come from the same sequence. Every position gets to look at every other position in one step, so information moves across the whole sequence without being passed along hop by hop the way a recurrent network passes it.

Viz primitive · attention-heatmaptokens = 8 · heads = 1
query ↓key →

8 queries against 8 keys; a brighter cell means more of that query's attention went to that key. Nothing is masked: every position can read every other, itself included.

Every position scoring every other, itself included. Drag the sequence length to watch the score matrix grow quadratically while the path between any two positions stays at one.

8

Reviewed by opendroid · 2026-08-04