Skip to content

fix(ext): persist continuous ODE state in st.carry - #499

Merged
MartinuzziFrancesco merged 1 commit into
SciML:masterfrom
Saswatsusmoy:fix/continuous-reservoir-carry
Aug 17, 2026
Merged

fix(ext): persist continuous ODE state in st.carry#499
MartinuzziFrancesco merged 1 commit into
SciML:masterfrom
Saswatsusmoy:fix/continuous-reservoir-carry

Conversation

@Saswatsusmoy

Copy link
Copy Markdown
Contributor

Summary

Continuous AR was always cold-starting. After collectstates / train, discrete models keep the terminal state in st; continuous went back to zeros / prob.u0.

This writes the raw ODE terminal into st.reservoir.carry (same (u,) shape as discrete, so resetcarry! already works) and seeds the next collect / AR from it. No new keywords.

ContinuousESN, SciMLProblemReservoir, and LSM.

Related to the warmup discussion on #476. Implementation stays off that investigation branch.

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC
  • Any new documentation only uses public API

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread ext/RCODEReservoirExt.jl
Comment on lines +852 to +854
reservoir = __with_carry(
merge(st_res_new, (encoder = st_enc_new,)), sol.u[end]
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MartinuzziFrancesco
MartinuzziFrancesco merged commit e22cb8d into SciML:master Aug 17, 2026
52 of 53 checks passed
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