Repository navigation
Fix flaky OU-Bridge tests: compare against exact moments - #335
Merged
ChrisRackauckas merged 1 commit intoSep 13, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
The scalar, vector, and inplace OU-Bridge testsets compared three
independent Monte Carlo estimates to each other at atol = 1e-3. The
Random.seed!(1234) calls between the samplers were dead code: solve
reseeds each NoiseProcess from system entropy (reseed = true), so every
realization is an independent draw. A difference of two 500k-sample
estimates carries ~4.3 standard errors of headroom at atol = 1e-3, so
the test flaked on a few percent of CI runs on every Julia version --
the Inplace OU-Bridge failure on 1.13 was this tail event, not a
regression.
Each sampler is now compared directly against the exact OU marginal
moments, mean mu(1 - e^{-Theta t}) and var sigma^2(1 - e^{-2Theta t})/(2Theta),
which gives ~6 standard errors at the same tolerance and is a strictly
stronger test: a bias shared by all three samplers can no longer hide in
a pairwise comparison. Verified on Julia 1.12 and 1.13 (all testsets
pass; the bridge estimator tracks the unconditional moments because its
endpoints are drawn from forward samples of the same process).
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Devin <noreply@cognition.ai>
Agent-Harness: Devin CLI
Agent-Model: SWE-2 Max
Agent-Session: /home/crackauc/.local/share/devin/cli/summaries/history_d0e0e74010b34bc5.md
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.
Summary
The scalar, vector, and inplace
OU-Bridgetestsets intest/bridge_test.jlcompared three independent Monte Carlo estimates to each other atatol = 1e-3over a 500k-sample loop. TheRandom.seed!(1234)calls between the samplers were dead code:solvereseeds eachNoiseProcessfrom system entropy (reseed = trueis the default), so every realization is an independent draw.A difference of two 500k-sample estimates carries ~4.3 standard errors of headroom at
atol = 1e-3, so the test flaked on a few percent of CI runs on every Julia version. TheInplace OU-Bridgefailure on Julia 1.13 CI was this tail event, not a 1.13 regression — the same failure mode has appeared on other versions.The fix
Each sampler is now compared directly against the exact OU marginal moments — mean
μ(1 − e^{−Θt}), varianceσ²(1 − e^{−2Θt})/(2Θ)— at the sameatol = 1e-3. That gives ~6 standard errors of headroom and is a strictly stronger test: a bias shared by all three samplers can no longer hide in a pairwise comparison.This also matches the file's existing convention — the
Brownian Bridgetestset already comparestimestep_meanto analytical moments.The bridge estimator is compared against the unconditional OU moments, which is correct: an OU bridge pinned to an endpoint drawn from the forward process's own distribution reproduces the forward law when marginalizing over the endpoint.
Discriminating-test evidence
This is a flakiness fix, so "fails before / passes after" doesn't apply per-run — instead, evidence that the old formulation was noise-limited and the new one is not:
atol = 1e-3. Reproduced failure:Inplace OU-Bridgein https://github.com/SciML/DiffEqNoiseProcess.jl CI (master, Julia 1.13).Verification
test/bridge_test.jlon Julia 1.13.0: all testsets pass — Brownian Bridge 80/80, Scalar/Vector/Inplace OU-Bridge 6/6 each.GROUP=QAequivalent (test/qa/qa.jl) on 1.13: 21/21 pass.typos: clean.Docs build skipped — test-only change, no docstrings or public API touched.
🤖 Generated with Devin (model: SWE-2 Max)
Session: /home/crackauc/.local/share/devin/cli/summaries/history_d0e0e74010b34bc5.md