๐Ÿ”ฅLimited Offer: Get 50% OFFon AI & Full Stack Courses๐Ÿ”ฅ
Back to Deep Learning Notes
Topic #231

GRU Reset Gate

The reset gate is GRU's second and final gate โ€” it controls how much of the previous hidden state gets used when computing the new candidate content, letting the network effectively "start fresh" when the old state isn't relevant to what's coming next.

Formula

\[ \mathbf{r}_t = \sigma(\mathbf{W}_r[\mathbf{h}_{t-1}, \mathbf{x}_t] + \mathbf{b}_r) \]

Same sigmoid-gated pattern as every other gate covered so far โ€” its distinct role becomes clear in how it's actually used, in the candidate computation:

\[ \tilde{\mathbf{h}}_t = \tanh(\mathbf{W}_h[\mathbf{r}_t \odot \mathbf{h}_{t-1}, \mathbf{x}_t] + \mathbf{b}_h) \]

Notice \(\mathbf{r}_t\) multiplies \(\mathbf{h}_{t-1}\) before it's used to compute the candidate โ€” if \(\mathbf{r}_t\) is close to 0, the candidate computation effectively ignores the previous hidden state almost entirely, computing new content based mostly on the current input alone.

What This Enables โ€” "Forgetting" Before Proposing

This is subtly different from the update gate's role. The update gate (previous note) decides how much of the final blended hidden state comes from old vs. new information. The reset gate decides how much the old hidden state influences the computation of the new candidate itself โ€” letting the network propose genuinely fresh content, largely uninfluenced by potentially irrelevant past context, when a reset is warranted (for instance, at a clear sequence boundary, like the start of a new sentence).

Numerical Example

\(r_t = 0.1\) (mostly reset โ€” largely ignore the old hidden state for this candidate), \(h_{t-1}=0.4\): \(r_t \odot h_{t-1} = 0.1 \times 0.4 = 0.04\) โ€” a heavily attenuated version of the old state feeds into the candidate computation, compared to the full \(0.4\) that would be used if \(r_t\) were close to 1.

Code

import torch

h_prev = torch.tensor([0.4, -0.2])
x_t = torch.tensor([1.0])

r_t = torch.tensor([0.1, 0.9])   # a hypothetical per-dimension reset gate
reset_hidden = r_t * h_prev
print(reset_hidden)   # tensor([0.0400, -0.1800]) -- dimension 1 heavily attenuated, dimension 2 barely changed

combined_for_candidate = torch.cat([reset_hidden, x_t])
# this combined vector is what feeds into the candidate computation, NOT the raw h_prev

Full Assembly Preview

Together, the reset gate (shaping what goes into the candidate) and the update gate (blending old state with the candidate into the final output) give GRU its complete gating behavior with just two gates instead of LSTM's three โ€” the full set of equations, assembled together, is the subject of the next note.

Common Mistakes

  • Confusing the reset gate with the update gate โ€” the reset gate affects the candidate computation (what new content gets proposed); the update gate affects the final blend (how much of that proposal actually gets used versus the old state).
  • Applying the reset gate to the final hidden state update instead of specifically within the candidate computation โ€” its multiplicative effect on \(\mathbf{h}_{t-1}\) is scoped specifically to computing \(\tilde{\mathbf{h}}_t\), not to the update-gate blending step.

Interview Relevance

Q: "What's the difference between GRU's reset gate and update gate?" The reset gate controls how much of the previous hidden state influences the computation of the new candidate content โ€” a reset value near 0 lets the candidate be computed largely fresh, ignoring past context. The update gate controls how much of that candidate actually replaces the old hidden state in the final output โ€” these are two distinct decisions applied at two different points in the computation.

Practice Question

In what kind of situation might you expect a well-trained GRU's reset gate to output a value close to 0?

Want to go beyond the notes?

Join CodingNow 2.0's Deep Learning course โ€” live mentorship, real projects, and 100% placement support.

Enroll Now โ€” Free Demo Available

GRU Reset Gate โ€“ FAQs

Quick answers about learning GRU Reset Gate in Deep Learning.

This free note from CodingNow 2.0 explains GRU Reset Gate in Deep Learning โ€” concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Deep Learning topic on CodingNow 2.0, including GRU Reset Gate, is 100% free with no signup required.
With focused practice, most students grasp GRU Reset Gate in 1โ€“3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) โ€” expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now