The Data: We are given test points , together with measurements , where is some unknown function.
The Objective: Our goal is to approximate at the given test points by a function computed by a feed-forward neural network.
The Cost Function: Approximation is achieved by minimizing the Sum of Squared Errors (SSE) across all test points. (Unlike LMS, which minimized instantaneous error, this is a batch approach).
Without loss of generality, we assume that:
- there are input neurons,
- and two hidden layers, each containing neurons.
Let denote the -th neuron in the first hidden layer.
Let be the weight connecting neuron in layer 1 with neuron in layer 2.
As activation function, we take for all neurons
The derivative of can be expressed in terms of itself.
The flow of error signals backward through a Feed-Forward Neural Network.

-
: The raw instantaneous error (Target Output) at timestep .
-
: The actual numerical output of neuron in layer during the forward pass.
-
: The derivative of the Sigmoid activation function
-
(Local Gradient): The exact amount of βerror responsibilityβ assigned to neuron in layer .
The Sum of Squared Errors :
The Blame is the derivative of the Total Error with respect to a specific neuronβs raw input ():
The blame () for the final output neuron is :
** = (The Raw Error) (The Sigmoid Derivative)
-
Single Connection (Layer 2): If a hidden neuron connects to only one output neuron, its local gradient is the subsequent multiplied by the connecting weight, passed through its own derivative: The error blame for Neuron in Layer 2 is = (The delta from Neuron 1 in the NEXT layer) * (The weight connecting them) * (The derivative of the sigmoid in Neuron ).
-
Multiple Connections (The Summation at Layer 1): If a hidden neuron connects to multiple neurons in the next layer, we must sum the backward-flowing error signals from all connected neurons (denoted by the node in the diagram).
The problem variables are the weights .
We disregard biases.
Because the network utilizes the Sigmoid activation function , the final output of the network is strictly bounded: .
- If the true target measurements of the dataset fall outside the range, the network cannot mathematically reach them. Therefore, a necessary preprocessing step is to normalize the dataset so all target values fall within the reachable bounds of the activation function.
Let denote the output signal of neuron . Then neuron receives as input
,
and its output is given by
.
The objective function is
(sum of squared errors)
The ultimate optimal weight vector lives in the dimension .
- Input layer () to Hidden 1 () = weights.
- Hidden 1 () to Hidden 2 () = weights.
- Hidden 2 () to Output () = weights.
- For a network with inputs, two hidden layers of neurons, and output, the total number of optimized parameters (ignoring biases) is
Goal: find an unconstrained minimizer of such that for all , to find the unconstrained minimizer that minimizes the total Sum of Squared Errors across all test points.
The objective function is a:
high-dimensional, smooth, non-convex empirical risk functional defined over a nonlinear parameterization of a feedforward neural network
Remark :
- New test points can be added without changing the structure of the model, since the objective is defined as a sum over samples.
- The structure of the network determines the structure of the objective function and therefore has a fundamental impact on how well different target functions can be approximated. This is a central topic in approximation theory.
- In general, we cannot expect numerical optimization methods such as steepest (gradient) descent to converge to a global minimum of the objective. Gradient descent is a local method: it follows the negative gradient toward stationary points, but in non-convex landscapes there is no general guarantee of reaching the global minimum.
- For the application of steepest descent methods, the activation function must be differentiable, since gradient-based optimization requires the existence of , which is computed via the chain rule through . If the math has a sharp corner (like a step function), the derivative is undefined, the chain rule breaks, and Backpropagation completely fails.
Backpropagation (high-level view)
Choose an initial parameter vector .
In Step
Assume is already computed. Then compute via:
where:
- is the learning rate
- is the gradient of the loss at , the steepest descent direction of at
- The update moves parameters in the direction of maximal local decrease of the objective
Backpropagation is the procedure used to compute efficiently using the chain rule through the network, while the update above is the actual optimization step (gradient descent).
The main breakthrough of backpropagation algo is that the computation of aligns extremely well with the layered structure of the neural network.
- This structural compatibility allows the gradient to be computed efficiently by reusing intermediate quantities computed during the forward pass.
To see this, one must carry out a sequence of explicit (and somewhat tedious) derivative computations, applying the chain rule systematically through the layers of the network.
Backpropagation is efficient because the chain rule factorization matches the computational graph of the network.
- The network is a compositional map
- gradients propagate naturally in reverse order of this composition So instead of recomputing derivatives repeatedly, backprop:
- stores intermediate activations
- reuses them during gradient computation
- Layer 3 (The Output): Looks at the final error, calculates its own derivative, and gets a βblame scoreβ (). It hands that number to the wires pointing backward.
- Layer 2 (Hidden): Layer 2 doesnβt even look at the final error. It just catches the number from Layer 3, multiplies it by its own derivative, and hands the new number backward.
- Layer 1 (Input): Catches the number from Layer 2, multiplies it by its own derivative, and uses it to update its weights.
The earlier a weight appears in the network, the more indirect and complex its influence on the objective function (E(w)). This is because its effect propagates through multiple subsequent layers via repeated nonlinear transformations.
For this reason, backpropagation proceeds from the output layer backward toward the input layer.
We therefore start by computing partial derivatives with respect to the weights in the last layer, i.e.
and then propagate these derivatives backward through the network using the chain rule.
The loss function is:
where the output neuron is given by:
Substituting this into the objective gives:
(the outputs of the previous layer) have already been calculated during the forward pass, they are treated as constants that are independent of the current weight being optimized.
The partial derivative of with respect to a single, specific weight
We are only taking the derivative with respect to one specific weight: , this means every other weight in that long addition problem is treated as a constant.
Substituting this gradient into the standard Steepest Descent formula ()
We mathematically group the raw error and the sigmoid derivative into a single term called the local gradient or (Delta):
Therefore updating a weight requires almost no new computation
- The error of the output (already calculated).
- The output of the Sigmoid itself (already calculated).
- The signal coming from the previous layer (already calculated).
Calculating the gradient for the Hidden Layer () : For a hidden layer, there is no βTarget.β The data set doesnβt tell Neuron in Layer 2 what its output should have been.
For Layer 2: **
For Layer 1 :
- Layer 3: Look at the target, calculate . Update Layer 3βs weights.
- Layer 2: Catch the from Layer 3. Calculate . Update Layer 2βs weights.
- Layer 1: Catch all the βs from Layer 2. Calculate . Update Layer 1βs weights.