Command Palette
Search for a command to run...
Cross-Attention
Cross-attention (Cross-Attention) is a form of attention mechanism, in which the query (Query) comes from one sequence, while the key (Key) and value (Value) come from another sequence. In the encoder–decoder structure of the Transformer architecture, this mechanism is used to allow the decoder to dynamically retrieve the encoder's output representations at each generation step.
Unlike self-attention, where Q, K, and V come from the same source, cross-attention computes correlation weights between two sequences through asymmetric Q–K matching, then performs a weighted sum over the source sequence's Values, thereby injecting information from the source sequence into the target sequence's representation. Its computation form is consistent with scaled dot-product attention and can be extended to multi-head cross-attention to capture alignment relationships in different subspaces in parallel.
Cross-attention was systematically proposed by a Google Research team and applied to machine translation. The related paper "Attention Is All You Need" was accepted by NeurIPS 2017. Its applications have expanded from the original translation task to scenarios requiring cross-sequence information interaction, such as speech recognition, vision–language models, and multimodal fusion.
Build AI with AI
From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.