Skip to content

Recurrent neural network

Written by GPT-6 Luna from the web 19 of 73 sentences cited

An AI wrote this article, and it can be wrong.

A recurrent neural network (RNN) is a class of artificial neural networks that processes a sequence by carrying information from earlier steps into later ones. This ability to use context makes RNNs useful for tasks involving ordered data, including speech recognition, handwriting transcription and time-series forecasting. Unlike a feedforward network, which processes each input without an internal state passed between inputs, an RNN’s recurrent connections give it a form of learned, task-dependent memory.1

RNNs became influential in sequence modeling because their shared computation can be applied across sequences of different lengths. Basic versions, however, can struggle to learn relationships spanning many steps. Gated variants such as long short-term memory (LSTM) and gated recurrent unit (GRU) networks were developed to improve the handling of information over time. RNNs later lost ground to architectures that process sequence elements more in parallel, especially in machine translation, but research continues on recurrent models and their applications.234

Basic mechanism

At each step, an RNN receives an input and updates an internal representation, often called its hidden state. That state is used alongside the next input, so the model’s response can depend on both the current element and information retained from earlier ones. In a simple form, the update is written as ht=ϕ(Wxxt+Whht−1+b)h_t = \phi(W_x x_t + W_h h_{t-1} + b), where xtx_t is the current input, ht−1h_{t-1} the previous state, and ϕ\phi a nonlinear function. The same weights are reused at each step, allowing one network to process sequences of varying lengths.1

The network can produce an output at every step or produce one output from the sequence as a whole. For example, it can predict the next word after each word in a sentence, label each point in a sensor signal, or classify an entire sequence. The state is not a literal record of every prior input; it is a learned summary shaped by the task and training data. Consequently, what the network retains depends on its parameters and on how it was trained.15

A common way to understand recurrence is to “unroll” the network into a chain of copies, one for each time step. Each copy receives the state from the preceding copy, while all copies share the same parameters. This representation makes clear how information flows through time and how errors at later steps can inform adjustments to earlier computations. It also shows why processing is sequential: the state at one step is needed before the next step’s state can be calculated.6

Training

RNNs are commonly trained with a method called backpropagation through time (BPTT). The network is unrolled over a sequence, a loss is calculated from its outputs, and gradients are propagated backward through the unrolled computation to adjust the shared weights. In sequence prediction, for instance, the loss may compare each predicted next element with the observed one. The method adapts backpropagation to a network whose computation includes feedback across time.6

The amount of history used during training can be limited by truncating the unrolled sequence. This reduces memory and computation requirements, but may also limit the model’s ability to learn dependencies that extend beyond the chosen window. In practice, training therefore involves choices about sequence length, model size, optimization and the form of the task’s loss function. These choices affect how well a trained network generalizes to sequences it did not see during training.6

Early development

Recurrent connections were explored as a way to give neural networks a dynamic memory: earlier activity could influence current processing without explicitly encoding elapsed time as a separate input. Jeffrey L. Elman’s 1990 paper “Finding Structure in Time” described a simple recurrent network in which hidden-unit activity was fed back as context for the next step. Elman tested the model on temporal patterns and language-related prediction tasks, arguing that its internal representations reflected both the current task and prior states.1

In a 1991 study, Elman trained a simple recurrent network to predict elements in multiclausal sentences, including sentences with embedded relative clauses. Analysis of its hidden-unit activity found representations that encoded grammatical relationships and constituent structure. These experiments helped establish recurrence as a way to study how networks could learn sequential structure, not merely map isolated inputs to outputs. They also illustrated a broader feature of RNNs: the internal state is learned through the prediction or recognition task rather than specified as a hand-built memory.5

Gated variants

A central training problem is that gradients can shrink or grow as they are propagated across many time steps. When gradients shrink, earlier inputs may have little effect on weight updates; when they grow, training can become unstable. Bengio, Simard and Frasconi analyzed the difficulty of learning long-term dependencies with gradient descent in 1994. Their work identified a basic tension: a network must be trainable while also preserving useful information over long intervals.2

Hochreiter and Schmidhuber introduced long short-term memory in a 1997 paper to address the problem of decaying error signals over long delays. LSTM units use gated operations to regulate the storage and release of information through an internal cell state. The authors reported that their method could learn tasks involving time lags exceeding 1,000 discrete steps in their experiments. This result concerned the tasks and experimental setup in that paper; it was not a guarantee that an LSTM would retain all useful information over that distance in every application.3

The gated recurrent unit, or GRU, is another recurrent design that uses gates to control updates to its state. It was presented in work on RNN encoder–decoder models for statistical machine translation, in which one recurrent network encoded a source sequence and another generated a target sequence. A subsequent empirical comparison of gated recurrent units on music and speech-signal modeling found LSTM and GRU units performed better than standard hyperbolic-tangent recurrent units in those experiments, while GRU performance was comparable to LSTM. The results do not establish one gated design as best for every task.78

Sequence applications

RNNs can be used for sequence-to-sequence tasks, where both input and output are ordered series. In 2014, Cho and colleagues proposed an encoder–decoder architecture for statistical machine translation: an encoder mapped a source sequence to a representation, and a decoder used it to generate a target sequence. Their experiments found that the model’s phrase-pair probabilities improved an existing phrase-based translation system when added as a feature. The paper also reported that the model learned representations with semantic and syntactic structure.7

Speech recognition is another example. Graves and Jaitly described a system combining deep bidirectional LSTM networks with connectionist temporal classification, a training objective designed for sequence labeling when the alignment between inputs and output labels is not given in advance. Their system transcribed audio directly into text without requiring an intermediate phonetic representation. Bidirectional RNNs process a sequence in both forward and backward directions, using context from either side; this can help when the complete sequence is available, but is not suitable for tasks that must respond before later inputs arrive.9

Recurrent models have also been applied to handwriting. A 2009 study proposed an RNN for recognizing unconstrained handwritten text, where characters can be cursive, overlapping or difficult to segment in advance. On two handwriting databases, the authors reported word-recognition accuracy of 79.7 percent on online data and 74.1 percent on offline data, outperforming the HMM-based comparison system in their experiments. Such results illustrate why recurrence was attractive for data whose meaning depends on both the order and surrounding context of its elements.10

Limitations

The vanishing-gradient problem makes it difficult for a basic RNN to learn dependencies across long intervals. Gating can improve information flow, but does not remove all challenges in optimization or guarantee accurate modeling of every long-range relationship. Empirical performance depends on the data, task, model design and training procedure. A model that performs well on one sequence-prediction benchmark may not perform similarly on a different domain or forecasting horizon.28

The recurrent calculation also creates a parallelization constraint: the computation for a later step depends on the state produced at an earlier step. In 2017, Vaswani and colleagues introduced the Transformer, an architecture based on attention that dispensed with recurrence and convolutions. In their machine-translation experiments, they reported improved results over prior systems and greater parallelizability during training. This helped shift sequence-transduction research toward architectures that can process many positions at once, although the comparison does not mean that recurrence is unsuitable for every sequential task.4

Continuing research

RNNs remain a subject of research, including work on time-series prediction and modifications to recurrent units. For example, a 2025 paper proposed a residual-time gated recurrent unit, designed to address difficulties with long sequences and deeper recurrent networks. The authors reported that their model outperformed conventional RNNs and other deep networks in their experiments. That result documents ongoing development, rather than showing that the proposed variant is generally superior across applications.11

A 2025 comparative study evaluated RNN, LSTM, GRU and hybrid models on three time-series datasets, using repeated runs to examine variability from random initialization. The authors found that the best-performing architecture differed by dataset; the conventional RNN was the fastest among the evaluated models. The result illustrates a recurring point in applied machine learning: accuracy and computational cost depend on the task and evaluation setup, so architectural comparisons are most informative when reported with their datasets and methods.12

References

12 sources
  1. pubmed.ncbi.nlm.nih.govpubmed.ncbi.nlm.nih.gov· cited 3×

  2. Attention Is All You Needarxiv.orgJun 12, 2017· cited 2×

  3. pubmed.ncbi.nlm.nih.govpubmed.ncbi.nlm.nih.gov