What is a gated recurrent unit (GRU)?
A GRU is a recurrent neural network unit that controls information flow in its hidden state with two gates, update and reset, learning long dependencies better than a standard recurrent network.
It differs from Long Short-Term Memory in simplicity: LSTM uses three gates and a separate cell state, while a GRU works with two gates and a single hidden state, so it has fewer parameters. It gives results close to LSTM on many tasks; which is better depends on the data.
- Topic
- Machine learning, models and training
- Also known as
- Gated Recurrent Unit
- Origin
- 2014
How a gated recurrent unit (GRU) works
- At each time step the previous hidden state and new input are combined to compute gate values.
- The reset gate sets how much past information to ignore when computing the new candidate state.
- The update gate sets how much of the new state comes from the old state and how much from the candidate.
- The resulting hidden state passes to the next step and produces that step's output if needed.
In more detail
The update rule and the parameter advantage
At each step t, the reset gate scales how much of the previous hidden state feeds the candidate state, while the update gate interpolates between keeping the old state and adopting the new candidate. Because of this simplified two-gate structure, a GRU uses roughly 25% fewer parameters than an LSTM of the same hidden size (three weight-matrix sets instead of four).
Sequential training and constant-memory inference
A major limitation of classic GRUs, which also explains why Transformers overtook them in large-scale NLP, is sequential training: because each candidate state depends non-linearly on the previous hidden state, time steps cannot be parallelised across a sequence during training. By contrast, inference runs in O(1) memory per step, making GRUs highly efficient for real-time streaming once trained.
Modern descendants of gated recurrence
The core gated-recurrence idea of the GRU lives on in modern linear-time sequence models such as Google DeepMind's RG-LRU (Griffin/Hawk), xLSTM and gated state-space architectures (Mamba-2, Gated DeltaNet). By removing non-linear hidden-state transitions or pairing them with local sliding-window attention, these descendants achieve parallelisable training while keeping GRU-like constant-memory streaming.
Commonly confused terms
| Term | How it differs |
|---|---|
| Vanilla recurrent neural network | A vanilla RNN updates its hidden state directly at every step without gating, causing gradients to vanish or explode over long sequences; GRU adds multiplicative gates to retain long-range signals stably. |
Why a gated recurrent unit (GRU) matters for on-premises AI
In-house, a GRU is a small, fast option for time series tasks such as sensor readings, consumption data, transaction sequences and system logs. With fewer parameters it trains slightly faster than LSTM and needs less memory, running cheaply on edge devices and CPUs. Transformers have replaced it in large language models, while the idea of carrying a fixed-size state returns in long-context models through state space models.
An energy company trains a GRU-based time series model for grid load forecasting; consumption data stays in-house and the model updates its forecast every hour with new readings.
Common questions
What is the difference between GRU and LSTM?
LSTM uses three gates and a separate cell state. GRU has fewer parameters with two gates, performs similarly on most tasks and is slightly faster.
Is GRU always better than LSTM?
No. It is faster and lighter, but LSTM can do better on some tasks with long dependencies; the choice is made by testing on the organisation's own data.
Related terms
- Recurrent neural network (RNN)
- Long short-term memory (LSTM)
- AI time series forecasting
- AI Transformer
- AI state space model
Sources
- Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation, 2014
- Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling, 2014
In the glossary: Glossary, E to L