Attention Mechanisms
Definition
Attention computes context-dependent weighted combinations of representations, allowing a model to emphasize information relevant to the current prediction.
What is attention in machine learning?
Attention is a mechanism that lets a model compute weighted combinations of other representations. The weights depend on the current input, so the model can emphasize information that appears most relevant to the current prediction.
Queries, keys and values
In the form used by transformers, each token is projected into query, key and value vectors. Similarity between a query and keys determines attention weights; those weights are used to combine value vectors.
Why attention changed sequence modeling
Earlier sequence models processed tokens recurrently. Attention made it easier to connect distant positions directly. Multi-head attention lets different sets of learned projections capture different relationships in parallel, which became a defining feature of transformers.
Related terms, defined
Reference guide and primary sources
Wikipedia is used here as a terminology and history reference guide. Current model versions, institutional statistics and product-specific claims are also linked to first-party or institutional sources because those details can change faster than encyclopedia articles.