Why Inspect the Final Gradient?
An estimation run can stop because its objective changed very little, because parameter updates became small, or because an iteration limit was reached. Those stopping events are not interchangeable with finding a point where the objective is locally stationary. The final gradient helps answer that narrower question: does a small feasible change in the estimated parameters still have a first-order effect on the objective?
The gradient is useful evidence, not a certificate that the model is correct or that the best possible solution has been found. Its interpretation depends on the objective being minimized, parameter scaling, constraints, and the numerical accuracy of the reported derivatives. The objective-function traces discussed in the earlier material can show what happened across iterations; a final-gradient check assesses the local behavior at the reported endpoint.
In a pharmacometric estimation problem, \(F\) may be an objective such as minus twice the log likelihood, depending on the estimation method and software. The sign convention matters: here \(F\) is always treated as a quantity being minimized. A positive component means that, locally, increasing its parameter increases \(F\); a negative component means that increasing the parameter decreases \(F\). The magnitude is the local change in objective per unit change in that parameter.
From Raw to Scaled Gradient Components
Raw gradient components have units of objective per parameter unit. They are therefore not directly comparable across parameters measured on different scales. For example, a gradient expressed per litre per hour may look numerically small beside one expressed per hour, even if both imply substantial objective changes over meaningful parameter changes. A parameter expressed in a different unit would also have a different raw gradient.
To make a scale-aware check, choose a positive, meaningful scale \(s_i\) for each parameter, in the same units as \(\theta_i\). It should represent a change that is consequential for that parameter, rather than being chosen solely to make the gradient look small. Define a dimensionless coordinate \(z_i=(\theta_i-\theta_{i,\mathrm{ref}})/s_i\), where \(\theta_{i,\mathrm{ref}}\) is any fixed reference value. By the chain rule, \(\partial F/\partial z_i=s_i g_i\). One explicit objective-normalized criterion is then:
Here \(G_i\) is the scaled component and \(G_{\max}\) is the largest absolute scaled component. This definition makes the scaling choice explicit; it is not a universal software convention. A run meets a specified scaled-gradient tolerance \(\tau\) under this definition when \(G_{\max}\leq\tau\). The tolerance and the exact software formula must be checked together: a threshold intended for one scaling convention cannot safely be applied to another.
The factor \(q\) avoids dividing by a value below one and normalizes by the magnitude of the objective when that magnitude is larger. This convention is practical, but objective rescaling or a different normalization changes the reported scaled components. For reproducible interpretation, record the objective definition, parameter scales, scaling formula, tolerance, and whether the gradient is raw or transformed. A small \(G_{\max}\) supports first-order stationarity at the chosen scales; it does not demonstrate that the objective was evaluated accurately or that the point is a global minimum.
Worked Example: A Small Scaled Gradient at an Interior Estimate
Suppose a hypothetical model gives \(F=840\) at an interior estimate. For clearance \(CL\), volume \(V\), and absorption rate \(k_a\), the final raw gradients are \(0.0004\) objective units per L/h, \(-0.0002\) objective units per L, and \(0.003\) objective units per h\(^{-1}\), respectively. Use scales \(s_{CL}=10\) L/h, \(s_V=20\) L, and \(s_{k_a}=1\) h\(^{-1}\), and assess the run against \(\tau=10^{-5}\) using the definition above.
First, \(q=\max(1,|840|)=840\). The clearance component is \(G_{CL}=(10)(0.0004)/840=0.004/840=4.76\times10^{-6}\). For volume, \(G_V=(20)(-0.0002)/840=-0.004/840=-4.76\times10^{-6}\). For absorption rate, \(G_{k_a}=(1)(0.003)/840=0.003/840=3.57\times10^{-6}\).
Thus \(G_{\max}=4.76\times10^{-6}\), which is below \(10^{-5}\). Under these stated scales and this criterion, the final gradient is consistent with first-order stationarity at the reported interior estimate. The result does not by itself establish that the estimate is scientifically plausible or that a different initialization would lead to the same solution.
What a Gradient Check Does—and Does Not—Establish
The first-order justification is local. For a small parameter change \(\Delta\boldsymbol{\theta}\), differentiability gives the approximation \(F(\boldsymbol{\theta}+\Delta\boldsymbol{\theta})\approx F(\boldsymbol{\theta})+\mathbf{g}^{T}\Delta\boldsymbol{\theta}\), with an error that becomes small relative to the step as the step approaches zero. If an interior point has a nonzero gradient component, choosing a sufficiently small change in the opposite direction reduces the objective to first order. For an unconstrained interior local minimum, however, changes in either direction for each parameter must not decrease the objective to first order. That requires every component to be zero.
In computation, gradients and parameter estimates are approximate, so the practical question is whether the scaled components are small relative to a declared tolerance. This is a numerical criterion, not a proof that the exact gradient is zero. Also, first-order stationarity alone cannot distinguish a local minimum from every other stationary configuration, establish global optimality, or verify the likelihood calculation. Those questions require other checks.
Parameter bounds change the first-order condition because not every direction is feasible. For a parameter with lower bound \(L\), if the estimate is exactly at \(L\), only an increase is locally feasible. A constrained minimum therefore requires \(g_i\geq0\) there: moving into the feasible region must not decrease \(F\) to first order. At an upper bound \(U\), the corresponding requirement is \(g_i\leq0\). An unconstrained rule that demands every raw component be near zero can consequently misclassify a valid boundary solution.
This bound-aware condition is a first-order necessary condition, not a claim that the parameter should be at the bound or that the estimate is substantively reasonable. If a parameter is merely close to a bound rather than at it, treating it as exactly constrained can conceal a feasible descent direction. Use the actual constraint status and the optimizer’s documented projection rule.
Worked Example: Small Objective Changes but an Unacceptable Gradient
A hypothetical run reports \(F=510\) and successive objective values that differ by less than \(0.001\). The estimate is interior. For three parameters, the gradients are \(g_1=0.08\), \(g_2=-0.01\), and \(g_3=0.12\). Use scales \(s_1=10\), \(s_2=20\), and \(s_3=1\), with tolerance \(\tau=10^{-4}\).
The objective normalizer is \(q=510\). The scaled components are \(G_1=(10)(0.08)/510=0.8/510=0.00157\), \(G_2=(20)(-0.01)/510=-0.2/510=-0.000392\), and \(G_3=(1)(0.12)/510=0.12/510=0.000235\). Therefore \(G_{\max}=0.00157\), which exceeds \(10^{-4}\) by a factor of about 15.7.
The small objective differences do not satisfy this gradient criterion. Near-flat changes along the particular steps taken by an algorithm can coexist with a larger scaled derivative in some parameter direction, for example when the updates are very small or progress is limited. The appropriate conclusion is that the run has not met the stated first-order tolerance; the trace alone does not justify calling it converged under this check.
Worked Example: Interpreting a Gradient at a Lower Bound
A hypothetical variance parameter \(\omega^2\) is estimated at its lower bound of zero, with scale \(s_{\omega^2}=0.04\). Let \(F=200\) and \(g_{\omega^2}=0.35\) objective units per variance unit. Suppose all other parameters are interior and their largest absolute scaled gradient is \(2.0\times10^{-5}\). Assess the first-order bound condition and explain what would change if \(g_{\omega^2}=-0.35\).
At the lower bound, only increases in \(\omega^2\) are feasible. Since \(g_{\omega^2}=0.35>0\), an increase raises the objective to first order, so this component satisfies the lower-bound sign condition. Its raw scaled magnitude would be \(s_{\omega^2}g_{\omega^2}/q=(0.04)(0.35)/200=0.014/200=7.0\times10^{-5}\), but a projected-gradient rule sets this component to zero because its sign is compatible with the lower bound. The other parameters have a maximum scaled component of \(2.0\times10^{-5}\); that value meets a projected-gradient tolerance of \(10^{-4}\).
If instead \(g_{\omega^2}=-0.35\), increasing the variance from zero would decrease the objective to first order. That is a feasible descent direction, so the lower-bound condition fails. A bound-aware check must retain this violation rather than projecting it away. The sign, not merely the fact that the estimate is at zero, determines whether the first-order condition is met.
Diagnostics, Failure Modes, and Alternatives
When a final-gradient check looks questionable, first verify what the software actually reports. Determine whether the values are evaluated at the final parameter vector, whether they are raw or scaled, whether the reported norm is a maximum component or another summary, and whether constraints are handled through a projected gradient. Then inspect parameter units, scales, objective normalization, and the convergence tolerance. A number without those definitions is difficult to interpret or reproduce.
Gradients can also be unreliable when small changes in parameters produce unstable objective evaluations. Numerical integration settings, noisy approximations, or finite-difference calculations can make successive derivative estimates disagree. Compare gradient reports across tighter numerical settings or independent runs when such instability is suspected. A component close to its threshold deserves particular caution: rounding or small numerical perturbations may change whether the criterion passes. Preserve sufficient digits for checking, even if the final report rounds values for display.
Gradient checks complement, rather than replace, other stopping diagnostics. A small change in objective can indicate stalled progress but does not establish stationarity; a small parameter update can reflect a restrictive step rather than a small gradient. Conversely, a small scaled gradient gives first-order evidence but does not prove that the objective was evaluated correctly. Compare these signals with the termination reason and the final estimates, and investigate disagreements rather than choosing the most reassuring one.
A common mistake is to compare raw gradients across parameters and conclude that the numerically largest one is the main problem, or to treat a software “converged” message as conclusive. Raw values depend on units, while a termination label may refer to a different stopping rule. The correction is to state the objective, parameter scales, scaling formula, constraint treatment, and tolerance, then calculate or verify the corresponding final criterion. A pass supports approximate first-order stationarity under those choices; it is not a general guarantee of a successful model fit.
Record the final objective and determine whether each derivative is raw, scaled, or projected.
Confirm parameter units and meaningful scales, and identify parameters at active bounds.
Calculate the stated maximum scaled component or projected-gradient measure and compare it with its own tolerance.
Investigate disagreement between the gradient, objective trace, parameter changes, and termination reason; do not treat any single signal as a universal success certificate.
Check Your Understanding
Answer each question, then compare with the brief solutions.
- For an interior estimate, why is a raw gradient of \(0.02\) not enough by itself to decide whether the parameter is converged?
- With \(F=400\), \(s_i=5\), and \(g_i=-0.0004\), calculate \(G_i\) using the stated scaling definition.
- A parameter is at its upper bound and has \(g_i=0.6\). Does it satisfy the first-order sign condition for a minimum? Explain.
- A run has a nearly unchanged objective trace but \(G_{\max}=0.003\) under a tolerance of \(10^{-4}\). What conclusion follows from the gradient criterion?
Solutions. (1) The raw gradient depends on the parameter’s units and scale, and its value must be judged relative to the objective scale and a stated tolerance. (2) \(q=400\), so \(G_i=(5)(-0.0004)/400=-0.002/400=-5.0\times10^{-6}\). (3) No. At an upper bound, feasible changes decrease the parameter; with a positive gradient, decreasing it gives a first-order objective change \(g_i\Delta\theta_i<0\), so a feasible descent direction exists. (4) The run fails that gradient criterion because \(0.003>10^{-4}\). The flat trace does not override the gradient result.