ANN Types: Recurrent (RNN)
A network with a short memory
A recurrent network is built for sequences: things that arrive one after another, where the past matters. A sentence, a week of temperatures, a melody. At each step the network sees the new item and a little hidden state — a memory of what it has already read — and it updates that memory before moving on.
A feedforward net treats every example as a bag of numbers with no order. If you gave it the words of a sentence in a pile, “the cat sat” and “sat the cat” would look the same. An RNN reads left to right (or through time), so the order can change the result.
An everyday picture is reading a story and holding a short summary in your head. Each new sentence updates the summary. You do not start from a blank mind at every line. Another picture is a running total: each new day adds something, and you carry the total forward.
The cost of that memory is that the same update is applied at every step. If the sequence is long, a signal has to travel back through many steps during training. Multiplied by a derivative a little less than one, again and again, the message can fade. That is the vanishing gradient in time, the same idea as on ANN: Gradient, just stretched along the sequence. LSTM and GRU were invented to ease that problem, with gates that decide what to keep.
A plain RNN is still a good first picture of sequence modelling: one step, one update, a little memory. For longer or more careful memory, turn the page.
See also
- ANN Types: Overview
- ANN Types: LSTM And GRU
- ANN: Gradient — why a repeated tiny slope can fade
- ANN: Evolution — RNNs and LSTM in the timeline