Skip to content

Correct and validate FBDF time and stability filters - #4484

Merged
ChrisRackauckas merged 5 commits into
SciML:masterfrom
ChrisRackauckas-Claude:cr/fbdf-time-filter-finish
Sep 8, 2026
Merged

ChrisRackauckas merged 5 commits into
SciML:masterfrom
ChrisRackauckas-Claude:cr/fbdf-time-filter-finish

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

Please ignore this draft until reviewed by @ChrisRackauckas.

The original filter used variable-coefficient BDF weights with FBDF's fixed-coefficient solve, returned filtered states even when selecting an unfiltered error estimate, and disabled BDF3-Stab at max_order=3. This completes the implementation with a correction derived from the actual fixed-coefficient equation, consistent candidate selection and step control, and discriminating numerical tests. The option remains off by default.

Changes

  • Derive the order-raising weight from the solve's error on a monic polynomial of degree k+1; it reduces to the paper's weight on equal steps. Estimate the higher candidate's defect using the higher-order BDF residual on the available history.
  • Keep state, derivative, error estimate, and reported order consistent. Apply the controller's safety factor and step bounds using the selected candidate's order, including after rejection. Preserve the BDF3 solve after selecting BDF3-Stab, rather than oscillating between base orders 2 and 3; gate higher-order candidates independently by qwait and max_order.
  • Reset STALD history across filtered attempts, include the additional point in higher-order dense output, advance history during fixed stepping, and read the reset order after discontinuities.
  • Reject time_filter=true with a mass matrix other than the default I explicitly. The previous half-error fallback was not a justified estimator. Its filtered-DAE success test is replaced by explicit rejection tests and checks that ordinary FBDF still solves the DAE; no test is skipped or marked broken to accommodate this change.
  • Add Core coverage for irregular grids, backward steps, polynomial reproduction and local convergence, candidate selection, controller/order queries, dense output, callbacks, rejections, and fixed-step restarts. Extend the existing QA allocation loop to filtered solves, including max_order=3.

Verification

Julia 1.12.4. Commands below use the repository root unless otherwise indicated.

Failing before, running the same regression file against a clean worktree at the original PR head:

julia --project=../filter-unfixed/lib/OrdinaryDiffEqBDF -e 'include("lib/OrdinaryDiffEqBDF/test/fbdf_filter_regression_tests.jl")'
Test Summary:                 | Pass  Fail  Total
FBDF filter regressions       |   28    42     70
  Polynomial reproduction     |   28    36     64
  Ineligible higher candidate |          3      3
  BDF3-Stab at max_order=3    |          3      3

Passing after:

julia --project=lib/OrdinaryDiffEqBDF -e 'include("lib/OrdinaryDiffEqBDF/test/fbdf_filter_regression_tests.jl"); include("lib/OrdinaryDiffEqBDF/test/fbdf_time_filter_tests.jl")'

All 314 assertions passed across these testsets, including:

FBDF filter regressions                   | 70 70
FBDF candidate error and controller        | 81 81
FBDF filtered dense output and derivatives | 64 64
FBDF filtered local convergence           | 32 32

From lib/OrdinaryDiffEqBDF:

GROUP=Core julia --project -e 'using Pkg; Pkg.test()'
GROUP=QA julia --project -e 'using Pkg; Pkg.test()'

Core exited 0: 713 passed, 2 pre-existing broken, 715 total. Its final summaries included:

FBDF Time Filter Tests       |  41  41
FBDF Filter Regression Tests | 273 273
Nordsieck BDF Tests          | 101 101
LHL Factorization Tests      |  19  19
Testing OrdinaryDiffEqBDF tests passed
Test Summary:    | Pass  Broken  Total
Allocation Tests |    4      18     22
JET Tests        |   18      23     41
Aqua             |   21             21
Testing OrdinaryDiffEqBDF tests passed

The 41 broken QA cases were already present; none were added or disabled. The added filtered IIP runtime allocation cases observed zero allocated bytes.

julia --project=docs docs/make.jl exited 0; document checks and rendering completed with page/search-size warnings, and deployment was skipped locally. Runic.jl 1.7.0 formatting checks, typos on touched files, and git diff --check passed.

Numerical scope and performance

The fixed-coefficient weight is an extension of the cited construction, tested for local order on unequal grids. The paper's constant-step BDF3-Stab stability result is not a general G-stability proof for arbitrary unequal-step sequences. This mathematical extension and the explicit mass-matrix restriction deserve review.

No speedup is claimed. For scalar exponential decay, scanning tolerances 10.^(-(5:0.25:12)), the best observed RHS counts meeting each maximum saved-point absolute-error target were:

Error target Plain FBDF RHS calls Filtered FBDF RHS calls
1e-7 258 448
1e-9 608 1043

Not verified locally: GPU group, Float32/BigFloat and unitful states, or reverse-mode differentiation through filtered solves. Existing GPU CI coverage does not by itself establish support for the opt-in filter.

CI on the final revision

Final revision: bfd0b92

All 141 PR checks completed: 138 successful, 3 skipped, 0 failed. Main CI, sublibrary CI, documentation, downstream integration tests, and downgrade workflows succeeded. The BDF logs on Julia LTS and current Julia each report 41 time-filter tests and 273 filter regressions passing. BDF QA reports allocation tests 4 passed / 18 existing broken, JET 18 passed / 23 existing broken, and Aqua 21 passed. The final downstream logs explicitly report Testing SciMLSensitivity tests passed and Testing PositiveIntegrators tests passed.

A separate Dependabot Auto-merge workflow has a startup failure with no jobs or PR checks: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/34214152358. This predates the completion changes and also occurred on the original PR revision: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/34156404606. It is not a failing test and was not changed in this numerical PR.

Links

Original Cursor attribution remains in the earlier commit trailers.

🤖 Completed with Codex CLI 0.153.4 (model: gpt-6-astra; local session transcript: /home/crackauc/.codex/sessions/2026/09/08/rollout-2026-09-08T04-52-13-01a08037-c26f-7662-aece-ff6e2be97b48.jsonl).

ChrisRackauckas and others added 3 commits September 7, 2026 15:36
The time/stab filter merged in SciML#3878 called `backdiff`, `bdf_and_filt_coeff`
and `bdf3stab_coeff`, none of which existed, so `FBDF(time_filter = true)`
threw and JET's typo pass flagged the undefined globals. Add them in in-place
form, together with the small divided-difference and step-ratio kernels the
filter needs, and preallocate their time/coefficient buffers on both FBDF
caches so the filter does not allocate per step.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor
Agent-Model: claude-opus-5-thinking-high
Agent-Session: local OrdinaryDiffEq fbdf-time-filter-finish
Co-authored-by: Cursor <[email protected]>
The filter was only wired into the out-of-place `perform_step!`, so
`FBDF(time_filter = true)` silently fell back to plain FBDF for in-place
problems. Lift both paths into `_fbdf_time_filter`/`_fbdf_time_filter!` with
the same candidate selection, reusing the `u₀`/`terk_tmp`/`terkp1_tmp`
scratch that is already dead by the time the error estimates are in, so the
in-place path stays allocation free.

The in-place step derives `fsallast` from the converged Newton condition
rather than calling `f`, which is only valid at the nonlinear solution, so
the filter now evaluates `f` itself whenever it moves `u`, and reuses that
evaluation for its own residual-based error estimate. The order-4 candidate
is skipped at `k == max_order` so the filter cannot emit a solution above
the requested order, and the residual estimate falls back to halving the
lower-order one under a mass matrix, where the identity it relies on does
not hold. The out-of-place error estimates need no pre-filter copy since
nothing between the solve and the filter mutates `u`.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor
Agent-Model: claude-opus-5-thinking-high
Agent-Session: local OrdinaryDiffEq fbdf-time-filter-finish
Co-authored-by: Cursor <[email protected]>
`fbdf_filter_accuracy.jl` was a benchmarking script that nothing ran, so it
could not catch the missing helpers. Replace it with a test that exercises
both the in-place and out-of-place filter paths on smooth, stiff and mass
matrix problems, and pins the opt-in default by checking that
`time_filter = false` reproduces plain `FBDF()` exactly.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor
Agent-Model: claude-opus-5-thinking-high
Agent-Session: local OrdinaryDiffEq fbdf-time-filter-finish
Co-authored-by: Cursor <[email protected]>
@ChrisRackauckas-Claude
ChrisRackauckas-Claude marked this pull request as draft September 8, 2026 09:02
codex and others added 2 commits September 8, 2026 05:41
Derive the order-raising correction from the actual fixed-coefficient solve
on unequal steps. Keep each candidate's state, derivative, error estimate,
and reported order together, preserve BDF3-Stab at max_order=3, and use the
selected order in step-size control. Repair filtered fixed-step history,
restart bookkeeping, and dense output. Reject unsupported mass-matrix
filtering explicitly and document the numerical and performance limits.

The original PR fails 42 of the 70 primary regression assertions. The fixed
implementation passes all 314 targeted assertions, including irregular-grid
local convergence, candidate control, dense output, callbacks, and restarts.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.153.4
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/08/rollout-2026-09-08T04-52-13-01a08037-c26f-7662-aece-ff6e2be97b48.jsonl
Qualify the Core controller and interpolation functions through their public
owner. The aliases resolve to identical function objects; all 314 targeted
assertions still pass.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.153.4
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/08/rollout-2026-09-08T04-52-13-01a08037-c26f-7662-aece-ff6e2be97b48.jsonl
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Finish FBDF time/stab filter: helpers, IIP, tests, cleanup Correct and validate FBDF time and stability filters Sep 8, 2026
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Completion changes are pushed, and the draft description now contains the numerical scope, failing-before/passing-after evidence, and measured performance limitations.

Local validation: Core 713 passed / 2 pre-existing broken; QA 43 passed / 41 pre-existing broken; docs build, Runic, spelling, and diff checks passed. All 314 targeted assertions pass; the original PR fails 42 of the 70 primary regression assertions. The added filtered IIP runtime allocation checks observed zero allocations. No tests were skipped or marked broken for this work.

The filter now uses weights derived for the fixed-coefficient solve, returns the selected state with its matching error/derivative/order, retains BDF3-Stab at max_order=3, and handles dense output, fixed-step history, and restarts. Mass matrices other than the default I are rejected explicitly for filtering. The scalar decay benchmark does not demonstrate a speedup. CI is now pending.

Links

  • Numerical and controller fixes: 9fcbd3a
  • Public API ownership in tests: bfd0b92

🤖 Completed with Codex CLI 0.153.4 (model: gpt-6-astra; local session transcript: /home/crackauc/.codex/sessions/2026/09/08/rollout-2026-09-08T04-52-13-01a08037-c26f-7662-aece-ff6e2be97b48.jsonl).

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 8, 2026 22:58
@ChrisRackauckas
ChrisRackauckas merged commit 9ee08fe into SciML:master Sep 8, 2026
141 checks passed
ChrisRackauckas added a commit that referenced this pull request Sep 11, 2026
bdf_step_reject_controller! selects the next step size with
min(h, hₖ₋₁) / hₖ₋₁ > hₖ on the signed step sizes h = dt/2, F·h.
For tdir < 0 (backward integration, e.g. adjoint solves) dt is
negative, so min picks the candidate with the *larger* magnitude.
On repeated failures the retry dt can stay at a fixed point with
EEst > 1 forever, looping until maxiters. This showed up as
SciMLSensitivity DAE-adjoint tests failing on Julia 1.13 after the
FBDF reinit ordering fix (#4484) moved restarts onto this path.

Do the step-size selection on magnitudes and restore the sign via
integrator.tdir when writing back integrator.dt. Behavior is
unchanged for forward-in-time integration (tdir = 1).



Agent-Harness: Devin CLI 3000.10.21
Agent-Model: SWE-2 High
Agent-Session: local Devin CLI session (no shareable URL); session db at /home/crackauc/.local/share/devin/cli/sessions.db

Co-authored-by: ChrisRackauckas-Claude <[email protected]>
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
ChrisRackauckas added a commit that referenced this pull request Sep 11, 2026
- Precompile SDE solves through specialization levels (#4467)
- Add 32-bit InterfaceI CI lane via test_groups.toml (#4480)
- incorporate time/stab filter for larger steps in FBDF (#3878)
- Keep 32-bit CI lane hard-failing. (#4482)
- Correct and validate FBDF time and stability filters (#4484)
- Keep DAE init from overwriting uprev during callback truncation (#4486)
- DiffEqBase: Int64 interp_points range length for 32-bit (#4487)
- Release OrdinaryDiffEqBDF 2.4.7 (#4490)
- Unify companion global error estimators into GlobalErrorEstimation (#4492)
- Add adjoint-based global error control as a SciMLSensitivity extension (#3953)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

3 participants