OSS4AI AI Stack · Season1 · #11
by Yujian Tang

An RNN passes a hidden state from each sequence step to the next with reused weights. Open full-size image
A state passed from step to step
A recurrent neural network, or RNN, processes a sequence by carrying a hidden state from one step to the next. At each step, it combines the previous state with the next input. The same learned weights are reused throughout the sequence.
Imagine reading a book one word at a time while repeatedly rewriting one index card of notes. The card is the hidden state. New words can update it, but preserving everything from a long passage in a fixed-size representation is difficult.
This is a mathematical state, not a database or a durable record of every earlier token. Understanding that distinction helps explain both recurrence's appeal and its limitations.
The basic recurrence
A simplified RNN update is:
h_t = tanh(W × h_(t-1) + U × x_t)
Here, x_t represents the current input and h_t the new hidden state. W transforms the old state; U transforms the input. A bias can also be included. The nonlinear function keeps the update from being just a sequence of linear transformations.
The next step depends on the state produced by this step. That dependency creates a natural streaming structure, but it also limits parallel processing across positions compared with an architecture that reads the sequence without a recurrent chain.

Repeated scalar factors0.9 or1.1 illustrate why long products can shrink or grow. Open full-size image
Why training signals can fade or grow
Training sends gradients backward through the unrolled sequence. Repeated multiplication can shrink or enlarge the signal. As a teaching illustration, multiplying by 0.9 across 100 steps gives about 0.00003. Multiplying by 1.1 across 100 steps gives about 13,781.
Real gradients involve matrices and nonlinear derivatives, not one constant factor. The example illustrates the mechanism rather than predicting a particular network's behavior. When gradients vanish, distant inputs may have little influence on parameter updates. When they explode, training can become unstable.
A network's ability to carry a hidden state does not therefore guarantee that it learns long-range dependencies well.
LSTM adds a controlled memory lane
Long Short-Term Memory adds a cell state and gates that regulate information flow. In the familiar formulation, a forget gate controls what to retain, an input gate controls what to add, and an output gate controls what to expose.
The separate cell-state path helps information and gradients move across steps without being repeatedly transformed in exactly the same way as a basic RNN state. It mitigates the problem; it does not promise perfect retention at any sequence length.
The GRU, introduced in the 2014 encoder-decoder work by Cho and colleagues, is a related gated design with a simpler structure. These architectures show that "recurrent" describes a broad approach, not one fixed cell.

A cell-state path and forget/input/output gates regulate what is retained, added and exposed. Open full-size image
Sequence-to-sequence exposed a bottleneck
Early sequence-to-sequence systems used an encoder to read an input sentence into a representation and a decoder to produce an output sentence. The 2014 LSTM work demonstrated this approach for translation.
A fixed-vector handoff asks one representation to summarize the entire source. Attention changed that arrangement by allowing the decoder to consult different input representations while generating each output. Bahdanau, Cho and Bengio's translation work is a foundational reference.
Transformers later removed recurrence from their core sequence-processing design. This made parallel training across token positions easier, while retaining attention as the mechanism for combining information across the sequence.
Use the history to ask better engineering questions
For a practical exercise, draw an RNN unrolled over four inputs and label which state each step needs. Then draw an attention-based encoder-decoder where the output can consult multiple input positions. The diagrams expose different dependencies and information paths.
Do not conclude that all non-transformer sequence models are obsolete. Mamba explores selective state-space sequence modeling. It is not simply an old LSTM renamed, and its tradeoffs need their own evaluation.
The lasting question is how an architecture handles long sequences: what it remembers, how it trains, which operations can run in parallel and what state it keeps during inference. Those questions are more useful than declaring one model family permanently dead.
Sources and scope
Research date: November 9, 2026. Historical results refer to the dates and conditions of the cited studies; product details describe the cited source snapshot, not a promise of current availability or pricing.
