Repository navigation
Fix EisenstatWalkerForcing2 two-iteration-stale residual ratio - #1351
ChrisRackauckas merged 5 commits into
Conversation
… ratio. The forcing term must track the residual at the iterate just accepted, not a stale copy of the previous residual. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/NonlinearSolve.jl/jobs/1170-cursor/log.txt on amdci2.julia.csail.mit.edu
post_step_forcing! was recording cache.fu before evaluate_f!, so the residual ratio lagged two Newton steps. Record the norm only on kept iterates, and settle it in refresh_residual! when evaluation was deferred. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/NonlinearSolve.jl/jobs/1170-cursor/log.txt on amdci2.julia.csail.mit.edu
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: Devin CLI 3000.11.3 (conflict resolution), Claude Code 2.1.285 (orchestration) Agent-Model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium Agent-Session: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master); Devin log /Users/chrisrackauckas/sandbox/master/fusion-fixes/SciML_NonlinearSolve.jl-1351/log.txt
Merged the default branch into this PR (clean merge, no conflicts; head ed83219) so CI runs on current master. 🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (merge), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
Core LTS classification at ed06acac: pre-existing on master, fixed on current master. Both Linux and macOS fail Links:
🤖 Posted by an AI agent — harness: Codex CLI · model: gpt-6.1-sol |
Please ignore until reviewed by @ChrisRackauckas.
post_step_forcing!was called withcache.fubefore the residual was refreshed after an accepted Newton step, soEisenstatWalkerForcing2adapted from a residual ratio lagging two iterations (and used ratio1.0for the first two steps). This moves the forcing update to afterevaluate_f!/ accepted trust-region residual copy, skips rejected trust-region steps, and settles the norm inrefresh_residual!when evaluation was deferred.Forcing
InternalAPI.initarg-order fix: atlib/NonlinearSolveFirstOrder/src/solve.jl:325the old call passedfu, u, uwhere the method expectsf, fu, u, so the forcing cache was initialized frominternalnorm(u), notinternalnorm(fu)(on master, the initial stored norm is13.4164vs residual norm116.2755for the #1170 test). That is not what causes the two-iteration-stale ratio —pre_step_forcing!oniter == 0already resetsrnormfrom the live residual — but it is kept in this PR because it establishes the initial state of the same residual-history invariant the regression tests assert.Fail before / pass after (regression file)
Negative control: revert only
lib/NonlinearSolveFirstOrder/src/solve.jltoHEAD~1, keep the new test file:Pass-after (fixed src):
Independent review additionally reports forcing regressions 40 pass on head vs 15 pass / 25 fail on master, and an independent residual-history probe 213/213.
Core group verification
Command:
Full Core result (this PR branch):
The TrustRegion Core failures reproduce on master and are not caused by this PR:
test/rootfind_tests__item8.jl:30—Enzyme.ThunkCallError(Vector cotangent whereSVector{2,Float64}expected) for an OOPSVectorproblem with Krylov TrustRegion. Introduced by commit6982cdd5(parent4b29d933passes); tracked in master red on lib/NonlinearSolveFirstOrder GROUP=Core: Enzyme.Compiler.ThunkCallError, bisects to Enzyme v0.13.203 (good) -> v0.13.204 (bad) #1325 / master red on Downgrade Sublibraries NonlinearSolveFirstOrder: Enzyme ccall TypeError SVector vs Vector in TrustRegion/Moré #1337.NonPublicExplicitImportsExceptionforRobustTrustRegionLinsolveimported atsrc/NonlinearSolveFirstOrder.jl:44. Introduced byce7518c5(parentc79e63a3passes); tracked in master red on NonlinearSolveFirstOrder [QA]: RobustTrustRegionLinsolve not public (all_explicit_imports_are_public) #1336.QA limitation: this job did not run
GROUP=QAitself; the QA baseline above is from the independent review, which found the sameNonPublicExplicitImportsExceptionon master.New Eisenstat-Walker regression suite passed inside Core (
40/40). Runic--checkandtyposon touched files: clean.Not verified
NonlinearSolveAlgend-to-end JVP/rhs cost improvement cited in EisenstatWalkerForcing2 adapts from a two-iteration-stale residual ratio #1170 / OrdinaryDiffEq#4207.GROUP=QArun (see independent-review baseline / master red on NonlinearSolveFirstOrder [QA]: RobustTrustRegionLinsolve not public (all_explicit_imports_are_public) #1336 above).Reviewer pushback
rnormunchanged (current choice).Fixes #1170
Please ignore this draft until reviewed by @ChrisRackauckas.
Risk assessment
EisenstatWalkerForcing2(and deferred residual + forcing).misc_tests__item11.jl; Core forcing suite 40/40; TrustRegion/QA failures identical on master.Harness: Cursor Agent CLI 2026.10.01-14929f9; model: auto; transcript: /log.txt