A Long Short-Term Memory (LSTM) cell carries a cell state — its long-term memory — down a "highway" from one time step to the next, largely unchanged unless the gates decide otherwise. Three sigmoid gates control that highway: the forget gate decides what fraction of the old memory survives, the input gate decides how much of a new candidate value gets written in, and the output gate decides how much of the (squashed) memory is exposed as the hidden state used for the next prediction — like next month's airline passenger count.
(1 − f_t); bars passing through shrink by that amount.C̃_t before it's added to the forgotten memory.C_t = f_t · C_{t-1} + i_t · C̃_t, shown as the second bank of bars.h_t = o_t · tanh(C_t), squashing the memory and revealing only part of it as the hidden state.LSTMs were introduced by Hochreiter & Schmidhuber in 1997 specifically to fix "vanishing gradients" in plain recurrent networks — the additive, gated cell-state highway lets gradients (and memories) flow across hundreds of time steps largely undiminished, which is exactly why they became a workhorse for time-series forecasting.
A 3D memory highway shows how an LSTM cell's forget, input and output gates decide what to keep, what to write in, and what to reveal at each time step — illustrated with a toy airline-passenger forecast.
The cell state flows left to right along a lit highway. A forget-gate valve scales down old memory, an input-gate valve scales in a new candidate value, and an output-gate valve squashes and releases part of the result as the hidden state that drives the forecast panel.
Drag the forget, input, candidate and output sliders to see the bar banks and forecast line respond instantly, or flip on Auto time-step to watch the gates oscillate through a short sequence on their own.
Because the cell-state update is additive (old memory plus a gated new term) rather than a full rewrite, gradients can flow through many time steps without vanishing — the core trick that made LSTMs so effective for long time-series like passenger demand.