Introduction
Welcome to the next step in our exploration of neural networks. In the last lesson, we constructed the static blueprint of a multi-layer feedforward neural network. You learned about its architecture: the input, hidden, and output layers, the concept of being "fully connected," and the powerful vectorized equation that describes the computation within a single layer: .
Today, we bring that blueprint to life. Our learning outcome is to explain the process of forward propagation to generate a prediction. We'll trace the path of information as it flows—or propagates—from the input layer, through the hidden layers, to the final output. This is the "thinking" process of the network, how it takes a piece of data and arrives at a conclusion.
Understanding this mechanism is fundamental. It's the first half of the cycle that allows an AI to both make predictions and, eventually, to learn from its mistakes.
What is Forward Propagation?
At its core, forward propagation is the computational process of passing input data sequentially through a neural network to produce an output. It is a one-way street, always moving from the input layer towards the output layer.
To get an intuitive feel for this flow, let's start with a short, conceptual animation.
But what is a neural network? | Deep learning chapter 1
Let's revisit the excellent 3Blue1Brown video from our last lesson. This segment beautifully illustrates the dynamic flow of activations through the network layers.
Watch from 04:49 to 05:36. Observe how the activations in the input layer (representing an image) trigger a cascade of activations through the hidden layers, culminating in a final pattern in the output layer that represents the network's prediction.
This visualization shows the what of forward propagation. Now, let's define it more formally before we dive into the how.
Forward Propagation in Neural Networks: A Complete Guide
This article from DataCamp provides a clear and concise definition of forward propagation and why it's a cornerstone of deep learning.
Read the introductory section, 'What is Forward Propagation?'. Focus on the definition and the reasons why understanding it is crucial.
As the article states, forward propagation is the prerequisite for understanding how networks learn. It's the prediction step that must happen before a network can evaluate its own performance and make adjustments.
The Algorithm of a Forward Pass
The process you just saw visually is, under the hood, a sequence of calculations. It's an algorithm where the output of each layer becomes the input for the next.
Let's formalize this. For a network with layers:
- The input data is the activation of the "0th" layer, so .
- For each subsequent layer from 1 to :
- Calculate the pre-activation value, , using the activations from the previous layer, :
- Calculate the activation for the current layer, , by applying the layer's activation function to :
- The final activation vector, , is the network's prediction, often denoted as .
This algorithm is elegantly captured in the following diagram.

A Step-by-Step Numerical Example
Theory and equations are essential, but seeing the numbers flow through the network solidifies understanding. The following video provides an excellent, detailed walkthrough of a forward pass with concrete values.
Forward propagation in training neural networks step by step
In this video, 'Forward propagation in training neural networks step by step' by Bevan Smith, you will see every calculation for a simple network laid out clearly. This will make the abstract algorithm tangible.
Watch from 09:01 to 17:25. Follow along with the calculations as the input values [60, 80, 5] are propagated through the network. Pay close attention to: How the pre-activation z is calculated for each neuron (a weighted sum plus a bias). How the activation function (sigmoid in this case) is applied to z to get the neuron's output g (or a in our notation). How the outputs of the hidden layer become the weighted inputs for the output layer.
Let's recap the key calculation for a single neuron from that video. To get the activation of the first hidden neuron, g1:
-
Calculate the pre-activation
z1:- Inputs:
- Weights: (Note: video uses a different weight naming)
- Bias:
-
Apply the activation function
g1:- The video uses the sigmoid function:
This exact process is repeated for every neuron in the layer, and then the entire procedure is repeated for the next layer, using the activations from the current layer as inputs.
A Deeper View: Forward Propagation as Geometric Transformation
Given your linear algebra background, we can appreciate forward propagation from a more profound perspective. It's not just a series of arithmetic steps; it's a sequence of geometric transformations. Each layer warps the data's "space."
Neural Networks From Linear Algebraic Perspective
This article, 'Neural Networks From Linear Algebraic Perspective' by Khalid Saifullah, offers a fantastic intuition for what's happening mathematically during a forward pass.
Read the sections 'Neural Network 101', 'What is actually happening...', and the 'Note' on non-linearity. Focus on these key ideas: The matrix multiplication Wx is a linear transformation that can rotate, scale, and shear the input data. Adding the bias +b enables translation, turning the operation into an affine transformation. The non-linear activation function then 'squashes' or 'bends' this transformed space. This perspective reveals that the network is learning to warp the input space until the data points from different classes are neatly separated.
This interpretation is powerful. A neural network learns a complex function by composing a series of simpler functions: an affine transformation followed by a non-linear "squashing." Layer by layer, it manipulates the geometry of the data until a simple decision boundary in the final layer's space is sufficient to solve the problem. This is a core reason for the "depth" in deep learning.
Conclusion
In this lesson, we demystified the process of making a prediction with a neural network. You've learned that forward propagation is the orderly, layer-by-layer computation that transforms an input into a final output.
Key Takeaways:
- Forward propagation is the process of feeding input data through a network, layer by layer, to generate a prediction.
- The process is algorithmic: the output activations of layer serve as the input for layer .
- For each neuron, the core operation is calculating a weighted sum of inputs, adding a bias (the pre-activation ), and then applying a non-linear activation function ().
- From a geometric viewpoint, each layer performs an affine transformation () followed by a non-linear warping of the data's feature space.
Preview of the Next Lesson:
We now know how a network with a given set of weights and biases makes a prediction. But this prediction is likely wrong, especially at first. How does the network learn from its errors? This brings us to the other half of the training cycle. In the next lesson, we will explore the concept of backpropagation, the ingenious algorithm that calculates how to adjust the network's 13,000+ parameters (as mentioned in the 3Blue1Brown video) to improve its predictions.