Same prediction, different backward graph
gradient▲▲△Exact values where possible; six decimal places for non-exact numerical results.
STATEMENT
Compare full backpropagation with a one-step truncation that detaches the state after the second input.
GIVEN
Use I.9.B01’s linear scalar model: , inputs , initial state zero, and final target one. The full forward states are . There is only a final output loss.
FIND
The prediction and loss in both computations, and their derivatives with respect to and . Explain the correct finite-difference check for each.
STRATEGY
After detaching , replace its computation by the constant . Differentiate the remaining one-step function and compare it with I.9.B02.
SOLUTION
The full graph has at . At the stated parameters its gradients are and .
The detached graph instead evaluates
At the original parameters this gives the same , and loss . Its last-state derivative is still , but there is no earlier parameter path:
The derivative with respect to the boundary value itself would be . Detachment stops it from propagating into the calculation that produced that value.
To finite-difference the full graph, perturb or and recompute every state. To finite-difference the truncated graph, first compute the boundary state at the original parameters, freeze it at , then perturb the parameters only in the final chunk.
Recomputing the boundary during the truncated check reattaches the dependency you intended to remove. Its result would be the full gradient, not a failure of the truncated backward implementation.
Answer
Both predictions are and both losses are . Full ; truncated .
Check — sanity
Resetting instead of detaching would set the boundary to zero. Because , that would give prediction zero and loss , a different forward computation. Detach preserves the value; reset replaces it.
Where this breaks
This comparison uses one fixed parameter setting and one final loss. Chunk-wise updates may also change parameters between chunks; they are not identical to a single full-sequence update even if boundary derivatives happen to be small.
Variation
Keep the final two time steps after detaching . The gradient happens to remain nine because the removed first-step contribution is zero, but the gradient drops from to . Matching one parameter’s derivative does not establish that the whole backward graph matches.