the.ai

Attention / Core

verified

Multi-Head Attention

One attention pass has to settle on a single set of weights, so it averages away anything it cannot decide between. Multi-head attention runs several passes side by side, each with its own projections, so one head can follow grammatical agreement while another tracks the subject of the sentence. The results are concatenated and mixed.

Viz primitive · attention-heatmaptokens = 8 · heads = 4
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.

One head's attention pattern at a time. Drag the head count to see the same budget split into more, narrower views — each sharper than the single head that had the whole width to itself.

4

Reviewed by opendroid · 2026-08-04