delta
An interactive guide

See how a network learns.

Change the inputs. Follow the calculations. Watch the gradients.

Inside a prediction2 → 3 → 2

← → to step · Space to play · Hover a symbol to trace its connections.

01 / The basics

Start with a prediction.

Follow two inputs through a small neural network.

Press Next to begin
Reading the diagram

Units, weights, and biases

A model uses adjustable parameters to make a prediction. Each unit multiplies its inputs by weights, adds a bias, then applies an activation function. These units form layers.

The forward pass computes the output. This untrained network has 17 parameters.

$x$
Input values.
$W, b$
Weights and biases.
$z$
Pre-activation: the weighted sum plus bias.
$a$
Activation: a unit's output.
$\hat{y}, y$
Prediction and target.
02 / Learning

Follow the gradient.

Make a prediction, measure the loss, then work backward.

Select a weight to inspect it
Explore the decision boundary Try XOR with and without a hidden layer

Which class wins?

The shaded field shows the prediction for each input. The decision boundary separates the two classes. Select a point to inspect it.

Choose XOR and train the network. A hidden layer can separate the four points; the linear model cannot. At equal probabilities, a point is marked undecided.

How the backward pass works

The chain rule

Backpropagation computes the gradient: a partial derivative of the loss for each parameter. The error signal $\delta$ passes through the transposed weights, then multiplies by the activation function's slope.

Gradient descent subtracts a multiple of each gradient from its parameter. The learning rate controls the update size.

At the output

With softmax and cross-entropy, the output error is $\hat{y}-y$. The Jacobian calculation below gives the same result.

Check the gradients Analytic vs. numerical

Gradient checking nudges each parameter by $h$ and compares the measured loss change with the backward pass.

03 / Multiple samples

Same weights. Four inputs.

Each row is one sample. Their gradients add together.

Hover a weight to see where it is used
Reading the matrices

One row per sample

A batch stacks samples into a matrix. Activations gain a row per sample. Weight and bias dimensions stay fixed.

The transpose aligns the dimensions for each matrix product. Biases are added to every row.

One gradient per parameter

The batched loss here is a sum. Each weight gradient is a dot product across the samples.

Each row is computed independently, so the batch Jacobian is block diagonal. Layers such as batch normalisation would couple the rows and change this property.

The matrix derivative Trace trick

The trace trick rearranges a scalar differential to identify the gradient. A directional derivative checks the result.

Check the batch gradients Batched, summed, and numerical

Compare three calculations of the same gradient, then check that changing one sample leaves the other outputs unchanged.

04 / Images

Follow an image through a network.

Draw on the input. Step through the filters and back again.

Select a cell to follow its calculation
Selected cell & network
Filters, pooling, and the backward pass

Shared filters

A convolution applies one kernel at many positions. Each output channel is a feature map. Weight sharing means a filter's gradient sums its contributions across the image.

The second layer combines channels. Its 12 outputs are flattened into a vector for the final layer.

Where gradients pass

ReLU keeps positive values and sets negative values to zero. Max-pooling keeps the largest value in each 2×2 patch; its gradient returns to that cell.

A ReLU at zero or a max-pool tie can create a kink. The numerical check marks these points separately because a unique derivative may not exist.

Check all 95 parameters Analytic vs. numerical

Gradient checking compares the backward pass with finite differences. Kinks are excluded from the verdict.

05 / Depth

How much gradient gets through?

Compare sigmoid, tanh, and ReLU across eight layers.

The chart uses a log scale
Why gradients shrink

Each backward step multiplies by the weights and the activation function's derivative. Sigmoid's slope never exceeds $0.25$, which can make the error signal much smaller in earlier layers.

Tanh has a slope up to $1$. ReLU's slope is $1$ for positive inputs and $0$ for negative inputs. Neither guarantees a constant gradient: the weights and inactive units also matter.

A vanishing gradient gives earlier layers very small updates during training.

Reference

Glossary

Look up a term, then find it in a simulation.

About the project

Small networks. Real calculations.

Delta is an interactive guide to backpropagation, built by Yoseph Naoom.

The networks are small enough to inspect every value. All calculations run in your browser. No account, uploads, or external model service.

Found a problem?

Include the simulation, what you changed, and what you expected.