Skip to content

Accept LM steps against the current cost - #1394

Open
ramlakhanmadheshiya wants to merge 1 commit into
SciML:masterfrom
ramlakhanmadheshiya:ram/lm-uphill-acceptance
Open

ramlakhanmadheshiya wants to merge 1 commit into
SciML:masterfrom
ramlakhanmadheshiya:ram/lm-uphill-acceptance

Conversation

@ramlakhanmadheshiya

@ramlakhanmadheshiya ramlakhanmadheshiya commented Nov 14, 2026 •

Copy link
Copy Markdown

loss_old was set to Inf and never updated, so every finite step was accepted and b_uphill had no effect.
The step is now compared with the cost at the current point.

Repro
using NonlinearSolve, LinearAlgebra
f(u, p) = [10 * (u[2] - u[1]^2), 1 - u[1]]
alg = LevenbergMarquardt(; b_uphill = 0.0, disable_geodesic = Val(true), damping_initial = 1e-8)
cache = init(NonlinearLeastSquaresProblem(f, [-1.2, 1.0]), alg)
step!(cache)
norm(cache.fu) # 4.919, was 48.39

The angle factor is capped at 1 so a step that lowers the cost is always accepted, as in geodesicLM.
Without the cap, b_uphill = 2 stops far from the solution on the Watson and Dennis-Schnabel problems from NonlinearProblemLibrary.

The comparison is now strict.
With ≤, LevenbergMarquardt() keeps accepting steps of equal cost at the Freudenstein-Roth local minimum and runs to maxiters.

With disable_geodesic = Val(true), the Freudenstein-Roth and trigonometric functions now stop at a local minimum.

Fixes #1385

@ramlakhanmadheshiya
ramlakhanmadheshiya marked this pull request as ready for review November 14, 2026 08:30

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LevenbergMarquardt: uphill-acceptance test never updates loss_old, so every finite step is accepted (b_uphill has no effect)

1 participant