Long Short-Term Memory

The paper introduced gated recurrent memory cells designed to preserve error signals over long time spans.

Metadata

FieldValue
PaperLong Short-Term Memory
AuthorsSepp Hochreiter, Jurgen Schmidhuber
Year1997
VenueNeural Computation
DOI10.1162/neco.1997.9.8.1735
Statusverified

Question

The paper asks whether a recurrent neural network can learn dependencies over long time lags without losing the training signal through repeated nonlinear transitions.

A vanilla recurrent model updates:

and predicts from . When the loss at a late time step depends on an early input, the gradient has to pass through many Jacobian products:

If the dominant singular values of these transition Jacobians are consistently below one, gradients shrink exponentially. If they are above one, gradients can explode. The architecture question is therefore not just “can recurrence represent memory?”, but “can the architecture expose a trainable path along which error can remain stable?”

LSTM answers this by separating a memory cell from the exposed hidden state and controlling read/write behavior with gates.

Main Claim

Long Short-Term Memory introduces a recurrent memory cell with multiplicative gates so that information and error signals can persist over long time intervals.

In modern terms, the key architectural claim is:

The paper is important because it makes memory an explicit architectural object. It is not simply a different activation function or optimizer trick. It changes the state update so that part of the recurrent computation can behave like a controlled accumulator.

Architecture Contract

ItemContract
Inputordered sequence
Outputhidden sequence or task-specific prediction from hidden states
Stateexposed hidden state plus internal cell state
Token mixingcausal recurrent update from to
Memory mechanismadditive cell state path with gated writes, retention, and reads
Parallelismsequential over time; batch-parallel across independent sequences
Inductive biastemporal order, causal state, compressive memory

The model processes one step at a time:

For a sequence classification task:

or, for token-level prediction:

The important constraint is that all information from earlier positions must be compressed into the recurrent state. This differs from attention, where later tokens can directly read earlier token representations.

Core Equations

The commonly used LSTM equations are usually written as:

where:

SymbolMeaning
input at time step
exposed hidden state
internal cell state
input gate; controls write strength
forget gate; controls retention of previous cell state
output gate; controls how much memory is exposed
candidate cell content
sigmoid gate in
elementwise product

The original 1997 presentation differs from the exact modern LSTM recipe; the forget gate became a standard addition through later variants. But the architectural idea is the same: protect a cell state and learn when to write, keep, and expose it.

Why The Additive Cell Path Matters

The central path is:

The derivative from to is approximately:

ignoring indirect dependencies of gates on . If a dimension of stays near , that memory dimension can carry information and gradients across many steps:

This is still not magic. If the forget gates are usually far below one, memory decays. If they are near one for irrelevant information, stale state can persist. LSTM gives the model a learnable mechanism for memory retention; it does not remove the need to learn the right retention policy.

The important architecture pattern is additive state update plus multiplicative control. This pattern later reappears in different forms:

  • GRU uses fewer gates and merges parts of the memory/update logic.
  • Residual connections provide additive identity paths across depth instead of time.
  • State-space models define recurrent dynamics with structured transition rules.
  • Mamba makes state-space transitions input-dependent.

Gate Roles

GateEquationRoleFailure Mode
Input gatedecides how much new candidate content enters memoryunder-writing misses useful evidence; over-writing destroys memory
Forget gatedecides how much previous memory remainstoo low causes decay; too high keeps stale state
Output gatedecides how much memory becomes visible in hidden state can expose too little or too much
Candidateproposes new contentcandidate bottleneck limits what can be stored

The gates are multiplicative selectors. They are not independent modules that understand semantics by themselves. They are learned functions of the current input and previous hidden state:

where implementations often fuse the four affine projections for efficiency.

Block View

BlockInputOutputArchitectural Reason
Recurrent affine projectionsgate logits and candidate logitscompute input-conditioned control signals
Sigmoid gateslogitsconstrain control values to
Candidate transformlogitspropose bounded write content
Cell updateadditive memory update
Output transformexpose controlled memory to the next layer/task

This decomposition is useful when reading later architectures. Many modern blocks can be read as variants of:

Relation To Vanilla RNNs

PropertyVanilla RNNLSTM
Stateone hidden state hidden state plus cell state
Updatefully nonlinear transitiongated additive memory update
Long-range gradientrepeated Jacobian product through nonlinear transitioncontrolled path through cell state
Memory controlimplicit in recurrent weightsexplicit read/write/retention gates
Parallelism over timesequentialsequential
Inductive biascausal compressive recurrencecausal compressive recurrence with protected memory

The LSTM does not change the sequential nature of recurrence. It changes the internal state geometry so that preserving information becomes easier.

Relation To GRU

The GRU can be read as a simpler gated recurrence:

GRU merges the cell and hidden state and uses update/reset gates. LSTM keeps a separate cell state and output gate. The practical choice depends on task scale, implementation, regularization, and historical codebase constraints rather than a universal dominance relation.

Relation To Transformers

The Transformer changes the sequence modeling bottleneck.

DimensionLSTMTransformer
Token interactioninformation flows through recurrent statetokens attend directly to other tokens
Training parallelismsequential over timeparallel over sequence positions under teacher forcing
Long context path length recurrent stepsone attention layer can connect any pair
Memory representationcompressed state vectorexplicit sequence of token states
Main cost pattern for recurrent projections attention plus projections

The Transformer became the default for large language models because direct token-token interaction and parallel training scale well on modern accelerators. LSTM remains useful as a reference for:

  • streaming inference with bounded state;
  • compact sequence models;
  • causal filters with small memory;
  • architecture discussions about gated state updates;
  • historical understanding of why attention was disruptive.

Relation To State-Space Models

State-space models and LSTMs both process sequences through recurrent state, but they organize the state update differently.

A simple linear state-space model has:

LSTM uses nonlinear, gated, input-dependent memory:

Modern selective state-space models such as Mamba revisit recurrent sequence modeling with hardware-aware scan algorithms and input-dependent parameters. LSTM is therefore not just an obsolete pre-Transformer artifact. It is a foundational example of controlled recurrence.

Evidence Reading

The paper’s evidence should be read in the context of the 1990s recurrent-learning problem. The reported tasks were small compared with modern benchmarks, but they directly targeted long time lags and gradient propagation.

ClaimEvidence TypeWhat It SupportsCaveat
LSTM can bridge long time lagssynthetic delay tasksgated memory can preserve information over many stepssynthetic tasks do not guarantee broad real-world performance
Constant error flow helps trainingcomparison against prior recurrent methodsarchitecture changes gradient behaviorlater variants and optimizers changed practical recipes
Memory cells can learn to store and release informationtask-specific sequence experimentsexplicit gates can learn retention policiessmall-scale experiments by modern standards

The paper should not be read as proving that LSTM solves all long-context learning. It proves that changing the recurrent architecture can materially change trainability over time.

What To Check In Later LSTM Papers

When reading later LSTM variants or applications, separate these factors:

FactorQuestion
Cell variantIs it original LSTM, forget-gate LSTM, peephole LSTM, stacked LSTM, bidirectional LSTM, or projected LSTM?
ObjectiveIs the gain from architecture or from sequence-to-sequence training, CTC, language modeling, or another objective?
Context lengthHow long are the dependencies actually tested?
Parallelism costIs sequential recurrence acceptable for the target hardware and latency regime?
State sizeIs the recurrent state large enough to carry required information?
RegularizationAre dropout, layer norm, clipping, or weight tying part of the reported gain?

This matters because many historical sequence-model improvements bundle architecture, objective, decoding, data, and optimization changes.

Implementation Notes

Most practical implementations fuse the gate projections:

then split:

and apply:

Important engineering details:

  • initialize forget-gate bias carefully when long retention is needed;
  • use gradient clipping for unstable sequence training;
  • mask padded positions so hidden states do not learn from padding tokens;
  • decide whether hidden state should reset between sequences, documents, or batches;
  • use packed sequences or length-aware batching for variable-length data;
  • avoid comparing LSTM and Transformer models without controlling parameter count, training tokens, and compute.

Common Misreadings

”LSTM removes vanishing gradients”

It reduces a major failure mode by adding controlled memory paths. It does not guarantee stable gradients for every sequence, task, initialization, or optimizer.

”The cell state is an external memory”

The cell state is internal recurrent state. It is not an addressable memory table like attention over stored tokens.

”Forget gates were in the original form exactly as used today”

The modern equations usually include forget gates and other later conventions. The original paper’s core idea is gated memory and error preservation, but the common implementation lineage includes subsequent refinements.

”Transformers made LSTM irrelevant”

Transformers changed the default for large-scale sequence modeling. LSTM remains relevant for compact recurrent baselines, streaming systems, historical comparison, and any architecture discussion about state, gating, and memory.

Why It Still Matters

LSTM is the cleanest canonical architecture for understanding:

  • recurrent neural networks;
  • gating;
  • vanishing and exploding gradients through time;
  • compressive sequence memory;
  • the pre-Transformer sequence modeling baseline;
  • why direct attention and state-space models are architectural alternatives, not just implementation tricks.

For an AI architecture wiki, LSTM should remain close to RNN Encoder-Decoder, Attention Is All You Need, Mamba, and State-space model.

Limitations

  • Sequential recurrence limits training parallelism over time.
  • The hidden/cell state is a fixed-size bottleneck for long sequences.
  • Long-range retention still has to be learned by gates.
  • Large-scale language modeling moved toward attention-based architectures because token states remain directly accessible.
  • Comparisons against modern sequence models are sensitive to hardware, implementation, and training budget.
  • For graph, image, and molecular structure inputs, LSTM alone does not encode permutation, locality, or equivariance without additional modeling choices.

Practical Reading Checklist

When using LSTM as a reference point, ask:

  • What information must persist across time?
  • Does the task require direct access to many previous tokens, or is a compressed state enough?
  • Is streaming/bounded-memory inference more important than full-context attention?
  • Are gates being used for memory, routing, or simple nonlinear feature selection?
  • Does the paper compare against a properly tuned recurrent baseline?
  • Does the experiment isolate architecture from objective and data changes?

Connections