Long short-term memory
In short
Long short-term memory (LSTM) is a type of recurrent neural network built to remember information across long sequences, such as sentences or speech. Small learned switches called gates decide what to store, what to output and what to forget.
- Also called
- LSTM, LSTM network
- Topic
- How AI models work
- Level
- Some background helps
- First described
- Sepp Hochreiter and Jürgen Schmidhuber, "Long Short-Term Memory", Neural Computation, 19971.
Recurrent neural networks read data one step at a time and carry a memory forward. In practice they struggled to learn links between things far apart, because the training signal travelling back through the steps tends to either blow up or fade away1.
Sepp Hochreiter and Jürgen Schmidhuber proposed LSTM in 1997 to fix this1. Each unit has an internal memory cell that lets the error signal flow back without shrinking or exploding, plus gate units that learn when to open and close access to it1. In their tests LSTM could bridge gaps of more than 1,000 time steps1.
A 2000 paper by Felix Gers, Schmidhuber and Fred Cummins added a "forget gate", so a cell can learn to reset itself instead of letting its memory grow without limit2. The standard LSTM layer in the PyTorch library has input, forget and output gates3.
LSTMs powered a jump in machine translation. In September 2016 Google moved Chinese to English in Google Translate onto GNMT, a deep LSTM network with eight encoder and eight decoder layers45. Google reported that it cut translation errors by 55% to 85% on several major language pairs, judged by bilingual human raters5.
The 2017 transformer design dropped recurrence entirely, which made training more parallel and much faster6. LSTM is still a standard building block in machine learning libraries3.
Example
In 2016 Google Translate began handling about 18 million Chinese to English translations a day with GNMT, its LSTM-based system5.
Why it matters
LSTM was how neural networks first learned to handle long stretches of language, and it made neural machine translation good enough for an everyday product. It also explains why the transformer's arrival in 2017 mattered so much.
Questions people ask
What is the difference between an LSTM and a transformer?
An LSTM reads a sequence one step at a time and carries a memory forward1. A transformer drops that step-by-step reading and uses attention to look at the whole sequence at once, which makes training more parallel and faster6.
What problem does LSTM solve?
Ordinary recurrent networks find it hard to learn long-range links, because the training signal either explodes or vanishes as it is passed back through time. LSTM's memory cell keeps that signal steady, letting it learn gaps of more than 1,000 steps1.
Related terms
Sources
- Hochreiter and Schmidhuber (1997), Long Short-Term Memory, Neural Computation 9(8)
- Gers, Schmidhuber and Cummins (2000), Learning to Forget: Continual Prediction with LSTM, Neural Computation
- PyTorch documentation, torch.nn.LSTM
- Wu et al. (2016), Google's Neural Machine Translation System, arXiv:1609.08144
- Google Research blog (27 September 2016), A Neural Network for Machine Translation, at Production Scale
- Vaswani et al. (2017), Attention Is All You Need, arXiv:1706.03762