Rakibul HaqueOnto the next

Attention, by hand

This is real scaled dot-product attention, the core of every Transformer, done in 2-D so you can see it. Each token is a key vector on the plane. Drag the black query vector around: the attention weight on each token is softmax(q · k / √d), and the attended output (the hollow marker) is the weighted average of the tokens. Pull the query toward a token and it dominates; the temperature slider controls how sharp or soft the focus is. Same mechanism I built from scratch for my neural machine translation and ViT work.

← All experiments