A picture has no order, but a sentence does. In Part 3, CNNs learned to see. Here we look at the network that learned to read one word at a time, and remember what came before.
1. One network, reused at every step
An RNN is one small network with a loop. At each step it reads the next input and its own last hidden state, then hands the new hidden state forward. The loop turns a fixed network into a memory.
2. The hidden state carries the memory
Feed in “the cat sat on the” and the network guesses “mat”. It can only do that because the hidden state still holds “cat”. Each step adds one word to what it remembers.
3. The signal fades as it travels back
Training an RNN means sending the error back through every step, a method called backpropagation through time. Each step multiplies the gradient by a number below 1, so after 10 steps the signal is about 1,000 times smaller. In 1994 Bengio, Simard and Frasconi proved why: a plain RNN cannot learn links across long gaps.
4. Eleven years from a loop to a gate
Jordan drew the first loop in 1986. Elman showed in 1990 that the hidden state could learn word order. In 1994 the vanishing gradient was named, and in 1997 Hochreiter and Schmidhuber answered with the LSTM.
Key takeaway
An RNN reads a sequence one step at a time and keeps what it has seen in its hidden state. That loop gave networks a memory, and its fading gradient showed exactly what the next architecture had to fix.
What is Next in This Series
Next is Part 5, LSTM, Visualized, where gates learn what to keep and what to forget. To see where the loop came from, read Part 2, The Multilayer Perceptron: How Backprop Cracked XOR. For how these ideas grew into modern LLMs, see How LLMs Actually Work.
Originally published on LogicStack. Run the code examples right in your browser with our free interactive Python and SQL playgrounds — no setup, no sign-up.
Top comments (0)