Gated Recurrent Unit (GRU)
A lighter LSTM with two gates and no separate cell state.
The idea
The update gate decides how much of the previous state to keep versus replace, and the reset gate decides how much of the past to use when proposing a new state. With fewer parameters than LSTM it trains faster and often performs similarly.
hₜ = (1 − z)·hₜ₋₁ + z·h̃ₜ
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)
The GRU has one state, but an update gate decides how much of the old state to keep. 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
- 1Compute the update gate z and reset gate r from the input and previous state.
- 2Propose a candidate state using the reset-scaled previous state.
- 3Blend old and candidate states with z.
- 4Pass the result on as the new hidden state.
Where it is used
Sequence tasks where speed and size matter.
Watch out for
Can underperform LSTM on tasks needing very long memory.