Recurrent Neural Networks (RNN)
Networks that read sequences one step at a time, carrying a memory forward.
The idea
At each step the network combines the new input with its previous hidden state to produce a new hidden state, so information from earlier items can influence later ones. The same weights are reused at every step. Plain RNNs struggle to remember over long spans because gradients shrink as they are passed back.
hₜ = tanh(W·xₜ + U·hₜ₋₁ + b)
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- positive
- negative
- gate (taller = more open)
A plain RNN reuses one cell at every step, passing its memory (the circle) forward. The first input (1.5) is the thing worth remembering.
- step:
- 0
One memory unit unrolled across seven time steps. Try a bigger first input and compare the cells.
Step by step
- 1Start with a zero hidden state.
- 2Read the next input.
- 3Compute the new hidden state from the input and the old one.
- 4Optionally produce an output at each step.
- 5Repeat to the end of the sequence.
Where it is used
Time series, simple language and speech models.
Watch out for
Vanishing and exploding gradients; sequential processing is slow to train.