TOPICS
Search

Backpropagation


Backpropagation computes the derivatives of a neural network's loss function with respect to its weights and biases by applying the chain rule from the output layer toward the input (Rumelhart et al. 1986). It is an application of reverse-mode automatic differentiation (Baydin et al. 2018).

Consider a feedforward network with fixed input column vector a^0, m layers, weight matrices W^l, and bias column vectors b^l. At layer l=1,...,m, let

z^l=W^la^(l-1)+b^l
(1)
a^l=sigma_l(z^l),
(2)

where the activation function sigma_l acts componentwise and is differentiable at the values used. For a differentiable scalar loss L(a^m), define the column vector delta^l=del _(z^l)L. Writing  circledot for componentwise multiplication and T for transpose, the chain rule gives

delta^m=del _(a^m)L circledot sigma_m^'(z^m)
(3)
delta^l=[(W^(l+1))^Tdelta^(l+1)] circledot sigma_l^'(z^l),
(4)

with the second equation applied for l=m-1,...,1. The derivative with respect to the weight W_(ij)^l is delta_i^la_j^(l-1) and the derivative with respect to the bias b_i^l is delta_i^l. These derivatives can be used by the method of steepest descent to update the parameters.

For example, take a two-layer scalar network with no biases, input x=2, hidden activation a^1=(w_1x)^2, output a^2=w_2a^1, and loss L=(a^2-1)^2/2. At w_1=1/2 and w_2=3, the forward calculation gives a^1=1 and a^2=3. The backward calculation gives delta^2=3-1=2 and delta^1=3·2·2(w_1x)=12, so partialL/partialw_2=2 and partialL/partialw_1=24. 3Blue1Brown (2017) illustrates the chain rule for a network with scalar layers.


See also

Automatic Differentiation, Chain Rule, Gradient, Method of Steepest Descent

Explore with Wolfram|Alpha

References

3Blue1Brown. "Backpropagation Calculus." Nov. 3, 2017. https://www.3blue1brown.com/lessons/backpropagation-calculus/.Baydin, A. G.; Pearlmutter, B. A.; Radul, A. A.; and Siskind, J. M. "Automatic Differentiation in Machine Learning: A Survey." J. Mach. Learn. Res. 18, 1-43, 2018. https://www.jmlr.org/papers/v18/17-468.html.Rumelhart, D. E.; Hinton, G. E.; and Williams, R. J. "Learning Representations by Back-Propagating Errors." Nature 323, 533-536, 1986. https://doi.org/10.1038/323533a0.

Cite this as:

Weisstein, Eric W. "Backpropagation." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/Backpropagation.html

Subject classifications