← 🧠 AI & Machine Learning

🧠 Self-Attention

Animate value flow
Top attends to:
Max weight:
Entropy:
FPS:
Drag — rotate · Scroll — zoom

🧠 Transformer Attention Mechanism Explained

Six tokens sit in a ring; glowing beams show how much each token's query attends to every other token's key, with brightness and thickness mapped to the softmax attention weight for each head.

🔬 What It Demonstrates

Scaled dot-product attention: scores from Q·K are divided by √d, passed through a temperature-scaled softmax, and used to blend value vectors from every token into the selected query token.

🎮 How to Use

Pick a query token and how many heads to compute. Lower the temperature to see attention sharpen onto one word, or raise it to flatten it toward uniform. Isolate a single head or overlay them all, and watch value particles flow in along each beam.

💡 Did You Know?

Multi-head attention lets a transformer look for several kinds of relationships at once — one head might track subject-verb agreement while another tracks nearby adjectives, all computed in parallel.