Learn AI Math

Cross-Attention

What is Cross-Attention?

In one sentence: Cross-attention lets one part of a model pay attention to a different input, like a decoder looking at an encoder's output.

In self-attention, words look at their own sentence. In cross-attention, the queries come from one source and the keys and values come from another. This is how a model connects two things, such as a sentence being written and the sentence being translated, or text and an image.

What does Cross-Attention look like?

In image generation, cross-attention lets the picture being drawn focus on the words in your prompt, like "red balloon."

Why does Cross-Attention matter?

Cross-attention is how models combine different inputs, such as text and images.

Last updated · Fact-checked by The AI Math

Linking to this page from a lesson or article?

Like this explanation? Get one every week.

The AI Math newsletter turns confusing AI news into plain English. No hype, no jargon walls.