Skip to content

Continue polyalgorithm after stalled least-squares solves - #1204

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-polyalg-stalled-success
Aug 28, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-polyalg-stalled-success

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

Ignore this draft until reviewed by @ChrisRackauckas.

What changed and why

Cache-based solve!(init(prob)) returned immediately when the first nonlinear least-squares polyalgorithm rung reported StalledSuccess. Direct solve(prob) and the step-driven cache path already treat that result as a reason to try the next rung. This makes the cache path follow the same rule and adds a bounded nonlinear least-squares regression covering the mismatch.

The bug was exposed by LinearSolve's rank-deficient QR fallback in SciML/LinearSolve.jl@f15353ac. CurveFit's bounded nonlinfit_reinit cache returned [1.578e-12, 9.825684, 1.745e-18] with residual norm 8.10367, while direct solve escalated and found [3.0, 2.0, 0.7] with residual norm 1.78e-14.

Failing before

cached_sol.retcode: StalledSuccess
cached_sol.u: [1.5780331164254596e-12, 9.825684095952546, 1.7454614466180318e-18]
direct_sol.retcode: Success
direct_sol.u: [3.0000000000000497, 1.9999999999999598, 0.7000000000000067]
cache solve escalates after StalledSuccess | 1 pass, 3 fail, 4 total

Passing after

cache solve escalates after StalledSuccess | 4 pass, 4 total

CurveFit's original reproducer with this NonlinearSolveBase checkout produced:

u=[3.0000000000000497,1.9999999999999598,0.7000000000000067]
retcode=Success
residual_norm=1.778575899402738e-14

Verification

After rebasing over the current upstream releases and the merged QA compat correction #1205:

GROUP=Core julia +release --project -e 'using Pkg; Pkg.test()'
PolyAlgorithm cache StalledSuccess escalation | 4 pass, 4 total
Testing NonlinearSolve tests passed

GROUP=QA julia +release --project -e 'using Pkg; Pkg.test()'
QA | 28 pass, 28 total, 1m01.2s
Testing NonlinearSolve tests passed

julia +release -m Runic --check lib/NonlinearSolveBase/src/solve.jl test/Core/polyalg_stalled_success_tests__item1.jl test/runtests.jl
# exit 0

git diff upstream/master | typos -
# exit 0

git diff --check upstream/master
# exit 0

Fresh CI on this rebased head passes Linux Core on Julia lts, current, and pre; QA; PolyAlgorithms; Bounds; Adjoint; Downstream; Trim; Verbosity; documentation; downgrade; formatting; spelling; and the completed sublibrary jobs.

CI failure classification

The six completed red checks reproduce independently of this polyalgorithm change:

  • Wrappers fails on Julia lts, current, and pre because its isolated environment still pins NLsolve 4.5 while the root requires NLsolve 5. Aligning the environment exposes NLsolve 5's requirement for ADTypes backends instead of legacy symbols. Draft Support NLsolve 5 autodiff in wrapper tests #1207 fixes both parts and reports Wrappers 135631/135631 and QA 28/28 passing.
  • ModelingToolkit InterfaceI, InterfaceII, and Initialization fail while reconstructing nested symbolic metadata, with values such as Base.ImmutableDict{DataType, Any} appearing where scope/name tuples are expected. The focused SymbolicUtils fix Fix nested ImmutableDict metadata updates JuliaSymbolics/SymbolicUtils.jl#1033 has a fail-before/pass-after regression and passes SymbolicUtils Core with 17,887 tests; the same checkout also passes the affected SymbolicAnalysis groups.

Tracker/LogExpFunctions failures from the pre-rebase head are resolved by merged #1203; exact current-master Simple Core and Adjoint runs pass.

macOS and CUDA jobs remain queued for lack of runners at the time of this update.

Not verified

GPU, adjoint, bounds-extension, downstream, trim, and full Everything groups were not run locally for this branch. Documentation was not built locally because no public API or documentation changed.

Reviewer note

The behavioral choice is limited to NonlinearSolvePolyAlgorithm: a StalledSuccess rung now escalates exactly as the direct-solve and step-driven paths already do. If every rung stalls or fails, the existing lowest-residual selection remains unchanged.

Links

🤖 Generated with Codex CLI 0.150.1 (model: unknown; session: local session ID 01a0441e-3d2f-7170-ab6e-58ef72975a9f).

Make cache-based solve! match the direct and step!-driven polyalgorithm paths by escalating past StalledSuccess. Add a bounded nonlinear least-squares regression that discriminates the cache mismatch.

Co-Authored-By: Chris Rackauckas <[email protected]>

Co-Authored-By: Codex <[email protected]>

Agent-Harness: Codex CLI 0.150.1

Agent-Model: unknown

Agent-Session: local session ID 01a0441e-3d2f-7170-ab6e-58ef72975a9f
@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the fix-polyalg-stalled-success branch from 10bb40a to 3975faa Compare August 27, 2026 20:29
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

The ModelingToolkit Initialization downstream failure is unrelated to this PR's NonlinearSolve changes.

The job checked out current ModelingToolkit master at c69fe3f74f101f48541962ca3c9c5ea26d94fc12 and resolved SymbolicUtils 4.46.0. Its only error (838 pass, 1 error, 12 broken) is the known SymbolicUtils 4.46.0 nested ImmutableDict metadata corruption: initializationsystem.jl:2149 receives Base.ImmutableDict{DataType,Any} where a scope value is required.

A separate clean current-master environment with NonlinearSolve master developed through the same five package paths resolved the same versions: ModelingToolkitBase 1.68.1, NonlinearSolve 4.28.1, and SymbolicUtils 4.46.0. The owning-package fix and its fail-before/pass-after reproducer are already in JuliaSymbolics/SymbolicUtils.jl#1033; no duplicate NonlinearSolve change is needed.

Local full-group execution was stopped before its terminal assertion to return this classification promptly; the linked CI job itself is the exact clean-current-master reproduction.

🤖 Comment generated with Codex CLI 0.150.1 (model: unknown; session: local session ID 01a0441e-3d2f-7170-ab6e-58ef72975a9f)

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 28, 2026 01:29
@ChrisRackauckas
ChrisRackauckas merged commit b431eb2 into SciML:master Aug 28, 2026
87 of 96 checks passed
ChrisRackauckas referenced this pull request Aug 30, 2026
Only despecialize when the problem asks for it

Release the accumulated source changes.



Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude <[email protected]>
ChrisRackauckas added a commit that referenced this pull request Sep 7, 2026
- Render cache accessor docs (#1196)
- Drop stale [compat] majors older than one year (#1198)
- Drop @fastmath from L2_NORM/Linf_NORM so isfinite guards survive (#1182)
- Release 4.28.1 (#1202)
- Release 2.48.1 (#1206)
- Align QA NLsolve compat with root project (#1205)
- Widen NonlinearSolveBase LogExpFunctions compat to 0.3.28–1 (#1203)
- Continue polyalgorithm after stalled least-squares solves (#1204)
- Align Wrappers NLsolve compat with root project (#1208)
- Release 2.48.2 (#1210)



Agent-Harness: Claude Code
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 added a commit that referenced this pull request Sep 7, 2026
- Render cache accessor docs (#1196)
- Drop stale [compat] majors older than one year (#1198)
- Drop @fastmath from L2_NORM/Linf_NORM so isfinite guards survive (#1182)
- Release 4.28.1 (#1202)
- Release 2.48.1 (#1206)
- Align QA NLsolve compat with root project (#1205)
- Widen NonlinearSolveBase LogExpFunctions compat to 0.3.28–1 (#1203)
- Continue polyalgorithm after stalled least-squares solves (#1204)
- Align Wrappers NLsolve compat with root project (#1208)
- Release 2.48.2 (#1210)



Agent-Harness: Claude Code
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 added a commit that referenced this pull request Sep 7, 2026
- Drop stale [compat] majors older than one year (#1198)
- Drop @fastmath from L2_NORM/Linf_NORM so isfinite guards survive (#1182)
- Release 4.28.1 (#1202)
- Release 2.48.1 (#1206)
- Align QA NLsolve compat with root project (#1205)
- Widen NonlinearSolveBase LogExpFunctions compat to 0.3.28–1 (#1203)
- Continue polyalgorithm after stalled least-squares solves (#1204)
- Align Wrappers NLsolve compat with root project (#1208)
- Release 2.48.2 (#1210)
- Preserve despecialized parameters during reinit (#1199)



Agent-Harness: Claude Code
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 added a commit that referenced this pull request Sep 7, 2026
- Drop stale [compat] majors older than one year (#1198)
- Drop @fastmath from L2_NORM/Linf_NORM so isfinite guards survive (#1182)
- Release 4.28.1 (#1202)
- Release 2.48.1 (#1206)
- Align QA NLsolve compat with root project (#1205)
- Widen NonlinearSolveBase LogExpFunctions compat to 0.3.28–1 (#1203)
- Continue polyalgorithm after stalled least-squares solves (#1204)
- Align Wrappers NLsolve compat with root project (#1208)
- Release 2.48.2 (#1210)
- Preserve despecialized parameters during reinit (#1199)



Agent-Harness: Claude Code
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 added a commit that referenced this pull request Sep 10, 2026
- Render cache accessor docs (#1196)
- Drop stale [compat] majors older than one year (#1198)
- Drop @fastmath from L2_NORM/Linf_NORM so isfinite guards survive (#1182)
- Release 4.28.1 (#1202)
- Release 2.48.1 (#1206)
- Align QA NLsolve compat with root project (#1205)
- Widen NonlinearSolveBase LogExpFunctions compat to 0.3.28–1 (#1203)
- Continue polyalgorithm after stalled least-squares solves (#1204)
- Align Wrappers NLsolve compat with root project (#1208)
- Release 2.48.2 (#1210)



Agent-Harness: Claude Code
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 added a commit that referenced this pull request Sep 10, 2026
- Render cache accessor docs (#1196)
- Drop stale [compat] majors older than one year (#1198)
- Drop @fastmath from L2_NORM/Linf_NORM so isfinite guards survive (#1182)
- Release 4.28.1 (#1202)
- Release 2.48.1 (#1206)
- Align QA NLsolve compat with root project (#1205)
- Widen NonlinearSolveBase LogExpFunctions compat to 0.3.28–1 (#1203)
- Continue polyalgorithm after stalled least-squares solves (#1204)
- Align Wrappers NLsolve compat with root project (#1208)
- Release 2.48.2 (#1210)



Agent-Harness: Claude Code
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