Visual walkthrough — The attention mechanism intuition
We will translate the tiny sentence "Je suis étudiant" → "I am a student" the whole way through, because a small concrete case is easier to see than symbols.
Step 0 — The problem we are trying to fix

WHAT the picture shows: three encoder boxes producing three hidden vectors, all funneling into one thin pipe (the fixed context vector) before the decoder.
WHY it fails: the pipe is a fixed size. A 3-word sentence and a 50-word sentence both get the same thickness of pipe. Long sentences overflow. (See also Gradient flow in deep networks for why long paths are hard to train.)
The plan: instead of one pipe, let the decoder reach back and look at each encoder vector directly, mixing them freshly at every output step.
Step 1 — The raw materials: encoder states
For our sentence we get three vectors:

WHAT the picture shows: three coloured arrows, one per input word — these are our raw ingredients. Attention never rewrites them; it only decides how much of each to use.
WHY keep all three: the failure in Step 0 was throwing and away and keeping only . Attention keeps the whole shelf of ingredients available.
Step 2 — The decoder's question: state
At the moment we are about to produce output word , the decoder holds . Think of as a question: "Given what I've said so far, which input word do I need next?"

WHAT the picture shows: the decoder having just said "I", now holding and looking back at the shelf of , asking "who's next?"
WHY and not : we are about to build , and we will need the answer to this question to build it. So does not exist yet. We must ask using the state we already have, . This ordering is the Bahdanau convention.
Step 3 — Scoring: how well does each answer the question?
We now compare the question against each ingredient and produce a single number — a score — saying "how relevant is input word right now?"

WHAT the picture shows: the question and one ingredient both being projected into a shared plane, added, bent by , then flattened to a single dot on a number line — the score.
WHY two separate matrices: and may have different lengths (dimensions and ). You cannot add vectors of different lengths. and first map both to the same length , then addition makes sense.
WHY and not just addition: pure addition can only detect "point in the same direction" matches. The task "does this ingredient answer this question?" is subtler, so we let a nonlinearity learn it.
For our example at (producing "am"), suppose the three scores come out:
Step 4 — Softmax: turn scores into a focus distribution
Scores are unbounded and don't sum to anything meaningful. We want a set of weights that behave like percentages of attention: each between 0 and 1, all summing to 1.

WHAT the picture shows: the three flat scores on the left; after -and-normalise they become three bars of a probability distribution summing to 1 — a tall bar over "suis".
Working the numbers for our example:
WHY this makes sense: "am" is the translation of "suis", and 73% of the focus landed on "suis". The model found that alignment.
Step 5 — The context vector: a custom-mixed summary
Now we use the weights to build one vector — a fresh summary of the input, tailored to this exact output step.
For our step ():

WHAT the picture shows: the three ingredient arrows scaled to their weights (a short one, a long one, a short one) then summed tip-to-tail into one resulting arrow that leans heavily toward .
WHY a weighted sum and not just "pick the biggest": picking the single top word is a hard choice — it has no smooth slope for learning to follow. A weighted blend is a soft lookup: nudging a score slightly nudges the blend slightly, so gradient-based training can improve it. (This soft/smooth property is what makes attention trainable — compare Gradient flow in deep networks.)
Step 6 — Feed context back into the decoder
The blend finally lets the decoder move forward one step.

WHAT the picture shows: entering the decoder cell twice — once into the state update () and once into the output ().
WHY twice: once to decide what to remember (state), once to decide what to say right now (output). Empirically both help.
And repeat: with now built, we loop back to Step 3 for step — new question, new scores, new focus, new context.
Step 7 — Edge and degenerate cases
Never let the reader hit a scene we did not show.

WHAT the picture shows: four small attention heatmaps side by side — uniform (flat grey), sharp diagonal, single hot cell, and anti-diagonal — one per case above.
The one-picture summary

WHAT the picture shows the whole pipeline in one flow: the question meets each ingredient → a score → softmax bars → weighted sum → back into the decoder to produce and → loop.
Recall Feynman retelling — say it in plain words
The decoder just finished saying a word, and it holds a little "state" that carries a question: what do I need next? On a shelf sit summaries of every input word — one arrow each. We hold the question up against each arrow and read off a number: how well does this arrow answer the question? Those numbers are raw, so we run them through softmax, which turns them into percentages that add up to 100. Now we build one custom arrow: take each shelf-arrow, shrink it to its percentage, and add them all up. The word that scored highest dominates this new arrow — that's the context. We hand the context to the decoder, which uses it both to update its memory and to pick the next word. Then it asks a fresh question and we do it all again. No book got squeezed into one sentence; the whole book stays open, and at every step we glance at exactly the page we need.
Recall Symbol checklist
::: encoder summary of input up to word ::: decoder state before producing output word — carries the "question" ::: raw relevance score of input word for output step (unbounded) ::: attention weight — focus fraction, in , summing to 1 over ::: context vector — the weighted blend
For the fully-parallel, RNN-free version of exactly this idea, continue to Transformers and self-attention.