Transformers
Paying attention…
Initializing Sorting Algorithms...
Sorting
Trees
Graphs
Preparing interactive visualizations...
Transformers
Paying attention…
Attention is a dictionary lookup made soft. Score a query against every key, turn the scores into weights, and blend the values. Four keys on a plane are enough to see all of it.
Hard lookup: one exact match, one value, or nothing.
Soft lookup: every key matches a little; the answer is a blend of every value.
A Python dictionary is a lookup: give it a key and it returns that key's value. The query has to equal a key exactly — "k₃" returns v₃, and anything else is a KeyError. Attention is the same lookup made soft: every key gets a score for how well it matches the query, and the answer is a blend of all the values, mixed by those scores.