A vector-Jacobian product (VJP) propagates a chosen output sensitivity backward through a function. JAX's reverse-mode transform returns both the function value and a callable that maps an output cotangent to input cotangents. section 4.3.3
Computing a VJP with JAX
For f(x1, x2) = x1x2 + sin(x1x2), use p, vjp_func = jax.vjp(f, 7.0, 2.0). The primal output is 14.990607; vjp_func(1.0) returns approximately (2.2734745, 7.9571605), matching reverse-mode gradients. section 4.3.3
VJPs are useful for wide Jacobians: applying different output cotangents can recover Jacobian rows without materializing the full Jacobian. Reverse mode saves passes when inputs greatly outnumber outputs, but requires more storage. section 4.3.3
