Why Use an Adjoint?
A PBPK model can contain many parameters but be used to answer one particular quantitative question, such as the predicted concentration at a specified time or the total exposure over a dosing interval. Forward sensitivity equations calculate derivatives with respect to parameters by augmenting the state system with one sensitivity system per parameter. When the number of parameters is large and the quantity of interest is a single scalar, that approach can require many additional equations.
The adjoint method reverses the calculation. It first solves the PBPK state equations forward in time, then solves one auxiliary system backward in time. The resulting gradient contains derivatives with respect to all parameters. This is especially useful for local sensitivity calculations of a scalar endpoint; it does not make every sensitivity problem cheaper, because the cost depends on how many distinct outputs are needed.
Here \(\phi\) describes a terminal contribution, such as the amount in a compartment at time \(T\), and \(L\) describes a running contribution, such as the concentration accumulated over time. A terminal-only endpoint has \(L=0\). The partial derivatives \(f_x\) and \(f_\theta\) are Jacobian matrices, while \(\phi_x\), \(L_x\), and \(\lambda\) are treated as column vectors. The formulas below assume that \(f\), \(\phi\), and \(L\) are differentiable in the state and parameters, and that the state solution is sufficiently regular on the interval. Dosing events or other discontinuities require appropriate jump conditions, discussed below.
Adjoint Equation and Gradient
For the endpoint defined above, the adjoint is determined by integrating backward from \(T\):
Once the state trajectory and adjoint are available, the parameter gradient is
The term \(x_{0,\theta}\) is the Jacobian of the initial state with respect to the parameters. If the initial state is fixed independently of \(\theta\), this term is zero. The direct terms \(\phi_\theta\) and \(L_\theta\) matter when the endpoint depends explicitly on a parameter, even after the state trajectory is held fixed.
Why the Formula Holds
The derivation shows how the adjoint removes the need to calculate the full state-sensitivity matrix. Write \(\delta x(t)\) for a first-order state change caused by a parameter change \(\delta\theta\). Differentiating the state equation gives \(\delta\dot{x}=f_x\delta x+f_\theta\delta\theta\), and the endpoint change is \(\delta J=\phi_x^T\delta x(T)+\phi_\theta^T\delta\theta+\int_0^T(L_x^T\delta x+L_\theta^T\delta\theta)\,dt\). To eliminate the unknown \(\delta x(t)\) from the integral, add the zero quantity \(\int_0^T\lambda^T(f_x\delta x+f_\theta\delta\theta-\delta\dot{x})\,dt\). Integration by parts gives \(-\int_0^T\lambda^T\delta\dot{x}\,dt=-\lambda(T)^T\delta x(T)+\lambda(0)^T\delta x(0)+\int_0^T\dot{\lambda}^T\delta x\,dt\).
Choose \(\lambda(T)=\phi_x\) so the terminal-state variation cancels, and choose \(\dot{\lambda}=-f_x^T\lambda-L_x\) so the remaining terms involving \(\delta x(t)\) cancel at every time. Since \(\delta x(0)=x_{0,\theta}\delta\theta\), the terms left over are exactly the stated gradient formula. This argument requires differentiable state and endpoint functions; it is not a claim that the numerical solution has zero error.
Record or otherwise retain the state values needed to evaluate \(f_x\), \(f_\theta\), \(L_x\), and \(L_\theta\) during the backward calculation.
Evaluate \(\lambda(T)=\phi_x(x(T),\theta)\), the state gradient of the terminal contribution.
Use the stored or reconstructed state trajectory and the adjoint equation from \(T\) to \(0\).
Integrate \(f_\theta^T\lambda+L_\theta\), then add the direct endpoint and initial-condition terms. Report each derivative with its parameter and endpoint units.
Worked Calculations
Worked Example: A Terminal Amount With One Rate Parameter
Consider a hypothetical one-compartment elimination model, \(\dot{x}=-\theta x\), with \(x(0)=2.00\) mg, \(\theta=0.200\) h\(^{-1}\), and endpoint \(J=x(3.00\text{ h})\). Here \(L=0\), \(\phi(x)=x\), and the initial amount does not depend on \(\theta\). The state solution is \(x(t)=2.00e^{-0.200t}\) mg, so \(J=2.00e^{-0.600}=1.0976\) mg.
Because \(\phi_x=1\), the terminal adjoint value is \(\lambda(3)=1\). Since \(f_x=-\theta\), the backward equation is \(\dot{\lambda}=\theta\lambda\), with solution \(\lambda(t)=e^{\theta(t-3)}\). Also \(f_\theta=-x\). Therefore
The units are mg per h\(^{-1}\), equivalently mg·h. Increasing the elimination rate locally decreases the terminal amount, consistent with the negative derivative. This simple example also verifies the adjoint calculation against the direct expression \(J=2.00e^{-3\theta}\), whose derivative is \(-6.00e^{-3\theta}\) mg·h.
Worked Example: Three Rate Parameters and One Scalar Output
Suppose a hypothetical amount \(x\), measured in mg, leaves a compartment through three parallel first-order pathways: \(\dot{x}=-(\theta_1+\theta_2+\theta_3)x\). Let \(x(0)=100\) mg, \(T=2.00\) h, and \((\theta_1,\theta_2,\theta_3)=(0.100,0.200,0.0500)\) h\(^{-1}\). The total rate is \(K=0.350\) h\(^{-1}\), and the scalar endpoint is \(J=x(T)=100e^{-0.700}=49.66\) mg.
For \(\phi(x)=x\), the terminal adjoint is one. Its equation is \(\dot{\lambda}=K\lambda\), so \(\lambda(t)=e^{K(t-T)}\). For each parameter, \(f_{\theta_i}=-x\). The state-adjoint product is constant: \(\lambda(t)x(t)=e^{K(t-T)}100e^{-Kt}=100e^{-KT}=x(T)\). Thus the three derivatives are calculated in the same backward solve:
All three derivatives are equal because the model includes the parameters only through their sum. Each has units of mg per h\(^{-1}\), or mg·h. The calculation illustrates the adjoint advantage: one scalar output requires one scalar backward equation, while its gradient reports three parameter derivatives.
Worked Example: An AUC Endpoint
For a hypothetical model \(\dot{x}=-kx\), let \(x(0)=50.0\) mg, \(k=0.400\) h\(^{-1}\), and define the scalar endpoint as \(J=\int_0^{3.00\text{ h}}x(t)\,dt\). In this case \(\phi=0\) and \(L=x\). The state solution gives
The terminal adjoint is \(\lambda(3)=0\), and its equation is \(\dot{\lambda}=k\lambda-1\). Solving backward gives \(\lambda(t)=[1-e^{-k(3-t)}]/k\). Since \(L_k=0\) and \(f_k=-x\), the gradient is
The same result follows by differentiating \(50.0(1-e^{-3k})/k\). The derivative is negative: a higher elimination rate reduces AUC. Its units are mg·h per h\(^{-1}\), or mg·h². Here the running contribution \(L\) changes the adjoint equation, which is why using the terminal-only adjoint equation would give the wrong gradient.
Computational Cost, Events, and Checks
The main computational comparison is between the number of parameters \(p\) and the number of outputs \(q\). A forward sensitivity method propagates derivatives of the state with respect to all parameters, usually adding \(m\times p\) sensitivity values to the system. An adjoint method for one scalar output adds a backward system of dimension \(m\), plus the work of accumulating the gradient. This can be attractive when \(p\) is large and \(q\) is small. For \(q\) distinct scalar outputs, however, each generally has its own terminal condition and adjoint calculation. Forward sensitivities may be more efficient when there are few parameters and many outputs. Finite differences are often easy to implement but require repeated model runs, and their accuracy depends on the perturbation size.
| Approach | Typical computational pattern | Useful when |
|---|---|---|
| Forward sensitivity equations | Propagate sensitivities for each parameter, often alongside the state. | There are relatively few parameters or many outputs. |
| Adjoint method | For each scalar output, solve one backward system and accumulate parameter derivatives. | There are many parameters and only a few scalar outputs. |
| Finite differences | Perturb parameters and repeat the model solve. | A simple independent check is wanted, or derivatives are unavailable. |
The cost is not determined by parameter count alone. The state trajectory must be available during the backward solve, which may require storing it or reconstructing it with checkpointing. Evaluating \(f_\theta^T\lambda\) can itself be costly for a model with many parameters. The adjoint also requires a sufficiently accurate backward integration and a correct derivative of the implemented model; it does not repair an inaccurate state solution.
PBPK models often include scheduled bolus doses or other known state resets. At a reset \(x^+=R(x^-,\theta)\), the state is discontinuous and the adjoint must not simply be integrated through the event as if the state were smooth. For a smooth reset map, the adjoint satisfies \(\lambda^- = R_x^T\lambda^+\), and the parameter gradient receives the event contribution \(R_\theta^T\lambda^+\). Continuous infusion start or stop times may change the right-hand side and require integration to be split at the event time. More complicated event rules need their corresponding derivative conditions; ignoring an event can produce a plausible-looking but incorrect gradient.
Useful diagnostics include checking that the baseline state and endpoint agree with the ordinary PBPK solve, tightening solver tolerances to assess gradient stability, and comparing selected adjoint derivatives with central finite differences. For a parameter \(\theta_i\), the latter estimate is \([J(\theta_i+h)-J(\theta_i-h)]/(2h)\), with other parameters held fixed. Agreement should be assessed over reasonable perturbation sizes and solver tolerances; a single step size is not proof. Also check derivative units and signs, the treatment of initial-condition dependence, and whether all dosing events and explicit parameter terms have been included.
Common Pitfalls and Limits
- Using the wrong endpoint. A terminal concentration and an AUC have different endpoint definitions. The running term \(L\) changes the adjoint equation and must be included when the output is an integral.
- Assuming every parameter affects only the ODE. If \(\phi\), \(L\), or \(x_0\) depends directly on \(\theta\), its gradient contribution must be retained.
- Assuming one adjoint gives every output gradient. One adjoint corresponds to one scalar objective. Several outputs generally require several backward solves, though a weighted combination of outputs can be treated as one scalar objective when that is the quantity actually wanted.
- Ignoring numerical and event handling. State interpolation error, loose tolerances, missed resets, or incorrect event derivatives can undermine the result. Compare selected derivatives with an independent calculation and refine the numerical solution.
Adjoints calculate local derivatives at the specified parameter vector and model scenario. They do not by themselves establish that a parameter is identifiable, that a local effect persists over a broad parameter range, or that the model is adequate for a clinical prediction. Their role is narrower: efficiently differentiate a defined scalar model output, subject to the model equations, endpoint definition, and numerical implementation.
Check Your Understanding
Answer each question, then compare with the solutions below.
- For a terminal-only output \(J=\phi(x(T),\theta)\), what is the terminal adjoint condition?
- If the initial state depends on \(\theta\), which term in the gradient accounts for that dependence?
- A model has 80 parameters and one scalar output. Why might an adjoint be preferable to forward sensitivity equations?
- For a model with many outputs but only two parameters, which method may be computationally attractive, and why?
- Why is it incorrect to integrate an adjoint smoothly through a bolus reset without applying a jump condition?
Solutions. (1) The terminal condition is \(\lambda(T)=\phi_x(x(T),\theta)\). (2) The contribution is \(x_{0,\theta}^{T}\lambda(0)\). (3) The adjoint dimension is the number of states, not the number of parameters; one backward solve can accumulate all 80 derivatives, whereas forward sensitivities commonly add 80 state-sensitivity systems. (4) Forward sensitivities may be attractive because the sensitivities for both parameters can be reused across the many outputs, while separate adjoints are generally needed for distinct scalar outputs. (5) The state jumps, so the adjoint must reflect the derivative of the reset map; otherwise the gradient omits how parameter and state changes propagate through that event.