ATTENTION VECTOR LAB
Loading D3...

Make attention math visible.

Transformer attention begins with a geometric question: which key points most strongly with this query? Predict first, then inspect every number.

Drag the blue query or use the worked aim

q = (0.20, -0.70)
Arrow keys move q by 0.05
The worked query is q=(0.80,0.60). Vector length and angle both change the dot product.

Predict before revealing

scale = sqrt(2)

Which key will receive the largest weight?

Choose a predicted key, then shape the query vector.

From vector dot products to normalized attention

Read the explanation

The source worked query is zero point eight zero point six. Its three key dot products are zero point eight, zero point nine six and minus zero point two eight. Math has the highest dot product in this fixture. Dot products depend on both direction and length, so a direction-only comparison would miss part of the calculation. These vectors are two dimensional illustrations, not learned model activations. The code divides each dot by square root two, then exponentiates after subtracting the largest score. That subtraction keeps the normalized result the same while limiting numerical growth. The worked weights are about thirty eight point seven percent Context, forty three point three percent Math and eighteen percent Deploy. All three sum to one hundred percent. The winner does not receive all the weight. The original Reverse query button negates both query components. Dot products become minus zero point eight, minus zero point nine six and plus zero point two eight. After the same normalization, Deploy becomes the largest weight. All key vectors remain unchanged. This illustrates the direction dependence of attention; the tool does not model masks, multi-head projections, positional encoding or a complete transformer.

Super generates helpful tools and automates fact-checking across the internet proactively. If you enjoyed this tool, build your own with Super and share it with a friend.