Skip to content

Use LineSearch projected Armijo caches in bounded solvers - #1266

Merged
ChrisRackauckas merged 15 commits into
SciML:masterfrom
ChrisRackauckas-Claude:refactor/linesearch-core-bounds
Sep 13, 2026
Merged

ChrisRackauckas merged 15 commits into
SciML:masterfrom
ChrisRackauckas-Claude:refactor/linesearch-core-bounds

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Bounded Levenberg–Marquardt and Gauss–Newton now use a persistent LineSearch.ProjectedBackTracking cache instead of a local Armijo loop. The solver passes its existing merit gradient and accepts the cached projected point/residual, avoiding an extra residual evaluation. Bounds, contraction, nonfinite rejection, and the projected Armijo condition are handled by LineSearch; the solver adapter handles state shapes and solver acceptance.

Cache reinitialization uses the existing NonlinearSolveBase callback machinery. Tests check parameter changes, cache identity, residual evaluation counts, and ordinary ArmijoLineSearch in NewtonRaphson, in addition to the existing sparse/operator, AD, preconditioning, and bounded convergence coverage. AGENTS.md records the requirement to keep line-search logic in LineSearch.jl.

The public APIs are available in registered LineSearch 0.1.18: JuliaRegistries/General#168088 . FirstOrder therefore requires LineSearch = "0.1.18". The unnecessary compatibility-widening draft #1265 is closed and its commit has been removed from this branch. This remains stacked on #1263 . Focused adapter diff: ChrisRackauckas-Claude/NonlinearSolve.jl@943588d...refactor/linesearch-core-bounds .

The validation below passed before the release-version correction, using the actual LineSearch checkout. The FirstOrder Julia source and tests are unchanged by that correction; only the LineSearch compat entry changes. All listed commands exited 0:

GROUP=Core julia +1.13.0 --project=lib/NonlinearSolveFirstOrder -e 'using Pkg; Pkg.test()'
Test Summary:  | Pass  Total   Time
Brusselator 2D |    5      5  18.3s
Test Summary:        | Pass  Total   Time
Structured Jacobians |   16     16  25.9s
Test Summary:           | Pass  Total   Time
SciMLOperator Jacobians |   14     14  14.4s
Testing NonlinearSolveFirstOrder tests passed
Total: 8595

GROUP=NativeBounds julia +1.13.0 --project=lib/NonlinearSolveFirstOrder -e 'using Pkg; Pkg.test(; julia_args=["--load=" * abspath("../scratch/preload-enzyme.jl")])'
Test Summary:          | Pass  Total      Time
Native bounded methods | 5845   5845  10m28.9s

GROUP=QA julia +1.12 --project=lib/NonlinearSolveFirstOrder -e 'using Pkg; Pkg.test()'
Test Summary: | Pass  Total     Time
QA            |   20     20  5m34.0s

GROUP=QA julia +1.12 --project -e 'using Pkg; Pkg.test()'
Test Summary: | Pass  Total     Time
QA            |   28     28  8m32.9s

julia +1.13.0 --compiled-modules=existing --project=docs docs/make.jl
RenderDocument: rendering document.
HTMLWriter: rendering HTML pages.

preload-enzyme.jl contains only using Enzyme, matching backend availability in the full Core group. The final 5845-assertion bounded run used the LineSearch mixed-precision fix. The earlier rebase preserved the tested FirstOrder subtree. The current rebase additionally includes the upstream SimpleNonlinearSolve Float32 fix; FirstOrder source and tests remain unchanged. Runic, typos over changed files, and git diff --check passed. No dependencies were added.

Commands used /home/crackauc/.juliaup/bin/julia and workspace-local temporary storage. The Core retry and final NativeBounds run were wrapped in strace -f -qq --seccomp-bpf -e trace=none -e signal=SIGTERM after simultaneous SIGTERM interruption of earlier jobs; no test failures preceded the interruption and no checks were disabled. Docs used JULIA_CONDAPKG_BACKEND=Null and JULIA_PYTHONCALL_EXE=/usr/bin/python3. Actual GPU hardware, wrapper suites, and external downstream suites were not run locally. LineSearch 0.1.18 is now registered, so registry resolution can use the public API.

After the 0.1.18 correction, FirstOrder QA passed again (20/20). A fresh environment with Pkg.free("LineSearch") resolved the registered package from ~/.julia/packages/LineSearch/AH6Up, with path tracking explicitly checked to be false. Bounded LM and both line-search GN variants converged:

julia +1.13.0 --project scratch/release-0118-registry-smoke.jl
Registered LineSearch integration | Pass  Total  Time
                                 |    8      8  12.1s

A fresh full Core/root QA/docs run is in progress.

Ignore this draft until reviewed by @ChrisRackauckas.

🤖 Generated with Codex CLI 0.154.0 (model: gpt-6-astra). Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl.

ChrisRackauckas and others added 15 commits September 13, 2026 05:48
Use independent local checkouts and the public AirspeedVelocity API so
Julia LTS can resolve unregistered monorepo sublibrary versions. Publish
comparison tables in the job summary and preserve the result artifacts.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Add a default Newton regression for a rank-deficient tall Jacobian and
require the first LinearSolve release with the pivoted-QR fallback.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Implement scaled and corrected trust-region subproblems with reflected and
Cauchy candidates, feasible differencing, and separate root/KKT termination.
Document dense storage limits and cover native bounds and cache contracts.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
…thods

Adapt mixed residual/state shapes internally without changing user callbacks.
Cover autodiff, analytic Jacobians, and parameter-changing cache reuse.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Reuse the shared Jacobian and LinearSolve caches, including solver options,
preconditioning, and reinitialization. Restrict dense trust-region work to
the projected one- or two-dimensional model.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Use a finite-difference Jacobian backend for JVPs and VJPs unless their
backends are explicitly selected. Keep the feasibility assertions outside
reverse AD and verify selection when Enzyme is loaded.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Convert operator prototypes through their matrix interface when a concrete
linear system is requested, preserving sparse storage. Exercise default,
LU, and Krylov solves and parameter-changing reinitialization.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Pass the current iterate to the shared linear-solver constructor so
preconditioner setup receives the same state and parameters as other
first-order methods. Assert the initial callback values.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Solve the damped box subproblem with an active set and globalize with
a feasible Armijo search and projected-gradient fallback.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Compute a free-variable dogleg inside the intersected box and rectangular
trust region, including rank-deficient slow-convergence coverage.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Recognize endpoints within one coordinate ulp as well as simultaneous
hit times, so a nearly active coordinate cannot stall the dogleg step.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Solve reduced free-variable systems with projected line search, trust
region, and trust-region-with-line-search-fallback options.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Consolidate bounds, projected gradients, active masks, quadratic models,
Cauchy lengths, and radius updates with BoundedTrustRegion. Keep each
method's shrink policy explicit and move the shared Armijo search out of LM.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
Reuse the merit gradient and cached accepted point/residual in bounded LM and Gauss-Newton. Register the line-search cache with the existing reinitialization machinery and remove the local backtracking loop.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl
strict interior before a coordinate transformation. `BoundedTrustRegion` accepts an
initial guess exactly on a bound, but rejects an initial guess outside the feasible box.

## Reflective trust regions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all solver documentation. Instead, add a solver page that documents the bounded solvers, and gives recommendations.

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 13, 2026 10:05
@ChrisRackauckas
ChrisRackauckas merged commit 4991216 into SciML:master Sep 13, 2026
18 checks passed
ChrisRackauckas referenced this pull request Sep 13, 2026
* Respect active bounds in least-squares implicit sensitivities

Differentiate the projected stationarity equation so active and fixed variables
have zero sensitivity while the coupled free variables use their constrained
stationarity system. Preserve scalar states across derivative, Jacobian, and
VJP callbacks, and exercise solve, cached solve, and parameter reinitialization.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl

* Fix bounded trust-region finite differences and matrix workspaces

Reuse the native bounded finite-difference stencils for concrete Jacobians
and derivative products, including sparse prototypes and scalar caches.
Preserve multidimensional state and residual shapes when multiplying
Jacobian products into bounded trust-region workspaces.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl

* Apply the chain rule to bounded-problem derivative callbacks

Evaluate analytic Jacobians and products in physical coordinates and apply the
inverse-transform derivative to Jacobian columns and JVP/VJP directions.
Preserve sparse storage and provided parameter Jacobians. Handle scalar states
through transformation and solution reconstruction.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl

* Avoid unused bounded finite-difference setup

Only construct additional bound vectors and product callbacks when the
selected derivative path requires them. Preserve the original problem
when no derivative callback needs wrapping.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl

* Add benchmarked native defaults for bounded problems

Select bounded trust region followed by projected Gauss–Newton for automatic
bounded solves, preserve native coordinates through shared polyalgorithms,
and document solver choices with reproducible benchmark evidence.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl

* Preserve sparse structure when bounded transform derivatives vanish

Use in-place right multiplication by the transform's diagonal derivative so
stored zeros remain available to cached sparse symbolic factorizations.
Exercise saturated coordinates and subsequent callback reuse.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl

* Project initial guesses consistently in native bounded polyalgorithms

Reuse default projection for explicit native bounded polyalgorithms so
auxiliary initialization callbacks can supply an out-of-box starting guess.
Cover direct and cached solves while preserving individual solver validation.
Refresh transformed baselines and polyalgorithm measurements, and document
the final solver recommendations and gradient tolerances.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.154.0
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/12/rollout-2026-09-12T04-30-15-01a094bd-179a-7972-97ec-36badb9448cd.jsonl

* Move bounded solver benchmarks to SciMLBenchmarks

Benchmark CI only needs the AirspeedVelocity suite; add bounded cases
covering the new default and drop the one-off study scripts,
measurements, and docs assets. The bounded solver benchmark and its
analysis move to SciMLBenchmarks.jl.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin 3000.10.21
Agent-Model: SWE-2 Max
Agent-Session: local transcript /home/crackauc/.local/share/devin/cli/transcripts/aluminum-blizzard.json

* Point the bounded default docstring at recommendations only

The benchmark evidence moved to SciMLBenchmarks; the solver page keeps
recommendations.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Agent-Harness: Devin 3000.10.21
Agent-Model: SWE-2 Max
Agent-Session: local transcript /home/crackauc/.local/share/devin/cli/transcripts/aluminum-blizzard.json

---------

Co-authored-by: ChrisRackauckas-Claude <[email protected]>
Co-authored-by: Codex <[email protected]>
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
ChrisRackauckas added a commit that referenced this pull request Sep 13, 2026
…7.0 (#1276)

PR #1266 bumped NonlinearSolve 4.30.0 -> 4.34.0 and NonlinearSolveFirstOrder
2.6.1 -> 2.10.0 in a single commit, skipping every intermediate version. PR
#1273 then took them to 4.35.0 / 2.11.0. General's AutoMerge rejects both for
the sequential version number guideline, and the skipped versions cannot be
registered because they never existed as commits.

Renumber to the next sequential versions instead:
  NonlinearSolve            4.35.0 -> 4.31.0
  NonlinearSolveFirstOrder   2.11.0 -> 2.7.0

The root [compat] pin NonlinearSolveFirstOrder = "2.11" becomes "2.7". Every
other internal pin ("2", "4.19", "2.20", "2.4.1", "4.8", "4.21") is loose
enough to be satisfied by the lower numbers, and NonlinearSolveBase = "2.50"
is already registered and unchanged.



Agent-Harness: Claude Code 2.1.239
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

2 participants