AI Compare Ninja AI Compare Ninja

Compare AI tools. Use prompts and skills.

Pricing market
Automatic
Language
EN

What is Attention mechanism?

Also called: Self-attention

Attention is the calculation a language model uses to decide which other words matter for the current word.

Example

In “The bank by the lake was wet”, the model pays attention to “lake” and understands it is a bench by the water, not a financial bank.

For pros

Each token forms query, key and value vectors; their similarity produces weights over all other tokens. Several attention heads work in parallel. The cost grows quadratically with context length, which is why more efficient variants exist.

Sources: arXiv 1706.03762, Wikipedia · Checked on 19 October 2026

Written by AI Compare Ninja with AI assistance and edited by us. Every explanation is our own text.