AI GLOSSARY · AI CONCEPTS

Long short-term memory (LSTM)

Markdown version · Wikidata Q6673524

Definition

Long short-term memory (LSTM) is a type of recurrent neural network built to learn dependencies across long sequences. It keeps a running memory, called the cell state, and uses learned gates to decide what to add, keep and output.

Also called: LSTM, long short term memory, LSTM network, LSTM model, LSTM networks, LSTM neural network.

In plain language

A plain recurrent network reads a sentence one word at a time and carries a short summary forward, but the summary tends to lose early details by the end of a long passage. An LSTM adds a separate memory lane and three small controls, called gates, that learn when to write something into memory, when to forget it and when to let it influence the output. That made it a common choice for text, speech and sensor data before transformers took over many of those jobs. It still reads one step after another, while transformer training can parallelise positions; actual speed depends on the model, sequence and hardware, and its memory is finite.

Technical definition

An LSTM cell keeps a cell state alongside the hidden state. Per IBM's description, a forget gate multiplies the previous cell state by a value between 0 and 1, an input gate scales a candidate cell state using a sigmoid, and an output gate decides which part of the updated cell state is exposed. IBM notes that the cell's self-connected recurrent edge of fixed weight 1 helps gradients pass across many time steps, which addresses the vanishing gradient problem that stalls training in plain recurrent networks. Colah's tutorial describes the same three gates regulating the cell state. Training uses backpropagation through time.

Worked examples in this catalogue

Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.

  1. Guide · Illustrative, not executed

    What Is an LLM? The Facts Agent Users Need

    What you see
    An explanation of what a large language model is for people who run agents, written for users rather than for machine-learning engineers.
    Why it exercises the concept
    The guide's Transformer and BERT examples contrast with an LSTM's recurrent state.
  2. Skill by Skill Almanac · Illustrative, not executed

    split-leakage-check 53/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    Checks train, validation and test files for duplicates, shared groups, time and label leakage; prints JSON.
    Why it exercises the concept
    LSTMs are often trained on time-ordered data, where time leakage between train and test files is a real risk. The catalogue has no training skills, so this is a contrast case that checks data, not a model.
  3. Skill by Skill Almanac · Illustrative, not executed

    data-analysis-eda 56/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    A fixed exploratory-analysis procedure and CSV profiler that keeps findings descriptive, evidenced and caveated.
    Why it exercises the concept
    Sequence data should be profiled before a recurrent model is trained on it. This skill profiles a CSV and does not build an LSTM.

How it shows up when you use agents

An LSTM can appear when a coding agent helps maintain, retrain or replace a sequence-model project. For comparison, the original Transformer architecture permits parallel processing of training positions with attention; its autoregressive decoder uses a causal mask and generates outputs sequentially. The architecture used by a coding product must be checked in that product's documentation.

What breaks when the term is misunderstood: people assume that "memory" in LSTM is the same as the memory an agent keeps between sessions. It is not. The hidden and cell states can be supplied to a later LSTM call; PyTorch defaults them to zeros only when they are omitted. An agent that needs to remember a past conversation uses a file, a database or the context window, not an LSTM cell.

A practical next step if you inherit an LSTM project: check that the train and test split respects time order, then compare against a simpler baseline before deciding to keep it. The catalogue has no training skills, so use split-leakage-check for the data side only.

Common confusions

  • LSTM versus RNN. An LSTM is one kind of recurrent neural network. It adds a cell state and gates to the plain recurrent design so it can learn longer dependencies.
  • LSTM versus transformer. Both model sequences. An LSTM processes steps in order and carries state forward. Transformer training can process positions in parallel, but decoder causal masks restrict attention and autoregressive generation proceeds token by token.
  • Myth: an LSTM remembers without limit. The gates learn what to keep, but the memory is a fixed-size vector and information can still be lost.
  • LSTM memory versus agent memory. The cell state is recurrent model state and can be carried between sequence chunks. Agent memory is stored outside the model and reloaded.

Terms that mention Long short-term memory (LSTM)

2 terms mention this one

More in AI concepts

Next steps

  1. What Is an LLM? The Facts Agent Users Need The long-form guide.
  2. split-leakage-check A skill that exercises it.
  3. Recurrent neural network (RNN) Related term.
  4. Transformer Related term.
  5. All glossary terms A to Z and by family.

Sources

Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-25. Wikipedia is never the only source.

Review record

Last verified

Drafted by Claude (original draft) and OpenAI Codex (targeted revisions); sources and example targets checked by Independent automated source review (OpenAI Codex); not human peer review on 2026-11-25. Last verified .

Change log (5)
  • : Independent automated factual/example review completed. Cached US query estimate aligned to receipt; no traffic promise. Final technical gate recorded separately; publication disabled.
  • : Targeted batch-08 scope and example corrections from independent source review; affected recheck pending.
  • : First version.
  • : Verifier pass: Dropped unsupported guide sentence.
  • : Automated review completed; approved for the staged public release. Search indexing is controlled by the release configuration.