fix(ext): persist continuous ODE state in st.carry - #499
Conversation
Discrete models already keep the terminal reservoir state in st after collect/train. Continuous was restarting AR from zeros / prob.u0. Write the raw ODE terminal into st.reservoir.carry and seed the next solve from it. resetcarry! already understands that shape.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 881018f43c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| reservoir = __with_carry( | ||
| merge(st_res_new, (encoder = st_enc_new,)), sol.u[end] | ||
| ), |
There was a problem hiding this comment.
Persist LSM refractory state with the carry
When an LSM solve is resumed from this new carry, only sol.u[end] is saved, but the spike callback also mutates p.ref_until to enforce tau_ref; __lsm_pack recreates ref_until = typemin for the next solve. If a neuron spikes near the end of collectstates/AR and the returned st is used for the next call, that neuron is no longer refractory even though an uninterrupted solve would keep du[unit] = 0 until t_spike + tau_ref, so warm-started LSM dynamics and features can be wrong exactly in the spiking/refractory case this carry is meant to preserve.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
ref_until is callback state on p, not part of the ODE u this PR is threading. also the next collect/AR restarts tspan, so copying the old absolute times would keep units refractory for the whole next interval. leftover tau_ref across calls is a fair lsm follow-up (same bucket as the exp filter). not changing this PR for it.
Summary
Continuous AR was always cold-starting. After
collectstates/train, discrete models keep the terminal state inst; continuous went back tozeros/prob.u0.This writes the raw ODE terminal into
st.reservoir.carry(same(u,)shape as discrete, soresetcarry!already works) and seeds the next collect / AR from it. No new keywords.ContinuousESN,SciMLProblemReservoir, andLSM.Related to the warmup discussion on #476. Implementation stays off that investigation branch.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC