LSTM Gate Equations › Summary
Language AI HandbookAll chapters LSTM Gate Equations › SummaryOne section · Sections in this chapter16 / 17 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
This chapter translated the intuition of LSTM gates into precise mathematics and working code. The key equations form a system where three gates control information flow through a memory cell.
The Gate Equations:
- Forget gate: decides what to discard from memory
- Input gate: decides how much new information to write
- Candidate: proposes new values to store
- Output gate: decides what to expose as output
The State Updates:
- Cell state: combines filtered memory with gated new information
- Hidden state: exposes filtered cell state as output
Parameter Count:
An LSTM cell has parameters, where is the input dimension (e.g., word embedding size), is the hidden dimension, and the factor of 4 accounts for the four components (forget gate, input gate, candidate, output gate). This is four times the parameters of a vanilla RNN. This reflects the four separate learnable transformations.
Implementation Insights:
- Initializing the forget gate bias to 1 improves training by starting with full memory retention
- Combining weight matrices into single operations improves computational efficiency
- The cell state can grow unbounded, so applying tanh before the output gate maintains numerical stability
With these equations internalized, you can now trace exactly how information flows through an LSTM, debug unexpected behaviors, and make informed decisions about when to use this architecture. The next chapter examines how these equations enable better gradient flow compared to vanilla RNNs.