Skip to content

Stabilize unglobalized bad Broyden steps - #1101

Closed
ChrisRackauckas-Claude wants to merge 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-brown-almost-linear-ci
Closed

ChrisRackauckas-Claude wants to merge 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-brown-almost-linear-ci

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Jul 22, 2026 •

Copy link
Copy Markdown
Member

Ignore this PR until it has been reviewed by @ChrisRackauckas.

Summary

  • Guard unglobalized bad-Broyden steps without adding a function evaluation or allocation to the ordinary path.
  • Activate the safeguard only when the initial inverse produces a gross displacement (norm(du) > 10 * max(norm(u), 1)), then retain a state-scale bound for that solve.
  • Leave ordinary unscaled trajectories bit-for-bit unchanged by returning a sentinel and skipping the displacement mutation.
  • Clear the safeguard through public reinit! so a reused solver cache cannot inherit limiter state.
  • Add an in-place Brown-almost-linear regression through the cached public init / solve! / reinit! interface.
  • Bump NonlinearSolve to 4.23.3 and NonlinearSolveQuasiNewton to 1.14.4.

No test expectation, threshold, tolerance, skip, or broken-test classification is changed.

Cause

Problem 8 in the robustness matrix, Brown almost linear, fails for algorithm 4:

Broyden(
    init_jacobian = Val(:true_jacobian),
    update_rule = Val(:bad_broyden),
)

At the standard start, the state norm is about 1.58, while the true-Jacobian displacement norm is about 5288 and the full-step residual is about 1.09e28. Bad-Broyden inverse updates then follow a roundoff-sensitive trajectory: the same source and dependency graph can converge or return the initial best residual 5.5 depending on the BLAS kernel.

The hard CI boundary is 74405d303 (#1051), which removed Brown from algorithm 4's expected-broken list without changing this solver path. Existing issue #1096 records the machine dependence. A controlled clean-master reproduction on Julia 1.12.6 with OPENBLAS_CORETYPE=Sandybridge returned Unstable, residual 5.5, after five steps.

Current rebase

  • Base: 2b0dda5f64402c5177507d9b1bb2e73ed0db4e5b
  • Head: fb57e9fbde97eaccaddc510d265a7d5c50a34180
  • The current master skip/expected-broken matrix is preserved unchanged.
  • The final diff contains only the three source/regression files plus the two package version bumps.

Local validation

From lib/NonlinearSolveQuasiNewton on Julia 1.12.6:

OPENBLAS_CORETYPE=Sandybridge GROUP=Core \
  julia +1.12 --startup-file=no --project=. \
  -e 'using Pkg; Pkg.test(; julia_args=["--check-bounds=auto", "--compiled-modules=yes", "--depwarn=yes"], force_latest_compatible_version=false, allow_reresolve=true)'

Passed all 1001 assertions:

  • Broyden: 599 / 599
  • Broyden iterator: 2 / 2
  • Broyden termination: 27 / 27
  • Klement: 216 / 216
  • Klement iterator: 2 / 2
  • Klement termination: 27 / 27
  • LimitedMemoryBroyden: 99 / 99
  • LimitedMemoryBroyden iterator: 2 / 2
  • LimitedMemoryBroyden termination: 27 / 27
  • Final output: Testing NonlinearSolveQuasiNewton tests passed

Repository-wide Runic 1.7.0 --check . and git diff --check both exited successfully.

The previous macOS CI validation of the final safeguard reported the complete root Broyden matrix at 95 pass / 20 expected broken; the remaining red Core jobs in that run were the separate homotopy allocation baseline tracked in #1076.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Follow-up 00f93ab9c addresses the first revision's downgrade CI failures without changing any benchmark expectation or tolerance:

  • avoids mutating δu when the step-size sentinel says the step is unscaled;
  • selects a persistent state-scale bad-Broyden bound only when the initial inverse produces a grossly oversized step;
  • keeps the ordinary 10× path for problems whose initial step is well scaled.

Exact downgraded-dependency validation on Julia 1.10.11:

  • Watson / true-Jacobian good Broyden: Success, residual 2.3647750424515834e-14, 219 steps;
  • Brown / true-Jacobian bad Broyden: Success, residual 1.3988810110276972e-14, 151 steps;
  • full Broyden matrix: 96 pass / 19 unchanged expected broken.

Fresh validation after the commit:

  • NonlinearSolveQuasiNewton GROUP=Core: 998/998 pass on Julia 1.12.6;
  • root Broyden matrix: 96 pass / 19 expected broken;
  • repository-wide Runic: clean;
  • root GROUP=Core: all preceding functional groups pass, then the known clean-master Julia 1.12 allocation pair reproduces unchanged (154.4 and 80.0 B/step), as audited in Julia 1.12 fails homotopy allocation guard due to escaped reshape headers #1076.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Follow-up bb3cd6731 addresses the first macOS CI result without changing the robustness expectations:

Local verification after the revision:

  • Julia 1.12.6 root Broyden matrix: 95 pass / 20 expected broken.
  • Exact Julia 1.10.11 downgrade floor: 95 pass / 20 expected broken; cached Brown solve succeeds in 151 steps with residual 1.3988810110276972e-14.
  • NonlinearSolveQuasiNewton GROUP=Core: all 1001 assertions pass.
  • Runic 1.5.1 and git diff --check: clean.

Fresh CI is running on bb3cd6731; the macOS Core lanes are the decisive remaining gate.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Fresh CI validation for bb3cd673:

Thus Brown is fixed on the affected macOS ARM lanes without changing the master expected-broken set or regressing Freudenstein-Roth/Watson. The remaining red Core statuses are unrelated allocation baselines already tracked in #1076.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

The remaining QuasiNewton sublibrary QA failure was also confirmed unrelated: clean master reproduces 19 pass / 1 fail solely from SciMLTesting 2.4 enabling the reexport audit by default. Draft #1102 now covers both root and QuasiNewton QA; its targeted QuasiNewton CI job 89018282756 is green at 20 / 20, with the audit still enabled.

Bound oversized bad-Broyden displacements relative to the current state before applying the inverse update. This removes the platform-sensitive Brown trajectory and also recovers the Watson benchmark.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Chris Rackauckas <[email protected]>
Keep ordinary unglobalized bad-Broyden trajectories bit-for-bit unchanged, and clear the safeguard when a solver cache is reinitialized.

Co-Authored-By: Chris Rackauckas <[email protected]>
@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/fix-brown-almost-linear-ci branch from bb3cd67 to fb57e9f Compare July 27, 2026 14:46
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Rebased onto current clean master 2b0dda5f64402c5177507d9b1bb2e73ed0db4e5b.

New head: fb57e9fbde97eaccaddc510d265a7d5c50a34180.

Reconciliation during the rebase:

  • preserved master's current Generalized Rosenbrock skip and expected-broken matrix unchanged;
  • bumped NonlinearSolve 4.23.2 → 4.23.3;
  • bumped NonlinearSolveQuasiNewton 1.14.3 → 1.14.4;
  • retained only the focused three-file implementation/regression diff.

Exact local validation on the rebased head:

cd lib/NonlinearSolveQuasiNewton
OPENBLAS_CORETYPE=Sandybridge GROUP=Core \
  julia +1.12 --startup-file=no --project=. \
  -e 'using Pkg; Pkg.test(; julia_args=["--check-bounds=auto", "--compiled-modules=yes", "--depwarn=yes"], force_latest_compatible_version=false, allow_reresolve=true)'

Result: all 1001 assertions passed:

  • Broyden 599 / 599, iterator 2 / 2, termination 27 / 27
  • Klement 216 / 216, iterator 2 / 2, termination 27 / 27
  • LimitedMemoryBroyden 99 / 99, iterator 2 / 2, termination 27 / 27
  • final output: Testing NonlinearSolveQuasiNewton tests passed

Whole-repository Runic 1.7.0 and git diff --check also exited successfully. The branch was force-updated only after fetching origin, verifying that the remote still ended at bb3cd6731, and confirming that its three commits were unchanged and authored by the existing PR author.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Closing in favor of #1125.

Problem #8 (Brown almost linear) on Broyden(; init_jacobian = Val(:true_jacobian), update_rule = Val(:bad_broyden)) is the same knife-edge case as problem #1, which #1108 already moved into skip_tests for this exact algorithm. #8 was simply never moved after 74405d3 (#1051) removed it from the broken list. The consistent fix is the one-line skip_tests[alg_ops[4]] = [1, 8], not a solver change.

The safeguard here changes unglobalized bad-Broyden trajectories for every user whose first step trips norm(du) > 10 * max(norm(u), 1), in order to push one marginal robustness-matrix entry onto the convergent side on one class of hardware. It does not address the underlying machine dependence documented in #1096 — which has failed in both directions, including an "Unexpected Pass" error while #8 was still marked broken — so the next BLAS kernel change can move a different problem across the same cliff. Unglobalized bad Broyden is genuinely unstable on this problem; the test matrix should record that rather than the solver being bent to hide it.

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