Cross-Attention

Category: Neural Networks & Architectures

An attention mechanism where queries come from one sequence and keys/values come from a different sequence, enabling cross-sequence information flow.

Full Explanation

Cross-attention (also called encoder-decoder attention) allows one sequence to attend to another by using queries from one source and keys/values from a different source. In the original Transformer, the decoder uses cross-attention to attend to encoder outputs, with decoder hidden states as queries and encoder outputs as keys and values. This mechanism enables the decoder to selectively focus on relevant parts of the input when generating each output token. Cross-attention is essential for encoder-decoder tasks like translation, summarization, and image captioning. It is also used in text-to-image models like Stable Diffusion, where image generation layers cross-attend to text embeddings. Cross-attention bridges different modalities or representations, making it fundamental to multi-modal AI systems.

Related Terms

More in Neural Networks & Architectures

Explore More

  • AI Tools Library — Discover AI tools related to Cross-Attention
  • AI Education — Courses to learn about Neural Networks & Architectures
  • AI News — Latest news and updates