Repository navigation
Homotopy sweeps: loose-then-tight tracking tolerances (tracking_abstol) - #1028
Merged
ChrisRackauckas merged 1 commit intoJul 11, 2026
Conversation
Add an opt-in `tracking_abstol` kwarg to HomotopySweep and SimpleHomotopySweep (SciML#1020 Priority 5): interior tracking steps only need enough accuracy to keep the predictor useful and stay inside the next corrector's convergence basin, so they may run at a loose absolute tolerance while the returned solution still satisfies the user's full tolerances. Mirroring the tracking_maxiters precedent exactly: - The λspan[1] anchor solve and the final landing on λspan[2] are exempt. HomotopySweep bakes the loose abstol into its single shared inner cache (`abstol` cannot be changed through `reinit!` — the polyalgorithm cache's `InternalAPI.reinit!` accepts only `p`/`u0`), so the anchor runs as a standalone full-tolerance solve and the landing is re-polished at the full tolerance warm-started from the loose landing solve (~1-2 extra corrector iterations). SimpleHomotopySweep's steps are fresh standalone solves, so the exemption is simply not splicing the loose kwargs there. - An explicit user-passed `abstol` OR `reltol` (solve kwarg or problem kwarg) disables the loosening entirely: splicing a loose abstol next to a user reltol would let the loose criterion fire first in the default OR-combined termination modes. - Constructor validation consistent with tracking_maxiters (positive or `nothing`). Default is `nothing` (disabled): the loose interior iterates slightly degrade the secant/quality signals the step controller reads, so loosening stays opt-in; 1e-4-1e-6 are good starting values (Bertini tracks at 1e-5/1e-6 with only the endgame tight; HomotopyContinuation.jl accepts on Newton contraction and polishes endpoints). Measured at tracking_abstol = 1e-4 (Julia 1.12): scalar cubic with NewtonRaphson inner 53 -> 43 residual calls; n = 50 coupled cubic 1247 -> 835 (-33%, -37% wall time; default polyalg inner 2122 -> 1442); SimpleHomotopySweep scalar path 43 -> 27 (-37%, -35% wall time). The SimpleHomotopySweep StaticArray/scalar paths remain allocation-free (AllocCheck) with the loosening active. ArcLengthContinuation intentionally untouched (churning in SciML#1025); it gets the same treatment in a follow-up. Co-Authored-By: Claude Fable 5 <[email protected]> Co-Authored-By: Chris Rackauckas <[email protected]>
ChrisRackauckas
marked this pull request as ready for review
July 11, 2026 04:01
ChrisRackauckas
added a commit
that referenced
this pull request
Jul 11, 2026
… NonlinearSolve 4.20.4 (#1034) Registered versions (NLSB 2.33.0 on 2026-07-06) predate the merged homotopy work: #1021, #1022, #1024, #1025, #1028, #1029 (NLSB features => minor), #1028's tracking_abstol on SimpleHomotopySweep (=> minor), and #1027's SciMLBase 3.34 compat floor (top-level => patch). Co-authored-by: ChrisRackauckas-Claude <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
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.
Part of #1020 (P5).
Note: This PR should be ignored until reviewed by @ChrisRackauckas.
What
Adds an opt-in
tracking_abstolkeyword toHomotopySweepandSimpleHomotopySweep. Interior tracking steps of a continuation sweep only need enough accuracy to keep the secant predictor useful and to stay inside the next step's Newton convergence basin — they are warm starts, not answers. Withtracking_abstolset, those interior corrector solves run at the loose absolute tolerance while the returned solution still satisfies the user's full tolerances, so the accuracy semantics of the result are unchanged.This is standard practice in production path trackers: Bertini tracks at
1e-5/1e-6and only the endgame runs tight; HomotopyContinuation.jl accepts steps on Newton contraction and polishes endpoints; AUTO-07p correctors run at path-tracking tolerances well looser than typical solution reporting tolerances. Values around1e-4–1e-6are good starting points when opting in.Design (mirrors the
tracking_maxitersprecedent from #1024 exactly)λspan[1]anchor solve (the one cold start, and the returned solution for a zero-width span) and the final landing onλspan[2]always run at the user's full tolerances.HomotopySweep): the looseabstolis baked into the single shared inner cache. It cannot be changed per-reinit!— the polyalgorithm cache'sInternalAPI.reinit!accepts onlyp/u0, no tolerance kwargs (checked inlib/NonlinearSolveBase/src/polyalg.jl). So the anchor runs as a standalone full-tolerance solve, and the landing is re-polished at the full tolerance warm-started from the loose landing solve (~1–2 extra corrector iterations). The existing_sweep_uncapped_solverescue was generalized into_sweep_exempt_solve(which now also forwardsjac/jac_prototype/sparsity/colorveclike the tracking cache, matching Sweep drivers: consume jac/jac_prototype/sparsity/colorvec from the NonlinearFunction (#1020 item 2) #1022).SimpleHomotopySweep): every step is a fresh standalone solve, so the exemption is simply not splicing the loose kwargs into the anchor/landing solves — no re-polish needed. The StaticArray/scalar paths remain allocation-free (AllocCheck run locally, including withtracking_abstolactive).abstolorreltol(solve kwarg or problem kwarg) disables the loosening entirely. Splicing a looseabstolnext to a userreltolwould let the loose criterion fire first in the default OR-combined termination modes, silently overriding the user's intent.tracking_maxiters: must be positive,nothingdisables.nothing(disabled). Loose interior iterates slightly degrade the secant/quality signals the step controller reads, and on trivial problems the two extra standalone solves (anchor + landing polish) can cost more wall time than the saved residual calls (see benchmarks), so the loosening stays opt-in.Benchmarks (Julia 1.12,
tracking_abstol = 1e-4vs disabled)u³-1-λ(Newton inner)u³-3u = -3+6λ(Newton inner)Honest notes on two rows:
solvepipeline entry (~10 μs), which dominates a trivial scalar problem. The constant is amortized on anything nontrivial (n=50: −37% wall time). This is part of why the default is off — the feature targets problems where residual/Jacobian evaluations are the cost.MaxIters; loose, the corrector branch-jumps across the fold and lands (verified at full tolerance by the exempt landing) on the correct λ=1 root. The Simple driver's tight baseline already branch-jumps the same way. Branch jumping at folds is inherent to natural continuation —ArcLengthContinuationremains the right tool there — but it's worth knowing the loose tolerance makes the jump more likely.Tests
test/Core/homotopy_tolerance_tests__item1.jl(registered in the Core group), covering for both drivers: (a) the final solution meets the full tolerance (residual < 1e-9 withtracking_abstol = 1e-3), (b) residual-call counts drop vs disabled (Ref-counter pattern per the effort tests, with generous margins over the measured reductions), (c) anchor exemption (zero-width span with a loose tolerance that provably stops far from the root standalone) and landing exemption (nsteps = 1, adaptive = falseso the only step is the landing), (d) userabstol/reltoloverride at both solve and problem level (bitwise-identical call counts to disabled), (e) constructor validation. Also verified locally: all 231 Core homotopy tests, all 64 SimpleNonlinearSolve homotopy tests, and the SimpleNonlinearSolve AllocCheck homotopy tests (plus new AllocCheck runs withtracking_abstolenabled) pass.Follow-up
ArcLengthContinuationintentionally untouched —lib/NonlinearSolveBase/src/arclength.jlis churning in the open #1025. It gets the same loose-then-tight treatment in a follow-up PR once that lands.🤖 Generated with Claude Code