AI Fundamentals · Part 4 of 5
Video Part 4 of 5 0:42

Attention explained

How self-attention lets words talk to each other and update their meaning based on context.

Step 5 on the mapHow it works underneath →
Title card reading: Words have many meanings. Attention picks the right one.

An embedding gives each word one fixed position, and that is not enough, because words change meaning with the words around them. “Bank” on its own could be a river bank or a high street bank. Attention is the step where every word in a sentence looks at every other word and adjusts its own meaning to fit. Next to “river”, the position of “bank” shifts towards nature. Next to “loan”, it shifts towards money.

The same step is how a model works out what “it” refers to. In “the animal didn’t cross the road because it was tired”, attention connects “it” to “animal” rather than “road”, because tiredness goes with animals. Nobody wrote that rule down. The model learnt in training which words tend to belong together, and attention applies that at the moment of reading.

Attention runs many times over, in layers, and each pass refines the meaning a little more. It is also the reason a model can take a whole paragraph into account at once instead of reading one word at a time and half forgetting the start. That design, attention repeated over a whole passage, is the Transformer, the subject of the last entry in this series.

The line to keepEmbeddings give words meaning. Attention gives them context.

Transcript of the video

A static embedding puts every word in one fixed place. But words change meaning depending on the words around them.

Take the word 'bank'. In isolation, a model cannot tell if you mean a river bank or a money bank.

Attention lets words talk to each other. The word 'river' pulls 'bank' toward nature, updating its coordinates in real time.

It is also how models resolve pronouns, connecting 'it' to 'animal' rather than 'tired'.

Embeddings give words meaning. Attention gives them context. Together, they understand language.

Found this useful?

Subscribe for the next one, or tell me what you want explained. I take requests.