Sitemap

Understanding Forward and Backward Propagation with RNN

3 min readJul 27, 2025

--

Recurrent Neural Networks (RNNs) are a powerful class of neural networks designed to work with sequence data by maintaining a memory of previous inputs. This guide will walk you through the detailed steps of forward and backward propagation in RNNs, utilizing equations and examples with matrices.

Key Components

Press enter or click to view image in full size

Forward Propagation

Forward propagation involves processing input data through the network layer by layer, generating intermediate outputs at each step. This is where the RNN uses its hidden state to capture temporal dependencies.

Press enter or click to view image in full size

Equations for Forward Propagation

Press enter or click to view image in full size

Example with Detailed Matrices

Let’s break down an example with specific matrices and inputs:

Press enter or click to view image in full size
Press enter or click to view image in full size

This process exemplifies the way RNNs propagate information forward through time, accumulating context.

Backward Propagation Through Time (BPTT)

Backward propagation is crucial for learning, as it helps adjust weights based on the error between the predicted and actual output.

Press enter or click to view image in full size

Loss and Gradient Equations

Press enter or click to view image in full size

Updating the Weights

Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

Gradient Descent

Gradient descent plays a pivotal role in refining weights for optimal performance. It iteratively adjusts weights by moving in the direction of decreasing loss.

Visualization of Gradient Descent

Press enter or click to view image in full size

Imagine a landscape of peaks and valleys. We will find out the global minima for loss and capture wo,wh,wi.

Get Rezowanur Rahman Robin’s stories in your inbox

Join Medium for free to get updates from this writer.

Steps: We move towards the minimum by calculating and applying gradients. Each iteration gets us closer to the point of minimum error.

Conclusion

Through the processes of forward and backward propagation, RNNs effectively model sequential dependencies by learning from data over time. This enables them to predict and generate data that is temporally coherent, forming the backbone of applications from language modeling to time-series forecasting. By understanding these foundational principles, you’ll be better equipped to harness the power of RNNs for various sequential tasks.

--

--