Backpropagation calculator, step by step
Backpropagation finds how much each weight of a neural network contributes to the error. Run the network forward, then apply the chain rule from the error back to every weight: ∂E/∂w = δ × the input that weight multiplies. A gradient-descent step then moves each weight by −η∂E/∂w. For Mazur's classic 2-2-2 example below, the error falls from 0.298371109 to 0.291027774 after one step.
Edit any input, weight, bias, target or activation and see every net, out, δ, gradient and new weight, each gradient checked against finite differences. Free, runs in your browser. For the update rule and learning rate on their own, see the gradient descent calculator.
Mazur (2015) worked example reproduced · Goodfellow, Bengio and Courville (Deep Learning ch. 6) · PyTorch and Keras activation docs · Nielsen ch. 5 · checked against an independent solution (40,017 checks at build) · Updated 24 Nov 2026
One forward pass, one backward pass and one update. Every number below follows from these inputs.
- Mazur's network: inputs 0.05 and 0.10, targets 0.01 and 0.99, w1 … w8 = 0.15 … 0.55, b1 = 0.35, b2 = 0.60, sigmoid, η = 0.5.
Click a weight (on the diagram or in the table) to see its chain rule. Highlighted: the weight, its units and every path from it to the error.
∂E/∂w5 = ∂E/∂outo1 × ∂outo1/∂neto1 × ∂neto1/∂w5
= 0.741365 × 0.186816 × 0.593270 = 0.082167
∂E/∂out = out − target = 0.751365 − 0.010000; ∂out/∂net = f′(neto1); ∂net/∂w5 = outh1.
new w5 = 0.400000 − 0.5 × 0.082167 = 0.358916
| Unit | net | out = f(net) | f | net = Σ w·in + b |
|---|---|---|---|---|
| h1 | 0.377500000 | 0.593269992 | sigmoid | 0.1500×0.0500 + 0.2000×0.1000 + 0.3500 |
| h2 | 0.392500000 | 0.596884378 | sigmoid | 0.2500×0.0500 + 0.3000×0.1000 + 0.3500 |
| o1 | 1.105905967 | 0.751365070 | sigmoid | 0.4000×0.5933 + 0.4500×0.5969 + 0.6000 |
| o2 | 1.224921404 | 0.772928465 | sigmoid | 0.5000×0.5933 + 0.5500×0.5969 + 0.6000 |
Etotal = Σ ½ (target − out)² = 0.298371109
| Unit | ∂E/∂out | ∂out/∂net | δ = ∂E/∂net | how |
|---|---|---|---|---|
| o1 | 0.741365070 | 0.186815602 | 0.138498562 | out − target |
| o2 | −0.217071535 | 0.175510053 | −0.038098237 | out − target |
| h1 | 0.036350306 | 0.241300709 | 0.008771355 | Σ δ·w (old weights) |
| h2 | 0.041370323 | 0.240613417 | 0.009954255 | Σ δ·w (old weights) |
| Weight | from → to | old | ∂E/∂w = δ·out | finite difference (rel. error) | new = old − η ∂E/∂w |
|---|---|---|---|---|---|
| h1 → o1 | 0.400000 | 0.082167041 | 0.082167041 (1.3e−11) | 0.358916480 | |
| h2 → o1 | 0.450000 | 0.082667628 | 0.082667628 (1.9e−11) | 0.408666186 | |
| bo1 | bias → o1 | 0.600000 | 0.138498562 | 0.138498562 (1.3e−11) | 0.600000000 (kept) |
| h1 → o2 | 0.500000 | −0.022602540 | −0.022602540 (9.3e−11) | 0.511301270 | |
| h2 → o2 | 0.550000 | −0.022740242 | −0.022740242 (4.7e−11) | 0.561370121 | |
| bo2 | bias → o2 | 0.600000 | −0.038098237 | −0.038098237 (2.6e−11) | 0.600000000 (kept) |
| i1 → h1 | 0.150000 | 0.000438568 | 0.000438568 (1.2e−8) | 0.149780716 | |
| i2 → h1 | 0.200000 | 0.000877135 | 0.000877135 (9.8e−10) | 0.199561432 | |
| bh1 | bias → h1 | 0.350000 | 0.008771355 | 0.008771355 (3.5e−11) | 0.350000000 (kept) |
| i1 → h2 | 0.250000 | 0.000497713 | 0.000497713 (4.9e−9) | 0.249751144 | |
| i2 → h2 | 0.300000 | 0.000995425 | 0.000995425 (7.0e−10) | 0.299502287 | |
| bh2 | bias → h2 | 0.350000 | 0.009954255 | 0.009954255 (1.4e−10) | 0.350000000 (kept) |
Etotal after one step = 0.291027774 (was 0.298371109, change −0.007343)
Finite difference: (E(w + h) − E(w − h)) / 2h with h = 10⁻⁵, a check that does not use the chain rule at all. For this example the largest relative difference is 1.2e−8. A large difference in your own working means a slip in a δ. ReLU's derivative at exactly 0 is taken as 0 and leaky ReLU's as α, a one-sided derivative as most software uses.
Repeat the step thousands of times. XOR needs a hidden layer with a non-linear activation; a linear one cannot fit it.
| Input | Target | Output |
|---|---|---|
| 0, 0 | 0 | – |
| 0, 1 | 1 | – |
| 1, 0 | 1 | – |
| 1, 1 | 0 | – |
- Press Train. XOR start weights and biases are uniform in [−1, 1] from mulberry32(seed); the error is Σ ½ (target − out)² over the four patterns; every step uses all four.
Out of 100 seeds (1 to 100), η = 0.5, 10,000 steps, sigmoid output:
| Hidden activation | Error below 0.01 | All 4 on the right side of 0.5 | Median steps to 0.01 |
|---|---|---|---|
| sigmoid | 87 / 100 | 87 / 100 | 1,936 |
| tanh | 74 / 100 | 74 / 100 | 378 |
| ReLU | 25 / 100 | 25 / 100 | 258 |
| leaky ReLU (α 0.01) | 39 / 100 | 50 / 100 | 319 |
| linear | 0 / 100 | 0 / 100 | never |
With only two hidden units, some starts end in a local minimum (one pattern left wrong) and ReLU units can die (zero gradient for every pattern). A wider hidden layer, another seed or another η usually fixes it. Linear: never, because the two layers are one linear model.
Each activation function and its derivative: the derivative is the factor backprop multiplies by at every unit.
| Function | f(x) | f′(x) |
|---|
Softmax is drawn as its first output for two classes, softmax([x, 0])₁, which equals sigmoid(x). GELU: PyTorch and Keras default to the exact x·Φ(x) (approximate='none' / False); the tanh form differs by at most about 0.0005 here.
How big is the gradient in each layer of a deep network, for sigmoid, tanh and ReLU?
| Activation | |∂E/∂W|, layer 1 | last hidden layer | ratio |
|---|
Each network: 10 units per hidden layer, one linear output, E = mean ½ (y − 1)² over 8 random normal inputs, biases 0. Weights normal with Xavier (Glorot) std √(2/(fan_in + fan_out)) for sigmoid and tanh and He std √(2/fan_in) for ReLU, as in PyTorch's xavier_normal_ and kaiming_normal_. Geometric mean over 10 seeds (mulberry32 1 to 10).
Type the numbers you worked out by hand (any cells, as many decimals as you kept). Each is marked right or wrong, with the slip that gives your number when one does.
| Cell | Your value | Verdict |
|---|
A value counts as right when it is within one unit of its last typed decimal, so rounded and truncated working both pass. Slips tested: missing activation derivative (output or hidden), derivative taken at out instead of net, net instead of out in ∂E/∂w, bias left out, updated weights used to backpropagate, target − out instead of out − target, + instead of − in the update, ½ dropped from the loss, η applied twice.
Backpropagation in NumPy for Mazur's example: one step with every intermediate, then 10,000 steps.
# Backpropagation by hand, in NumPy: Matt Mazur's 2-2-2 example (2015).
# Inputs 0.05, 0.10; targets 0.01, 0.99; sigmoid everywhere; E = sum 1/2 (target - out)^2; learning rate 0.5.
# Like the post, the biases stay fixed (set UPDATE_BIAS = True to train them too).
import numpy as np
x = np.array([0.05, 0.10])
t = np.array([0.01, 0.99])
W1 = np.array([[0.15, 0.20], # w1, w2: into h1
[0.25, 0.30]]) # w3, w4: into h2
b1 = np.array([0.35, 0.35])
W2 = np.array([[0.40, 0.45], # w5, w6: into o1
[0.50, 0.55]]) # w7, w8: into o2
b2 = np.array([0.60, 0.60])
eta, UPDATE_BIAS = 0.5, False
def sigmoid(z):
return 1.0 / (1.0 + np.exp(-z))
def forward(W1, b1, W2, b2):
net_h = W1 @ x + b1
out_h = sigmoid(net_h)
net_o = W2 @ out_h + b2
out_o = sigmoid(net_o)
return net_h, out_h, net_o, out_o
def step(W1, b1, W2, b2):
net_h, out_h, net_o, out_o = forward(W1, b1, W2, b2)
E = np.sum(0.5 * (t - out_o) ** 2)
dE_dout_o = out_o - t # from E = 1/2 (t - out)^2
dout_dnet_o = out_o * (1 - out_o) # sigmoid'(net) = out (1 - out)
delta_o = dE_dout_o * dout_dnet_o
dE_dW2 = np.outer(delta_o, out_h) # dE/dw5 = delta_o1 * out_h1, ...
dE_dout_h = W2.T @ delta_o # uses the OLD W2
delta_h = dE_dout_h * out_h * (1 - out_h)
dE_dW1 = np.outer(delta_h, x)
new = (W1 - eta * dE_dW1, b1 - eta * delta_h if UPDATE_BIAS else b1,
W2 - eta * dE_dW2, b2 - eta * delta_o if UPDATE_BIAS else b2)
return E, out_o, dE_dW1, dE_dW2, new
E, out_o, dE_dW1, dE_dW2, (nW1, nb1, nW2, nb2) = step(W1, b1, W2, b2)
print(f"E = {E:.15g}")
print(f"out_o1 = {out_o[0]:.15g}")
print(f"out_o2 = {out_o[1]:.15g}")
print(f"dE_dw5 = {dE_dW2[0, 0]:.15g}")
print(f"w5_new = {nW2[0, 0]:.15g}")
print(f"dE_dw1 = {dE_dW1[0, 0]:.15g}")
print(f"w1_new = {nW1[0, 0]:.15g}")
print("new w1..w4:", np.round(nW1.ravel(), 9), " new w5..w8:", np.round(nW2.ravel(), 9))
params = (nW1, nb1, nW2, nb2)
print(f"E_after_1 = {np.sum(0.5 * (t - forward(*params)[3]) ** 2):.15g}")
for _ in range(9999):
params = step(*params)[4]
out = forward(*params)[3]
print(f"E_after_10000 = {np.sum(0.5 * (t - out) ** 2):.15g}")
print("outputs after 10,000 steps:", np.round(out, 9))
With NumPy 2.5.5 it prints E = 0.2983711088, dE_dw5 = 0.08216704056, w5_new = 0.3589164797 and w1_new = 0.1497807161: tab 1's numbers to 10 digits. After 10,000 steps the error is 3.51019e−5. Our verifier runs this exact script at every update.
How does backpropagation work?
Backpropagation is the chain rule of calculus applied from the error back through the network, one layer at a time. Goodfellow, Bengio and Courville: "Back-propagation is an algorithm that computes the chain rule, with a specific order of operations that is highly efficient." Each unit gets a δ, the derivative of the error with respect to its net input. Every weight's gradient is then one multiplication:
Three passes. Forward: compute net and out for every unit and the error. Backward: compute δ for the output units, then for each hidden layer from the δs above it, using the old weights. Update: subtract η × gradient from each weight. The gradient descent calculator covers how big η can be.
Backpropagation numerical example, step by step
Matt Mazur's "A Step by Step Backpropagation Example" (2015) is the example most courses copy: two inputs, two sigmoid hidden units, two sigmoid outputs, squared error with the ½ ("The 1/2 is included so that exponent is cancelled when we differentiate later on") and η = 0.5. The forward pass:
The output-layer weight w5 has a three-factor chain:
A hidden-layer weight such as w1 affects both outputs through h1, so ∂E/∂outh1 is a sum over o1 and o2. It uses the old w5 and w7, not the new ones:
Does our calculator match the post? Yes, for every number of the step: the forward pass, all four output and all four hidden gradients and new weights (w5+ = 0.358916480, w1+ = 0.149780716) agree with the post to its last printed digit. The one exception is ∂Eo2/∂outh1, printed as −0.019049119, which comes out −0.019049118 here because the post rounds as it goes. Two of the post's later numbers differ. It gives the error after the first round as 0.291027924; the step as written gives 0.291027774. After 10,000 rounds it gives outputs 0.015912196 and 0.984065734; here they are 0.015913620 and 0.984064274. Both of the post's numbers come out exactly, to all nine digits (0.291027924; 0.015912196 and 0.984065734), if the hidden δs are computed with the already-updated w5 … w8. The post's own text warns against that ("we use the original weights, not the updated weights"), and the Python script it links computes the hidden δs before any update. Its 10,000-round error, 0.0000351085, is what the correct order gives after 9,999 steps (3.51085e−5). Small, but it shows how easy that slip is; tab 5 catches it.
The post keeps the biases fixed. With "update biases" ticked, each bias gets ∂E/∂b = δ and the error after one step is 0.280471447 instead of 0.291027774.
What is a neural network?
A neural network is a function built from layers of simple units. Each unit adds up its inputs times weights, adds a bias, and passes the sum through an activation function: out = f(Σ w·in + b). Mazur's network has 8 weights and 4 biases; training means finding the values that make the outputs match the targets. Backpropagation supplies the gradient for that search.
What is deep learning?
Deep learning is machine learning with neural networks that have many layers, so each layer can build features out of the layer before. The same backpropagation trains them; the gradient just passes through more layers. That depth is also the difficulty: the gradient is a product of one factor per layer, and it can shrink to nothing (see the vanishing gradient below).
What is the role of the activation function?
It makes the network non-linear. Without it, layers collapse: Goodfellow 6.1, "if f(1) were linear, then the feedforward network as a whole would remain a linear function of its input." For a 2-2-1 network with a linear hidden layer:
A single linear layer cannot separate XOR ("a linear model is not able to represent the XOR function", Goodfellow 6.1), so the best it can do is output 0.5 for all four patterns, error 0.5. In our 100 seeded runs the linear hidden layer never got below 0.50. With sigmoid hidden units 87 runs reached error below 0.01, with tanh 74, with ReLU 25 and with leaky ReLU 39. The activation's derivative also sets how much gradient passes through each unit, which is why the choice matters for training.
What are the different types of activation functions?
The table gives each common activation with its derivative. f′(0) and the largest slope are computed by the calculator. Swish and GELU peak above 1 (at x = 2.40 and x = √2).
| Function | f(x) | Range | f′(x) | f′(0) | max |f′| | Zero-centred | Typical use |
|---|---|---|---|---|---|---|---|
| Binary step | if , else | {0, 1} | (undefined at 0) | – | 0 | no | The perceptron; no gradient, so backprop cannot train through it |
| Linear (identity) | (−∞, ∞) | 1 | 1 | yes | Regression outputs; in a hidden layer the layers collapse into one | ||
| Sigmoid (logistic) | (0, 1) | 0.25 | 0.25 | no | Binary-class output (a probability); hidden use now discouraged (saturates) | ||
| tanh | (−1, 1) | 1 | 1 | yes | Hidden layers when a sigmoid-shaped unit is wanted (Goodfellow 6.3.2: usually better than sigmoid) | ||
| ReLU | [0, ∞) | if , else | 0 | 1 | no | The default recommendation for hidden layers (Goodfellow 6.1) | |
| Leaky ReLU (α = 0.01) | if , else | (−∞, ∞) | or | 0.01 | 1 | nearly | ReLU that keeps a small gradient for x < 0 (dying ReLU) |
| PReLU (learnt α) | if , else , learnt | (−∞, ∞) | or | 0.25 | 1 | nearly | Leaky ReLU with α learnt (PyTorch starts a at 0.25) |
| ELU (α = 1) | if , else | (−α, ∞) | or | 1 | 1 | nearly | Smooth for x < 0, outputs down to −α |
| Swish / SiLU | [−0.278, ∞) | 0.5 | 1.0998 | no | Smooth, dips below 0; PyTorch calls it SiLU | ||
| GELU (exact) | [−0.170, ∞) | 0.5 | 1.1289 | no | Smooth ReLU-like unit; PyTorch and Keras default to this exact form | ||
| GELU (tanh approximation) | [−0.170, ∞) | by the chain rule | 0.5 | 1.129 | no | approximate='tanh' in PyTorch; faster, close to the exact form | |
| Softmax (2 classes, p₁) | (0, 1), sums to 1 | 0.25 | 0.25 | no | Multi-class output, with cross-entropy loss |
Two library defaults differ: PyTorch's LeakyReLU has negative_slope 0.01, Keras's leaky_relu 0.2. Goodfellow 6.3.2 on sigmoid and tanh: "When a sigmoidal activation function must be used, the hyperbolic tangent activation function typically performs better than the logistic sigmoid." For a multi-class output, softmax with cross-entropy gives the simplest δ of all:
What is the vanishing gradient problem?
The gradient reaching an early layer is a product of one factor w·f′(net) per layer above it. Nielsen (ch. 5) notes the sigmoid derivative "reaches a maximum at σ′(0) = 1/4", so with ordinary weights each factor is below 1/4 and the product shrinks geometrically: 0.2520 = 9.1e−13. Measured in tab 4, for 20 hidden layers with Xavier initialisation, sigmoid's first-layer gradient is 10−12.9 against 10−0.3 at the last hidden layer, 13 orders of magnitude apart. tanh with Xavier (10−1.0 vs 10−1.1) and ReLU with He initialisation (10−1.2 vs 10−1.0) stay within about one. In plain words: with deep sigmoid stacks the first layers get almost no update, so they keep their random start. That is why hidden layers use ReLU-type units with matched initialisation. Goodfellow 6.3.2 on sigmoidal units: "their use as hidden units in feedforward networks is now discouraged".
Does backpropagation update the weights?
Strictly, no: it computes the gradients, and an optimiser updates the weights. Goodfellow 6.5: "back-propagation refers only to the method for computing the gradient, while another algorithm, such as stochastic gradient descent, is used to perform learning using this gradient." In everyday use "backpropagation" often means the whole loop of forward pass, backward pass and update, as in this calculator's step.
What 93 public neural network challenge reports say (as of 24 Nov 2026)
We read the 93 public Skill-Lync reports titled "Supervised Learning - Classification Week 9 Challenge", as of 24 Nov 2026, n = 93, 0 image-only. Each answers five questions: what a neural network is, what deep learning is, the role of the activation function, its types, and backpropagation. A row counts the reports whose text shows the thing; the links are examples.
- 92 / 93Answer Q1 What is a neural network?. report 1report 2
- 90 / 93Answer Q2 What is deep learning?. report 1report 2
- 91 / 93Answer Q3 Role of the activation function. report 1report 2
- 91 / 93Answer Q4 Types of activation function (3 or more named). report 1report 2
- 93 / 93Answer Q5 Backpropagation. report 1report 2
- 90 / 93Name the sigmoid activation. report 1report 2
- 91 / 93Name the ReLU activation. report 1report 2
- 85 / 93Name the tanh activation. report 1report 2
- 53 / 93Name the softmax activation. report 1report 2
- 52 / 93Name the leaky ReLU activation. report 1report 2
- 41 / 93Name the linear activation. report 1report 2
- 38 / 93Name the ELU activation. report 1report 2
- 35 / 93Name the binary step activation. report 1report 2
- 25 / 93Name the parametric ReLU activation. report 1report 2
- 21 / 93Name the swish activation. report 1report 2
- 51 / 93State an output range (e.g. sigmoid 0 to 1, tanh -1 to 1). Sigmoid 39, tanh 33, ReLU 8. report 1report 2
- 26 / 93Write a formula for at least one activation. Sigmoid 20, tanh 17, ReLU 17, leaky ReLU 4. report 1report 2
- 10 / 93Give the derivative of any activation. Most of these are one line (e.g. the sigmoid derivative or ReLU's 0/1); none tabulates derivatives. report 1report 2
- 76 / 93Backprop answer mentions gradients or derivatives. report 1report 2
- 68 / 93Backprop answer says the weights are updated or adjusted. Strictly, backprop computes the gradients and the optimiser (gradient descent) updates the weights; many textbooks use the word for both. report 1report 2
- 32 / 93Backprop answer names the chain rule. report 1report 2
- 93 / 93Backprop explained in words only (no equation, number or code in text). Equations, worked numbers or code in the backprop answer: 0 / 0 / 0. report 1report 2
- 56 / 93Mention a loss / cost / error function. report 1report 2
- 48 / 93Mention gradient descent. report 1report 2
- 33 / 93Mention the dying ReLU problem. report 1report 2
- 29 / 93Mention the vanishing gradient problem. report 1report 2
- 16 / 93Discuss zero-centred output (tanh vs sigmoid). report 1report 2
What stands out: all 93 explain backpropagation in words only, with no equation, worked number or code. 90 name the sigmoid and 91 ReLU, but only 10 give any derivative, though backprop multiplies by one at every unit. 29 mention the vanishing gradient. The calculator adds the numbers the prose leaves out. These are first-party counts, a starting point rather than a measure of ability.
Common backpropagation slips and how to fix them
- Missing the activation derivative. δ = ∂E/∂out × f′(net), at the output and in every hidden layer. For Mazur's o1, leaving it out gives δ = 0.741365 instead of 0.138499.
- Using the new output weights for the hidden δs. Compute every δ first, then update. With the new w5 … w8, w1+ becomes 0.149817639 instead of 0.149780716.
- Sign of the error derivative. For E = ½(target − out)², ∂E/∂out = out − target. Writing target − out flips every gradient, and the update then climbs the error.
- The ½ in the loss. Dropping it doubles E and every gradient (0.596742218 instead of 0.298371109), which acts like doubling η. Either is fine if used consistently; compare like with like.
- σ′ at the wrong place. σ′(net) = out(1 − out). Writing σ(out)(1 − σ(out)) applies the sigmoid twice.
Tab 5 tests these and five more against any cell you type.
How we checked the calculator
An independent Python script, scripts/verify/backprop.py, recomputes everything with its own code. Where the browser code multiplies element-wise derivatives, it builds each layer's full Jacobian. This page refuses to build if the two differ in any of 40,017 numbers or verdicts (11,968 more assertions run inside the script, 361 cases). The cases include 210 random networks of 1 to 4 layers and up to 8 units with every activation and both losses, compared cell by cell. Every gradient is also checked against central finite differences. Edge cases: ReLU exactly at 0, saturation at net = ±30, softmax with logits near 1,000, η = 0 and a one-unit network. Mazur's published numbers are asserted one by one. The script also checks the slips of tab 5, the activation table, the XOR seed counts and the vanishing-gradient norms, and runs the tab 6 script. Two deliberate bugs (dropping f′ in the hidden δ, and backpropagating with the updated weights) each make the build fail.
What this calculator does not cover
- Mini-batches, momentum, Adam. One pattern per step in tab 1, the full XOR batch in tab 2, plain gradient descent with a fixed η.
- Convolutional and recurrent layers. Fully connected layers only; the chain rule is the same, the bookkeeping is not.
- Large networks. Up to 8 units per layer and 3 weight layers in the editor, so every number fits on the screen.
- Regularisation and dropout. The loss is MSE or cross-entropy alone.
Neural networks, activation functions and backpropagation are part of Skill-Lync's PG program in data analytics and data science; the Advanced Deep Learning course goes on to CNNs and sequence models.
Frequently asked questions
How do you calculate backpropagation by hand?
Do a forward pass and write down net and out for every unit, then the error. Go backwards: for each output unit δ = (out − target) × f′(net), for each hidden unit δ = (Σ δ × old weight) × f′(net). Each weight's gradient is δ times the input it multiplies. Then subtract η times the gradient.
What is the derivative of the sigmoid function?
σ′(x) = σ(x)(1 − σ(x)), so with out = σ(net) it is simply out(1 − out). It peaks at x = 0, where it is 0.25, and falls towards 0 on both sides: at x = 5 it is 0.00665. That small maximum is why stacked sigmoid layers shrink the gradient.
Why do we need activation functions in a neural network?
Without a non-linear activation, two layers W₂(W₁x + b₁) + b₂ are one layer with weights W₂W₁, however deep the network. Such a network cannot learn XOR: in 100 seeded trials a linear hidden layer reached error 0.50 at best, while sigmoid hidden units solved 87 of them.
What is the vanishing gradient problem?
In a deep network the gradient for an early layer is a product of many factors f′(net) × w. With sigmoid each f′ is at most 0.25, so the product shrinks fast. In our 20-layer test the first layer's gradient was about 10^13 times smaller than the last layer's, so early layers barely learn.
Why is ReLU used instead of sigmoid?
ReLU's derivative is exactly 1 for every positive input, so it does not shrink the gradient the way sigmoid's (at most 0.25) does, and it is cheap to compute. Its weakness is units stuck at negative net, which get zero gradient ("dying ReLU"); leaky ReLU keeps a small slope there.
Does backpropagation update biases?
Standard backpropagation gives the bias of each unit the gradient ∂E/∂b = δ, the same δ as its weights with input 1, and gradient descent updates it like a weight. Mazur's well-known worked example keeps the biases fixed for simplicity; tick "update biases" in the calculator to train them.
Is backpropagation the same as gradient descent?
No. Backpropagation computes the gradient of the error with respect to every weight using the chain rule. Gradient descent, or another optimiser such as Adam, then uses that gradient to change the weights. Goodfellow and colleagues stress this: backpropagation "refers only to the method for computing the gradient".
Related on Skill-Lync
- Gradient descent calculator (the update rule and the safe learning rate, for linear regression)
- Sample vs population variance calculator (the statistics week of the same program)
- Genetic algorithm simulator (optimisation without any gradient)
- Newton-Raphson method calculator (steps from the second derivative)
- All free engineering tools
Sources
- Matt Mazur, "A Step by Step Backpropagation Example", 17 March 2015 (mattmazur.com): network, inputs, weights, every intermediate number, the ½, "use the original weights"; and its linked Python script (github.com/mattm/simple-neural-network), read for the update order.
- Goodfellow, Bengio and Courville, Deep Learning (MIT Press, 2016), chapter 6: 6.1 (XOR, linear layers collapse, ReLU the default recommendation), eq. 6.33 (stable softmax), 6.3 (one-sided derivatives at 0), 6.3.1 (leaky ReLU and PReLU), 6.3.2 (sigmoid saturation, tanh), 6.5 (back-propagation computes only the gradient; the chain rule).
- Michael Nielsen, Neural Networks and Deep Learning, chapter 5 "Why are deep neural networks hard to train?": σ′(0) = 1/4 and the vanishing gradient.
- PyTorch 2.15 documentation: GELU (approximate='none' default, tanh form), LeakyReLU (negative_slope 0.01), PReLU (init 0.25), ELU (α 1.0), SiLU (swish), nn.init (xavier_normal_, kaiming_normal_, Glorot and Bengio 2010, He et al. 2015).
- Keras 3 API, layer activations: relu, sigmoid, tanh, softmax, elu, gelu (approximate=False), silu/swish, leaky_relu (negative_slope 0.2), linear.
- Skill-Lync, the 93 public neural network challenge reports, read 24 Nov 2026.