Skip to content

WIP: Update SSA jumps after VariableRateJumps occur, given VariableRateJump maps - #713

Open
isaacsas wants to merge 13 commits into
SciML:masterfrom
isaacsas:vrj-ssa-hooks
Open

isaacsas wants to merge 13 commits into
SciML:masterfrom
isaacsas:vrj-ssa-hooks

Conversation

@isaacsas

@isaacsas isaacsas commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Part of the series that lets SSA jumps be updated after a VariableRateJump fires, so that Catalyst can stop making their dependents VariableRateJumps. This PR adds the VariableRateJump maps to JumpDependencies, a per-aggregator update for changes made outside the aggregator, and hooks in VR_FRM, VR_Direct and VR_DirectFW that use it. The next PR adds a public update_aggregated_jumps!(integrator; ...) for callbacks and events, built on the same update.

VariableRateJump maps

JumpDependencies gains two maps, numbering the VariableRateJumps in the order given to the JumpProblem:

  • vrjtovars_map: entry k lists the variables the kth VariableRateJump changes;
  • vrj_dep_graph: entry k lists the jumps whose rates must be recalculated when the kth VariableRateJump occurs.

With Coevolve, the entries of bounded VariableRateJumps are ignored, since Coevolve handles them as SSA jumps. The maps are checked against the problem like the others: one entry per VariableRateJump, indices in range.

Without either map nothing changes: the rule that an SSA jump's rate must not depend on what a general VariableRateJump changes still holds, and the VR callbacks do exactly what they did before. With one, after each VariableRateJump occurs the aggregator updates the rates that depend on the change. What each aggregator needs:

  • Direct, DirectFW, FRM, FRMFW: nothing more. They recompute every rate when they choose the next jump. When the maps show that a VariableRateJump changes no rate, it is skipped; for that they store one Bool per VariableRateJump, not the lists.
  • SortingDirect, RDirect, NRM, CCNRM, DirectCR, Coevolve: vrj_dep_graph, or vrjtovars_map and vartojumps_map, from which the jump lists are derived (vartojumps_map is generated when every jump is a MassActionJump).
  • RSSA, RSSACR: vrjtovars_map, since they update the brackets of the changed variables. Each entry keeps only the variables that some jump's rate reads.

A missing map is an error naming the fields to give. JumpProblem prepares the list each VariableRateJump hands the aggregator once, in normal form (sorted, unique, Int).

The update

update_after_external_change!(p, integrator, deps) (internal, one generic method plus per-aggregator update_external_rates!) does three things:

  1. Recompute the listed rates as after a jump, with no executed jump. NRM and CCNRM pass 0 as the executed jump; RSSA and RSSACR update the brackets of the listed variables; Direct, DirectFW, FRM and FRMFW do nothing here.
  2. Choose the next jump again (generate_jumps!). This is exact because the jumps are memoryless, and it is needed even when no rate bound changed, since the next jump was chosen with the old state.
  3. Register the next jump time only if it is later than t and changed. A next jump at t fires in the same callback pass, since discrete callbacks run after continuous ones, while a tstop at t makes SDE solvers stop. A test covers this tie for ODEs and SDEs. An unchanged time keeps the tstop registered when it was chosen; NRM, CCNRM and Coevolve often keep the same next jump.

Nothing is done after an affect stopped the solve (terminate!), since a new tstop would restart it.

CCNRM

CCNRM keeps its jump times in bins and searches from the bin where its last search stopped. After a jump at t, every new time is at least t, so that's enough. An outside update happens before the next jump, possibly in an earlier bin, so the update moves the search back to the bin of t. If the table was rebuilt to start at the next jump's time, after t, the update first rebuilds the window to start at t (the times stay) and then moves the search back as well, since the rebuild positions it at the old times. A rebuilt window that holds no time no longer throws.

Coevolve

update_dependent_rates! and next_time now take the executed jump, defaulting to p.next_jump as before, and the outside update passes 0. Before, the jump at the top of the queue was treated as the one that executed and drew a fresh time, while the others rescaled theirs. After an outside change no jump executed. Redrawing only the top jump's time conditions it on being the smallest, which biased its times: in the bounded-VariableRateJump test the mean was about 10 standard errors off. With the executed jump passed in, every listed jump with a constant rate rescales its time.

Finding the aggregator

The VR callbacks don't store the SSA aggregator. Each time a VariableRateJump occurs, they find it among the integrator's discrete callbacks, so deepcopy, remake and the planned isolated_copy need nothing new. Over a Tuple of callbacks, a generated function picks the aggregator's position from the callbacks' types. The search therefore compiles to one field access however many callbacks there are, whether the aggregator's callback comes first (JumpProcesses' ODE solve) or after the user's (StochasticDiffEq, which still passes a Tuple). Over an erased Vector it is a loop. A test with 40 user DiscreteCallbacks checks, in both orders, that the search infers, allocates nothing and is fast: the best of 5 runs of 10⁴ searches must take under 1 ms. The generated lookup takes at most 0.05 ms, coverage runs included; the Base.tail recursion took 89–113 ms on Julia 1.10 and 1.13.

Missing-map errors (from the #709 review)

The per-aggregator missing_dep_graph_message methods are replaced by one missing_map_message(aggregator, map, purpose, fields), which uses nameof(typeof(aggregator)). Every missing-map error uses it, the new VariableRateJump ones included, for example:

The NRM algorithm needs a dependency graph for ConstantRateJumps: give dep_graph in the JumpDependencies.

Coevolve's message says "for ConstantRateJumps or bounded VariableRateJumps" when the problem has bounded VariableRateJumps. The errors stay ErrorExceptions, as test/variable_rate.jl checks; the new VariableRateJump ones are ErrorExceptions too. The exact-message checks in test/jump_dependencies.jl are updated.

Docs and tests

  • Docs: the JumpDependencies docstring (the maps, a VariableRateJumps section with each aggregator's needs), the rule in the jump diffusion tutorial, the discrete stochastic example and the algorithms overview, and a new FAQ entry with an example. HISTORY entries.
  • test/vrj_ssa_updates.jl (new) uses a birth–death model whose births are a VariableRateJump at rate K(1 + sin Ωt) and whose deaths are a MassActionJump at rate ΓA. A(T) is Poisson with a known mean, so the tests are exact:
    • every SSA aggregator × VR_FRM, VR_Direct, VR_DirectFW (ODE, FullSpecialize), and Direct, NRM, RSSA, Coevolve × VR_FRM, VR_Direct (SDE), each against the exact mean and Poisson dispersion;
    • without the maps, the stale rates as before;
    • empty entries leave the seeded results unchanged;
    • an SSA jump due at the VariableRateJump's time fires at once (ODE and SDE);
    • a rate switched from zero to positive and back by two VariableRateJumps;
    • bounded VariableRateJumps with Coevolve;
    • missing and wrong maps;
    • the search among 40 callbacks, and an exact solve with them;
    • remake and ensembles;
    • isolated_copy, which shares the read-only lists (VR_DirectEventCache's updates is among its shared fields);
    • CCNRM finding a jump that an update moves before its search position, or before its window, also with narrow bins (binwidthconst = 2, numbinsconst = 5);
    • no update after an affect stops the solve (ODE, also with a custom return code, and SDE with EM()), for all three VR aggregators;
    • an unchanged next jump time adding no tstop (NRM);
    • what the VR callbacks store (Bools for the Direct family, lists for the others).
  • A separate commit changes Fix VR_Direct and VR_DirectFW simulating Coevolve's bounded jumps twice #712's new test in test/variable_rate.jl to pass its dep_graph in a JumpDependencies. It used the JumpProblem keyword that Add JumpDependencies for passing dependency maps #709 deprecated, which printed deprecation warnings in the test suite.

Performance

Alternating benchmark of master ba89d1f7 and this branch, best of 3 rounds with rotated order (Julia 1.13.3, Apple silicon). ODE problems are built with FullSpecialize and solved with Tsit5.

Hybrid problems. VR_FRM, VR_Direct and VR_DirectFW, each with Direct, NRM, RSSA and Coevolve, on two models over T = 20:

  • a birth–death process: births are a VariableRateJump at rate 20(1 + sin 2t), deaths a MassActionJump;
  • a 10-species chain fed by the same births: conversions and a final death are MassActionJumps.
rows within ±3% geometric mean of branch/master time
without VariableRateJump maps: the same behavior on both, so what the hooks cost when off 24 20 0.989 (0.92–1.02)
exact, birth–death: maps (branch) vs the death as a VariableRateJump (master) 12 4 0.991 (0.90–1.23)
exact, chain: maps (branch) vs every jump a VariableRateJump (master) 12 0 0.31 (0.16–0.52)

The exact rows compare against today's workaround. On master, an exact simulation must make every jump whose rate reads, directly or through other such jumps, a component that a VariableRateJump changes into a VariableRateJump itself. In the chain that is every jump. With the maps they stay MassActionJumps:

  • In the chain the branch is 5.6–6.4× faster with VR_FRM, about 2× with VR_Direct and about 2.8× with VR_DirectFW.
  • In the birth–death model, with a single affected jump, the two are about even. The exceptions are NRM and Coevolve with VR_FRM, 11% and 23% slower: updating a heap-based aggregator costs more there than integrating one more rate.

SSA networks. The 13 networks of #709's benchmark, with Coevolve (whose update functions changed) and with Direct and NRM as controls: 32 of 37 within ±3%, geometric mean 1.007. The five outside it are sir/Coevolve, sir_crj/NRM, hub_1000/Direct, and ode_sir with NRM and Coevolve:

  • sir/Coevolve was 1.06 in all three rounds, but 1.006 in a recheck with five alternating processes per version.
  • sir_crj/NRM is the process-state effect described in Add JumpDependencies for passing dependency maps #709.
  • hub_1000/Direct was slow in one round only.
  • ode_sir with NRM and Coevolve came out faster.

The search. It takes 2 ns and allocates nothing among 41 discrete callbacks. That holds with the aggregator's callback first (ODE) and last (a real SDE integrator, StochasticDiffEq's order). The first version recursed through Base.tail. Once there were more than 32 callbacks that recursion was no longer resolved at compile time, and with 40 user callbacks the search took 8 µs, though it still inferred and allocated nothing. The generated lookup fixed that, and the test now times the search, using only public functions.

SDEs. In the birth–death jump-diffusion (SRIW1), maps with VR_Direct took 2.6× as long as making the death a VariableRateJump: about 7,650 accepted steps against 790. That is what SSA jumps cost in SDE solves in general. Each one is a tstop, and the step size grows back slowly after it. A pure-SSA version of the same process, with no VariableRateJumps, takes about 6,840 steps for its roughly 800 jumps. An update that changes the next jump time also leaves the aggregator's earlier tstop in place, since a tstop can't be removed, so the integrator stops there once without a jump. That accounts for roughly a tenth of the steps here, and costs little in ODE solves. An update that leaves the time unchanged adds no tstop. With VR_FRM the two approaches are about even in SDEs (10.7 ms against 11.2 ms).

🤖 Generated with Claude Code 2.1.319 (model: claude-opus-5-5)

isaacsas and others added 6 commits November 7, 2026 20:47
When Coevolve handles the bounded VariableRateJumps, JumpProblem passes the remaining ones
(cvrjs) to the VR aggregator. VR_FRM builds its callbacks from them, but VR_Direct and
VR_DirectFW built their cache from all of jumps.variable_jumps, so they also simulated the
bounded jumps that Coevolve handles, which then fired twice as often (a rate-1 jump fired
about 40 times by t = 20 instead of 20). The cache is now built from cvrjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`JumpDependencies` gains `vrjtovars_map` and `vrj_dep_graph`, indexed over the
problem's `VariableRateJump`s. When either is given, `JumpProblem` prepares the
list each general `VariableRateJump` hands the SSA aggregator: the jumps whose
rates to recompute (from `vrj_dep_graph`, or derived from `vrjtovars_map` and
`vartojumps_map`), or for RSSA and RSSACR the changed variables. After the
jump's affect, the VR_FRM, VR_Direct and VR_DirectFW callbacks find the SSA
aggregator among the integrator's discrete callbacks (an unrolled search over a
tuple) and call `update_after_external_change!`, which recomputes the listed
rates, redraws the next jump, and registers its time if it is later than `t`.
Without these maps nothing changes.

Coevolve's `update_dependent_rates!` and `next_time` take the executed jump
(0 for an outside change), so jumps with constant rates rescale their times
after an outside change instead of the next jump redrawing its time, which
biased it.

The per-aggregator `missing_dep_graph_message` methods become one
`missing_map_message` used for every missing map, the new ones included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The recursion through `Base.tail` stopped being resolved at compile time
beyond 32 discrete callbacks: with the aggregator after 40 user callbacks
(StochasticDiffEq's order) the search took 8 µs instead of 2 ns. The
generated function picks the position from the callbacks' types, so its
body is the field access. The test now checks the typed code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia v1)

Time benchmarks
master 2964500 master / 2964500
aggregators/CCNRM 0.164 ± 0.0097 ms 0.163 ± 0.011 ms 1.01 ± 0.089
aggregators/Coevolve 0.185 ± 0.011 ms 0.188 ± 0.012 ms 0.986 ± 0.084
aggregators/DirectCR 0.187 ± 0.016 ms 0.18 ± 0.013 ms 1.04 ± 0.11
aggregators/DirectFW 0.12 ± 0.0093 ms 0.126 ± 0.0093 ms 0.952 ± 0.1
aggregators/FRM 0.122 ± 0.0074 ms 0.127 ± 0.0079 ms 0.965 ± 0.083
aggregators/FRMFW 0.128 ± 0.0075 ms 0.131 ± 0.0082 ms 0.976 ± 0.083
aggregators/NRM 0.16 ± 0.01 ms 0.167 ± 0.013 ms 0.961 ± 0.095
aggregators/RDirect 0.152 ± 0.0085 ms 0.154 ± 0.011 ms 0.988 ± 0.09
aggregators/RSSA 0.142 ± 0.0081 ms 0.143 ± 0.0092 ms 0.997 ± 0.086
aggregators/RSSACR 0.169 ± 0.01 ms 0.176 ± 0.012 ms 0.961 ± 0.086
aggregators/SortingDirect 0.131 ± 0.0077 ms 0.137 ± 0.0075 ms 0.954 ± 0.077
construct/jumpproblem_constantrate 0.118 ± 0.023 μs 0.181 ± 0.082 μs 0.652 ± 0.32
construct/jumpproblem_massaction 0.457 ± 0.024 μs 0.456 ± 0.026 μs 1 ± 0.078
construct/vr_direct 5.98 ± 0.43 μs 5.95 ± 0.39 μs 1 ± 0.097
construct/vr_frm 8.02 ± 3.7 μs 7.91 ± 3.4 μs 1.01 ± 0.64
events/ode_division/Direct 0.493 ± 0.0061 ms 0.498 ± 0.0062 ms 0.99 ± 0.017
events/sde_dosing/Direct 0.296 ± 0.005 ms 0.289 ± 0.0055 ms 1.02 ± 0.026
events/ssa_dosing/Direct 0.0871 ± 0.002 ms 0.0943 ± 0.0019 ms 0.924 ± 0.028
events/vrj_reset/VR_Direct 1.48 ± 0.01 ms 1.49 ± 0.0092 ms 0.994 ± 0.0092
events/vrj_reset/VR_FRM 2.56 ± 0.0093 ms 2.54 ± 0.0091 ms 1.01 ± 0.0052
ode/mixed/VR_Direct 1.57 ± 0.013 ms 1.55 ± 0.013 ms 1.01 ± 0.012
ode/mixed/VR_FRM 2.65 ± 0.011 ms 2.65 ± 0.012 ms 1 ± 0.0062
ode/sir_zero_drift/Direct 0.377 ± 0.0067 ms 0.376 ± 0.0069 ms 1 ± 0.026
ode/sir_zero_drift/NRM 0.432 ± 0.0067 ms 0.432 ± 0.0063 ms 0.999 ± 0.021
ode/telegraph/Coevolve 0.173 ± 0.0022 ms 0.172 ± 0.0022 ms 1.01 ± 0.018
ode/telegraph/Direct 0.149 ± 0.0025 ms 0.146 ± 0.0024 ms 1.02 ± 0.024
ode/telegraph/NRM 0.161 ± 0.0021 ms 0.161 ± 0.0024 ms 0.997 ± 0.02
pure_jump/bounded_vrj/Coevolve 0.391 ± 0.01 ms 0.391 ± 0.0081 ms 0.998 ± 0.033
pure_jump/chain/CCNRM 0.631 ± 0.016 ms 0.6 ± 0.013 ms 1.05 ± 0.034
pure_jump/chain/Direct 3.6 ± 0.048 ms 3.6 ± 0.044 ms 0.999 ± 0.018
pure_jump/chain/DirectCR 0.49 ± 0.0099 ms 0.487 ± 0.01 ms 1.01 ± 0.029
pure_jump/chain/NRM 0.713 ± 0.018 ms 0.719 ± 0.016 ms 0.991 ± 0.033
pure_jump/chain/RSSA 2.06 ± 0.011 ms 2.06 ± 0.011 ms 1 ± 0.0073
pure_jump/chain/RSSACR 0.466 ± 0.012 ms 0.468 ± 0.012 ms 0.996 ± 0.036
pure_jump/chain/SortingDirect 1.22 ± 0.013 ms 1.22 ± 0.011 ms 1 ± 0.015
sde/mixed/VR_Direct 1.12 ± 0.0084 ms 1.09 ± 0.006 ms 1.02 ± 0.0095
sde/mixed/VR_FRM 5.61 ± 0.027 ms 5.56 ± 0.022 ms 1.01 ± 0.0064
sde/telegraph/Direct 0.298 ± 0.0052 ms 0.294 ± 0.0051 ms 1.01 ± 0.025
solve/constantrate 0.113 ± 0.009 ms 0.114 ± 0.0087 ms 0.998 ± 0.11
solve/massaction 0.116 ± 0.011 ms 0.122 ± 0.0098 ms 0.95 ± 0.12
vrj/m1_1/VR_Direct 0.35 ± 0.0059 ms 0.35 ± 0.0056 ms 1 ± 0.023
vrj/m1_1/VR_DirectFW 0.376 ± 0.0059 ms 0.384 ± 0.0063 ms 0.98 ± 0.022
vrj/m1_1/VR_FRM 0.521 ± 0.0065 ms 0.53 ± 0.0079 ms 0.983 ± 0.019
vrj/m1_16/Coevolve 0.18 ± 0.0035 ms 0.183 ± 0.0041 ms 0.98 ± 0.029
vrj/m1_16/VR_Direct 0.73 ± 0.0053 ms 0.737 ± 0.0048 ms 0.99 ± 0.0097
vrj/m1_16/VR_DirectFW 0.788 ± 0.0056 ms 0.787 ± 0.0046 ms 1 ± 0.0092
vrj/m1_16/VR_FRM 2.61 ± 0.026 ms 2.61 ± 0.022 ms 0.999 ± 0.013
time_to_load 1.08 ± 0.014 s 1 ± 0.0062 s 1.08 ± 0.016
Memory benchmarks
master 2964500 master / 2964500
aggregators/CCNRM 3.65 k allocs: 0.231 MB 3.65 k allocs: 0.231 MB 1
aggregators/Coevolve 3.65 k allocs: 0.232 MB 3.65 k allocs: 0.232 MB 1
aggregators/DirectCR 3.66 k allocs: 0.232 MB 3.66 k allocs: 0.232 MB 1
aggregators/DirectFW 3.71 k allocs: 0.234 MB 3.71 k allocs: 0.234 MB 1
aggregators/FRM 3.68 k allocs: 0.233 MB 3.68 k allocs: 0.233 MB 1
aggregators/FRMFW 3.68 k allocs: 0.233 MB 3.68 k allocs: 0.233 MB 1
aggregators/NRM 3.65 k allocs: 0.232 MB 3.65 k allocs: 0.232 MB 1
aggregators/RDirect 3.69 k allocs: 0.233 MB 3.69 k allocs: 0.233 MB 1
aggregators/RSSA 3.63 k allocs: 0.231 MB 3.63 k allocs: 0.231 MB 1
aggregators/RSSACR 3.71 k allocs: 0.234 MB 3.71 k allocs: 0.234 MB 1
aggregators/SortingDirect 3.69 k allocs: 0.233 MB 3.69 k allocs: 0.233 MB 1
construct/jumpproblem_constantrate 15 allocs: 0.625 kB 15 allocs: 0.625 kB 1
construct/jumpproblem_massaction 14 allocs: 0.688 kB 14 allocs: 0.688 kB 1
construct/vr_direct 0.106 k allocs: 5.08 kB 0.106 k allocs: 5.08 kB 1
construct/vr_frm 0.086 k allocs: 13 kB 0.086 k allocs: 13 kB 1
events/ode_division/Direct 0.082 k allocs: 4.34 kB 0.082 k allocs: 4.34 kB 1
events/sde_dosing/Direct 0.184 k allocs: 9.94 kB 0.184 k allocs: 9.94 kB 1
events/ssa_dosing/Direct 15 allocs: 1 kB 15 allocs: 1 kB 1
events/vrj_reset/VR_Direct 0.099 k allocs: 5.64 kB 0.099 k allocs: 5.64 kB 1
events/vrj_reset/VR_FRM 0.142 k allocs: 7.58 kB 0.142 k allocs: 7.58 kB 1
ode/mixed/VR_Direct 0.082 k allocs: 4.36 kB 0.082 k allocs: 4.36 kB 1
ode/mixed/VR_FRM 0.123 k allocs: 6.09 kB 0.123 k allocs: 6.09 kB 1
ode/sir_zero_drift/Direct 0.068 k allocs: 3.62 kB 0.068 k allocs: 3.62 kB 1
ode/sir_zero_drift/NRM 0.075 k allocs: 3.91 kB 0.075 k allocs: 3.91 kB 1
ode/telegraph/Coevolve 0.079 k allocs: 4.05 kB 0.079 k allocs: 4.05 kB 1
ode/telegraph/Direct 0.07 k allocs: 3.69 kB 0.07 k allocs: 3.69 kB 1
ode/telegraph/NRM 0.077 k allocs: 3.97 kB 0.077 k allocs: 3.97 kB 1
pure_jump/bounded_vrj/Coevolve 25 allocs: 2.2 kB 25 allocs: 2.2 kB 1
pure_jump/chain/CCNRM 19 allocs: 8.8 kB 19 allocs: 8.8 kB 1
pure_jump/chain/Direct 16 allocs: 5.61 kB 16 allocs: 5.61 kB 1
pure_jump/chain/DirectCR 16 allocs: 5.61 kB 16 allocs: 5.61 kB 1
pure_jump/chain/NRM 26 allocs: 18.4 kB 26 allocs: 18.4 kB 1
pure_jump/chain/RSSA 16 allocs: 5.61 kB 16 allocs: 5.61 kB 1
pure_jump/chain/RSSACR 16 allocs: 5.61 kB 16 allocs: 5.61 kB 1
pure_jump/chain/SortingDirect 16 allocs: 5.61 kB 16 allocs: 5.61 kB 1
sde/mixed/VR_Direct 0.204 k allocs: 11.6 kB 0.204 k allocs: 11.6 kB 1
sde/mixed/VR_FRM 0.328 k allocs: 17.9 kB 0.328 k allocs: 17.9 kB 1
sde/telegraph/Direct 0.183 k allocs: 9.81 kB 0.183 k allocs: 9.81 kB 1
solve/constantrate 3.71 k allocs: 0.234 MB 3.71 k allocs: 0.234 MB 1
solve/massaction 3.71 k allocs: 0.234 MB 3.71 k allocs: 0.234 MB 1
vrj/m1_1/VR_Direct 0.082 k allocs: 4.33 kB 0.082 k allocs: 4.33 kB 1
vrj/m1_1/VR_DirectFW 0.082 k allocs: 4.33 kB 0.082 k allocs: 4.33 kB 1
vrj/m1_1/VR_FRM 0.123 k allocs: 6.19 kB 0.123 k allocs: 6.19 kB 1
vrj/m1_16/Coevolve 0.079 k allocs: 6.67 kB 0.079 k allocs: 6.67 kB 1
vrj/m1_16/VR_Direct 0.082 k allocs: 6.52 kB 0.082 k allocs: 6.52 kB 1
vrj/m1_16/VR_DirectFW 0.082 k allocs: 6.52 kB 0.082 k allocs: 6.52 kB 1
vrj/m1_16/VR_FRM 0.159 k allocs: 20.3 kB 0.159 k allocs: 20.3 kB 1
time_to_load 0.2 k allocs: 11.7 kB 0.2 k allocs: 11.7 kB 1

Benchmark Results (Julia lts)

Time benchmarks
master 2964500 master / 2964500
aggregators/CCNRM 0.171 ± 0.0066 ms 0.167 ± 0.0067 ms 1.02 ± 0.057
aggregators/Coevolve 0.194 ± 0.0081 ms 0.196 ± 0.0074 ms 0.988 ± 0.056
aggregators/DirectCR 0.175 ± 0.0076 ms 0.178 ± 0.0075 ms 0.983 ± 0.06
aggregators/DirectFW 0.128 ± 0.0029 ms 0.131 ± 0.004 ms 0.974 ± 0.037
aggregators/FRM 0.146 ± 0.0042 ms 0.146 ± 0.004 ms 1 ± 0.04
aggregators/FRMFW 0.154 ± 0.0059 ms 0.156 ± 0.0046 ms 0.987 ± 0.048
aggregators/NRM 0.168 ± 0.0075 ms 0.168 ± 0.0066 ms 1 ± 0.059
aggregators/RDirect 0.142 ± 0.0074 ms 0.144 ± 0.0062 ms 0.989 ± 0.067
aggregators/RSSA 0.142 ± 0.0074 ms 0.133 ± 0.0053 ms 1.07 ± 0.07
aggregators/RSSACR 0.153 ± 0.0082 ms 0.16 ± 0.0074 ms 0.957 ± 0.068
aggregators/SortingDirect 0.133 ± 0.0057 ms 0.135 ± 0.0044 ms 0.985 ± 0.053
construct/jumpproblem_constantrate 0.23 ± 0.03 μs 0.23 ± 0.03 μs 1 ± 0.18
construct/jumpproblem_massaction 0.53 ± 0.1 μs 0.51 ± 0.04 μs 1.04 ± 0.21
construct/vr_direct 5.74 ± 0.47 μs 5.6 ± 0.39 μs 1.03 ± 0.11
construct/vr_frm 10.3 ± 1.4 μs 9.89 ± 0.61 μs 1.04 ± 0.15
events/ode_division/Direct 0.406 ± 0.0078 ms 0.401 ± 0.008 ms 1.01 ± 0.028
events/sde_dosing/Direct 0.264 ± 0.0071 ms 0.265 ± 0.007 ms 0.999 ± 0.038
events/ssa_dosing/Direct 0.0859 ± 0.0018 ms 0.0854 ± 0.001 ms 1.01 ± 0.024
events/vrj_reset/VR_Direct 1.37 ± 0.01 ms 1.35 ± 0.011 ms 1.01 ± 0.011
events/vrj_reset/VR_FRM 2.51 ± 0.021 ms 2.62 ± 0.02 ms 0.958 ± 0.011
ode/mixed/VR_Direct 1.35 ± 0.013 ms 1.34 ± 0.013 ms 1.01 ± 0.013
ode/mixed/VR_FRM 2.84 ± 0.017 ms 2.82 ± 0.017 ms 1.01 ± 0.0088
ode/sir_zero_drift/Direct 0.424 ± 0.013 ms 0.424 ± 0.014 ms 1 ± 0.047
ode/sir_zero_drift/NRM 0.457 ± 0.013 ms 0.493 ± 0.03 ms 0.926 ± 0.062
ode/telegraph/Coevolve 0.156 ± 0.0029 ms 0.154 ± 0.003 ms 1.01 ± 0.027
ode/telegraph/Direct 0.138 ± 0.0022 ms 0.139 ± 0.003 ms 0.993 ± 0.027
ode/telegraph/NRM 0.142 ± 0.0025 ms 0.144 ± 0.0025 ms 0.988 ± 0.024
pure_jump/bounded_vrj/Coevolve 0.22 ± 0.0063 ms 0.221 ± 0.0061 ms 0.997 ± 0.04
pure_jump/chain/CCNRM 0.623 ± 0.011 ms 0.641 ± 0.012 ms 0.972 ± 0.025
pure_jump/chain/Direct 4.4 ± 0.042 ms 4.33 ± 0.018 ms 1.02 ± 0.011
pure_jump/chain/DirectCR 0.431 ± 0.0093 ms 0.436 ± 0.009 ms 0.987 ± 0.029
pure_jump/chain/NRM 0.644 ± 0.017 ms 0.635 ± 0.019 ms 1.01 ± 0.04
pure_jump/chain/RSSA 1.93 ± 0.0078 ms 1.93 ± 0.009 ms 0.997 ± 0.0062
pure_jump/chain/RSSACR 0.294 ± 0.0079 ms 0.294 ± 0.0082 ms 1 ± 0.039
pure_jump/chain/SortingDirect 1.17 ± 0.011 ms 1.18 ± 0.011 ms 0.994 ± 0.013
sde/mixed/VR_Direct 0.869 ± 0.011 ms 0.876 ± 0.012 ms 0.991 ± 0.018
sde/mixed/VR_FRM 5.95 ± 0.032 ms 5.88 ± 0.035 ms 1.01 ± 0.0081
sde/telegraph/Direct 0.262 ± 0.0074 ms 0.264 ± 0.0075 ms 0.992 ± 0.04
solve/constantrate 0.118 ± 0.0047 ms 0.122 ± 0.0042 ms 0.974 ± 0.052
solve/massaction 0.129 ± 0.0045 ms 0.131 ± 0.0056 ms 0.981 ± 0.054
vrj/m1_1/VR_Direct 0.331 ± 0.0087 ms 0.323 ± 0.0084 ms 1.02 ± 0.038
vrj/m1_1/VR_DirectFW 0.349 ± 0.0086 ms 0.344 ± 0.0082 ms 1.02 ± 0.035
vrj/m1_1/VR_FRM 0.497 ± 0.0083 ms 0.498 ± 0.0082 ms 0.997 ± 0.023
vrj/m1_16/Coevolve 0.158 ± 0.0059 ms 0.162 ± 0.0055 ms 0.975 ± 0.05
vrj/m1_16/VR_Direct 0.635 ± 0.008 ms 0.637 ± 0.0079 ms 0.998 ± 0.018
vrj/m1_16/VR_DirectFW 0.654 ± 0.0074 ms 0.653 ± 0.0085 ms 1 ± 0.017
vrj/m1_16/VR_FRM 1.99 ± 0.018 ms 1.99 ± 0.018 ms 0.999 ± 0.013
time_to_load 1.13 ± 0.0046 s 1.13 ± 0.016 s 0.995 ± 0.014
Memory benchmarks
master 2964500 master / 2964500
aggregators/CCNRM 1.82 k allocs: 0.192 MB 1.82 k allocs: 0.192 MB 1
aggregators/Coevolve 1.83 k allocs: 0.192 MB 1.83 k allocs: 0.192 MB 1
aggregators/DirectCR 1.83 k allocs: 0.193 MB 1.83 k allocs: 0.193 MB 1
aggregators/DirectFW 1.85 k allocs: 0.194 MB 1.85 k allocs: 0.194 MB 1
aggregators/FRM 1.84 k allocs: 0.194 MB 1.84 k allocs: 0.194 MB 1
aggregators/FRMFW 1.84 k allocs: 0.194 MB 1.84 k allocs: 0.194 MB 1
aggregators/NRM 1.83 k allocs: 0.192 MB 1.83 k allocs: 0.192 MB 1
aggregators/RDirect 1.84 k allocs: 0.194 MB 1.84 k allocs: 0.194 MB 1
aggregators/RSSA 1.82 k allocs: 0.192 MB 1.82 k allocs: 0.192 MB 1
aggregators/RSSACR 1.85 k allocs: 0.194 MB 1.85 k allocs: 0.194 MB 1
aggregators/SortingDirect 1.84 k allocs: 0.194 MB 1.84 k allocs: 0.194 MB 1
construct/jumpproblem_constantrate 12 allocs: 0.781 kB 12 allocs: 0.781 kB 1
construct/jumpproblem_massaction 10 allocs: 0.703 kB 10 allocs: 0.703 kB 1
construct/vr_direct 0.1 k allocs: 5.36 kB 0.1 k allocs: 5.36 kB 1
construct/vr_frm 0.097 k allocs: 15 kB 0.097 k allocs: 15 kB 1
events/ode_division/Direct 0.059 k allocs: 4.8 kB 0.059 k allocs: 4.8 kB 1
events/sde_dosing/Direct 0.133 k allocs: 10.7 kB 0.133 k allocs: 10.7 kB 1
events/ssa_dosing/Direct 10 allocs: 1.03 kB 10 allocs: 1.03 kB 1
events/vrj_reset/VR_Direct 0.072 k allocs: 6.09 kB 0.072 k allocs: 6.09 kB 1
events/vrj_reset/VR_FRM 0.093 k allocs: 8.06 kB 0.093 k allocs: 8.06 kB 1
ode/mixed/VR_Direct 0.059 k allocs: 4.81 kB 0.059 k allocs: 4.81 kB 1
ode/mixed/VR_FRM 0.079 k allocs: 6.58 kB 0.079 k allocs: 6.58 kB 1
ode/sir_zero_drift/Direct 0.052 k allocs: 4.17 kB 0.052 k allocs: 4.17 kB 1
ode/sir_zero_drift/NRM 0.056 k allocs: 4.45 kB 0.056 k allocs: 4.45 kB 1
ode/telegraph/Coevolve 0.057 k allocs: 4.53 kB 0.057 k allocs: 4.53 kB 1
ode/telegraph/Direct 0.052 k allocs: 4.17 kB 0.052 k allocs: 4.17 kB 1
ode/telegraph/NRM 0.056 k allocs: 4.45 kB 0.056 k allocs: 4.45 kB 1
pure_jump/bounded_vrj/Coevolve 16 allocs: 2.28 kB 16 allocs: 2.28 kB 1
pure_jump/chain/CCNRM 12 allocs: 9.34 kB 12 allocs: 9.34 kB 1
pure_jump/chain/Direct 11 allocs: 6.09 kB 11 allocs: 6.09 kB 1
pure_jump/chain/DirectCR 11 allocs: 6.09 kB 11 allocs: 6.09 kB 1
pure_jump/chain/NRM 15 allocs: 19 kB 15 allocs: 19 kB 1
pure_jump/chain/RSSA 11 allocs: 6.09 kB 11 allocs: 6.09 kB 1
pure_jump/chain/RSSACR 11 allocs: 6.09 kB 11 allocs: 6.09 kB 1
pure_jump/chain/SortingDirect 11 allocs: 6.09 kB 11 allocs: 6.09 kB 1
sde/mixed/VR_Direct 0.144 k allocs: 12.1 kB 0.144 k allocs: 12.1 kB 1
sde/mixed/VR_FRM 0.21 k allocs: 19 kB 0.21 k allocs: 19 kB 1
sde/telegraph/Direct 0.133 k allocs: 10.6 kB 0.133 k allocs: 10.6 kB 1
solve/constantrate 1.85 k allocs: 0.194 MB 1.85 k allocs: 0.194 MB 1
solve/massaction 1.85 k allocs: 0.194 MB 1.85 k allocs: 0.194 MB 1
vrj/m1_1/VR_Direct 0.059 k allocs: 4.78 kB 0.059 k allocs: 4.78 kB 1
vrj/m1_1/VR_DirectFW 0.059 k allocs: 4.78 kB 0.059 k allocs: 4.78 kB 1
vrj/m1_1/VR_FRM 0.079 k allocs: 6.67 kB 0.079 k allocs: 6.67 kB 1
vrj/m1_16/Coevolve 0.057 k allocs: 7.17 kB 0.057 k allocs: 7.17 kB 1
vrj/m1_16/VR_Direct 0.059 k allocs: 6.97 kB 0.059 k allocs: 6.97 kB 1
vrj/m1_16/VR_DirectFW 0.059 k allocs: 6.97 kB 0.059 k allocs: 6.97 kB 1
vrj/m1_16/VR_FRM 0.107 k allocs: 20.8 kB 0.107 k allocs: 20.8 kB 1
time_to_load 0.153 k allocs: 14.5 kB 0.153 k allocs: 14.5 kB 1

isaacsas and others added 4 commits November 8, 2026 05:11
# Conflicts:
#	HISTORY.md
#	src/variable_rate.jl
The test passed it as a JumpProblem keyword, which SciML#709 deprecated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coverage runs (the Downgrade workflow) add code_coverage_effect statements
to the typed code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The typed-code check read compiler internals (CodeInfo, ReturnNode, IR
expression heads). Time 10^4 searches instead, storing each result so none
is skipped: the generated lookup takes at most 0.05 ms among 41 callbacks
(coverage included), the earlier Base.tail recursion 89-113 ms (Julia 1.10
and 1.13).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@isaacsas isaacsas mentioned this pull request Nov 11, 2026
isaacsas and others added 2 commits November 11, 2026 22:53
… lists

From the review of SciML#713:

- CCNRM searches its time table from the bin where its last search stopped.
  An outside update happens before the next jump, possibly in an earlier
  bin, so a jump it moved there was skipped (and surfaced later as a tstop
  in the past). If the table had been rebuilt to start at a later jump
  time, the new time could even fall before its window, an out-of-bounds
  insert. The update now moves the search back to the bin of `t`, or
  rebuilds the window to start at `t`.
- After an affect stops the solve, the outside update does nothing: a new
  tstop restarted SDE solves, and ODE solves stopped with a custom retcode.
- isolated_copy shares VR_DirectEventCache's `updates` (read-only lists);
  copying the field threw.
- An unchanged next jump time keeps its stop instead of adding another, so
  NRM, CCNRM and Coevolve no longer add a stop per update when the next
  jump stays the same.
- Direct, DirectFW, FRM and FRMFW store one Bool per VariableRateJump
  (whether it changes a rate) instead of the lists they don't use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Independent review (Codex CLI v0.164.0 / gpt-6.1-sol), reviewer session 01a1cf3b-f1dd-7cd1-b102-8a24ff90c211, reviewed head 82e21f6

  • Verdict: MERGE
  • Risk assessment: medium-low (ML2: opt-in hybrid SSA/variable-rate scheduling changes across twelve aggregators, checked against independent analytic distributions)
  • Round / slot: 2 / 1

This is a blind code-only review by a session other than the PR author's, copied below from the reviewer's report with only the grading metadata removed. The posting agent did not re-run the reviewer's commands. A MERGE verdict is advice; merging is left to the maintainers.

CI: green
Session: 01a1cf3b-f1dd-7cd1-b102-8a24ff90c211

Risk

medium-low (ML2: opt-in hybrid SSA/variable-rate scheduling changes across twelve aggregators, checked against independent analytic distributions)

Blocking findings

None found by inspection or execution.

  • Verdict: MERGE
  • Round: 2
  • Blocking priorities: none
  • Deferred P2 issues: none

Non-blocking findings

None.

What I ran

AI reviewer: codex-cli 0.164.0, model gpt-6.1-sol; local session identified above (no session URL available). Risk and verdict are independent; no author rating or earlier review was read.

  • Inspected git diff origin/master...HEAD, affected implementations and tests, repository test configuration, and the supplied risk criteria. The checked-out head matches the requested SHA. Newest-commit attribution trailers are absent, so author harness/model are unknown.
  • Set the requested TMPDIR and preserved JULIA_DEPOT_PATH. Used Julia 1.13.2 with two threads and a scratch manifest resolved from the checkout's dependency/compat declarations and test extras. There is no committed Julia manifest.
  • julia --startup-file=no --project=../scratch/reviewer-env ../scratch/reviewer-suite.jl: exit 0. The script ran the project's complete InterfaceI group: 2,978 assertions passed, including variable-rate tests 314/314, new SSA-update regressions 235/235, and dependency-map tests 179/179.
  • The same script ran scratch adversarial probes: 80/80 passed. Six-species grouped vector callbacks with nonconsecutive indices were checked across seven SSA aggregators against analytic immigration/death means. General jumps changing a bounded Coevolve rate passed for four VR configurations and both input orders; probes also checked successful completion and nonnegative populations.
  • git diff --check origin/master...HEAD: exit 0. git status --short: empty; checkout unchanged.
  • Requested Python command, uv run --locked python --version: printed Python 3.15.0, with uv's warning that --locked has no effect outside a project. This checkout has neither uv.lock nor pyproject.toml; a project-locked Python interpreter was unavailable.

What I did not verify

QA, documentation builds, other test groups, additional Julia versions/platforms, a clean-base replay comparison, or end-to-end performance. CI green is caller-supplied, not independently queried. PR body, comments, reviews, sibling review artifacts, and author execution claims were not inspected.


🤖 Posted by an AI agent — harness: Claude Code 2.1.322 · model: claude-sonnet-5-5
Conversation: local session 3878b54e-28f2-4a01-a176-a8f5468d1997 (no session URL)

From the second review of SciML#713. When an outside update rebuilt the time
table's window to start at `t`, `rebuild!` set the search position from the
old times, and the move back to the bin of `t` was skipped, so a jump the
update put in an earlier bin was missed. The update now always moves the
search back after a rebuild. `rebuild!` also sets `minbin` to 0 when the
rebuilt window holds no time instead of throwing (assigning `nothing` to the
integer field). The CCNRM test also runs with narrow bins
(`binwidthconst = 2, numbinsconst = 5`), whose checks failed before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #713

Reviewed head: 2964500
Raw SHA-256: 82adfe3e1a41d26fb0fb7545d601a13592e53c984bd8d24211ffa3729dddc011
Source SHA-256: dc183dfcb3b99e642e7fb1a7048871b443a15c40b3e060ba71215cd3c844203d
Source: standard-review-v1 (harness-log)
Reviewer session: 01a1d157-92fd-7353-955b-3e83062b3cbc
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes

Risk assessment

  • Risk: medium-low (ML2)
  • Verdict: MERGE
  • Reviewed head: 2964500

Review report

VERDICT: MERGE
Round: 3
Head: 2964500
Slot: 1
CI: CI is not green
Session: 01a1d157-92fd-7353-955b-3e83062b3cbc

Risk

medium-low (ML2: opt-in hybrid jump scheduling across SSA aggregators, checked against analytic moments and exact state invariants; no-map behavior retained).

Blocking findings

None confirmed.

  • Verdict: MERGE
  • Round: 3
  • Blocking priorities: none
  • Deferred P2 issues: none

Non-blocking findings

  • src/jump_dependencies.jl:290: The added comment says “as before,” contrary to the supplied instruction to describe current behavior without historical narration. Remove those two words. Confirmed by reading; no functional consequence observed.

What I ran

AI review by Codex (version unavailable), model gpt-6.1-sol; actual local session ID above, no session URL available. Review remained blind to PR discussion, author risk ratings, and earlier reviews. Newest-commit Agent-Harness and Agent-Model trailers are absent.

All commands exported the requested TMPDIR; probes, environments, and logs stayed under this round's scratch directory. The runtime's layered JULIA_DEPOT_PATH was preserved. Julia ran with two threads and four precompile tasks in memory-limited scopes.

  • julia --version: julia version 1.13.2. No checked-in Julia Manifest exists. Created a scratch environment from the checkout's dependency, weak-dependency, test-extra, and compat declarations; developed the unchanged checkout into it and instantiated successfully.
  • GROUP=InterfaceI julia --startup-file=no --project=<scratch>/env test/runtests.jl: exit 0, 1378.64 seconds. Complete group passed, including variable-rate tests 314/314, new SSA-update tests 247/247, and dependency-map tests 179/179.
  • julia --startup-file=no --project=<scratch>/env <scratch>/probes.jl: exit 0, 3084/3084 assertions. Exercised constant-rate closures across every SSA aggregator, all VR modes including forced vector callbacks, immutable state replacement, NoSpecialize, grouped callback indices, and bounded Coevolve updates. Analytic checks covered bounded birth–death processes (600 trajectories per configuration, maximum absolute standardized mean error 1.31) and two-way coupling (1200 trajectories per configuration, maximum 1.71).
  • The same probes loaded the unmodified base branch's priority-table source: rebuilding an empty window raises MethodError before the change; the head succeeds with minbin == 0 and no candidate. 4/4 assertions passed.
  • julia --startup-file=no --project=<scratch>/env <scratch>/termination_probe.jl: exit 0, 12/12 assertions. SDE affects calling terminate!(integrator, ReturnCode.Success) stopped at approximately 0.135 with state [1, 0] in all four VR configurations.
  • git diff --check origin/master...HEAD and git diff --name-only -z origin/master...HEAD | xargs -0 typos: exit 0.
  • uv run --locked python --version: Python 3.15.0, with warning that --locked has no effect outside a project. This Julia repository has no uv.lock or Python project; this does not establish a locked project Python interpreter.

What I did not verify

Other Julia versions/platforms, documentation build, QA, InterfaceII, threaded suites, GPU execution, or performance benchmarks. CI was not inspected under the blind-review restriction and remains reported as not green; MERGE is code-review advice, not authorization to bypass CI. No prior-review comparison was performed because no trusted earlier opinion was supplied. No checkout edits, commits, pushes, or GitHub posts were made.

AUTHOR_GRADE: {"task":"feature","score":4,"difficulty":4,"rounds":3,"author_harness":"unknown","author_model":"unknown","note":"Complete InterfaceI passes, independent analytic and structural probes pass, and empty-window rebuilding fails on base and passes on head. Only a minor historical-comment instruction violation was found; other platforms and CI remain unverified."}

Head link: 2964500


🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol
Conversation: local session 01a1d157-92fd-7353-955b-3e83062b3cbc (no session URL)

This branch has not been deployed

No deployments
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.

2 participants