Lesson 7.5 · 8 min read · about 50 min to master at a very slow pace

Multiple Paths and Deeper Networks

When a hidden unit feeds several outputs, its gradient is a sum over paths. A two-hidden-layer, two-output example, the general backward recursion, and how it explains vanishing gradients.

Not startedJump to quiz

A network with fan-out

Two hidden layers (outputs , then ) and two outputs . A bar marks a pre-activation, so and . The cost for one example is

Last layer: one path each

Second layer: sum over both outputs

feeds both and , so a weight into affects the cost along two paths, and the contributions add:

The first layer follows the same way and reuses the bracketed terms already computed. That reuse is what backpropagation is.

Common error

Following only one path when a node fans out to several outputs. The derivative with respect to a shared node is the sum over every downstream path. Draw the network and trace each path.

The general recursion

For any depth, with :

The matrix product does the summing over paths automatically. Unrolled, it shows one activation-derivative factor per layer, which is exactly why deep sigmoid networks suffer vanishing gradients (Section 4).

Stuck? Common doubts

Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.

First passWhere does the sum appear in the matrix formula?

In : row of times is , the sum over every unit that unit feeds into, each weighted by its connecting weight. So the matrix form and the "sum over paths" rule are the same thing.

Cheatsheet

Fan-out

A node feeding several downstream nodes: its gradient is the sum over all paths. In matrix form, does the sum.

Backward recursion

, .

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1conceptIn a network with two outputs, hidden unit feeds both. What does (a weight into ) contain?
Q2conceptWhere does the "sum over paths" appear in the matrix recursion ?
Q3interpretWhy does layer 1's gradient in the two-hidden-layer example "reuse the bracketed terms"?
Q4applyYou compute a gradient by hand, following one path through the network, and your gradient check disagrees. What's the likely mistake?
Q5conceptUnrolling shows what about deep networks?