What Actually Happens Inside a Transformer's Attention Heads?
We call it attention. We visualize it with colorful heatmaps. But what is actually happening inside a neural network when one word attends to another? The answer is more interesting than you might think.
Imagine asking an AI model to complete this sentence:
“The animal didn’t cross the street because it was too…”
What does it refer to? The animal? The street?
To answer correctly, the model needs to connect information across different parts of the sentence. It needs to retrieve something it encountered earlier, understand how the pieces relate, and use that information to predict what comes next.
This is where attention comes in.
If you’ve spent any time reading about modern language models, you’ve probably encountered the term attention. It appears everywhere: research papers, technical discussions, architecture diagrams, and almost every explanation of how transformers work.
The original Transformer paper even made it the centerpiece of its...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE