For a GRU with ht=(1−zt)⊙ht−1+zt⊙h~t, what is the direct term in ∂ht/∂ht−1, and why does a small zt let gradients survive many steps? If zt=0.01 at every step, what does that direct path contribute over 100 steps?

Sequence models and transformers, Recurrent networks
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can find the identity-like path in the GRU Jacobian and compare it with a vanilla RNN.

Key idea

∂ht∂ht−1=diag(1−zt)+(terms through zt,h~t). When zt≈0 the first term is nearly I, so the state is copied.

Steps

  1. Write ht as a function of ht−1 in three ways: directly, through zt, and through h~t (and rt).
  2. The direct path gives diag(1−zt), since ∂[(1−zt)⊙ht−1]/∂ht−1=diag(1−zt) when holding zt fixed.
  3. The other paths give terms such as diag(h~t−ht−1) diag(zt(1−zt))Uz+diag(zt) ∂h~t/∂ht−1. These involve weight matrices and sigmoid or tanh derivatives, which can shrink.
  4. Across T steps the gradient contains the product ∏tdiag(1−zt). If the model learns zt near 0, this product is near I, so error signals pass through unchanged. This is the same idea as the LSTM forget gate near 1.
  5. Numbers: with zt=0.01, each step multiplies the direct path by 0.99. After 100 steps, 0.99100=0.366.
  6. Compare: a vanilla RNN whose per-step factor is 0.9 gives 0.9100≈2.7×10−5. So the gated path decays far more slowly.

Common mistakes

How long your answer should be

Half a page; 4–5 minutes.

Last checked on 4 December 2026.

Read this

Previous in Sequence models and transformers: How does the GloVe objective J=∑i,jf(Xij)(wi⊤w~j+bi+b~j−log⁡Xij)2 arise from the idea that meaning is carried by ratios of co-occurrence probabilities? What is the role of f?
Next in Sequence models and transformers: Count the matrix-multiply FLOPs of one transformer layer's forward pass for sequence length n=2048, model width d=1024 and feed-forward width dff=4d (one sequence, ignoring softmax, layer norm and biases). Which part dominates, and at what n does attention's n2 term equal the linear-in-n part?