Tutorials › Generalized Linear Mixed Models (GLMM) › Line Search and Failed Optimization Steps

Convergence, Singular Fits and Boundary Estimates · Tutorial 311 of 698

Line Search and Failed Optimization Steps

Use line-search rules and objective traces to assess whether rejected or shrinking GLMM optimization steps reflect cautious progress or a fit that is no longer advancing.

Advanced 12 min read

What You'll Learn

  • Define an ascent line search and its sufficient-increase condition.
  • Calculate Armijo acceptance thresholds for proposed steps.
  • Interpret traces that show repeated rejection or step-size reduction.
  • Check whether rounded objective values can support a claimed accepted step.
  • Distinguish a small accepted step from evidence of convergence.
  • Compare line search with fixed-step and trust-region approaches.

Why a Line Search Matters

A GLMM optimizer updates model parameters repeatedly to improve an objective, commonly a log likelihood or a negative log likelihood. The optimizer may propose a direction that looks promising locally but would make the objective worse if followed too far. A line search chooses how far to move along that direction: it tests a proposed step, reduces its length when needed, and accepts a step only when it meets the algorithm’s specified criterion.

A trace with repeated rejections or shrinking step lengths is therefore not, by itself, proof that fitting has failed. Backtracking can be a normal response to an overly ambitious trial step. The important question is whether accepted steps continue to make meaningful progress and whether the final point satisfies appropriate convergence conditions. Interpreting a trace also requires knowing which objective is reported, whether it is being maximized or minimized, and whether the printed precision is sufficient to check the acceptance rule.

Line Search and the Acceptance Rule

Definition: Let \(Q(\theta)\) be a differentiable objective to maximize, with parameter vector \(\theta\). At the current value \(\theta\), let \(d\) be a proposed direction with directional derivative \(\nabla Q(\theta)^\mathsf{T}d>0\). A line search tests points \(\theta+\alpha d\), where \(\alpha>0\) is the step length. The Armijo sufficient-increase condition accepts a trial when $$ Q(\theta+\alpha d)\geq Q(\theta)+c\alpha\nabla Q(\theta)^\mathsf{T}d, $$ where \(c\) is a fixed constant satisfying \(0<c<1\). The right-hand side requires a specified fraction of the increase predicted by the directional derivative.

A common backtracking strategy starts with a trial length, often \(\alpha=1\), and repeatedly multiplies it by a factor \(\beta\), where \(0<\beta<1\), until the criterion is met. The particular starting length, reduction factor, and acceptance rule are implementation choices; they should not be assumed from a trace unless the software documents them. A rejected trial means that this trial failed the stated rule. It does not mean that the model or the likelihood is invalid.

Some software minimizes a negative log likelihood or another loss \(f(\theta)\) instead. For a descent direction \(p\), the corresponding Armijo condition is \(f(\theta+\alpha p)\leq f(\theta)+c\alpha\nabla f(\theta)^\mathsf{T}p\), with \(\nabla f(\theta)^\mathsf{T}p<0\). The inequality reverses because a smaller objective is preferred. A trace must be read using its own sign convention; a decrease in negative log likelihood represents an improvement, whereas an increase in log likelihood represents an improvement.

Why Backtracking Can Work

The justification for backtracking follows from a local approximation. If \(Q\) is differentiable at \(\theta\), then for a small positive \(\alpha\),

$$ Q(\theta+\alpha d) = Q(\theta)+\alpha\nabla Q(\theta)^\mathsf{T}d+o(\alpha). $$

Here \(o(\alpha)\) is a remainder whose ratio to \(\alpha\) tends to zero as \(\alpha\) tends to zero. Subtracting the Armijo threshold from the local approximation gives

$$ Q(\theta+\alpha d)-\{Q(\theta)+c\alpha\nabla Q(\theta)^\mathsf{T}d\} = (1-c)\alpha\nabla Q(\theta)^\mathsf{T}d+o(\alpha). $$

Because \(1-c>0\) and the directional derivative is positive, the leading term is positive. For sufficiently small positive \(\alpha\), the remainder cannot outweigh that term, so the Armijo condition will hold, provided the objective is evaluated consistently and the trial points remain feasible. This local argument explains why backtracking is useful; it does not guarantee that every practical search will succeed. Numerical error, constraints, an unreliable direction, or a discontinuity in the evaluated objective can defeat the assumptions behind the argument.

Worked Example: Checking a Rejected Full Step

Suppose a hypothetical GLMM optimizer maximizes \(Q\). At the current parameters, \(Q(\theta)=-120.000\), the proposed direction has \(\nabla Q(\theta)^\mathsf{T}d=0.80\), and the Armijo constant is \(c=0.10\). It first tries \(\alpha=1\), for which the objective is \(-119.950\).

The required increase is \(c\alpha\nabla Q(\theta)^\mathsf{T}d =0.10(1)(0.80)=0.080\). Thus the minimum acceptable objective is \(-120.000+0.080=-119.920\). The trial value \(-119.950\) increases the objective by only \(0.050\), so it fails the sufficient-increase condition and must be rejected under this rule.

The search next tries \(\alpha=0.5\), with objective value \(-119.940\). The required increase is \(0.10(0.5)(0.80)=0.040\), so the minimum acceptable value is \(-119.960\). The actual increase is \(0.060\), and \(-119.940\geq-119.960\). This trial passes. The full step’s rejection and the half step’s acceptance are consistent with a functioning backtracking search; neither alone establishes whether the final fit has converged.

Reading an Objective Trace at Its Reported Precision

A printed trace is rounded, while the optimizer may make its decision using full-precision values. Rounding can hide small changes. But it cannot hide a change that is much larger than the maximum difference compatible with the displayed values. Therefore, compare the precision of the trace with the improvement required by the acceptance rule before treating an apparent plateau as ambiguous.

Worked Example: Equal Printed Values Cannot Meet a Larger Threshold

Suppose a hypothetical maximization trace reports both the current objective and a purportedly accepted trial objective as \(-84.210000\), rounded to six decimal places. The trial uses \(\alpha=0.125\), the directional derivative is \(0.80\), and \(c=0.10\). Assume these are the objective, derivative, and rule used internally.

The required increase is \(0.10(0.125)(0.80)=0.0100\). Under ordinary rounding to six decimal places, each printed value differs from its underlying value by at most \(0.0000005\). If both values print identically, their underlying difference in absolute value is less than \(0.000001\). In particular, the objective increase cannot be \(0.0100\) or greater. The printed values therefore rule out an Armijo increase of the required size; they do not merely leave that condition undecidable.

If the software nevertheless records the step as accepted, investigate whether it uses a different acceptance rule, whether the trace reports a different objective from the one used internally, or whether the displayed directional derivative is not the derivative used for the decision. Also check whether the values were rounded or otherwise transformed before display. Do not infer that the stated Armijo rule was satisfied by this trace.

Repeated Shrinking Steps and a Stalled Solution

Repeated backtracking deserves attention when step lengths become very small, but a small accepted step is not itself a convergence test. It may reflect a direction that is poorly scaled, strong local curvature, a parameter constraint, or an objective evaluated with limited numerical accuracy. To decide whether the algorithm is advancing, examine more than the objective trace: check the accepted step length and parameter change, the gradient or other relevant stationarity measure, the number of rejected trials, and the optimizer’s termination message. Near a constraint, an appropriate constrained-stationarity condition is needed rather than an unconstrained gradient test.

The following hypothetical calculation shows why an accepted step need not imply convergence. Consider the one-parameter objective \(Q(\theta)=-50+0.02\theta-0.5\theta^2\), with current value \(\theta=0\), direction \(d=1\), and \(c=0.10\). The directional derivative is \(0.02\). For any proposed \(\alpha\), the objective change is \(0.02\alpha-0.5\alpha^2\), and the required increase is \(0.002\alpha\).

Worked Example: Many Rejections Before a Small Accepted Step

The optimizer tests a backtracking sequence. Each objective change below is calculated from \(0.02\alpha-0.5\alpha^2\), and each required increase is \(0.002\alpha\).

Step length \(\alpha\)Objective changeRequired increaseDecision
1\(0.020-0.500=-0.480\)0.002Reject
0.5\(0.010-0.125=-0.115\)0.001Reject
0.25\(0.005-0.03125=-0.02625\)0.0005Reject
0.125\(0.0025-0.0078125=-0.0053125\)0.00025Reject
0.0625\(0.00125-0.001953125=-0.000703125\)0.000125Reject
0.03125\(0.000625-0.00048828125=0.00013671875\)0.0000625Accept

At the accepted trial, the new parameter is \(\theta=0.03125\). The objective increases by \(0.00013671875\), which exceeds the required \(0.0000625\). Yet the gradient at that point is \(0.02-\theta=-0.01125\). Its absolute value, \(0.01125\), is greater than a hypothetical gradient-norm tolerance of \(0.001\). Thus the step passes the line-search rule but does not meet that stationarity tolerance. One accepted step, even one that improves the objective, is not enough to claim convergence.

Diagnosing the Trace and Choosing a Response

1
Confirm what is being optimized.
Identify whether the reported quantity is a log likelihood to maximize, a negative log likelihood to minimize, or another objective. Verify that the trace and acceptance calculation refer to the same quantity and parameterization.
2
Check the proposed direction.
For maximization, verify that the reported directional derivative is positive; for minimization, verify that the direction is a descent direction. A wrong sign, inconsistent gradient, or non-finite calculation can make the acceptance test meaningless.
3
Compare improvement with the threshold.
Calculate the required Armijo change and compare it with the actual change. Account for printed precision: if the trace’s maximum rounding uncertainty is far smaller than the required change, identical printed values cannot support acceptance under that rule.
4
Assess progress beyond acceptance.
Review whether accepted steps continue, whether parameter changes are meaningful on the parameter scales, and whether gradients or other stopping measures meet the documented tolerances. A sequence of tiny steps with a persistently non-small gradient suggests stalling rather than demonstrated convergence.
5
Investigate reproducible discrepancies.
Check constraints, objective-evaluation precision, gradient accuracy, and consistency across restarts or optimizers. Do not treat a termination label or a monotonically improving trace as sufficient evidence on its own.

Line search is one strategy among several. A fixed-step method always uses a chosen step length, so it can be efficient when well scaled but may overshoot or make unnecessarily small moves. Backtracking adapts the length along a specified direction, but it cannot repair a fundamentally unhelpful direction or establish that the objective is correctly evaluated. A trust-region method instead restricts the size of a local model’s proposed move and adjusts that region using observed versus predicted improvement. These approaches differ in how they control a step; none makes diagnostics unnecessary.

In GLMM fitting, the objective may involve numerical approximations, and parameter constraints or transformations can affect both the feasible steps and the reported parameter scales. A line-search conclusion is valid only for the objective, coordinates, direction, and acceptance rule actually used. A trace alone does not identify the cause of repeated rejection, and changing a step-size setting without checking gradients and objective consistency can conceal rather than resolve a problem.

Common Mistakes

  • Calling every rejection a failed fit. A large trial can fail while a shorter one is accepted. Inspect the sequence and the subsequent convergence evidence.
  • Confusing objective conventions. For a maximized log likelihood, improvement means an increase; for a minimized negative log likelihood, it means a decrease. Apply the matching inequality.
  • Calling any accepted step convergence. Acceptance checks progress along one trial direction. It does not establish that the gradient is small or that the optimizer has reached a suitable stopping point.
  • Blaming rounding when the required change is much larger. Identical values rounded to six decimal places differ by less than \(0.000001\). They cannot show an increase of \(0.0100\) under the stated rule.
  • Interpreting a small step without scale or gradient information. A small parameter change might be appropriate near a solution or might signal stalling. Consider parameter scaling, constraints, and stationarity measures together.
Key takeaway: A line-search trace is evidence about individual proposed steps, not a complete verdict on the fit. Check the direction, objective convention, required change, reported precision, accepted parameter movement, and convergence measures before deciding whether repeated shrinking is ordinary caution or a stalled solution.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A maximization trace has \(Q(\theta)=-30.00\), \(\nabla Q(\theta)^\mathsf{T}d=0.50\), \(c=0.10\), and \(\alpha=0.4\). What increase is required, and does a trial value of \(-29.97\) pass?
  2. A minimization algorithm uses a descent direction. Should an accepted step have a larger or smaller loss than the current value? State the sign of the directional derivative.
  3. Two objective values both print as \(12.3456\), rounded to four decimal places. Can they differ by \(0.02\) in absolute value? Explain.
  4. A line search accepts a step, but the gradient norm remains well above the stated tolerance. What can and cannot be concluded?

Solutions. (1) The required increase is \(0.10(0.4)(0.50)=0.020\), so the minimum acceptable value is \(-29.980\). The trial value \(-29.97\) increases the objective by \(0.030\), so it passes. (2) The loss should decrease, and the directional derivative must be negative: \(\nabla f(\theta)^\mathsf{T}p<0\). (3) No. Each rounded value differs from its underlying value by at most \(0.00005\), so two values printing identically differ by at most \(0.0001\), far less than \(0.02\). (4) The tested step met the line-search rule, but the stated gradient criterion for convergence has not been met. The accepted step alone does not establish convergence.

Clinical Biostats