Skip to content

Default delayed couplings to the circular history buffer - #22

Merged
mapi1 merged 2 commits into
mainfrom
feat/circular-default
Nov 17, 2026
Merged

mapi1 merged 2 commits into
mainfrom
feat/circular-default

Conversation

@mapi1

@mapi1 mapi1 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Delayed couplings now default to buffer_strategy="circular" instead of "roll". Roll shifts the whole buffer every step (and again in the gradient); circular only advances a write pointer, so per-step cost is independent of buffer length. It is faster in most forward and gradient workloads, clearly so on GPU and for long buffers, and about neutral on CPU. Simulation results are unchanged.

Changes

  • DelayedCoupling.__init__ defaults to "circular" (coupling/base.py); docstring updated.
  • SigmoidCoupling, TanhCoupling, DelayedSigmoidCoupling and PrePostCoupling are exported from tvboptim.experimental.network_dynamics.coupling.
  • docs/advanced/buffer_strategies.qmd updated for the new default.
  • Agent skill: buffer note follows the new default; ParallelExecution gets a per-device recipe (host devices via XLA_FLAGS with n_vmap=1 on CPU, n_vmap batching on GPU).
  • Changelog entries.

Behaviour change

The default coupling state gains an integer write_idx leaf, so states, configs and pickles saved under the old default no longer match the tree structure. Re-prepare, or pass buffer_strategy="roll". During a run the raw history is a ring indexed from write_idx, not oldest to newest.

@mapi1
mapi1 merged commit 3fff1f0 into main Nov 17, 2026
11 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.

1 participant