Neural networks
The Chain Rule and Credit Assignment
Use the chain rule to connect downstream loss changes with upstream parameters and understand accumulation across branches and shared values.
By the end you can
- Apply the chain rule to a sequence of neural operations
- Explain credit assignment as multiplication of local sensitivities
- Describe how gradients add when one value influences the loss through several paths
- Connect repeated multiplication to vanishing and exploding gradient behavior
Hidden layers have no direct target
The output loss can compare a prediction with a target. An internal activation has no supplied “correct” value of its own. Training has to work out for itself how changing that activation would alter the final loss.
The problem has a name and a date. Marvin Minsky set it out in 1961, in a section of Steps Toward Artificial Intelligence headed “The Credit-Assignment Problem for Learning Systems”. He put it as a question rather than a definition: “But in the course of play, each ultimate success (or failure) is associated with a vast number of internal decisions. If the run is successful, how can we assign credit for the success among the multitude of decisions?” It reached the journal earlier still; the paper's own header records “Received by the IRE, October 24, 1960”. Schmidhuber's 2014 survey opens on the same difficulty, calling it “the fundamental credit assignment problem (Minsky, 1963)” and defining it as “Which modifiable components of a learning system are responsible for its success or failure?” Half a century apart, the same question.
Hidden units acquire useful structure precisely because nobody supplies them with a target. The 1986 paper in Nature that made the method famous claims exactly that in its abstract: “As a result of the weight adjustments, internal ‘hidden’ units which are not part of the input or output come to represent important features of the task domain, and the regularities in the task are captured by the interactions of these units.” The Nobel Committee for Physics restated the point in 2024: “A key advance was the demonstration by David Rumelhart, Hinton and Ronald Williams in 1986 of how architectures with one or more hidden layers could be trained for classification using an algorithm known as backpropagation”.
The chain rule supplies the missing link. It composes local derivatives along every dependency path.
Minsky named it in 1961: how to assign credit for success among the multitude of decisions.
Case
Reverse-mode credit assignment was described in a 1970 master’s thesis
The bookkeeping is older than the name backpropagation. Schmidhuber's 2014 survey of deep learning traces it back: “explicit, efficient error backpropagation (BP) in arbitrary, discrete, possibly sparsely connected, NN-like networks apparently was first described in a 1970 master’s thesis (Linnainmaa, 1970, 1976), albeit without reference to NNs”. Baydin and colleagues reach the same conclusion in the Journal of Machine Learning Research: “Prior to Werbos, the work by Linnainmaa (1970, 1976) is often cited as the first published description of the reverse mode.” Sixteen years separate that thesis from the 1986 paper, which in Schmidhuber's words “significantly contributed to the popularisation of BP for NNs”. Popularised is not invented.
The thesis is not a rumour, and the priority is not an in-house claim of the deep-learning literature. Seppo Linnainmaa wrote it at the University of Helsinki in 1970, and it appeared in English in 1976 as a paper on the Taylor expansion of the accumulated rounding error. The Nobel Committee for Physics lists exactly that item as the reference for the scheme Rumelhart, Hinton and Williams “reinvented”: “S. Linnainmaa, Master's thesis (in Finnish), Univ. Helsinki (1970); published in BIT 16, 146 (1976)”. Andreas Griewank's history of the reverse mode places the idea in no laboratory at all: “Seppo Linnainmaa (Lin76) of Helsinki says the idea came to him on a sunny afternoon in a Copenhagen park in 1970. He used it as a tool for estimating the effects of arithmetic rounding errors on the results of complex expressions.”
The title of the thesis names what the method was for when it was invented. Accumulated rounding error, not learning.
Visual
A three-operation derivative chain
Suppose x becomes z, z becomes a, and a contributes to loss L. The three local derivatives can be composed starting from either end. Which end you start from is the whole practical question.
There is a number on that choice. For a function with n inputs and m outputs, building the full m×n Jacobian costs n·c·ops(f) in forward mode but m·c·ops(f) in reverse mode, “where c is a constant guaranteed to be c < 6 and typically c ∼ [2, 3]”. That is the survey of automatic differentiation by Baydin and colleagues in the Journal of Machine Learning Research. A loss is a single number, so m is 1. One reverse sweep returns the sensitivity of L to every upstream quantity, at a small multiple of the cost of the forward pass. Forward mode would need a separate sweep per input.
Griewank fixes the ratio exactly at ω = 3 when only multiplications are counted, and notes the price: MEM{F′(x)} ∼ OPS{F(x)}. Reverse mode buys its speed by storing the forward values. His summary is why the arrows in the diagram below run right to left: “In other words, as Wolfe observed, gradients can ‘always’ be computed at a small multiple of the cost of computing the underlying function, irrespective of n the number of independent variables, which may be huge.”
- 1
x → z
The first operation has local derivative dz/dx.
- 2
z → a
The activation contributes da/dz.
- 3
a → L
The downstream computation contributes dL/da.
- 4
x → L
Multiply the three local terms to obtain dL/dx.
Example
One scalar chain worked by hand
Let z=2x+1, a=z², and L=3a at x=2.
- Forward values: z=5, a=25, and L=75.
- Local derivative dL/da equals 3.
- Local derivative da/dz equals 2z, which is 10 at z=5.
- Local derivative dz/dx equals 2.
- The chain gives dL/dx=3×10×2=60.
Branches create sums of path contributions
If one value feeds two downstream paths, changing it affects the loss through both. The total derivative is the sum of those path contributions.
That is why gradients accumulate at residual additions, reused embeddings, tied weights, and any shared activation. The sum is not a bookkeeping nicety. Inside a deep residual network an identity skip splits ∂E/∂x_l into two additive terms, and one of them reaches the shallow unit without passing through any weight layer. He and colleagues drew the consequence in 2016: “This implies that the gradient of a layer does not vanish even when the weights are arbitrarily small.”
Veit and colleagues at Cornell, an independent group, then measured how much each of those summed paths actually carries. In a 110-layer ResNet, almost all of the gradient arrives along paths only 5-17 modules long — 0.45% of all the paths in the network. A network retrained on those effective paths alone reached 5.96% error against 6.10% for the full model. Failing to accumulate would omit valid influence. The measurement says which summands the influence was hiding in.
Products carry sensitivity along a path; sums combine sensitivity from multiple paths.
Comparison
Product and sum rules inside neural graphs
Two simple rules explain most reverse-mode bookkeeping. A stack of plain layers is the sequential case; the residual block measured by Veit and colleagues is the parallel one.
Sequential dependency
One value influences the loss through a chain of operations.
- Multiply local derivatives
- Long chains can shrink or grow
- Order follows graph dependencies
- Example: stacked activations
Parallel dependency
One value reaches the loss through several branches.
- Compute each path contribution
- Add contributions at the shared value
- Common with residual and multi-task paths
- Example: shared encoder feeding two heads
Key idea
Repeated multiplication explains fragile gradient flow
Multiplying many local derivatives below one tends to shrink sensitivity. Multiplying factors above one can make it grow rapidly. The per-layer factor has been measured, not merely argued. Glorot and Bengio watched the singular values of each layer's Jacobian J_i = ∂z_{i+1}/∂z_i and reported the average ratio: “With our normalized initialization, this ratio is around 0.8 whereas with the standard initialization, it drops down to 0.5.” A factor β applied at each of L layers arrives as β^L. So 0.8 against 0.5 is not a difference of style. He and colleagues showed the consequence in 2015: a 30-layer network under that Glorot (“Xavier”) initialization “completely stalls”, because “its gradients are all diminishing”.
The scalar intuition has a matrix version with a stated threshold. Pascanu and colleagues proved it in 2013. They show that “it is sufficient for λ1 < 1/γ, where λ1 is the largest singular value of Wrec, for the vanishing gradient problem to occur”. Here γ is a bound on the derivative of the nonlinearity. It is 1 for tanh and 1/4 for the logistic sigmoid. Inverting the proof gives the necessary condition for exploding gradients. That condition is that λ1 exceed 1/γ. Their remedy for that direction is the one still in daily use. Clip the gradient by its norm.
The remedy in the other direction was scored in public. Replacing part of the product with an additive path is what a residual network does, and He and colleagues reported what it bought them: “Our 152-layer residual net is the deepest network ever presented on ImageNet, while still having lower complexity than VGG nets [41]. Our ensemble has 3.57% top-5 error on the ImageNet test set, and won the 1st place in the ILSVRC 2015 classification competition.” ImageNet's own official results table for ILSVRC 2015 records the winning MSRA entry at a classification error of 0.03567, with a localization error of 0.090178. Real networks contain matrices, nonlinearities, normalization and branches, so the behavior is richer than scalar multiplication. The chain-rule intuition still tells you why initialization and residual paths matter.
Gradient flow is a property of the entire path, not one layer in isolation.
Analogy
A chain of exchange rates
Money is converted through several currencies. To find dollars per yen, multiply each local exchange rate; if two independent routes return money, add their contributions.
Currency conversion is scalar, whereas neural derivatives can be matrices or higher-order linear maps. Direction and interaction matter alongside magnitude.
The chain rule converts local rates into end-to-end sensitivity.
Steps
Build a derivative ledger
Use a small graph before trusting automatic differentiation.
1. Draw dependencies
Mark which values feed each operation.
2. Compute forward values
Record the numbers at the evaluation point.
3. Write local derivatives
Differentiate each operation with respect to its inputs.
4. Reverse the graph
Propagate loss sensitivity backward along all paths.
5. Accumulate branches
Sum contributions wherever a value was reused.
Key takeaways
- The chain rule turns local operation derivatives into end-to-end loss sensitivity — a computational answer to the question Minsky posed in 1961.
- Hidden layers can learn without direct targets: Rumelhart, Hinton and Williams claimed in Nature in 1986 that internal units “come to represent important features of the task domain”.
- Derivatives multiply along sequential paths and add where a value influences several branches, as an identity skip does inside a residual block.
- Repeated products explain vanishing and exploding gradients: Glorot and Bengio measured per-layer ratios of about 0.8 against 0.5, and a 30-layer network stalls at the lower one.
- Shared parameters and residual branches require explicit gradient accumulation; in a 110-layer ResNet, paths 5-17 modules long — 0.45% of all paths — carry almost all of the gradient.
- Reverse mode is the direction of choice because its cost is bounded: c < 6 and typically 2-3 times the forward pass, whatever the number of inputs.