Report the top error-estimate contributors on solver exit - #4057
Draft
ChrisRackauckas-Claude wants to merge 1 commit into
Draft
Report the top error-estimate contributors on solver exit#4057ChrisRackauckas-Claude wants to merge 1 commit into
ChrisRackauckas-Claude wants to merge 1 commit into
Conversation
5 tasks
Implements SciMLBase's `log_error_estimate` for `ODEIntegrator`, so a solve that gives up reports the scalar error estimate along with the state components that produced it. `EEst = internalnorm(atmp)` only says the step was rejected. `atmp` says which equation rejected it, which is the thing a user has to look at when one component of a large system quietly forces the step size down until the solve hits maxiters. The residuals survive on mutable caches after the step, so the breakdown needs no recomputation; out-of-place caches build them in a local, so those report the scalar estimate alone. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DKB6v14nZHZPYtKiLsPLDT
ChrisRackauckas-Claude
force-pushed
the
diagnostics/error-estimate-contributors
branch
from
July 29, 2026 14:50
caf1509 to
6c2817c
Compare
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.
Please ignore until reviewed by @ChrisRackauckas.
Motivation
From a Slack thread with @MasonProtter: a large ODE run repeatedly with updated parameters suddenly starts hitting
maxiters. Saving every step to see what happened OOMs a 256GB machine, and withsave_everystep=falsethe surviving output is ten time points and a stats block — no NaNs, no large values, nothing to go on.The solver knew which equation was forcing the step size down. It just never said so. Quoting the thread:
What this does
Implements
SciMLBase.log_error_estimate(added in SciML/SciMLBase.jl#1478) forODEIntegrator. On any failing exit, the log now carries the scalar estimate plus the top-3 contributing state components:That is a 10-equation system where only component 7 is stiff — the diagnostic names it, 15 orders of magnitude clear of everything else.
Details:
atmpis read straight off the cache. Mutable caches keep the residuals after the step, so there is no recomputation and no extrafevaluation; the numbers reported are exactly the ones the controller rejected on.cache.current, so the cache that actually ran is the one reported, not the one that would run next.""— there is no error estimate to report.Printfis added to OrdinaryDiffEqCore for%.4gformatting (also added by #3731; trivial conflict if that lands first).Tests
test/InterfaceIII/exit_diagnostics.jlcovers the unit behavior oftop_error_contributors(including the NaN ordering), and asserts throughsolvethat the named component appears for amaxitersexit, an instability exit under bothTsit5andFBDF, a NaN-producing RHS, and a composite algorithm; that a silent verbosity emits nothing; and that an out-of-place cache degrades to the scalar estimate.Run locally on Julia 1.11:
Checklist
Additional context
Depends on SciML/SciMLBase.jl#1478, which defines the
log_error_estimatehook and is what makes these diagnostics fire onmaxitersat all. CI here will not resolve until that is merged and released — theSciMLBase = "3.41"compat bound points at the unreleased version.Composes with #3731: that PR's
log_numerical_instabilityreports the Jacobian rows/columns involved, this one reports which components the step controller is choking on, and #1478 makes both run on every failing exit rather than only ondtmin/unstable.🤖 Generated with Claude Code
https://claude.ai/code/session_01DKB6v14nZHZPYtKiLsPLDT