Skip to content

Fix EisenstatWalkerForcing2 two-iteration-stale residual ratio - #1351

Merged
ChrisRackauckas merged 5 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/1170-forcing-after-step
Nov 2, 2026
Merged

ChrisRackauckas merged 5 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/1170-forcing-after-step

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Please ignore until reviewed by @ChrisRackauckas.

post_step_forcing! was called with cache.fu before the residual was refreshed after an accepted Newton step, so EisenstatWalkerForcing2 adapted from a residual ratio lagging two iterations (and used ratio 1.0 for the first two steps). This moves the forcing update to after evaluate_f! / accepted trust-region residual copy, skips rejected trust-region steps, and settles the norm in refresh_residual! when evaluation was deferred.

Forcing InternalAPI.init arg-order fix: at lib/NonlinearSolveFirstOrder/src/solve.jl:325 the old call passed fu, u, u where the method expects f, fu, u, so the forcing cache was initialized from internalnorm(u), not internalnorm(fu) (on master, the initial stored norm is 13.4164 vs residual norm 116.2755 for the #1170 test). That is not what causes the two-iteration-stale ratio — pre_step_forcing! on iter == 0 already resets rnorm from 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.jl to HEAD~1, keep the new test file:

forcing residual matches the current iterate after each step |    9    15     24
ERROR: Some tests did not pass: 9 passed, 15 failed, 0 errored, 0 broken.

Pass-after (fixed src):

forcing residual matches the current iterate after each step |   24     24
line-search path also records the post-step residual |    8      8
deferred residual defers the forcing-norm update |    8      8

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:

cd lib/NonlinearSolveFirstOrder
export TMPDIR=.../jobs/1170-cursor/tmp
export JULIA_DEPOT_PATH=.../jobs/1170-cursor/scratch/depot:$HOME/.julia   # private compiled/ to avoid shared-depot lock hangs
GROUP=Core julia +1.12 --project=. -e 'using Pkg; Pkg.test()'

Full Core result (this PR branch):

Eisenstat-Walker forcing uses the current residual ratio |   40     40
Native bounded methods | 5989   5989  14m47.1s
NewtonRaphson |  309    309
TrustRegion | 1113     21   1134  15m49.8s
ERROR: Some tests did not pass: 1113 passed, 0 failed, 21 errored, 0 broken.
Package NonlinearSolveFirstOrder errored during testing

The TrustRegion Core failures reproduce on master and are not caused by this PR:

QA limitation: this job did not run GROUP=QA itself; the QA baseline above is from the independent review, which found the same NonPublicExplicitImportsException on master.

New Eisenstat-Walker regression suite passed inside Core (40/40). Runic --check and typos on touched files: clean.

Not verified

Reviewer pushback

Fixes #1170

Please ignore this draft until reviewed by @ChrisRackauckas.

Risk assessment

Harness: Cursor Agent CLI 2026.10.01-14929f9; model: auto; transcript: /log.txt

ChrisRackauckas and others added 2 commits October 2, 2026 02:22
… 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
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

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
Conversation: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master)

@ChrisRackauckas-Claude

ChrisRackauckas-Claude commented Oct 17, 2026 •

Copy link
Copy Markdown
Member Author

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Core LTS classification at ed06acac: pre-existing on master, fixed on current master. Both Linux and macOS fail PolyAlgorithm Type Inference → solve!() inference (test/Core/core_tests__item3.jl:27), matching the earlier master failure. The head lacks the merged retcode type assertion in #1347. The first completed master Core LTS jobs after that fix pass on both platforms.

Links:


🤖 Posted by an AI agent — harness: Codex CLI · model: gpt-6.1-sol
Conversation: local headless job codex-nls-core-lts-20261017 (no session URL)

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review November 2, 2026 01:57
@ChrisRackauckas
ChrisRackauckas merged commit 5b6a1df into SciML:master Nov 2, 2026
81 checks passed
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.

EisenstatWalkerForcing2 adapts from a two-iteration-stale residual ratio

2 participants