Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Which side of the Jacobian do you multiply on: JVP, VJP or the adjoint?

GeoStack · background · numerical methods · derivative products

Abstract

An EMIT overpass shows a methane enhancement map; we want the emission field that made it. Every derivative tool in JAX, from jvp to grad to the adjoint, is a product with one matrix, the Jacobian of the transport model. They differ only in which side you multiply on, and what that costs. The page expands two chapters of the numerical-methods lens: 1 · Calculus, autodiff, changes of variables, where JVP and VJP apply the Jacobian without forming it, and 26 · Adjoints, calculus of variations, where the gradient costs one backward run.

Keywords:JacobianJVPVJPadjointtangent linear modeladjoint modelHessian-vector productautomatic differentiationmethanesource inversionJAX

Every derivative is an operator

Each box is one computation with a fixed signature. Read down: each box comes from the one above by a single move, named in the line between them. The shape and unit of every row are the lesson; watch where units flip to their inverse.

hh · Forward model: emissions to enhancement map

F(U)=I−UΔtΔsD1+KhΔtΔs2L\rEst{\mat{F}}(\rExt{U}) = \mat{I} - \frac{\rExt{U} \rCon{\Delta t}}{\rCon{\Delta s}} \rCon{\mat{D}_1} + \frac{\rCon{K_h} \rCon{\Delta t}}{\rCon{\Delta s}^2} \rCon{\mat{L}}
c0=0\rEst{\vect{c}_0} = \vect{0}
ct=F(U)ct−1+Δtwx\rEst{\vect{c}_t} = \rEst{\mat{F}}(\rExt{U}) \rEst{\vect{c}_{t-1}} + \frac{\rCon{\Delta t}}{\rCon{w}} \rIn{\vect{x}}
y^=PcT\rOut{\hat{\vect{y}}} = \rCon{\mat{P}} \rEst{\vect{c}_T}
RoleSymbolNameShapeUnitNote
Inputx\rIn{\vect{x}}emission rate per cell(cell,)kg s⁻¹
External inputU\rExt{U}10 m wind()m s⁻¹
Parameternone—nothing is fitted
ConstantD1\rCon{\mat{D}_1}, L\rCon{\mat{L}}upwind difference, Laplacian(cell, cell)—stencils
Δt\rCon{\Delta t}, Δs\rCon{\Delta s}, w\rCon{w}time step, cell size, cell area()s, m, m²
Kh\rCon{K_h}eddy diffusivity()m² s⁻¹
P\rCon{\mat{P}}observation step(pixel, cell)ppm·m (kg m⁻²)⁻¹
EstimatedF(U)\rEst{\mat{F}(U)}one transport step(cell, cell)—eq. 1
c0:T\rEst{\vect{c}_{0:T}}column trajectory(step, cell)kg m⁻²eq. 2–3
Outputy^\rOut{\hat{\vect{y}}}predicted enhancement(pixel,)ppm·meq. 4

To the next box: differentiate with respect to x\vect{x}, wind held fixed.

J\mat{J} · Jacobian: the object

Jh=∂h∂x=ΔtwP∑tF(U)T−t\rOut{\mat{J}_h} = \frac{\partial h}{\partial \rIn{\vect{x}}} = \frac{\rCon{\Delta t}}{\rCon{w}} \rCon{\mat{P}} \sum_{t} \rEst{\mat{F}}(\rExt{U})^{T-t}

The sum runs over the steps t=1,…,Tt = 1, \ldots, T.

RoleSymbolNameShapeUnitNote
Inputx\rIn{\vect{x}}emission rate per cell(cell,)kg s⁻¹linearisation point
External inputU\rExt{U}10 m wind()m s⁻¹
ConstantP\rCon{\mat{P}}, Δt\rCon{\Delta t}, w\rCon{w}…as in box hh
EstimatedF(U)\rEst{\mat{F}(U)}one transport step(cell, cell)—box hh, eq. 1
OutputJh\rOut{\mat{J}_h}Jacobian of hh(pixel, cell)ppm·m (kg s⁻¹)⁻¹eq. 1

To the next box: multiply on the right by a tangent δx\delta\vect{x}.

JVP · Push a tangent forward (tangent linear model)

δc0=0\rEst{\delta\vect{c}_0} = \vect{0}
δct=F(U)δct−1+Δtwδx\rEst{\delta\vect{c}_t} = \rCon{\mat{F}(U)} \rEst{\delta\vect{c}_{t-1}} + \frac{\rCon{\Delta t}}{\rCon{w}} \rIn{\delta\vect{x}}
δy=PδcT=Jhδx\rOut{\delta\vect{y}} = \rCon{\mat{P}} \rEst{\delta\vect{c}_T} = \mat{J}_h \rIn{\delta\vect{x}}
RoleSymbolNameShapeUnitNote
Inputx\rIn{\vect{x}}emission rate per cell(cell,)kg s⁻¹linearisation point
δx\rIn{\delta\vect{x}}tangent(cell,)kg s⁻¹
External inputU\rExt{U}10 m wind()m s⁻¹
ConstantF(U)\rCon{\mat{F}(U)}, P\rCon{\mat{P}}, Δt\rCon{\Delta t}, w\rCon{w}…as in box hh
Estimatedδct\rEst{\delta\vect{c}_t}tangent columns(cell,)kg m⁻²eq. 1–2, not stored
Outputδy\rOut{\delta\vect{y}}tangent of the map(pixel,)ppm·meq. 3

To the next box: transpose, and multiply on the left by a cotangent y†\vect{y}^\dagger.

VJP · Pull a cotangent back (adjoint model)

cT†=P⊤y†\rEst{\vect{c}^\dagger_T} = \rCon{\mat{P}}^\top \rIn{\vect{y}^\dagger}
ct−1†=F(U)⊤ct†\rEst{\vect{c}^\dagger_{t-1}} = \rCon{\mat{F}(U)}^\top \rEst{\vect{c}^\dagger_t}
x†=Δtw∑tct†=Jh⊤y†\rOut{\vect{x}^\dagger} = \frac{\rCon{\Delta t}}{\rCon{w}} \sum_{t} \rEst{\vect{c}^\dagger_t} = \mat{J}_h^\top \rIn{\vect{y}^\dagger}

The sum runs over t=1,…,Tt = 1, \ldots, T.

RoleSymbolNameShapeUnitNote
Inputx\rIn{\vect{x}}emission rate per cell(cell,)kg s⁻¹forward sweep stores c0:T−1\vect{c}_{0:T-1}
y†\rIn{\vect{y}^\dagger}cotangent(pixel,)(ppm·m)⁻¹
External inputU\rExt{U}10 m wind()m s⁻¹
ConstantF(U)\rCon{\mat{F}(U)}, P\rCon{\mat{P}}, Δt\rCon{\Delta t}, w\rCon{w}…as in box hh
Estimatedct†\rEst{\vect{c}^\dagger_t}adjoint columns(cell,)(kg m⁻²)⁻¹eq. 1–2, backward in tt
Outputx†\rOut{\vect{x}^\dagger}pull-back onto emissions(cell,)(kg s⁻¹)⁻¹eq. 3

To the next box: seed y†\vect{y}^\dagger with ∂J/∂y^\partial \mathcal{J} / \partial \hat{\vect{y}}.

∇\nabla · Gradient of the cost (the adjoint method)

y^=h(x;U)\rEst{\hat{\vect{y}}} = h(\rIn{\vect{x}}; \rExt{U})
y†=−Σε−1(y−y^)\rEst{\vect{y}^\dagger} = -\rCon{\gmat{\Sigma}_\varepsilon}^{-1} (\rIn{\vect{y}} - \rEst{\hat{\vect{y}}})
x†=Jh⊤y†\rEst{\vect{x}^\dagger} = \mat{J}_h^\top \rEst{\vect{y}^\dagger}
∇xJ=x†+Σx−1(x−μx)\rOut{\nabla_{\vect{x}} \mathcal{J}} = \rEst{\vect{x}^\dagger} + \rCon{\gmat{\Sigma}_x}^{-1} (\rIn{\vect{x}} - \rCon{\gvect{\mu}_x})
RoleSymbolNameShapeUnitNote
Inputx\rIn{\vect{x}}emission rate per cell(cell,)kg s⁻¹
y\rIn{\vect{y}}observed enhancement(pixel,)ppm·m
External inputU\rExt{U}10 m wind()m s⁻¹
Parameternone—prior and noise are fixed
ConstantΣε\rCon{\gmat{\Sigma}_\varepsilon}observation-error covariance(pixel, pixel)(ppm·m)²
Σx\rCon{\gmat{\Sigma}_x}prior covariance(cell, cell)(kg s⁻¹)²
μx\rCon{\gvect{\mu}_x}prior mean(cell,)kg s⁻¹
Estimatedy^\rEst{\hat{\vect{y}}}predicted enhancement(pixel,)ppm·meq. 1, box hh
y†\rEst{\vect{y}^\dagger}cotangent(pixel,)(ppm·m)⁻¹eq. 2, the seed
x†\rEst{\vect{x}^\dagger}pull-back onto emissions(cell,)(kg s⁻¹)⁻¹eq. 3, box VJP; Jh\mat{J}_h applied, never formed
Output∇xJ\rOut{\nabla_{\vect{x}} \mathcal{J}}gradient of the cost(cell,)(kg s⁻¹)⁻¹eq. 4

To the next box: differentiate the gradient along a direction δx\delta\vect{x}.

HVP · Curvature along a direction

δy=Jhδx\rEst{\delta\vect{y}} = \mat{J}_h \rIn{\delta\vect{x}}
y†=Σε−1δy\rEst{\vect{y}^\dagger} = \rCon{\gmat{\Sigma}_\varepsilon}^{-1} \rEst{\delta\vect{y}}
x†=Jh⊤y†\rEst{\vect{x}^\dagger} = \mat{J}_h^\top \rEst{\vect{y}^\dagger}
∇x2Jδx=x†+Σx−1δx\rOut{\nabla^2_{\vect{x}} \mathcal{J} \delta\vect{x}} = \rEst{\vect{x}^\dagger} + \rCon{\gmat{\Sigma}_x}^{-1} \rIn{\delta\vect{x}}
RoleSymbolNameShapeUnitNote
Inputx\rIn{\vect{x}}, δx\rIn{\delta\vect{x}}linearisation point, direction(cell,), (cell,)kg s⁻¹
External inputU\rExt{U}10 m wind()m s⁻¹
ConstantΣε\rCon{\gmat{\Sigma}_\varepsilon}, Σx\rCon{\gmat{\Sigma}_x}…as in box ∇\nabla
Estimatedδy\rEst{\delta\vect{y}}tangent of the map(pixel,)ppm·meq. 1, one JVP
y†\rEst{\vect{y}^\dagger}cotangent(pixel,)(ppm·m)⁻¹eq. 2
x†\rEst{\vect{x}^\dagger}pull-back onto emissions(cell,)(kg s⁻¹)⁻¹eq. 3, one VJP
Output∇x2Jδx\rOut{\nabla^2_{\vect{x}} \mathcal{J} \delta\vect{x}}Hessian-vector product(cell,)(kg s⁻¹)⁻¹eq. 4

The kinds on this page

Table 1:The kinds of object on this page, with their dimensions.

KindDimensionsHere
scalar()wind UU, cost J\mathcal{J}, total rate QQ
field(cell,) = (row, col)emissions x\vect{x}, columns ct\vect{c}_t, their tangents and cotangents
trajectory(step, cell)c0:T\vect{c}_{0:T}, what a VJP stores
vector(pixel,)clear-sky observations y\vect{y}, y^\hat{\vect{y}}, δy\delta\vect{y}, y†\vect{y}^\dagger
matrix / operator(pixel, cell), (cell, cell)Jh\mat{J}_h, F(U)\mat{F}(U), P\mat{P}, covariances

The problem: where did this methane come from?

The retrieval example ended with an L2 product: an enhancement map α^\hat{\gvect{\alpha}} in ppm·m from the matched filter, one value per 60 m EMIT pixel. A mass-balance estimate, as in the quantification example, gives one number for the whole plume. A source map asks for more: an emission rate in every grid cell, chosen so that wind and diffusion carry it into the map we see. That is an inverse problem, and every way of solving it runs on derivatives of a transport model.

The data are one enhancement map at the overpass time, with a block of cloud masked out. The unknown is an emission field x\vect{x} on the same grid. The model releases x\vect{x} every time step for 15 minutes, advects it with the 10 m wind and diffuses it. The truth used to make the synthetic map is one facility emitting 2.0 kg s⁻¹, the rate the quantification example found. The grid, noise and wind are real-scale; the scene is synthetic so that every number can be checked. It is a different synthetic scene from the one on the two plume pages, which share only the 60 m pixel, the 750 ppm·m threshold, κ\kappa and the 2.0 kg s⁻¹ rate with it, so its plume, noise and mass numbers differ from theirs.

nn indexes grid cells sn∈Ωx\vect{s}_n \in \Omega_x, n=1,…,Dxn = 1, \ldots, D_x; mm indexes clear pixels in Ωy\Omega_y, m=1,…,Dym = 1, \ldots, D_y; t=1,…,Tt = 1, \ldots, T indexes model steps. Coordinates are s=(s1,s2)\vect{s} = (s_1, s_2), with the wind along s1s_1. A tangent (a small change of an input) is marked δ\delta; a cotangent (a weighting on an output, also called an adjoint variable) is marked †\dagger.

Table 3:Notation.

SymbolRoleShapeUnit
x\vect{x}in · emission rate per cell, the unknownRDx\mathbb{R}^{D_x} (cell,)kg s⁻¹
y\vect{y}, y^\hat{\vect{y}}observation · enhancement α^\hat{\gvect{\alpha}} at clear pixels; model predictionRDy\mathbb{R}^{D_y} (pixel,)ppm·m
UUu · 10 m wind speed, givenR\mathbb{R}m s⁻¹
ct\vect{c}_test · CH4\mathrm{CH_4} column mass enhancement at step ttRDx\mathbb{R}^{D_x} (cell,)kg m⁻²
D1\mat{D}_1, L\mat{L}const · upwind difference along s1s_1; five-point Laplacian stencil; zero inflowRDx×Dx\mathbb{R}^{D_x \times D_x}—
F(U)\mat{F}(U)est · one transport step, linear in c\vect{c}, depends on UURDx×Dx\mathbb{R}^{D_x \times D_x}—
P\mat{P}const · keep clear pixels and divide by κ\kappaRDy×Dx\mathbb{R}^{D_y \times D_x}ppm·m (kg m⁻²)⁻¹
hhforward model x↦y^\vect{x} \mapsto \hat{\vect{y}}, box hhRDx→RDy\mathbb{R}^{D_x} \to \mathbb{R}^{D_y}kg s⁻¹ → ppm·m
Jh\mat{J}_hJacobian of hh with respect to x\vect{x}RDy×Dx\mathbb{R}^{D_y \times D_x}ppm·m (kg s⁻¹)⁻¹
δx\delta\vect{x}, δy\delta\vect{y}, δct\delta\vect{c}_ttangents: input direction and its imagesshapes of x\vect{x}, y\vect{y}, ct\vect{c}_tunits of x\vect{x}, y\vect{y}, c\vect{c}
y†\vect{y}^\dagger, ct†\vect{c}^\dagger_t, x†\vect{x}^\daggercotangents: output weighting and its pull-backsshapes of y\vect{y}, ct\vect{c}_t, x\vect{x}inverse units
Σε=σε2I\gmat{\Sigma}_\varepsilon = \sigma_\varepsilon^2 \mat{I}const · observation-error covarianceRDy×Dy\mathbb{R}^{D_y \times D_y}(ppm·m)²
μx\gvect{\mu}_x, Σx=σx2I\gmat{\Sigma}_x = \sigma_x^2 \mat{I}const · prior mean and covariance of x\vect{x}RDx\mathbb{R}^{D_x}, RDx×Dx\mathbb{R}^{D_x \times D_x}kg s⁻¹, (kg s⁻¹)²
J\mathcal{J}cost: negative log posterior of x\vect{x}R\mathbb{R}—
κ\kappaconst · kg m⁻² per ppm·m, from ps=101 325p_s = 101\ 325 Pa, Ts=288T_s = 288 KR>0\mathbb{R}_{>0}kg m⁻² (ppm·m)⁻¹

Step 0 · The forward model is a loop of one linear step

Each step moves the column field ct−1\vect{c}_{t-1} half a cell downwind, smooths it slightly, and adds this step’s emissions Δtwx\frac{\Delta t}{w} \vect{x}. After T=90T = 90 steps the observation operator keeps the clear pixels and converts kg m⁻² to ppm·m. The model is linear in x\vect{x} for a fixed wind, and nonlinear in the wind, because UU enters every one of the 90 steps.

# Shapes: D_x = 4,096 cells (row, col = 64 × 64); D_y = 3,900 clear pixels; T = 90 steps
# Units:  [x] = kg s⁻¹ per cell;  [c] = kg m⁻²;  [α] = ppm·m
# Setup:  the upper-case constants are the running-example table's; clear holds the
#         D_y flat indices of the pixels outside the cloud block; y_obs is the observed
#         map (D_y,) and mu_x the prior mean (D_x,)

# user
# shift by k cells along an axis; the k cells that enter are zero (clean-air inflow)
def shift(c, k, axis):
    rolled = jnp.roll(c, k, axis)                    # (row, col) → (row, col)  [c]
    index = jnp.arange(c.shape[axis])
    inflow = index < k if k > 0 else index >= c.shape[axis] + k
    return jnp.where(jnp.expand_dims(inflow, 1 - axis), 0.0, rolled)

# user
# F(U) c + (Δt/w) x,  with F(U) = I − (UΔt/Δs) D₁ + (K_h Δt/Δs²) L
def step(c, x, wind):
    # D₁ c: upwind difference along s₁, zero (clean-air) inflow
    upwind = c - shift(c, 1, 1)                     # (row, col) → (row, col)  [c]
    # L c: five-point Laplacian stencil
    laplacian = (shift(c, 1, 0) + shift(c, -1, 0)   # (row, col) → (row, col)  [c]
                 + shift(c, 1, 1) + shift(c, -1, 1) - 4 * c)
    # c_t = c_{t−1} − (UΔt/Δs) D₁c + (K_hΔt/Δs²) Lc + (Δt/w) x
    return (c - (wind * DT / DS) * upwind            # → (row, col)            [c]
            + (DIFFUSIVITY * DT / DS**2) * laplacian
            + (DT / PIXEL_AREA) * x)

# user
def forward(x, wind=WIND):
    x_grid = x.reshape(N_ROW, N_COL)                 # (D_x,) → (row, col)      [x]
    # today (jax 0.12)
    # c_t = F(U) c_{t−1} + (Δt/w) x,  t = 1 … T,  c_0 = 0
    c_final, _ = jax.lax.scan(                       # → (row, col)            [c]
        lambda c, _: (step(c, x_grid, wind), None),
        jnp.zeros((N_ROW, N_COL)), None, length=N_STEP,
    )
    # ŷ = P c_T: clear pixels, divided by κ
    return (c_final / KAPPA).reshape(-1)[clear]      # → (D_y,)               [α]

Program 1:The forward model: one linear transport step, scanned over the T = 90 steps, then the observation step.

Step 1 · The Jacobian is the object, not the computation

Entry [Jh]mn[\mat{J}_h]_{mn} answers one question: if cell nn emitted 1 kg s⁻¹ more, how many ppm·m more would pixel mm show at the overpass? Column nn is the footprint of cell nn on the map. Row mm is the set of cells that could have reached pixel mm. For this model the Jacobian has a closed form, and it does not depend on x\vect{x}, because hh is linear in x\vect{x}. It depends on the wind.

Table 4:The cheapest route to each derivative quantity, in passes of the model.

What you needShapeCheapest routePasses
Footprint of one facility(pixel,)one JVP with en\vect{e}_n1
Sensitivity of the map to the wind(pixel,)one JVP in UU1
Cells that could reach one pixel(cell,)one VJP with em\vect{e}_m1
Gradient of the scalar cost(cell,)one VJP1
Curvature along one direction(cell,)one JVP and one VJP2
The whole Jacobian(pixel, cell)min⁡(Dx,Dy)\min(D_x, D_y) products3 900

Step 2 · JVP: push an input direction forward

A JVP answers “if I nudge the inputs along δx\delta\vect{x}, how does the output move?” It runs alongside the forward model: every intermediate value ct\vect{c}_t carries its own tangent δct\delta\vect{c}_t, and both march forward together. Nothing is stored, so memory is about twice a forward run, and the cost is about one forward run no matter how many outputs there are. Data assimilation calls this recursion the tangent linear model.

Use · jax.jvp(forward, (x,), (dx,)), one call per input direction.

δc0=0\rEst{\delta\vect{c}_0} = \vect{0}
δct=F(U)δct−1+Δtwδx\rEst{\delta\vect{c}_t} = \rCon{\mat{F}(U)} \rEst{\delta\vect{c}_{t-1}} + \frac{\rCon{\Delta t}}{\rCon{w}} \rIn{\delta\vect{x}}
δy=PδcT\rOut{\delta\vect{y}} = \rCon{\mat{P}} \rEst{\delta\vect{c}_T}
RoleSymbolNameShapeUnitNote
Inputx\rIn{\vect{x}}primal(cell,)kg s⁻¹where to linearise
δx\rIn{\delta\vect{x}}tangent(cell,)kg s⁻¹same shape and unit as the primal
External inputU\rExt{U}wind()m s⁻¹closed over: a default argument of forward
Parameternone—nothing is trained
ConstantF(U)\rCon{\mat{F}(U)}, P\rCon{\mat{P}}, Δt\rCon{\Delta t}, w\rCon{w}…baked into the traced function
Estimatedδct\rEst{\delta\vect{c}_t}tangent columns(cell,)kg m⁻²eq. 1–2, carried with ct\vect{c}_t, then dropped
Outputy^\rOut{\hat{\vect{y}}}, δy\rOut{\delta\vect{y}}primal output, tangent of the map(pixel,), (pixel,)ppm·mthe primal output and eq. 3, together

Swap jax.jvp for jax.linearize to pay for the forward pass once and reuse the linear map for many tangents.

# Shapes: D_x = 4,096; D_y = 3,900
# Units:  [x] = kg s⁻¹;  [α] = ppm·m;  [U] = m s⁻¹

# δx = e_n: one extra kg s⁻¹ at the facility cell (32, 8)
dx = jnp.zeros_like(x).at[32 * N_COL + 8].set(1.0)   # → (D_x,)           [x]
# today (jax 0.12)
# ŷ = h(x),  δy = J_h δx: one forward pass carrying the tangent
y_hat, dy = jax.jvp(forward, (x,), (dx,))           # → (D_y,), (D_y,)    [α]
# today (jax 0.12)
# δx ↦ J_h δx, linearised once, reused for many tangents
y_hat, jvp_fn = jax.linearize(forward, x)           # → (D_y,), fn (D_x,) → (D_y,)
# today (jax 0.12)
# ∂ŷ/∂U: one scalar input, so one JVP gives the whole column
y_hat, dy_wind = jax.jvp(                           # () → (D_y,)         [α] [U]⁻¹
    lambda u: forward(x, u), (WIND,), (1.0,)
)

Program 2:Three JVPs: the facility’s footprint, a linearised map reused for many tangents, and the map’s sensitivity to the wind.

Step 3 · VJP: pull an output weighting back

A VJP answers the reverse question: “given a weighting y†\vect{y}^\dagger on the outputs, which inputs matter, and how much?” It runs the chain of step Jacobians from the observation end, transposed, back to the emissions. For that it needs every step’s linearisation point, so the forward pass runs first and stores the trajectory. The cost is about one forward run no matter how many inputs there are. Data assimilation calls the backward recursion the adjoint model; machine learning calls it backpropagation.

Use · jax.vjp(forward, x), one forward sweep, then one backward sweep per cotangent.

cT†=P⊤y†\rEst{\vect{c}^\dagger_T} = \rCon{\mat{P}}^\top \rIn{\vect{y}^\dagger}
ct−1†=F(U)⊤ct†\rEst{\vect{c}^\dagger_{t-1}} = \rCon{\mat{F}(U)}^\top \rEst{\vect{c}^\dagger_t}
x†=Δtw∑tct†\rOut{\vect{x}^\dagger} = \frac{\rCon{\Delta t}}{\rCon{w}} \sum_{t} \rEst{\vect{c}^\dagger_t}
RoleSymbolNameShapeUnitNote
Inputx\rIn{\vect{x}}primal(cell,)kg s⁻¹forward sweep runs once and keeps the residuals
y†\rIn{\vect{y}^\dagger}cotangent(pixel,)(ppm·m)⁻¹passed to the returned vjp_fn; same shape as the output
External inputU\rExt{U}wind()m s⁻¹closed over; not differentiated: it is not a primal argument
Parameternone—nothing is trained
ConstantF(U)⊤\rCon{\mat{F}(U)}^\top, P⊤\rCon{\mat{P}}^\top, Δt\rCon{\Delta t}, w\rCon{w}…transposes are derived by JAX, never written by hand
Estimatedc0:T−1\rEst{\vect{c}_{0:T-1}}stored trajectory(step, cell)kg m⁻²forward sweep; 90 × 4 096 floats here
ct†\rEst{\vect{c}^\dagger_t}adjoint columns(cell,)(kg m⁻²)⁻¹eq. 1–2, backward in tt
Outputx†=Jh⊤y†\rOut{\vect{x}^\dagger} = \mat{J}_h^\top \vect{y}^\daggerpull-back onto emissions(cell,)(kg s⁻¹)⁻¹eq. 3; same shape as the input

The returned vjp_fn can be called many times with different y†\vect{y}^\dagger; the forward sweep is paid once.

# Shapes: D_x = 4,096; D_y = 3,900; T = 90
# Units:  [x] = kg s⁻¹;  [α] = ppm·m

# today (jax 0.12)
# ŷ = h(x); store c_{0:T−1}; return y† ↦ J_hᵀ y†
y_hat, vjp_fn = jax.vjp(forward, x)                  # → (D_y,), fn (D_y,) → (D_x,)
# m: the clear-pixel index of pixel (32, 40)
pixel = jnp.searchsorted(clear, 32 * N_COL + 40)    # → ()
# y† = e_m: unit weight on one pixel
y_adj = jnp.zeros_like(y_hat).at[pixel].set(1.0)     # → (D_y,)          [α]⁻¹
# x† = J_hᵀ y†: one backward pass
(x_adj,) = vjp_fn(y_adj)                             # (D_y,) → (D_x,)   [x]⁻¹

Program 3:One VJP: the forward sweep runs once, and one backward sweep returns the influence map of one pixel.

x\vect{x}(cell,)kg s−1\mathrm{kg\ s^{-1}}

add Δtwx\frac{\Delta t}{w} \vect{x} every step

c0→c1→…→cT\vect{c}_0 \to \vect{c}_1 \to \ldots \to \vect{c}_T(step, cell)kg m−2\mathrm{kg\ m^{-2}}stored

P\mat{P}: keep clear pixels, divide by κ\kappa

y^\hat{\vect{y}}(pixel,)ppm m\mathrm{ppm\ m}

seed with a cotangent

y†\vect{y}^\dagger(pixel,)(ppm m)−1(\mathrm{ppm\ m})^{-1}

P⊤\mat{P}^\top

cT†→…→c1†\vect{c}^\dagger_T \to \ldots \to \vect{c}^\dagger_1(cell,)(kg m−2)−1(\mathrm{kg\ m^{-2}})^{-1}

ct−1†=F⊤ct†\vect{c}^\dagger_{t-1} = \mat{F}^\top \vect{c}^\dagger_t, backward in tt; sum over tt, times Δt/w\Delta t / w

x†=Jh⊤y†\vect{x}^\dagger = \mat{J}_h^\top \vect{y}^\dagger(cell,)(kg s−1)−1(\mathrm{kg\ s^{-1}})^{-1}

The VJP of the forward model, with the shape and unit of every value. The forward sweep (plain boxes) adds the emissions every step and stores the column trajectory; the cotangent seeded on the map (shaded boxes) runs back through the transposed steps and comes out in the inverse unit of the emissions.

Step 4 · The gradient is one VJP, and the adjoint method is how it runs in time

To estimate x\vect{x} we minimise a cost, a single number. Its gradient has Dx=4 096D_x = 4\ 096 entries but comes from one VJP, because the output is a scalar: seed the cotangent with the cost’s sensitivity to the predicted map and pull it back. The model below writes the cost before anything is assumed linear or Gaussian.

4 · Assumptions.

5 · Result (uses A1–A4).

J(x)=12∥y−h(x;U)∥Σε−12+12∥x−μx∥Σx−12+const\mathcal{J}(\vect{x}) = \frac{1}{2} \Vert \vect{y} - h(\vect{x}; U) \Vert^2_{\gmat{\Sigma}_\varepsilon^{-1}} + \frac{1}{2} \Vert \vect{x} - \gvect{\mu}_x \Vert^2_{\gmat{\Sigma}_x^{-1}} + \mathrm{const}
∇xJ=−Jh⊤Σε−1(y−h(x;U))+Σx−1(x−μx)\nabla_{\vect{x}} \mathcal{J} = -\mat{J}_h^\top \gmat{\Sigma}_\varepsilon^{-1} (\vect{y} - h(\vect{x}; U)) + \gmat{\Sigma}_x^{-1} (\vect{x} - \gvect{\mu}_x)

where ∇xJ∈RDx\nabla_{\vect{x}} \mathcal{J} \in \mathbb{R}^{D_x} is the gradient, a column in emission space, in (kg s⁻¹)⁻¹. With A4 the product Jh⊤(…)\mat{J}_h^\top (\ldots) is the backward recursion of box VJP, seeded with y†=−Σε−1(y−y^)\vect{y}^\dagger = -\gmat{\Sigma}_\varepsilon^{-1} (\vect{y} - \hat{\vect{y}}). One forward run and one backward run give all 4 096 partial derivatives. That is the adjoint method. In Lagrangian form, ct†\vect{c}^\dagger_t is the multiplier that enforces A4 at step tt.

“Adjoint” names four related things, and papers switch between them without saying so.

Table 5:The four meanings of “adjoint”.

MeaningWhat it isHereIn JAX
adjoint operatorthe map A⊤\mat{A}^\top with (Aa)⊤b=a⊤A⊤b(\mat{A}\vect{a})^\top \vect{b} = \vect{a}^\top \mat{A}^\top \vect{b}; for a field operator, A†\mathcal{A}^\dagger under an inner productP⊤\mat{P}^\top, F(U)⊤\mat{F}(U)^\top, Jh⊤\mat{J}_h^\topjax.linear_transpose
adjoint modelthe transposed tangent linear model, run backward in timebox VJP, eq. 1–2jax.vjp through lax.scan
adjoint variablethe cotangent of a state, a Lagrange multiplier of the model constraintct†\vect{c}^\dagger_tthe carry of the backward scan
adjoint methoda gradient from one forward and one backward runbox ∇\nablajax.grad

There is one more split. The discrete adjoint differentiates the code you ran, step by step; that is what jax.grad through lax.scan gives, and why it matches finite differences to rounding. The continuous adjoint derives an adjoint PDE or ODE first and then discretises it on its own, so its gradient is only consistent with the forward scheme as the step shrinks. In diffrax these are RecursiveCheckpointAdjoint and BacksolveAdjoint.

Use · jax.value_and_grad(cost)(x), once per optimiser iteration.

y^=h(x;U)\rEst{\hat{\vect{y}}} = h(\rIn{\vect{x}}; \rExt{U})
y†=−Σε−1(y−y^)\rEst{\vect{y}^\dagger} = -\rCon{\gmat{\Sigma}_\varepsilon}^{-1} (\rIn{\vect{y}} - \rEst{\hat{\vect{y}}})
x†=Jh⊤y†\rEst{\vect{x}^\dagger} = \mat{J}_h^\top \rEst{\vect{y}^\dagger}
∇xJ=x†+Σx−1(x−μx)\rOut{\nabla_{\vect{x}} \mathcal{J}} = \rEst{\vect{x}^\dagger} + \rCon{\gmat{\Sigma}_x}^{-1} (\rIn{\vect{x}} - \rCon{\gvect{\mu}_x})
RoleSymbolNameShapeUnitNote
Inputx\rIn{\vect{x}}current emissions(cell,)kg s⁻¹the iterate
y\rIn{\vect{y}}observed map(pixel,)ppm·mclosed over by cost
External inputU\rExt{U}wind()m s⁻¹A5: given
Parameternone—σε\sigma_\varepsilon, σx\sigma_x fixed; tuning them would be a loss L(θ)\mathcal{L}(\gvect{\theta}) one level up
ConstantΣε\rCon{\gmat{\Sigma}_\varepsilon}, Σx\rCon{\gmat{\Sigma}_x}, μx\rCon{\gvect{\mu}_x}…(ppm·m)², (kg s⁻¹)²diagonal: σε=250\sigma_\varepsilon = 250 ppm·m, σx=0.5\sigma_x = 0.5 kg s⁻¹, μx=0\gvect{\mu}_x = \vect{0}
Estimatedy^\rEst{\hat{\vect{y}}}, y†\rEst{\vect{y}^\dagger}prediction and seed(pixel,)ppm·m, (ppm·m)⁻¹eq. 1–2
x†\rEst{\vect{x}^\dagger}pull-back onto emissions(cell,)(kg s⁻¹)⁻¹eq. 3, the adjoint run
OutputJ(x)\rOut{\mathcal{J}(\vect{x})}the cost value()—for line searches
∇xJ\rOut{\nabla_{\vect{x}} \mathcal{J}}gradient of the cost(cell,)(kg s⁻¹)⁻¹eq. 4

jax.grad requires a scalar output; for a vector output it is jax.vjp you want.

# Shapes: D_x = 4,096 (row, col = 64 × 64); D_y = 3,900; T = 90
# Units:  [x] = kg s⁻¹;  [c] = kg m⁻²;  [α] = ppm·m

# user
# 𝒥(x) = ½ ‖y − h(x)‖²_{Σ_ε⁻¹} + ½ ‖x − μ_x‖²_{Σ_x⁻¹}
def cost(x, wind=WIND):
    misfit = (y_obs - forward(x, wind)) / SIGMA_EPS   # → (D_y,)                —
    departure = (x - mu_x) / SIGMA_X                   # → (D_x,)                —
    return 0.5 * misfit @ misfit + 0.5 * departure @ departure   # → ()

# user
def gradient_by_adjoint(x, wind=WIND):
    x_grid = x.reshape(N_ROW, N_COL)                 # (D_x,) → (row, col)      [x]

    def forward_body(c_prev, _):
        # c_t = F(U) c_{t−1} + (Δt/w) x; emit c_{t−1} to store it
        return step(c_prev, x_grid, wind), c_prev

    # today (jax 0.12)
    c_final, trajectory = jax.lax.scan(              # → (row, col), (T, row, col)
        forward_body, jnp.zeros((N_ROW, N_COL)), None, length=N_STEP
    )
    # ŷ = P c_T
    y_hat = (c_final / KAPPA).reshape(-1)[clear]     # → (D_y,)                [α]
    # y† = −Σ_ε⁻¹ (y − ŷ)
    y_adj = -(y_obs - y_hat) / SIGMA_EPS**2          # → (D_y,)                [α]⁻¹
    # c†_T = Pᵀ y†
    c_adj = (jnp.zeros(N_ROW * N_COL).at[clear].set(y_adj) / KAPPA
             ).reshape(N_ROW, N_COL)                 # → (row, col)            [c]⁻¹

    def backward_body(c_adj, c_prev):
        # today (jax 0.12)
        # c†_{t−1} = Fᵀ c†_t;  (Δt/w) c†_t is this step's share of x†
        _, step_vjp = jax.vjp(lambda c, q: step(c, q, wind), c_prev, x_grid)
        c_adj_prev, x_adj_t = step_vjp(c_adj)        # → (row, col), (row, col)
        return c_adj_prev, x_adj_t

    # today (jax 0.12)
    # run t = T … 1
    _, x_adj_steps = jax.lax.scan(                   # → (T, row, col)         [x]⁻¹
        backward_body, c_adj, trajectory, reverse=True
    )
    # x† = ∑_t (Δt/w) c†_t
    x_adj = x_adj_steps.sum(0).reshape(-1)           # → (D_x,)                [x]⁻¹
    # ∇𝒥 = x† + Σ_x⁻¹ (x − μ_x)
    return x_adj + (x - mu_x) / SIGMA_X**2           # → (D_x,)                [x]⁻¹

# today (jax 0.12)
# 𝒥(μ_x), ∇𝒥(μ_x): the same two sweeps, derived automatically
value, grad = jax.value_and_grad(cost)(mu_x)         # → (), (D_x,)
grad_hand = gradient_by_adjoint(mu_x)                # → (D_x,)    # max rel. diff 7e-16

Program 4:The adjoint method written by hand, two scans and one VJP per step, checked against jax.value_and_grad.

Step 5 · HVP: curvature without a Hessian

The gradient says which way is downhill; the Hessian says how far. With 4 096 unknowns the Hessian has 16.8 million entries, but Newton-type solvers and posterior uncertainty need only its products with vectors. An HVP is a derivative of the gradient along a direction, so it is a JVP of a VJP: about two gradients’ cost.

Use · jax.jvp(jax.grad(cost), (x,), (dx,)), once per conjugate-gradient iteration.

δy=Jhδx\rEst{\delta\vect{y}} = \mat{J}_h \rIn{\delta\vect{x}}
y†=Σε−1δy\rEst{\vect{y}^\dagger} = \rCon{\gmat{\Sigma}_\varepsilon}^{-1} \rEst{\delta\vect{y}}
x†=Jh⊤y†\rEst{\vect{x}^\dagger} = \mat{J}_h^\top \rEst{\vect{y}^\dagger}
∇x2Jδx=x†+Σx−1δx\rOut{\nabla^2_{\vect{x}} \mathcal{J} \delta\vect{x}} = \rEst{\vect{x}^\dagger} + \rCon{\gmat{\Sigma}_x}^{-1} \rIn{\delta\vect{x}}
RoleSymbolNameShapeUnitNote
Inputx\rIn{\vect{x}}linearisation point(cell,)kg s⁻¹where the curvature is taken
δx\rIn{\delta\vect{x}}direction(cell,)kg s⁻¹the CG search direction
External inputU\rExt{U}wind()m s⁻¹given
Parameternone—nothing is trained
ConstantΣε\rCon{\gmat{\Sigma}_\varepsilon}, Σx\rCon{\gmat{\Sigma}_x}…as in Step 4
Estimatedδy\rEst{\delta\vect{y}}, y†\rEst{\vect{y}^\dagger}tangent of the map, cotangent(pixel,)ppm·m, (ppm·m)⁻¹eq. 1–2
x†\rEst{\vect{x}^\dagger}pull-back onto emissions(cell,)(kg s⁻¹)⁻¹eq. 3
Output∇x2Jδx\rOut{\nabla^2_{\vect{x}} \mathcal{J} \delta\vect{x}}Hessian-vector product(cell,)(kg s⁻¹)⁻¹eq. 4; Hessian (kg s⁻¹)⁻² times direction kg s⁻¹

The eq. 1–4 stack is the Gauss–Newton form; the call named above is the exact form. They coincide here because hh is linear in x\vect{x}.

The general Hessian of the cost has one more term, the curvature of hh weighted by the residual. Which instance applies depends on what you put in the control vector.

Linear in the control (this page)

∇x2J=Jh⊤Σε−1Jh+Σx−1\nabla^2_{\vect{x}} \mathcal{J} = \mat{J}_h^\top \gmat{\Sigma}_\varepsilon^{-1} \mat{J}_h + \gmat{\Sigma}_x^{-1}

Gauss–Newton is exact and the cost is quadratic, so one CG solve gives the posterior mean and the Laplace posterior is the true posterior.

Nonlinear control

∇x2J=Jh⊤Σε−1Jh+Σx−1−∑m=1Dyrm∇x2hm\nabla^2_{\vect{x}} \mathcal{J} = \mat{J}_h^\top \gmat{\Sigma}_\varepsilon^{-1} \mat{J}_h + \gmat{\Sigma}_x^{-1} - \sum_{m=1}^{D_y} r_m \nabla^2_{\vect{x}} h_m

Put UU in the control, or observe radiance through Beer–Lambert, and the last term appears, with r=Σε−1(y−h(x))∈RDy\vect{r} = \gmat{\Sigma}_\varepsilon^{-1} (\vect{y} - h(\vect{x})) \in \mathbb{R}^{D_y}, in (ppm·m)⁻¹, and hmh_m the mm-th output of hh. Gauss–Newton drops it and stays positive definite; the exact HVP keeps it and can be indefinite far from the optimum.

# Shapes: D_x = 4,096; D_y = 3,900
# Units:  [x] = kg s⁻¹;  [α] = ppm·m

# user
def hvp(x, v):
    # today (jax 0.12)
    # ∇²𝒥 v = d/dε ∇𝒥(x + ε v): forward-over-reverse
    return jax.jvp(jax.grad(cost), (x,), (v,))[1]    # (D_x,), (D_x,) → (D_x,)  [x]⁻¹

# user
def gauss_newton(x, v):
    # today (jax 0.12)
    # δy = J_h v
    y_hat, dy = jax.jvp(forward, (x,), (v,))         # → (D_y,), (D_y,)         [α]
    # today (jax 0.12)
    _, vjp_fn = jax.vjp(forward, x)
    # x† = J_hᵀ Σ_ε⁻¹ δy
    (x_adj,) = vjp_fn(dy / SIGMA_EPS**2)             # (D_y,) → (D_x,)          [x]⁻¹
    # J_hᵀ Σ_ε⁻¹ J_h v + Σ_x⁻¹ v
    return x_adj + v / SIGMA_X**2                    # → (D_x,)                 [x]⁻¹

matvec = jax.jit(lambda v: hvp(mu_x, v))
# today (jax 0.12)
# ∇²𝒥 Δx = −∇𝒥(μ_x),  x̂ = μ_x + Δx   (one Newton step is exact: 𝒥 is quadratic)
increment, _ = jax.scipy.sparse.linalg.cg(matvec, -jax.grad(cost)(mu_x), tol=1e-6, maxiter=500)   # → (D_x,)
x_hat = mu_x + increment                             # → (D_x,)                 [x]
# today (jax 0.12)
# z = Σ_x|y 1,  𝕍[Q | y] = 1ᵀ z
z, _ = jax.scipy.sparse.linalg.cg(matvec, jnp.ones_like(x_hat), tol=1e-6, maxiter=500)            # → (D_x,)

Program 5:The exact and the Gauss–Newton HVP, and the two conjugate-gradient solves for the posterior mean and the variance of the total.

Two tests every derivative must pass

A wrong adjoint still returns a vector of the right shape, so check it before trusting it. Both tests use the pairing that defines the transpose and cost a few model runs.

Dot-product test (is the VJP the transpose of the JVP?)

∣δy⊤y†−δx⊤x†∣∣δy⊤y†∣≈0\frac{\vert \delta\vect{y}^\top \vect{y}^\dagger - \delta\vect{x}^\top \vect{x}^\dagger \vert}{\vert \delta\vect{y}^\top \vect{y}^\dagger \vert} \approx 0

Random δx\delta\vect{x} and y†\vect{y}^\dagger. Both sides are ppm·m × (ppm·m)⁻¹ and kg s⁻¹ × (kg s⁻¹)⁻¹: dimensionless. Here 3.9 × 10⁻¹⁶.

Taylor test (is the gradient the derivative of the cost?)

J(x+ϵδx)−J(x)−ϵδx⊤∇xJ=O(ϵ2)\mathcal{J}(\vect{x} + \epsilon \delta\vect{x}) - \mathcal{J}(\vect{x}) - \epsilon \delta\vect{x}^\top \nabla_{\vect{x}} \mathcal{J} = O(\epsilon^2)

Divided by ϵ2\epsilon^2, the remainder must settle to a constant, 12δx⊤∇x2Jδx\frac{1}{2} \delta\vect{x}^\top \nabla^2_{\vect{x}} \mathcal{J} \delta\vect{x}. Here 2.3073 × 10⁷ at ϵ=10−1,10−2,10−3\epsilon = 10^{-1}, 10^{-2}, 10^{-3}.

# Shapes: D_x = 4,096; D_y = 3,900
# Units:  [x] = kg s⁻¹;  [α] = ppm·m

# δx, y†: random directions, one in each space
key_x, key_y = jax.random.split(jax.random.PRNGKey(1))
dx = jax.random.normal(key_x, x.shape)               # → (D_x,)                 [x]
y_adj = jax.random.normal(key_y, y_obs.shape)        # → (D_y,)                 [α]⁻¹
# today (jax 0.12)
# δy = J_h δx
_, dy = jax.jvp(forward, (x,), (dx,))                # (D_x,) → (D_y,)          [α]
# today (jax 0.12)
_, vjp_fn = jax.vjp(forward, x)
# x† = J_hᵀ y†
(x_adj,) = vjp_fn(y_adj)                             # (D_y,) → (D_x,)          [x]⁻¹
# |δyᵀ y† − δxᵀ x†| / |δyᵀ y†|
dot_gap = jnp.abs(dy @ y_adj - dx @ x_adj) / jnp.abs(dy @ y_adj)   # → ()   3.9e-16

# today (jax 0.12)
g = jax.grad(cost)(x)                                # → (D_x,)                 [x]⁻¹
for eps in (1e-1, 1e-2, 1e-3):
    # [𝒥(x + εδx) − 𝒥(x) − ε δxᵀ∇𝒥] / ε² → ½ δxᵀ ∇²𝒥 δx
    taylor = (cost(x + eps * dx) - cost(x) - eps * g @ dx) / eps**2  # → ()   2.3073e7

Program 6:The dot-product test and the Taylor test, run in float64.

Everything else in the grad space

The same objects go by different names in each community. This table is the crosswalk.

Table 6:One derivative object, four vocabularies, and its cost in model runs.

MathsJAXData assimilationMachine learningCost
Jh\mat{J}_hjacfwd, jacrevweighting function, sensitivity matrixJacobianmin⁡(Dx,Dy)\min(D_x, D_y) runs
Jhδx\mat{J}_h \delta\vect{x}jvp, linearizetangent linear modelforward mode, pushforward≈ 1 run
Jh⊤y†\mat{J}_h^\top \vect{y}^\daggervjpadjoint modelreverse mode, backprop, pullback≈ 1 run + storage
∇xJ\nabla_{\vect{x}} \mathcal{J}grad, value_and_gradadjoint method, 4D-Var gradientgradient≈ 2 runs
∇x2Jδx\nabla^2_{\vect{x}} \mathcal{J} \delta\vect{x}jvp of gradsecond-order adjointHVP≈ 4 runs
∇x2J\nabla^2_{\vect{x}} \mathcal{J}hessianposterior precision at the optimumHessianDxD_x HVPs

And the tools that change how a derivative is computed, not what it is:

Table 7:The tools that change how a derivative is computed.

ToolWhat it doesUse it forStatus
jax.linearizeruns hh once and returns δx↦Jhδx\delta\vect{x} \mapsto \mat{J}_h \delta\vect{x}many tangents at one point: ensemble perturbations, TLM validity checkstoday (jax 0.12)
jax.linear_transposetransposes a function that is already linear, with no linearisation storedobservation operators, regridding, P⊤\mat{P}^\top; here it matched the VJP exactlytoday (jax 0.12)
jax.vmap of jvp or vjpbatches products; jacfwd and jacrev are exactly thisa handful of directions or pixels at oncetoday (jax 0.12)
jax.custom_vjp, jax.custom_jvpreplaces JAX’s rule with yoursthe implicit function theorem through an iterative solver, a hand-tuned legacy adjoint, a numerically stable gradienttoday (jax 0.12)
jax.checkpointrecomputes forward values in the backward sweep instead of storing themlong assimilation windows and 3-D modelstoday (jax 0.12)
jax.lax.stop_gradienttreats a value as a constantplug-in estimates such as the matched filter’s background μ^y\hat{\gvect{\mu}}_y, Σ^y\hat{\gmat{\Sigma}}_ytoday (jax 0.12)
lineax linear_solvedifferentiates a solve by solving with the transposeimplicit diffusion steps, posterior covariance productsnot pinned (lineax)
diffrax RecursiveCheckpointAdjoint, BacksolveAdjointdiscrete adjoint with checkpointing; continuous adjoint ODE solved backwardcontinuous-time models in vardaxnot pinned (diffrax)
finite differences, complex stepapproximate a JVP from model runschecking derivatives, never computing gradients in DxD_x dimensions—

Worked numbers

Table 8:Every number on this page, by box: illustrative values from the source explainer’s run.

BoxQuantityValueUnit
hhone forward run (CPU)0.58ms
hhmass at overpass w∑ncT,nw \sum_n c_{T,n}, released 1 8001 799kg
hhpeak enhancement, facility cell15 530ppm·m
J\mat{J}size Dy×DxD_y \times D_x3 900 × 4 096—
J\mat{J}storage in float64; nonzero fraction128; 16 %MB; —
J\mat{J}build time, jacfwd / jacrev3.7 / 6.4s
JVPone call0.62ms
JVPfacility footprint, peak7 765ppm·m (kg s⁻¹)⁻¹
JVPfootprint mass κw∑\kappa w \sum, expected 900899.6s
JVPwind sensitivity, min / max−4 894 / 5 005ppm·m (m s⁻¹)⁻¹
VJPone call0.58ms
VJP[Jh][\mat{J}_h] pixel (32, 40), cell (32, 8), by JVP and VJP2 696.4ppm·m (kg s⁻¹)⁻¹
∇\nablaJ(μx)\mathcal{J}(\gvect{\mu}_x)33 796—
∇\nablapeak −∇xJ-\nabla_{\vect{x}} \mathcal{J}, facility cell31 978(kg s⁻¹)⁻¹
∇\nablahand adjoint vs jax.grad, max relative difference7 × 10⁻¹⁶—
HVPexact vs Gauss–Newton, relative difference1.1 × 10⁻¹⁶—
HVPCG iterations to 10⁻³ / 10⁻⁶127 / 322—
HVPfacility cell x^(32,8)\hat{x}_{(32,8)}1.99 ± 0.05kg s⁻¹
HVPtotal Q^\hat{Q}, truth 2.02.09 ± 0.26kg s⁻¹
HVPJ(x^)\mathcal{J}(\hat{\vect{x}}), expected ≈ 1 95024—
testsdot-product gap3.9 × 10⁻¹⁶—
testsTaylor remainder / ϵ2\epsilon^22.3073 × 10⁷—
References
  1. Kidger, P. (2021). On Neural Differential Equations [Phdthesis]. University of Oxford.