Skip to content

Add benchmarked bounded defaults and solver recommendations - #1273

Merged
ChrisRackauckas merged 9 commits into
SciML:masterfrom
ChrisRackauckas-Claude:feature/bounded-default-polyalgorithm
Sep 13, 2026
Merged

ChrisRackauckas merged 9 commits into
SciML:masterfrom
ChrisRackauckas-Claude:feature/bounded-default-polyalgorithm

Conversation

@ChrisRackauckas-Claude

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

Copy link
Copy Markdown
Member

Bounded problems currently enter the unbounded default through a variable transformation. This adds FastShortcutBoundedPolyalg() and selects it for bounded root and least-squares problems: native bounded trust region first, then projected Gauss–Newton. The choice is supported by 869 measurements across 79 cases in 12 families: the new default passed 76/79, compared with 64/79 for the previous transformed default. The benchmark suite, its problem definitions, and its analysis live in SciMLBenchmarks.jl (SciML/SciMLBenchmarks.jl#1879); this repository keeps only the AirspeedVelocity benchmark-CI suite, extended with bounded cases covering the new default.

The bounded solver catalog, API documentation, and recommendations now have a dedicated solver page. The bound-constraints tutorial focuses on constructing and solving problems. Sparse prototypes and Krylov operators continue through the shared Jacobian and linear-solver caches. Initial guesses outside the box are projected for automatic selection and all-native bounded polyalgorithms; individual native algorithms retain their feasible-start requirement. This includes auxiliary guesses changed by initialization callbacks. Correctors restrict the default to its supported trust-region stage. Initialization runs once, in physical coordinates, and honors NoInit().

Please ignore this draft until reviewed by @ChrisRackauckas.

Prerequisites

Benchmarking exposed existing defects on the clean base. They were reproduced and isolated into these prerequisite PRs, whose commits are included here so the proposed default can be tested end to end:

Those PRs contain their failing-before/passing-after evidence. The transformed baselines below include the chain-rule correction; benchmarking the incorrect derivatives would misrepresent their performance.

Benchmark evidence

The suite covers dense, sparse, and operator configurations; roots and nonzero-residual least squares; multiple starts; fixed variables; underdetermined/rank-deficient systems; analytic and automatic Jacobians; and diffusion systems up to 1,024 unknowns. Independent acceptance checks require feasibility, a successful return code, and either a root residual threshold or both projected stationarity and a reference cost. All 79 analytic benchmark Jacobians passed independent ForwardDiff checks; SciPy independently reproduced the two nonzero fitting reference costs.

Configuration Accepted Family-weighted geometric time / fastest accepted native method
New bounded default 76/79 1.61
Bounded trust region 75/79 1.41
Projected Gauss–Newton 76/79 1.72
Reflective trust region 76/79 6.68
Previous transformed default 64/79 7.43

Ratios average each method's successful subset; they are not direct speedups between methods with different coverage. Every ordered two-, three-, and four-stage native sequence was scored using actual return-code fallback. Trust region → projected Gauss–Newton was fastest at the best coverage; additional stages recovered no more cases. The chosen sequence was also measured directly. Algorithm objects are constructed before timing; bounded_default measures the explicit polyalgorithm, while automatic selection and initial-guess projection are exercised by the solver tests.

A separate 15-sample paired experiment, warming both methods before measurement and alternating their order, confirmed the ordering: trust region was faster on 53/75 common successes; the family-weighted Gauss–Newton/trust-region geometric ratio was 1.279. The operator subset instead favored Gauss–Newton by a factor of 1.593, which motivates the explicit recommendation to benchmark it for operator workloads. Three Freudenstein–Roth starts remain non-root local-minimum failures.

The 17-sample cache experiment includes periodic retained-stage reprobes. On the underdetermined case, retain_best=true reduced mean time from 13.04 ms to 1.47 ms; the other cache cases showed no consistent benefit. Parameters and starts were fixed in that experiment.

Measurements exclude compilation, use one Julia/BLAS thread, and were taken on a shared dual AMD EPYC 7502 host with Julia 1.13.0. The suite, problem definitions, analysis, and reproduction moved to SciMLBenchmarks.jl in SciML/SciMLBenchmarks.jl#1879.

Local verification

Commands used /home/crackauc/.juliaup/bin/julia +1.13.0 --compiled-modules=existing, JULIA_NUM_THREADS=1, JULIA_PKG_PRECOMPILE_AUTO=0, and a workspace-local TMPDIR.

  • GROUP=Core julia --project -e 'using Pkg; Pkg.test()': 1,556 passing assertions across 82 top-level summaries, plus 89 unchanged pre-existing broken assertions; exited 0.
  • GROUP=PolyAlgorithms julia --project -e 'using Pkg; Pkg.test()': 483 passed, including 376 new bounded-default assertions.
  • GROUP=Bounds julia --project -e 'using Pkg; Pkg.test()': 23 passed.
  • GROUP=Core julia --project=lib/NonlinearSolveBase -e 'using Pkg; Pkg.test()': 523 passed with the final sparse-structure correction.
  • GROUP=Core julia --project=lib/NonlinearSolveFirstOrder -e 'using Pkg; Pkg.test()': 8,749 passed across 43 nonempty top-level summaries, including 5,989 native bounded assertions and 10 standalone bounded-default assertions; exited 0.
  • GROUP=QA julia --project -e 'using Pkg; Pkg.test()': 28 passed. The same command with --project=lib/NonlinearSolveBase and --project=lib/NonlinearSolveFirstOrder passed 20 assertions each on the final solver changes.
  • julia --project=docs docs/make.jl with JULIA_CONDAPKG_BACKEND=Null and JULIA_PYTHONCALL_EXE=/usr/bin/python3: the final full build passed after the auxiliary-initialization fix, including examples, doctests, document checks, and external links. Deployment was skipped automatically outside CI.
  • Existing homotopy initialization test rerun after the shared polyalgorithm initialization change: 12 passed.
  • Runic, typos across the changed files, and git diff --check: passed.
  • The benchmark suite moved to SciMLBenchmarks.jl in Add bounded nonlinear solver benchmark to the NonlinearProblem group SciMLBenchmarks.jl#1879, as a single self-contained document (benchmarks/NonlinearProblem/bounded_solvers.jmd) in the existing nonlinear-solver group; it was validated with the CI weave entrypoint. The bounded study scripts, measurements, and docs assets were removed from this repository; benchmark/ now contains only the AirspeedVelocity suite plus bounded cases for the new default.

Literal final test output:

Test Summary:                 | Pass  Total     Time
Bounded default polyalgorithm |  376    376  5m05.8s
...
     Testing NonlinearSolve tests passed

Test Summary:           | Pass  Total     Time
Bounds: nonlinear model |   23     23  1m46.8s
     Testing NonlinearSolve tests passed

The new NoInit regression initially produced 6 passed / 2 failed for its eight assertions: direct polyalgorithm children reran initialization. After forwarding NoInit() to children, the unchanged eight assertions pass within the 376-assertion result above. The initialization test additionally verifies exactly one initializer callback.

A second regression used an auxiliary initialization callback that moved its starting guess outside the box. The previous default solved the case (Success, u = [0.7499999999998385]), but the first native-default implementation rejected the guess. The same test before and after sharing projection with native bounded polyalgorithms produced:

Before: ArgumentError: The initial guess must satisfy the lower bounds.
Bounded auxiliary initialization projects updated guesses | Error  Total
                                                         |     1      1
After:
Bounded auxiliary initialization projects updated guesses | Pass  Total   Time
                                                         |   24     24  32.4s

The test covers root and least-squares auxiliary problems, both sides of the box, direct and cached solves, and preservation of the callback's supplied state.

Review notes and limits

The public constructor and initialization-selection hook are documented together. Versions become NonlinearSolve 4.35.0, NonlinearSolveFirstOrder 2.11.0, and NonlinearSolveBase 2.50.0, with corresponding minimum dependencies. There are no new production dependencies.

This does not claim global convergence or universal performance rankings. GPU, distributed, downstream, arbitrary-precision, and all-AD-backend coverage were not run. ForwardDiff active-set sensitivities assume locally unchanged active sets and parameter-independent bounds. The pre-existing mixed scalar-state/array-residual dogleg limitation is documented with an explicit Gauss–Newton workaround at #1270.

Responds to #1266 (comment).

🤖 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). Benchmark cleanup in this revision by Devin 3000.10.21 (model: SWE-2 Max; session: local transcript /home/crackauc/.local/share/devin/cli/transcripts/aluminum-blizzard.json).

ChrisRackauckas and others added 7 commits September 13, 2026 08:10
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
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
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
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
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
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
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
Comment thread docs/src/solvers/bounded_solvers.md Outdated
algorithm is required, but the transformed derivative can become small near an active
bound. Native methods operate directly on the box and can reach its boundary.

## Benchmark evidence

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 should go to SciMLBenchmarks.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done — the full benchmark section has been removed from this page. The recommendations now point to SciMLBenchmarks.jl, where the study moved in SciML/SciMLBenchmarks.jl#1879.

@ChrisRackauckas

Copy link
Copy Markdown
Member

The benchmarks here should just be AirspeedVelocity benchmarks for benchmark CI. All of the new benchmarks here should move to SciMLBenchmarks.

ChrisRackauckas and others added 2 commits September 13, 2026 09:48
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
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
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Done — the benchmark study has moved to SciML/SciMLBenchmarks.jl#1879.

What's left in this repo under benchmark/ is only the AirspeedVelocity suite: the existing benchmarks.jl/ci.jl, plus a small bounded group (Poisson root problem for the default and BoundedTrustRegion; exponential least-squares fit for the default and BoundedGaussNewton) so benchmark CI exercises the new default.

Removed from this PR: the 79-case study scripts (bounded_*.jl), the analysis and reference-cost scripts, all committed results and plot artifacts, the docs asset copy in docs/make.jl, and the benchmark-evidence section on the bounded solvers page. That page now gives the recommendations and links to the SciMLBenchmarks document instead of embedding the study.

The three benchmark documents (full sweep, paired comparison, cache experiment) were woven successfully with the CI entrypoint on the benchmark branch; measurements there reproduce the recorded findings (bounded default 76/79 accepted vs 63/79 for the previous transformed default, trust region → projected Gauss–Newton heading the order ranking).

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 13, 2026 15:11
@ChrisRackauckas
ChrisRackauckas merged commit e732a6f into SciML:master Sep 13, 2026
103 of 104 checks passed
ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/SciMLBenchmarks.jl that referenced this pull request Sep 13, 2026
Moves the bounded solver study out of SciML/NonlinearSolve.jl#1273 into a
single self-contained benchmark document, following the existing
NonlinearProblem group conventions: the 79-case sweep across 12 families
with order scoring and a performance profile, plus a paired
trust-region/Gauss-Newton re-measurement as a closing section. Problem
definitions and the independent ForwardDiff Jacobian check are inline.

The shared environment pins NonlinearSolve 4.35 / NonlinearSolveBase 2.50 /
NonlinearSolveFirstOrder 2.11 to the pull request branch (and bumps NLsolve
to 5) until that release registers; the manifest records the resolved
commit. Other documents in the group run against the same environment.

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
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Update on the benchmark relocation: SciML/SciMLBenchmarks.jl#1879 now consolidates the study into a single self-contained document, benchmarks/NonlinearProblem/bounded_solvers.jmd, in the existing nonlinear-solver benchmark group — matching that repo's conventions. The cache-reuse experiment was dropped as not useful for a standing benchmark page; the paired trust region vs Gauss–Newton comparison is folded in as a closing section. The consolidated document was re-validated with the CI weave entrypoint (default 76/79 vs 63/79 previous transformed default; trust region → projected Gauss–Newton still heads the order ranking; paired run: trust region faster 55/75).

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]>
ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/SciMLBenchmarks.jl that referenced this pull request Sep 13, 2026
Moves the bounded solver study out of SciML/NonlinearSolve.jl#1273 into a
single self-contained benchmark document, following the existing
NonlinearProblem group conventions: the 79-case sweep across 12 families
with order scoring and a performance profile, plus a paired
trust-region/Gauss-Newton re-measurement as a closing section. Problem
definitions and the independent ForwardDiff Jacobian check are inline.

The shared environment requires the released NonlinearSolve 4.31 /
NonlinearSolveBase 2.50 / NonlinearSolveFirstOrder 2.7 (which contain
FastShortcutBoundedPolyalg and the native bounded solvers) and bumps
NLsolve to 5; the other documents in the group run against the same
environment.

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
ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/SciMLBenchmarks.jl that referenced this pull request Sep 13, 2026
Moves the bounded solver study out of SciML/NonlinearSolve.jl#1273 into a
single self-contained benchmark document, following the existing
NonlinearProblem group conventions: the 79-case sweep across 12 families
with order scoring and a performance profile, plus a paired
trust-region/Gauss-Newton re-measurement as a closing section. Problem
definitions and the independent ForwardDiff Jacobian check are inline.

The shared environment requires the released NonlinearSolve 4.31 /
NonlinearSolveBase 2.50 / NonlinearSolveFirstOrder 2.7 (which contain
FastShortcutBoundedPolyalg and the native bounded solvers) and bumps
NLsolve to 5; the other documents in the group run against the same
environment.

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
ChrisRackauckas added a commit to SciML/SciMLBenchmarks.jl that referenced this pull request Sep 13, 2026
…1879)

Moves the bounded solver study out of SciML/NonlinearSolve.jl#1273 into a
single self-contained benchmark document, following the existing
NonlinearProblem group conventions: the 79-case sweep across 12 families
with order scoring and a performance profile, plus a paired
trust-region/Gauss-Newton re-measurement as a closing section. Problem
definitions and the independent ForwardDiff Jacobian check are inline.

The shared environment requires the released NonlinearSolve 4.31 /
NonlinearSolveBase 2.50 / NonlinearSolveFirstOrder 2.7 (which contain
FastShortcutBoundedPolyalg and the native bounded solvers) and bumps
NLsolve to 5; the other documents in the group run against the same
environment.



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: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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