A cotangent is a reverse-mode sensitivity: the derivative of an output with respect to a variable. It shows how output changes flow backward through a computation. section 4.3.3
Reverse-mode autodiff uses cotangents in a backward pass:
- Runs the function forward while recording intermediate values and dependencies. section 4.3.3
- Starts the output cotangent at 1.0, then propagates sensitivities from outputs toward inputs. section 4.3.3
- Sums contributions when a variable affects the output along multiple paths. section 4.3.3
Cotangents with vjp()
For f(x1, x2) = x1*x2 + sin(x1*x2) at (7.0, 2.0), jax.vjp returns the primal output 14.990607 and a function. Passing output cotangent 1.0 returns input cotangents (2.2734745, 7.9571605). section 4.3.3
