AI & LLMs

LSTM

also: long short-term memory

Long Short-Term Memory: an RNN with gates that let it remember information over long sequences, mitigating vanishing gradients.

An LSTM (Long Short-Term Memory) is a type of RNN with a gated memory cell: learnable input, forget, and output gates control what to store, discard, and emit at each step. The gates let gradients flow across many steps, so it captures longer-range dependencies than a plain RNN.

Worked example: in “the clouds are in the sky,” a plain RNN may forget “clouds” by the time it predicts “sky”; the LSTM’s forget gate can keep that context alive across the intervening words. Gotcha: LSTMs dominated sequence modeling for years but are still sequential (no parallel training) and still degrade over very long contexts — transformers replaced them by using attention to connect any two positions directly, in parallel, regardless of distance.