Skip to content

Cross-Attention

A variant of attention where queries come from one sequence and keys and values from another. This allows the model to connect two different sources of information.

Difference from Self-Attention

Self-Attention Cross-Attention
Source One sequence Two different
Task Connect words within text Connect text with context

Where It Is Used

  • Machine Translation: The encoder reads the source text, and the decoder uses cross-attention to "look" at it while generating the translation.
  • Image Captioning: The model creates a description by referring to visual features.
  • Multimodal Models: Connect text with images.

See Also

← All terms