← Neural Networks & Model Architectures
02 · Neural Networks & Model Architectures · Topic 06

What is Attention?

Attention is a mechanism that lets a neural network weigh which pieces of information are most relevant to one another.

What is it?

For each part of the input, attention calculates how strongly it should use information from other parts.

The result is a context-aware representation: each token can carry information about relationships that matter for the current task.

Think of it like...

When reading “The trader closed the position because it was risky,” you look at other words to interpret “it” and decide which relationship matters most.

Attention does this using mathematical weights, not human awareness.

How it works

1 · Input TokensBreak the input into pieces the model can process.
2 · Create RepresentationsRepresent each token as numbers.
3 · Compare RelationshipsMeasure how relevant tokens are to one another.
4 · Assign Attention WeightsGive stronger relationships larger mathematical weights.
5 · Combine Relevant InformationMix relevant information into a context-aware representation.

Real-world examples

Pronoun relationships

Connect “it” with the risky position in a sentence.

Translation

Relate words across a sentence while producing a translation.

LLM context processing

Use relevant earlier tokens when generating the next token.

Vision Transformers

Relate image patches to understand the whole image.

What it is NOT

Attention ≠ Human Attention

It is a mathematical operation over representations, not awareness or focus.

Attention ≠ Transformer

Attention is a mechanism. A Transformer is an architecture that uses attention and other components.

Attention ≠ Context Window

Attention weighs relationships among available tokens. A context window is the amount of input a model can process.

Remember this

Attention mathematically weighs relationships between pieces of information.

Video

Video coming soon

No verified video asset is available for this topic yet.

↑