The vector–Jacobian product, without forming the Jacobian
symbolic▲▲△For with and , write down the Jacobian explicitly, count its entries, and then show that the quantity backpropagation actually needs — — can be computed without ever building it. State the cost of each route.
Hint
Ask what is for this particular operation. The answer does not depend on at all, which is why the product collapses.
Solution
The Jacobian. , so
The Jacobian is , with entries. For a modest layer with that is numbers.
The product. By Definition 7 the backward pass needs , and since :
which is one matrix–vector product of exactly the shape the forward pass already performed. No new object is constructed.
The costs. Forming and multiplying costs storage and arithmetic. The VJP costs arithmetic and storage. The arithmetic is the same; the storage is not, and storage is what decides whether the layer fits.
Why this generalises. The saving is not special to matrix products. For every primitive the derivative is known in closed form, and in every case the closed form is a rule for computing rather than a recipe for — elementwise operations give a Hadamard product, a sum gives a broadcast, a broadcast gives a sum. A system that materialised Jacobians would be quadratic in width at every layer and could not train anything.
Where it stops working. A second derivative needs the Jacobian of the Jacobian, and the same trick applies one level up — a Hessian–vector product is computable without the Hessian, by differentiating a VJP. But asking for the full Hessian of a model with parameters really does mean numbers, and no reformulation avoids it.