Backpropagation
Backpropagation is the algorithm neural networks use to learn. It calculates how much each weight contributed to the error and sends that information backward through the network so every weight can be adjusted.
Data & AI
After the network makes a prediction (a forward pass), backpropagation works backward from the output to the input, using calculus (the chain rule) to find the gradient of the loss for each weight. Gradient descent then uses those gradients to update the weights.
It's like tracing back through a chain of events to assign blame: if the final answer was wrong, backpropagation figures out which connections to nudge, and by how much, to do better next time.
Examples
Python — PyTorch's .backward() runs backpropagation automatically.
import torch
loss = model(x).sum()
loss.backward() # backpropagation computes gradients
print("gradients computed for all parameters")