Backpropagation Through Time › Comparing BPTT Across RNN Variants
Language AI HandbookAll chapters Backpropagation Through Time › Comparing BPTT Across RNN VariantsOne section · Sections in this chapter11 / 15 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Once you understand BPTT for a vanilla RNN, it is informative to consider how the same algorithm behaves for LSTMs and GRUs. These architectures do not require a different training algorithm; they use BPTT exactly as described above. What they change is the structure of the forward computation, which in turn changes the structure of the Jacobians that appear in the backward pass.
BPTT in an LSTM
An LSTM maintains two state vectors at each timestep: the hidden state (sometimes called the output state) and the cell state (the memory). The key gradient path in an LSTM runs through the cell state, not the hidden state. The cell state update equation is:
where is the forget gate and is the input gate. The gradient of with respect to is simply : a diagonal matrix containing the forget gate values. Because forget gate values are squashed by a sigmoid into , this Jacobian is always diagonal and always has entries between 0 and 1. The forget gate is learned and can be set close to 1.0 for dimensions that need long-term memory. When the forget gate is near 1, gradients flow backward through the cell state with almost no attenuation.
This is a fundamentally different gradient regime from the vanilla RNN, where the recurrent Jacobian involves both the tanh derivative (always in ) and a full matrix that can have large or small spectral properties depending on training. The LSTM essentially replaces that matrix product with a learned diagonal gate, giving the model explicit control over gradient flow.
BPTT in a GRU
A Gated Recurrent Unit (GRU) achieves similar benefits with a simpler structure, maintaining only one state vector. The update rule involves a reset gate and an update gate :
The gradient of with respect to has a component proportional to . When the update gate is close to 0, this component is close to 1, passing gradients backward with minimal attenuation. The GRU achieves a similar constant-error-carousel effect to the LSTM through the interpolation structure of the update gate.
Both LSTMs and GRUs still use BPTT. The benefit they provide is architectural: by creating gradient paths that do not inevitably pass through full matrix products and saturated nonlinearities, they allow BPTT to compute meaningful gradients even at large distances from the output. The training algorithm is unchanged; the model is designed to be more amenable to training.