Overview
Transformer Attention computes similarity scores between queries and keys, normalizes them, and uses the weights to mix value vectors.
Lets each token combine information from other tokens using learned query, key, and value vectors.
Compact metadata for implementation and discovery.
Transformer Attention computes similarity scores between queries and keys, normalizes them, and uses the weights to mix value vectors.
Quick facts
Runtime and memory behavior at a glance.
Best
O(n^2 d)
Average
O(n^2 d)
Worst
O(n^2 d)
Space
O(n^2)
Attention(Q, K, V) = softmax(Q K^T / sqrt(d_k)) VComputes normalized relevance weights and applies them to value vectors.
Show attention weights from one token to every other token in a sequence.
The quadratic sequence cost is a major scaling constraint for long contexts.
What each reference supports for this entry.
Transformer paper introducing scaled dot-product attention for sequence modeling.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Transformer attention models sequence dependencies without recurrent state updates.
Scaled dot-product attention uses softmax to normalize attention weights.