When forward-mode autodiff tracks a value and its derivative together, the original value is the primal; the derivative is the tangent. Each intermediate therefore travels as a pair, forming a dual-number trace. section 4.3.2
Reading a JVP result
For f(x₁, x₂) = x₁x₂ + sin(x₁x₂) at (7, 2), jax.jvp(f, x, (1.0, 0.0)) returns p = 14.990607 and t = 2.2734745. The primal p is the ordinary function output; the tangent t is its derivative in the chosen input direction. section 4.3.2
Table 4.2. Forward mode autodiff example with f(x1, x2) = x1 × x2 + sin(x1 × x2) evaluated at the point (7.0, 2.0) with respect to the first variable x1 (view table figure)
| Forward primal trace |
Forward tangent (derivative) trace |
|---|---|
| v−1 = x1 = 7.0 (start) v0 = x2 = 2.0 |
v’−1 = x’1 = 1.0 (start) v’0 = x’2 = 0.0 |
| v1 = v−1 × v0 = 14.0 v2 = sin(v1) = 0.99 v3 = v1 + v2 = 14.99 |
v’1 = v’−1 × v0 + v−1 × v’0 = 1.0 × 2.0 + 7.0 × 0.0 v’2 = v’1 × cos(v1) = 2.0 × 0.137 v’3 = v’1 + v’2 = 2.0 + 0.274 |
| y = v3 = 14.99 (end) |
y’ = v’3 = 2.274 (end) |
Trace the ordinary intermediate values beside their derivative trace, from the inputs through multiplication and sine to the final primal output. section 4.3.2
