AlgoPlus//machine learning / lstm
Read the theory

LSTM & GRU

Gated memory: forget, input, and output gates control a long-lived cell state.

Timestep
Cell state
Legend
Forget gate
Input gate
Output gate
AI Tutor Workspace
In a nutshell
An LSTM is a recurrent network with a built-in memory line called the cell state, plus three gates — small 0-to-1 valves — that control it: a forget gate erases, an input gate writes, and an output gate decides what to reveal. Because the cell state is edited by adding rather than rewritten each step, information can survive many tokens, letting the network learn long-range dependencies that a plain RNN forgets.
Ready
Press play to begin the cinematic walkthrough.
Add a notebook with three switches: one to erase a line, one to write a new line, one to decide what to read aloud. Now 'France' can survive until you need 'French'.
Key terms
Go deeper in the lesson
Read the full theory, intuition & complexity for LSTM & GRU.