A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Backpropagation Algorithm

Graduate Depth 92 in the knowledge graph ☐ I know this ☆ Set as goal
76topics build on this
642prerequisites beneath it
See this on the map →
Chain RuleChain Rule for Multivariable Functions+4 more→→Autoencoders for Unsupervised LearningBatch Normalization+6 more
neural-networks training-algorithms gradient-computation

Core Idea

Backpropagation computes gradients efficiently via the chain rule in two phases: forward pass computes activations, backward pass propagates error signals layer-by-layer. Complexity is O(n) for n parameters, enabling large-scale neural network training.

How It's Best Learned

Implement backpropagation from scratch, deriving gradients by hand and verifying with numerical gradients.

Common Misconceptions

Backpropagation applies to any differentiable computation, not just neural networks. Vanishing/exploding gradients require normalization techniques.

Explainer

You already know from neural networks that a model makes predictions by passing inputs through layers of weighted connections and activation functions. Training the model means adjusting those weights so the predictions improve — but with potentially millions of weights across dozens of layers, how do you know which direction to adjust each one? That is the problem backpropagation solves.

The algorithm runs in two phases. In the forward pass, inputs flow through the network layer by layer, and you store the intermediate activations at each layer. At the end, you compute the loss — a scalar measuring how wrong the prediction was. In the backward pass, you work in reverse: starting from the loss, you use the chain rule to compute the gradient of the loss with respect to each weight. The chain rule says that ∂L/∂w = (∂L/∂a) · (∂a/∂w), where a is the activation that w influences. Because each layer feeds into the next, the error signals propagate back through the network by repeated application of the chain rule. Crucially, the stored activations from the forward pass are needed here — they are part of the local gradient at each layer.

The efficiency of backpropagation comes from the order of computation. A naïve approach to computing ∂L/∂w for every weight would recompute many of the same partial derivatives repeatedly. Backpropagation avoids this by computing error signals once per layer in a single backward sweep, reusing results as they propagate. This gives O(n) time for n parameters — the same cost as a single forward pass — which is why training large networks is computationally feasible.

A common misconception is that backpropagation is specific to neural networks. It is not — it is reverse-mode automatic differentiation applied to a particular kind of computation graph. Any software that computes a differentiable function (not just neural nets) can use the same technique. Modern deep learning frameworks like PyTorch build a dynamic computation graph during the forward pass and then traverse it in reverse to compute all gradients automatically.

The main practical hazard is the vanishing gradient problem: when gradients pass through many layers, they are repeatedly multiplied by local derivatives. If those derivatives are consistently small (as with saturating activations like sigmoid, whose derivative peaks at 0.25), the product shrinks exponentially. Early layers receive nearly zero gradient and fail to learn. The opposite — exploding gradients from derivatives greater than 1 — causes numerical instability. Remedies include ReLU activations (gradient is 1 for positive inputs), batch normalization (keeps activations in healthy ranges), and gradient clipping for recurrent networks.

Practice Questions 3 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Dividing Integers → Unit Rates → Proportions → Percent Concept → Converting Between Fractions, Decimals, and Percents → Operations with Rational Numbers → Two-Step Equations → Solving Multi-Step Equations → Equations with Variables on Both Sides → Angle Pairs: Complementary, Supplementary, and Vertical → Parallel Lines and Transversals → Corresponding Angles → Alternate Interior Angles → Triangle Angle Sum Theorem → Exterior Angle Theorem → Triangle Inequality Theorem → Similar Triangles: AA Similarity → Similar Triangles: SSS and SAS Similarity → Proportions in Similar Triangles → Right Triangle Trigonometry Introduction → Sine, Cosine, and Tangent Ratios → Trigonometric Ratios Review → Radian Measure → Converting Between Degrees and Radians → The Unit Circle → Graphing Sine and Cosine → Graphing Tangent and Reciprocal Trigonometric Functions → Derivatives of Trigonometric Functions → Antiderivatives → Indefinite Integrals → Basic Integration Rules → Riemann Sums → Definite Integral Definition → Probability Density Functions and Continuous Distributions → Cumulative Distribution Functions → Continuous Random Variables → Probability Density Functions → Expected Value → Linear Regression in Machine Learning → Neural Network Fundamentals → Backpropagation Algorithm

Longest path: 93 steps · 642 total prerequisite topics

Prerequisites (6)

Leads To (8)