# Recurrent neural network (RNN)

> Canonical: https://skillalmanac.com/glossary/recurrent-neural-network | Last verified: 2026-11-25 | Index status: index-eligible

A recurrent neural network (RNN) is a neural network for sequential data that passes a hidden state from one step to the next, so earlier inputs can influence later outputs. Transformers have largely replaced it for language.

Also called: RNN, RNNs, recurrent neural networks, feedback neural network, neural network recurrent, recurrent network.

## In plain language

A recurrent neural network reads a sequence one piece at a time, such as the words of a sentence or readings from a sensor, and keeps a running memory of what it has seen so far. At each step it combines the new piece with that memory to decide what to output. This made it a main tool for text, speech and time series. Newer models called transformers now do most of that work, but recurrent networks are still used where models must be small.

## Technical definition

An RNN applies the same weights at every time step and feeds the hidden state from step t into step t+1, giving it a form of memory over the sequence. It is trained with backpropagation through time, which sums errors across steps. Plain RNNs suffer from vanishing gradients, which makes long-range dependencies hard to learn. LSTM cells address this with input, output and forget gates. Transformers replaced recurrence with attention, which parallelises better.

## How it shows up when you use agents

You will rarely meet a recurrent network directly when running Claude Code, Codex or Cursor. Common language models used in coding agents are [transformers](/glossary/transformer), which use attention rather than the original RNN recurrence; check the selected model's documentation. The idea still explains behaviour you can observe.

An RNN carries a hidden state forward, summarizing earlier sequence inputs. Transformer attention can relate available positions inside a [context window](/glossary/context-window), subject to masking. A causal decoder cannot attend to future target positions and generates new tokens incrementally. Runtime context is separate from knowledge learned in model parameters; earlier material outside the supplied context is not directly available unless the application retrieves or summarizes it.

Where RNNs still appear is small, resource-limited work, which IBM says they remain suited to. For an adjacent example of hardware budgeting for open-weight language models, the [local model sizing](/skills/skill-almanac/local-model-sizing) skill provides estimates; it does not demonstrate an RNN.

What breaks when the term is misunderstood: people assume a chat model carries a hidden memory between sessions, as a recurrent network does within a sequence. A coding agent uses the model's learned parameters together with runtime context, tools and any supplied memory files. Saved application state is different from a recurrent hidden state. See [Neural network](/glossary/neural-network).

## Common confusions

- **RNN versus transformer.** An RNN processes a sequence step by step through a hidden state. Transformer attention is subject to its mask: encoder positions can be processed in parallel, while causal decoding generates tokens sequentially. IBM notes that transformers capture long-range dependencies more effectively and generally perform better on language tasks.
- **RNN versus LSTM.** An LSTM is a kind of recurrent network with gates that control what is kept or discarded, designed to ease the vanishing gradient problem.
- **Myth: RNNs are obsolete.** Their use has declined, but IBM says they remain useful in smaller, resource-constrained settings.
- **Recurrent versus recursive.** Recurrent networks loop over time steps. Do not confuse the word with recursive networks, which apply the same network over a tree.

## Worked examples in this catalogue

### [local-model-sizing](https://skillalmanac.com/skills/skill-almanac/local-model-sizing)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A calculation of whether an open-weight language model will run on a given GPU, Mac or PC, with a script that computes the memory needed.

Why it exercises the concept: An adjacent hardware-planning analogy: this skill estimates open-weight language-model memory, not RNN behavior or why an architecture is used. Resource limits matter when selecting either kind of model.

### [text-entity-extractor](https://skillalmanac.com/skills/skill-almanac/text-entity-extractor)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A report of URLs, hashtags, @mentions and dates found in one plain text file, with counts and first occurrences.

Why it exercises the concept: It processes text with fixed rules, with no learned memory. Comparing it with a recurrent network shows the other approach to sequences: a hand-written scan against a model that learns patterns.

### [What Is an LLM? The Facts Agent Users Need](https://skillalmanac.com/learn/what-is-an-llm-for-agent-users)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: An explanation of what a large language model can and cannot do, from the point of view of someone running a coding agent.

Why it exercises the concept: The guide contrasts the original Transformer decoder with BERT and explains runtime context versus learned parameters. It is an architecture comparison, not an RNN demonstration or a complete sequence-model history.

## Related terms

- [Neural network](https://skillalmanac.com/glossary/neural-network.md)
- [Transformer](https://skillalmanac.com/glossary/transformer.md)
- [Deep learning](https://skillalmanac.com/glossary/deep-learning.md)
- [Natural language processing (NLP)](https://skillalmanac.com/glossary/natural-language-processing.md)
- [Large language model (LLM)](https://skillalmanac.com/glossary/large-language-model.md)

## Sources

- [What is a Recurrent Neural Network (RNN)?](https://www.ibm.com/think/topics/recurrent-neural-networks), IBM (accessed 2026-11-23)
- [Speech and Language Processing (3rd edition draft)](https://web.stanford.edu/~jurafsky/slp3/), Stanford University (Jurafsky and Martin) (accessed 2026-11-23)
- [Attention Is All You Need](https://arxiv.org/abs/1706.03762), arXiv (Vaswani et al., 2017) (accessed 2026-11-23)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-25. [Glossary index](https://skillalmanac.com/glossary.md).
