Standard feedforward neural networks and CNNs assume that all inputs are independent of one another. While that works well for static images or tabular rows, it breaks down completely when order matters—such as predicting stock prices, translating sentences, or transcribing speech.
To process sequential data where past context dictates future meaning, deep learning relies on recurrent architectures: Recurrent Neural Networks (RNNs), Long Short-Term Memory networks (LSTMs), and Gated Recurrent Units (GRUs).
1. Recurrent Neural Networks (RNNs): Memory Through Loops
An RNN processes sequences one step at a time while maintaining an internal hidden state ($h_t$) that acts as a running summary of everything seen so far.
Unrolled RNN Over Time:
y_0 y_1 y_2
^ ^ ^
| | |
[ RNN Cell ] -> [ RNN Cell ] -> [ RNN Cell ]
^ ^ ^
| | |
x_0 x_1 x_2