Gated Recurrent Unit (GRU)

Machine Learning
Introduced by
Cho, K. et al.
Year
2014
Type
Gated recurrent neural network unit

What does it do?

The Gated Recurrent Unit (GRU) is a recurrent neural network cell that uses an update gate and a reset gate to control how information from earlier steps of a sequence is kept or overwritten.

It was introduced by Cho and colleagues in 2014 within an RNN encoder–decoder framework. Its design is simpler than the LSTM's, using two gates and no separate memory cell.

The intuition behind the method

A plain recurrent network struggles to retain information across long sequences, because its signal fades or becomes unstable as it is passed step by step. The GRU adds gates that learn, at each time step, how much of the past state to keep and how much new information to absorb. With two gates instead of the LSTM's three, it can carry memory across long spans with fewer parameters and a simpler structure.

History

Kyunghyun Cho and colleagues introduced the GRU in 2014 within an RNN encoder–decoder framework for statistical machine translation (Cho et al., 2014). In the same year, Chung, Gulcehre, Cho and Bengio presented an empirical evaluation of gated recurrent neural networks on sequence modelling, comparing GRUs with LSTM units. That work was a NIPS 2014 Deep Learning Workshop paper, also available as an arXiv preprint (arXiv:1412.3555) (Chung et al., 2014).

When to use it

Choose a GRU for prediction, forecasting or classification when the data are genuinely ordered sequences, such as time series, longitudinal records or text, and when dependencies across many steps appear to matter. It is a reasonable option when a lighter gated model than the LSTM is preferred. Do not use it when observations have no meaningful order, such as ordinary tabular rows, because the recurrence then has no real sequence to model. The amount of data needed depends on sequence length, dimensionality and signal-to-noise, so no single sample-size rule applies. Small sequence datasets carry a high overfitting risk, so a simpler non-recurrent baseline should be compared before concluding that the recurrent structure helps.

Limitations and considerations

  • The hidden state is a fixed-size vector, so all relevant past information must be compressed into it, and very long dependencies may still be lost.
  • It requires genuinely ordered input; without a meaningful order, the recurrence has no interpretable role.
  • Its gates and weights yield no explicit coefficients, so the effect of an individual input on a prediction is hard to read directly.
  • Results can vary with sequence length and training choices such as hidden size and learning settings, so they should be checked on held-out data.
  • Each hidden state depends on the previous one, so computation must proceed step by step over time. This prevents parallel processing across time steps, limits the efficiency gained from GPUs, and makes training time grow with sequence length.
  • Gating reduces, but does not remove, vanishing-gradient problems on long sequences, so very long dependencies can still be hard to learn; gradient clipping and careful tuning of learning settings are commonly used in practice.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Gating lets the unit learn, at each time step, how much past state to keep and how much to overwrite, which addresses the fading of signal in a plain recurrent cell over long sequences.
  • It uses two gates and no separate memory cell, so it has fewer parameters than an LSTM with the same hidden size.
  • It makes no normality assumption about the data; the requirement is that the inputs form ordered sequences.
  • It suits ordered sequences of continuous values or text, such as time series and longitudinal records.

Applications

  • Forecasting and prediction on time-series and longitudinal sequences.
  • Sequence classification over continuous-valued or text inputs.
  • Modelling longer-range dependencies where a gated model comparable to an LSTM, but with fewer parameters, is wanted; GRUs often perform comparably to LSTMs on some sequence tasks.
  • A lighter recurrent baseline before reaching for heavier sequence models.

How it works

How it works

1

Notation: x_t is the input at step t, h_t the hidden state, σ the logistic sigmoid, tanh the hyperbolic tangent, ⊙ the element-wise product, and W and U the weight matrices; the equations as written omit bias terms. At each time step the unit computes two gates from the current input and the previous hidden state, each passed through a sigmoid so that its values lie between zero and one. The update gate z_t sets how much of the previous state is kept versus replaced. The reset gate r_t sets how much of the previous state is used when forming a new candidate state.

Formula
z_t = \sigma(W_z x_t + U_z h_{t-1}), \quad r_t = \sigma(W_r x_t + U_r h_{t-1})
2

The candidate state is computed with a tanh from the current input and the previous state multiplied element-wise by the reset gate. When r_t is near zero, the past contributes little and the candidate reflects mainly the new input; when r_t is near one, the prior state shapes the candidate fully.

Formula
\tilde{h}_t = \tanh(W x_t + U(r_t \odot h_{t-1}))
3

The new hidden state is an element-wise interpolation between the previous state and the candidate, weighted by the update gate. When z_t is near zero, the previous state passes through largely unchanged, which lets information persist over many steps; when z_t is near one, the state is largely replaced by the candidate.

Formula
h_t = (1 - z_t) \odot h_{t-1} + z_t \odot \tilde{h}_t

Common pitfalls

  • Splitting sequences at random rather than by time lets future values leak into training and inflates apparent accuracy.
  • Treating unordered tabular rows as a sequence imposes an order that does not exist in the data.
  • Judging the model on its training sequences alone; a held-out set, ideally later in time, is needed to assess generalisation.
  • Applying a GRU to a small dataset where it mainly memorises the training sequences.

Frequently asked questions

How does a GRU differ from an LSTM?

A GRU uses two gates (update and reset) and a single hidden state, whereas an LSTM uses three gates and a separate memory cell. The GRU therefore has fewer parameters and a simpler structure, which can reduce training cost; the speed difference depends on the implementation and task.

How much data does a GRU need?

It needs sequential data. The amount required depends on sequence length, dimensionality and signal-to-noise, so there is no single validated minimum sample size. Small sequence datasets carry a high overfitting risk, so compare against a simpler non-recurrent baseline and check performance on a held-out part of the series. For ordinary tabular data a recurrent network is not the appropriate tool.

Does GRU assume normally distributed data?

No. Like other recurrent neural networks it makes no normality assumption; what it requires is genuinely sequential input such as a time series or longitudinal sequence.

When should I prefer a GRU over a heavier model?

Choose a GRU when the data are ordered sequences in which long-range dependencies seem important, you want a model with fewer parameters than an LSTM, and you have enough sequential data to limit overfitting.

Related methods

Sources

  1. Cho, K. et al. (2014). Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation. EMNLP.

    Open publication reference
  2. Chung, J., Gulcehre, C., Cho, K. & Bengio, Y. (2014). Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling. NIPS 2014 Deep Learning Workshop. arXiv:1412.3555

    Open publication reference
  3. BATDI-BASARAN-nitel-arastirmada-yapay-zeka-II, p. 159