the.ai

Attention / Core

verified

Cross-Attention

Cross-attention is attention between two different sequences. The queries come from the sequence being written, the keys and values from the one being read. It is how a decoder consults an encoded input, and how a model conditions on an image, an audio clip, or a retrieved document.

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

6 queries against 20 keys; a brighter cell means more of that query's attention went to that key. Nothing is masked: every target position can read every source position.

Target positions as rows, source positions as columns, with no mask between them. Drag the length to see the score matrix stay rectangular rather than square.

6

Reviewed by opendroid · 2026-08-04