Guard Hegedüs warm starts with residual predictiveness - #1123
Merged
ChrisRackauckas merged 2 commits intoAug 9, 2026
Merged
Conversation
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Member
Author
|
Cross-repository CI note: any immediate OrdinaryDiffEq downstream resolver failure is the clean OrdinaryDiffEq |
ChrisRackauckas
marked this pull request as ready for review
August 9, 2026 13:20
ChrisRackauckas-Claude
pushed a commit
to ChrisRackauckas-Claude/OrdinaryDiffEq.jl
that referenced
this pull request
Aug 9, 2026
SciML#3991 resolved `WarmStart.Auto` to `WarmStart.Hegedus` on the Newton path. The guess there is the previous Newton increment, and those converge to zero, so once Newton has converged the guess is pure round-off while the Hegedüs scalar `ξ = ⟨Au,b⟩/⟨Au,Au⟩` is ill-conditioned exactly where it is applied. A 1-ulp input change moved the Hairer4 solution by 3.7e-03 (SciML#4034). SciML/LinearSolve.jl#1123, released in 5.8.0, fixes that at the source: a Hegedüs guess is discarded unless it reduces the residual by at least half. Pin that with a `[compat]` floor rather than feature-detecting it, so the guarantee is expressed in the resolver instead of in a runtime probe of a LinearSolve internal. Verified against LinearSolve 5.8.0, 1-ulp perturbation of the SciML#4034 DAE: Hairer4, Auto (this branch) 1.33e-15 Hairer4, unguarded Hegedus 3.73e-03 Hairer4, cold start 6.64e-08 The guarded default is also the fastest of the three on the workloads measured: 1D Brusselator KenCarp4 (N=400) nf 158_259 guarded vs 175_852 unguarded vs 202_145 cold, at identical accuracy against a 1e-13 reference. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
ChrisRackauckas
added a commit
to SciML/OrdinaryDiffEq.jl
that referenced
this pull request
Aug 9, 2026
#3991 resolved `WarmStart.Auto` to `WarmStart.Hegedus` on the Newton path. The guess there is the previous Newton increment, and those converge to zero, so once Newton has converged the guess is pure round-off while the Hegedüs scalar `ξ = ⟨Au,b⟩/⟨Au,Au⟩` is ill-conditioned exactly where it is applied. A 1-ulp input change moved the Hairer4 solution by 3.7e-03 (#4034). SciML/LinearSolve.jl#1123, released in 5.8.0, fixes that at the source: a Hegedüs guess is discarded unless it reduces the residual by at least half. Pin that with a `[compat]` floor rather than feature-detecting it, so the guarantee is expressed in the resolver instead of in a runtime probe of a LinearSolve internal. Verified against LinearSolve 5.8.0, 1-ulp perturbation of the #4034 DAE: Hairer4, Auto (this branch) 1.33e-15 Hairer4, unguarded Hegedus 3.73e-03 Hairer4, cold start 6.64e-08 The guarded default is also the fastest of the three on the workloads measured: 1D Brusselator KenCarp4 (N=400) nf 158_259 guarded vs 175_852 unguarded vs 202_145 cold, at identical accuracy against a 1e-13 reference. Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR should be ignored until reviewed by @ChrisRackauckas.
Companion to SciML/OrdinaryDiffEq.jl#4040 and SciML/OrdinaryDiffEq.jl#4034.
What changed
WarmStart.Hegedusnow uses its projected previous solution only when thatprojection reduces the raw initial residual by at least a factor of two. If the
previous direction is not predictive, the solve starts cold.
The public documentation now describes that fallback and no longer says that
OrdinaryDiffEq resolves
WarmStart.Autoto Hegedüs. It also says explicitly thatwarm starting is workload-dependent and should be benchmarked against a cold
start. The threshold remains an implementation detail; no public API was added.
This is a bug-fix release bump to 5.3.1.
Why
The Hegedüs scalar
minimizes the residual along the previous solution direction. When
Auisnearly orthogonal to
b, however, that direction predicts essentially none ofthe new solution. In the OrdinaryDiffEq index-1 DAE reproducer, the previous
Newton increment had converged to round-off,
|ξ|spanned roughly 63 orders ofmagnitude, and GMRES sometimes accepted the rescaled noise at iteration zero.
That made each Newton update depend on the entire prior solve history and
amplified a one-ulp input perturbation into a
3.73e-3solution change.For the least-squares scalar, the projected residual ratio is
The implementation therefore checks the equivalent cosine threshold using the
already-computed
Auand inner product. It adds no operator application orworkspace allocation. For an unpreconditioned solve it also reuses the RHS norm
that is already needed for the stopping criterion.
Robustness and performance evidence
On the small index-1 DAE that exposed the bug:
nf6.64e-83.73e-31.33e-15The guard both removes the round-off amplification and improves the iteration
count on that correlated tiny-DAE workload.
It is deliberately not used to re-enable OrdinaryDiffEq's
Autodefault.On a matrix-free 1D Brusselator (
n=800, default diagonal preconditioner),guarded Hegedüs still regressed against cold starts:
nfchangeThe guard makes explicit Hegedüs safer; it does not make warm starting a
universal speedup.
Local verification
test/Core/warm_start.jl: 41/41 assertions passed on Julia 1.12.6.GROUP=Core: passed.GROUP=QA: passed, including Allocation QA (48/48) and SupernodalLU Allocation QA (8/8).--check: passed.1.33e-15(nf=617), Hairer42 drift1.33e-15(nf=625), and Cash4drift
2.77e-9(nf=740).