← Back to Deep Learning Mind Map
⚡Flashcard Drill➔
🧠 Deep LearningID: lstm

LSTM Gating

LSTM 门控
🎯Core Definition
LSTM (Long Short-Term Memory) solves the RNN long-term dependency problem with “three gates and one state”. Forget gate ft=σ(Wf[ht−1,xt]+bf)f_t = \sigma(W_f[h_{t-1}, x_t] + b_f), input gate it=σ(Wi[ht−1,xt]+bi)i_t = \sigma(W_i[h_{t-1}, x_t] + b_i), candidate memory c~t=tanh⁡(Wc[ht−1,xt]+bc)\tilde{c}_t = \tanh(W_c[h_{t-1}, x_t] + b_c); cell state ct=ft⊙ct−1+it⊙c~tc_t = f_t \odot c_{t-1} + i_t \odot \tilde{c}_t, output gate ot=σ(Wo[ht−1,xt]+bo)o_t = \sigma(W_o[h_{t-1}, x_t] + b_o), hidden state ht=ot⊙tanh⁡(ct)h_t = o_t \odot \tanh(c_t) (⊙\odot is elementwise product, [ht−1,xt][h_{t-1}, x_t] concatenation). The key is that the cell state is an additive path: ∂ct∂ct−1=ft\frac{\partial c_t}{\partial c_{t-1}} = f_t is a scalar gate instead of a matrix chain product, so when the forget gate is near 1 the gradient passes through almost unchanged over long distances — the core defense against vanishing gradients. Gating costs 4 weight sets on [ht−1,xt][h_{t-1}, x_t], i.e. roughly 4× the parameters of a vanilla RNN. xLSTM (2024) continues this line: sLSTM adds exponential gating with memory mixing, and mLSTM uses a matrix memory with a covariance update rule for higher capacity.
💡Use Cases
the standard answer for sequence modeling in the 2010s (MT, speech, forecasting); in interviews it appears mainly in comparison questions — LSTM vs GRU, LSTM vs Transformer, LSTM vs Mamba — with follow-ups on writing out the gate equations, analyzing the additive-path gradient, and forget-gate initialization.
⚡Key Problems Solved
RNN gradients multiply through ∏WTdiag(tanh⁡′)\prod W^T \mathrm{diag}(\tanh'), so long-term memory decays exponentially; LSTM replaces the multiplicative update with ct=ftct−1+itc~tc_t = f_t c_{t-1} + i_t \tilde{c}_t, turning the chain product into “keep by the gate + write by the gate”. With ft≈1f_t \approx 1 gradients propagate undiminished, making 100+-step dependencies learnable — at the cost of ~4× parameters and two activation computations, in exchange for trainable long-range memory.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of LSTM Gating.
Use Cases
In production engineering, what are the primary use cases for LSTM Gating and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Write out the LSTM gate equations (forget/input/output gates, candidate c~t\tilde{c}_t, cell state ctc_t, hidden state hth_t) and explain the role of each gate.
2
Why does LSTM mitigate vanishing gradients? Derive the additive path ∂ct∂ct−1=ft\frac{\partial c_t}{\partial c_{t-1}} = f_t and explain why gradients flow through long distances when ft≈1f_t \approx 1.
3
Why is the forget-gate bias initialized to a large positive value (bf≈1b_f \approx 1)? What happens if it saturates to 0 early (cell cleared, long memory lost)?
4
Compare LSTM vs GRU: GRU merges forget+input into an update gate and drops the separate cell state, cutting weights from 4 sets to 3; what is the capacity-vs-efficiency trade-off?
5
What does xLSTM (2024) improve: what problems do sLSTM's exponential gating & memory mixing and mLSTM's matrix memory & covariance update solve?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "LSTM Gating"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
🎯 Drill This Card Now➔
← Previous CardRNN & BPTTNext Card →GRU

🔗 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/lstm