11 slides · speaker notes · the deck · present it
How a network remembers
Today one idea: a network that carries something from one word to the next. Everything else — LSTMs, the trouble with long sentences, even why recurrence is back in fashion — follows from that loop.
A feed-forward network has no yesterday
Feed a sentence to an ordinary network one word at a time and watch: each word goes in, a guess comes out, and nothing stays. 'The' after 'sat on' and 'The' at the start get the same answer. For language that is hopeless — what a word means depends on what came before it.
Language arrives in order, and the order matters.
Add a loop: the state
The fix is one arrow. Whatever the cell computed — we call it h, the state — goes back in with the next word. Two weight matrices: W for the new word, U for what we carried. The bars on the right are h: a handful of numbers that every word nudges.
Unrolled in time: one cell, copied
Draw the loop out in time and it becomes a chain. It is not five networks — it is one cell, the same W and U, used five times. That is why it takes a sentence of any length, and it is also the picture we need for training.
One cell, the same weights, as many steps as the sentence is long.
What the state holds
So what does h hold? Nobody tells it. Train it only to predict the next word, and look inside: most units flicker with every word, but some hold one fact for as long as it matters. 'The keys to the cabinet are' — the network has to remember 'keys' is plural across 'cabinet'. Linzen and colleagues showed LSTMs doing exactly that; Karpathy found cells that track open quotes.
Trained to predict the next word, a unit learns to wait for the verb.
Learning: backpropagation through time
To learn, we use the chain we just drew. Run forward, measure the error at the end, and send the blame back through every step — backpropagation through time. Look at the numbers: each step back multiplies the gradient by another factor.
Blame is passed back step by step — and every step multiplies it.
Why it forgets: vanishing and exploding gradients
Multiply by 0.9 thirty times and you have four per cent left; by 1.1 and you have seventeen times as much. That is the whole problem with plain RNNs: the error from a word thirty steps away either vanishes or blows up. Hochreiter saw it in 1991, Bengio and colleagues in 1994. Clipping tames the explosion; the vanishing needs a new cell.
Thirty steps back, the signal is gone — or it is everything.
LSTM: a memory with gates
The LSTM's answer: keep a second, separate memory — the belt on top — and change it only by adding. Three gates, each a small network with values between zero and one, decide: forget erases what is no longer needed, input writes what is new, output decides what the rest of the network gets to see. Along the belt the gradient is not squeezed at every step.
The memory is added to, not multiplied — so the signal can travel far.
Attention: look back instead of carrying
Then came a different idea: instead of squeezing everything into one state, let 'are' look back at every word and decide which ones matter — here, 'keys'. Attention started as help for recurrent translators in 2014; in 2017 the Transformer threw the recurrence away. The price: memory that grows with the length of the text.
Why carry everything, if you can look it up?
Recurrence returns
And now the loop is back. For very long inputs attention's growing memory hurts, and a fixed-size state looks good again. State-space models, Mamba, RWKV, xLSTM, even stripped-down 'minLSTM' — recurrent at heart, trained in parallel. The idea from 1990 still has legs.
Long contexts made the fixed-size state attractive again.
Remember the loop
If you remember one picture, make it the loop. The rest is what happens when you try to train it, and what people built when it did not work. Read Chris Olah's post on LSTMs tonight — it is the best fifteen minutes on the topic.