← Back to Deep Learning Mind Map
🧠 Deep LearningID: gru

GRU

🎯Core Definition
GRU (Gated Recurrent Unit) is a simplified LSTM variant with only two gates. The update gate zt=σ(Wz[ht−1,xt]+bz)z_t = \sigma(W_z[h_{t-1}, x_t] + b_z) decides how much history to keep vs how much new information to write; the reset gate rt=σ(Wr[ht−1,xt]+br)r_t = \sigma(W_r[h_{t-1}, x_t] + b_r) decides how much of the history to discard; the candidate hidden state is h~t=tanh⁡(Wh[rt⊙ht−1,xt]+bh)\tilde{h}_t = \tanh(W_h[r_t \odot h_{t-1}, x_t] + b_h); and the output is ht=(1−zt)⊙ht−1+zt⊙h~th_t = (1 - z_t) \odot h_{t-1} + z_t \odot \tilde{h}_t (⊙\odot elementwise). Compared with LSTM: there is no separate cell state, the forget and input gates merge into the update gate, and weights drop from 4 sets to 3 (roughly 25% fewer parameters). When zt≈0z_t \approx 0, ht≈ht−1h_t \approx h_{t-1} — the same additive shortcut as LSTM's ft≈1f_t \approx 1 that keeps long-range memory; when rt≈0r_t \approx 0, the candidate ignores history and depends only on the current input, capturing short-term dependencies.
💡Use Cases
the recurrent unit of choice for parameter-sensitive, small-data, or real-time inference settings (speech, forecasting, lightweight sequence models); in interviews it is a staple comparison question — GRU vs LSTM formulas, parameter count, capacity and training efficiency.
⚡Key Problems Solved
LSTM's four gated components are redundant on most tasks; GRU achieves nearly the same long-term memory with 3 weight sets — about 25% fewer parameters and cheaper per-step computation, so it trains faster and overfits less on small data and edge devices. The cost: no dedicated cell state, so stored information is coupled with the output in one hth_t, a coarser memory granularity.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of GRU.
Use Cases
In production engineering, what are the primary use cases for GRU and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Write out GRU's update gate ztz_t, reset gate rtr_t, candidate h~t\tilde{h}_t and output ht=(1−zt)ht−1+zth~th_t = (1 - z_t)h_{t-1} + z_t\tilde{h}_t; explain the role of each gate.
2
Structural differences: why does GRU have ~25% fewer parameters (3 vs 4 weight sets)? How does the absence of a cell state affect memory granularity?
3
What happens when zt≈0z_t \approx 0 (ht≈ht−1h_t \approx h_{t-1} additive shortcut)? How does this correspond to LSTM's forget gate ft≈1f_t \approx 1?
4
Role of the reset gate: when rt≈0r_t \approx 0 the candidate h~t\tilde{h}_t depends only on the current input — why does this help capture short-term dependencies and discard irrelevant history?
5
When to pick GRU over LSTM (data size, parameter budget, inference latency)? Why is the accuracy gap between them usually small on typical tasks?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "GRU"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardLSTM GatingNext Card →SSM & Mamba

🔗 More Deep Learning Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/DL/card/gru
中文速览与面试要点

GRU (GRU)

定义: GRU(Gated Recurrent Unit)是 LSTM 的简化变体, 只有两个门。更新门 z_t = (W_z[h_t-1, x_t] + b_z) 决定保留多少历史、写入多少新信息; 重置门 r_t = (W_r[h_t-1, x_t] + b_r) 决定多大程度丢弃历史; 候选隐藏态 h_t = (W_h[r_t h_t-1, x_t] + b_h); 输出 h_t = (1 - z_t) h_t-1 + z_t h_t( 逐元素乘)。相比 LSTM: 无独立细胞状态, 遗忘门与输入门合并为更新门, 权重从 4 组减到 3 组(参数约少 25%)。更新门 z_t 0 时 h_t h_t-1, 与 LSTM 的 f_t 1 一样提供加性直通路径保持长程记忆; 重置门 r_t 0 时忽略历史、仅由当前输入生成候选, 用于捕捉短期依赖。 使用场景: 参数敏感/数据量小/实时推理场景的首选循环单元(语音、时序、轻量序列模型); 面试高频对比题: GRU vs LSTM 的公式差异、参数量、表达能力与训练效率。 解决的问题: LSTM 的 4 个门控部件在多数任务上冗余, GRU 用 3 组权重实现几乎相当的长期记忆能力——参数量减少约 25%、单步计算更少, 在小数据与移动端场景训练更快、更不易过拟合; 代价是没有独立细胞状态, 信息存储粒度略粗(历史与输出耦合在同一 h_t 中)。

核心要点

  • 默写 GRU 更新门 z_t、重置门 r_t、候选 h_t 与输出 h_t = (1 - z_t)h_t-1 + z_t h_t 的公式, 并解释每个门的职责。
  • GRU vs LSTM 的结构差异: 为什么 GRU 参数量约少 25%(3 组 vs 4 组权重)? 没有细胞状态对记忆粒度有什么影响?
  • 更新门 z_t 0 时 GRU 发生了什么(h_t h_t-1 的加性直通)? 这与 LSTM 遗忘门 f_t 1 的机制有何对应?
  • 重置门的作用: r_t 0 时候选 h_t 只依赖当前输入, 这为什么有利于捕捉短期依赖和丢弃无用历史?
  • 何时选 GRU 而非 LSTM: 数据量、参数量预算、推理延迟等角度; 两者在常见任务上的精度差距为何通常很小?