Exercises

bluegrass bubblegum bass, portuguese breakbeat, slushwave new jack swing, chillwave swing · 4:19

Listen on 93

Lyrics

[Verse 1]
Start with a simple computational graph in hand
Two inputs flowing through operations we've planned
Forward mode walks the chain from left to right
Calculating derivatives with each step in sight
Take the gradient seed, multiply along each edge
Building up the slope until you reach the ledge

[Chorus]
Forward needs n passes, reverse needs just one back
Automatic differentiation keeps us on track
Chain rule flowing forward, backprop flowing back
Same gradient answers through a different attack
Forward mode or reverse mode, mathematics stay true
Computational efficiency depends on what you choose

[Verse 2]
Now flip the script and try the backward dance
Reverse mode starts where forward calculations end
Store the forward values, then retrace your steps
Adjoint variables accumulate as gradient preps
For functions mapping vectors down to single scalars
Reverse mode wins the race like computational scholars

[Chorus]
Forward needs n passes, reverse needs just one back
Automatic differentiation keeps us on track
Chain rule flowing forward, backprop flowing back
Same gradient answers through a different attack
Forward mode or reverse mode, mathematics stay true
Computational efficiency depends on what you choose

[Bridge]
Three layer MLP with weights and biases stacked
Hidden activations, output layer packed
Forward mode computes each partial one by one
Reverse mode sweeps backward when forward pass is done
Both derivatives match when calculations complete
Mathematical proof that makes the theory sweet

[Verse 3]
First layer weights get gradients from the chain
Second layer biases feel the error's pain
Third layer outputs push the signal back
Through nonlinear functions keeping math on track
Verify the gradients match between both modes
Confidence builds as understanding explodes

[Verse 4]
When parameters number in the thousands or more
Reverse mode shines like never seen before
Memory overhead versus computational cost
Choose your method wisely or efficiency's lost
Jacobian matrices tell the scaling tale
Forward or reverse, let mathematics prevail

[Chorus]
Forward needs n passes, reverse needs just one back
Automatic differentiation keeps us on track
Chain rule flowing forward, backprop flowing back
Same gradient answers through a different attack
Forward mode or reverse mode, mathematics stay true
Computational efficiency depends on what you choose

[Outro]
Hand calculations prove what algorithms know
Gradients flow where mathematics show
Forward or reverse, the answer stays the same
Automatic differentiation wins the optimization game

← Readings | Connection to neuroscience →