Long short-term memory (LSTM)

Long short-term memory is a type of recurrent neural network that uses gated memory cells to keep information over long sequences, and it powered much speech and translation software before transformers.

A recurrent neural network reads a sequence one step at a time, carrying a running summary forward. Training one to link information across many steps proved hard. As errors are passed back through time, the gradients that guide learning shrink towards zero, so the network stops learning long-range connections. This is the vanishing gradient problem, analysed by Sepp Hochreiter in his 1991 diploma thesis.

LSTM fixes this with a memory cell and three gates that learn what to do with it. The forget gate decides what to drop from memory, the input gate decides what new information to store, and the output gate decides what to pass on. Because the cell can carry information forward almost unchanged, gradients flow back with little loss. In a sentence such as The keys that I left on the kitchen table yesterday are missing, the network can hold on to the plural keys long enough to choose are.

Hochreiter and Jürgen Schmidhuber described an early version in a 1995 technical report and published the most cited LSTM paper in Neural Computation in 1997. The forget gate, now standard, was added in 1999 by Felix Gers, Schmidhuber and Fred Cummins.

LSTMs reached a huge audience in the mid-2010s. In 2015 Google used one for speech recognition in Google Voice, reportedly cutting transcription errors by 49%. In 2016 Google's neural machine translation system for Google Translate used LSTMs, Apple announced them for QuickType and Siri, and Amazon's Polly text-to-speech service used a bidirectional LSTM. In 2018 OpenAI Five used an LSTM to beat human players at Dota 2.

Transformer-based models have since replaced recurrent networks for most language work. LSTMs remain in use for smaller sequence tasks; the open-source Tesseract OCR engine, for example, added an LSTM recogniser in version 4. In May 2024 a team led by Hochreiter published xLSTM, an updated design that includes a variant able to run in parallel like a transformer.

Common questions

What is an LSTM used for?

LSTMs process sequences, such as speech, text, handwriting and time series. They were the standard choice for speech recognition, machine translation and text prediction in the mid-2010s, and they are still used for many smaller sequence tasks.

What is the difference between an LSTM and a transformer?

An LSTM reads a sequence one step at a time and keeps a running memory. A transformer uses attention to look at all positions in the sequence at once, which suits parallel hardware and has made it the dominant design for large language models.

What is the vanishing gradient problem?

When a recurrent network is trained over long sequences, the signals used to adjust its weights can shrink towards zero as they pass back through many steps. The network then fails to learn connections between distant parts of the sequence. LSTM's gated memory cell was designed to prevent this.

Are LSTMs still used?

Yes, though less for large language tasks. They appear in speech, handwriting and OCR systems, time series forecasting and other settings where a compact sequence model is enough, and research on updated versions such as xLSTM continues.

Finding more

Search for "LSTM", "vanishing gradient" or "LSTM vs transformer" for explanations and comparisons. Reliable sources include the original papers by Hochreiter and Schmidhuber, university deep learning courses, and the documentation of frameworks such as PyTorch and TensorFlow. Treat accuracy improvements quoted in company announcements as the company's own measurements unless an independent test confirms them.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.