3.5.5 · D5Sequence Models

Question bank — Gated Recurrent Units (GRU)

1,724 words8 min readBack to topic

The machinery, stated in full

Nothing on this page uses a symbol we haven't spelled out. Here are the four GRU equations with every piece named:


True or false — justify

GRU has three gates just like LSTM.
False — GRU has two gates ( update, reset). LSTM's forget and input gates are fused into the single , so there is no separate output gate either.
GRU keeps a separate cell state alongside .
False — GRU drops the cell state entirely; there is only one state vector that plays both roles. That is the whole "LSTM-lite" saving.
Because comes from a sigmoid, every slot of is a single number between 0 and 1.
True — squashes any real number into , and it acts slot-by-slot, so each of the dimensions gets its own independent gate value.
If (all slots) then equals exactly.
True — plug in: . The candidate is completely discarded and memory is copied through untouched.
If (all slots) then equals exactly.
True — . The old memory is fully overwritten by the candidate.
The reset gate appears in the final blend equation for .
False — only appears inside the candidate . The final line uses only .
The weights and are two independent learned quantities.
False — they are coupled: once is known, is fixed. This coupling is exactly how GRU compresses LSTM's separate forget/input gates into one.
GRU always outperforms LSTM.
False — GRU has fewer parameters and often trains faster, but on tasks needing very fine-grained memory control LSTM can win. "Nearly as well, usually cheaper" is the honest claim, not "always better."
Every slot of can have a different value at the same timestep.
True — is a vector; dimension 5 might be (keep) while dimension 6 is (replace). The gate is per-feature, not one scalar for the whole state.

Spot the error

Someone writes . What's wrong?
The and are swapped. The standard convention has multiply the old state ; here would mean "take the candidate," inverting the whole "keep-vs-write" meaning.
Someone writes the candidate as . What's missing?
The reset gate. It should be inside, not raw . Without the network loses its ability to ignore irrelevant past when forming a candidate.
Someone claims lives in because it's a gate.
is not a gate — it comes from , so it lives in and can be negative. Only and (from ) are gates in .
Someone writes , feeding the reset-gated state into .
Wrong input. The correct form is using the raw concatenation, independently of . Only the candidate uses .
Someone says "" in is a dot product returning one number.
No — is the Hadamard (element-wise) product, returning a vector of the same length. A dot product would collapse the state to a scalar and destroy the memory.
Someone claims the reset gate multiplies the current input, writing . What's wrong?
The reset gate multiplies only , never . The correct form is — the current input always enters at full strength; resetting the present input would make no sense.

Why questions

Why is called a convex combination of and ?
Because the two weights and are both in and sum to exactly 1. Any such weighted average is a convex combination — is guaranteed to lie "between" the old state and the candidate.
Why does a high help fight the vanishing-gradient problem?
The term contributes to the Jacobian . When the gradient passes back nearly unscaled, so over steps it scales like instead of decaying like . See 3.5.02-Vanishing-and-Exploding-Gradients.
Why use sigmoid for the gates but tanh for the candidate?
Gates need to answer "how much?" — a fraction in , so is perfect. The candidate is a proposed state value that should be able to push memory positive or negative, so it needs the symmetric range of .
Why does GRU have ~25% fewer parameters than LSTM?
GRU uses 2 gate weight matrices () instead of LSTM's 3, and has no separate cell-state pathway. Fewer gates and one merged state vector means fewer and to learn.
Why can't a plain basic RNN learn long-range dependencies the way GRU can?
A basic RNN multiplies the state by the same weight/derivative every step, so gradients shrink (or blow up) exponentially. GRU's gated pathway gives a near-identity route the gradient can travel unscaled.
Why does merging forget and input into one gate not cripple the model?
In LSTM the forget and input gates are often anti-correlated anyway ("forget old ⇔ write new"). GRU bakes that correlation in via vs , losing a little flexibility for a big simplicity/parameter win.
Why is the reset gate useful even when the update gate could also gate memory?
They act at different places. shapes what candidate gets proposed (can the past even contribute?), while decides how much of that candidate to accept afterwards. Resetting before the candidate lets GRU forget history for the proposal yet still keep old memory in the final blend if is high.

Edge cases

What happens if for every slot?
The candidate becomes — it depends only on the current input . The network proposes a fresh state as if it had amnesia about the past, useful right after a topic change.
What happens if for every slot, for many steps in a row?
The state is copied through unchanged: . Memory is perfectly preserved and the current inputs are ignored — this is the "gradient highway" that carries information (like a name) across long gaps.
Can while simultaneously ?
Yes, and the result is subtle: a fresh candidate is computed (ignoring the past), but then throws that candidate away and keeps . So the wasted computation of has zero effect on . The gates are independent, so contradictory-looking combinations are legal.
What is at the very first timestep, , before any real memory exists?
is initialised (usually to zeros). Then , so the first state is just a scaled candidate — sensible, since there is no history to keep.
If a slot of is exactly , what is that dimension doing?
It takes a plain 50/50 average of the old value and the candidate for that feature — neither committing to memory nor fully overwriting. Real trained gates rarely sit exactly here; they push toward 0 or 1 to make crisp keep/write decisions.
Does the update gate directly control the output the way LSTM's output gate does?
No. GRU has no output gate — is exposed directly as both the state and the output. only controls how is formed, not how it is read out. This differs from 3.5.03-Long-Short-Term-Memory-(LSTM).

Related: 3.5.06-Bidirectional-RNNs · 3.6.01-Attention-Mechanism · यही page Hinglish में