Exercises — Gated Recurrent Units (GRU)
Throughout, we use the four GRU equations exactly as the parent defined them. Let me restate the vocabulary so every symbol here is earned before use:

The picture above is the mixing law of Step 4 drawn as a slider: is the position of the knob between "old memory" and "new candidate".
Level 1 — Recognition
L1.1 In the equation , which term carries the old memory, and what weight multiplies it?
Recall Solution
The old memory is , multiplied by . The candidate gets the complementary weight . Because the two weights add to , this is a convex combination — a weighted average that never overshoots either input.
L1.2 A GRU cell has (in every coordinate). What is ?
Recall Solution
. The cell copies the old state forward unchanged — the "remember everything" extreme.
L1.3 Which gate uses rather than , and why does that matter?
Recall Solution
The candidate uses . Its output lives in , so the candidate is a signed proposal (memory content can be positive or negative). The two gates use because they are fractions of keeping — they must live in .
Level 2 — Application
For L2 use these tiny 1-D numbers (single hidden unit, so is ordinary multiplication).
L2.1 Given , , . Compute .
Recall Solution
The new state leans toward the positive candidate because we accepted of it.
L2.2 A pre-activation into the update gate is . Compute , then use to find .
Recall Solution
High means we keep the (zero) old state, so almost none of the strong candidate enters.
L2.3 Reset gate , old state . What value does the candidate network see in place of ?
Recall Solution
It sees . The reset gate has almost erased the past inside the candidate computation only — the raw still survives untouched in Step 4.
Level 3 — Analysis
L3.1 Show that if for every timestep, the backprop factor along the carried term approaches , and explain why that defeats vanishing gradients.
Recall Solution
Differentiate the carried term (treat as a gate value near ): Over steps the chain rule multiplies these: the gradient scales like . Compare a plain RNN, whose factor is and typically , giving exponentially. The near- product is the gradient highway the parent note mentioned.

L3.2 Two candidate models: Model A always outputs ; Model B learns per timestep. Which is strictly less expressive, and give one sentence type where the difference bites?
Recall Solution
Model A is strictly less expressive: it is forced to blend old and new every step, unable to fully preserve a subject across many filler words. In "Alice … [many clauses] … was tired", Model B can push during filler to keep "Alice", while Model A leaks of the identity each step, decaying it as after words.
L3.3 In L2.1 you got . Recompute with the reset gate acting in Step 4 by mistake (multiply by there) and state numerically how wrong the buggy answer is.
Recall Solution
Buggy: Correct was . The bug shifts the state by — a error on the mixed part, precisely because it double-applies the reset.
Level 4 — Synthesis
L4.1 A 2-D GRU unit. Reset gate , old state . Compute the vector fed to the candidate, i.e. .
Recall Solution
Coordinate 1 is fully reset (starts fresh); coordinate 2 keeps its full history. This per-dimension gating is the whole point of using a vector gate, not a scalar.
L4.2 Design a pattern (in words) that makes a GRU behave like a plain feed-forward layer that ignores the past entirely. Then write the resulting .
Recall Solution
Force for all . Then If additionally , then depends only on — a memoryless nonlinear layer. So GRU contains the plain layer as a limiting case.
L4.3 Numeric synthesis. One unit. Inputs give at three filler steps then at the decision step. Start (encodes "Alice"). At every filler step the candidate is ; at the decision step the candidate is . Track .
Recall Solution
Filler steps (): . Decision step (): The identity signal survives () through fillers, then the low- decision step lets the strong new candidate flip the state to .
Level 5 — Mastery
L5.1 Prove the update gate couples forget and input behaviour: show that increasing "keep-old" necessarily decreases "accept-new", unlike LSTM's independent .
Recall Solution
The old weight is ; the new weight is . Their sum is , a constant. So : any rise in keep-old is an exactly equal fall in accept-new. In LSTM, and come from separate sigmoids with no such constraint — you can keep old and write new fully, at extra parameter cost. GRU trades that freedom for ~ fewer parameters (see 3.5.03-Long-Short-Term-Memory-(LSTM)).
L5.2 Parameter counting. Hidden size , input size . Count trainable parameters in the GRU (weights + biases for all three of ). Then count an LSTM's four gates () and give the GRU/LSTM ratio.
Recall Solution
Each weight matrix is , plus a bias vector of . Per gate: .
- GRU (3 matrices): .
- LSTM (4 matrices): .
- Ratio exactly → GRU has fewer parameters, confirming the parent's claim.
L5.3 Limiting-behaviour completeness. Fill the table of extreme gate settings and name each regime. Cases: , , .
Recall Solution
| becomes | Regime | ||
|---|---|---|---|
| any | Freeze: copy memory, ignore input | ||
| Full refresh with context: plain RNN update | |||
| Reset: memoryless, input-only |
These three corners span the behaviour space; everything a GRU does is a smooth, per-dimension blend between them. This links forward to how attention removes gating entirely — see 3.6.01-Attention-Mechanism.
Recall Self-test summary
high means ::: keep the old state, reject the new candidate The reset gate acts only inside ::: the candidate (Step 2), never in Step 4 Backprop carry factor per step is ::: , so long-memory needs GRU-to-LSTM parameter ratio is ::: (25% fewer) Prerequisite to revisit ::: 3.5.01-Basic-RNN-Architecture
See also: 3.5.06-Bidirectional-RNNs · Hinglish version.