Skip to content

Reset and resize CSRM connection spike history - #815

Open
AHMETHAKANBEZIR1 wants to merge 2 commits into
BindsNET:masterfrom
AHMETHAKANBEZIR1:fix/csrm-window-reset
Open

AHMETHAKANBEZIR1 wants to merge 2 commits into
BindsNET:masterfrom
AHMETHAKANBEZIR1:fix/csrm-window-reset

Conversation

@AHMETHAKANBEZIR1

@AHMETHAKANBEZIR1 AHMETHAKANBEZIR1 commented Oct 23, 2026 •

Copy link
Copy Markdown

CSRM simulation history is not following the state transitions already provided by Network. Network.reset_state_variables resets the neurons but leaves Connection.s_w intact, so spikes from one trial drive the next supposedly independent trial. When an input batch changes size, Network.run resizes the neuron state but the old connection window instead crashes torch.cat.

Clear the dense connection's CSRM spike window on explicit reset, and lazily recreate it when the input batch size changes. A run boundary without either transition continues to preserve the simulation history. Learned weights and bias remain intact.

In a constructed one-neuron CPU example, a spike-containing trial followed by reset and an all-zero trial produces voltage 0.3679 on master instead of the fresh network's 0. A size-one input batch followed by size two raises a tensor-size mismatch on master. Both work with this change.

Validation on Windows, Python3.12, Torch2.14.0+cpu:

  • Seven new cases against exact unmodified master 78ec02b: six failures and one passing continuity control. With the patch all seven pass.

  • Four reset cases compare every step of a reused network with a fresh one (two window lengths, bias and no bias), including spike outputs and unchanged learned weights. Two batch-resize cases check size1->2 and2->1 against fresh networks. The control checks that a split run without reset still matches an unsplit run and retains nonzero history.

  • Complete local suite: 262 passed, 1 skipped. The module import path was explicitly verified for this checkout in the Poetry environment.

  • Both configured all-file pre-commit hooks (isort, black), normal commit hooks and staged diff check pass. Changelog updated. No CUDA or task-accuracy benchmark is claimed.

This was found by source analysis and constructed simulations, not a claimed production incident. No open CSRM/window-reset fix or claimed issue was found. AI disclosure: the account owner requested OSS work; OpenAI Codex performed the diagnosis, implementation, tests and description. No independent human code review has occurred.

Local compatibility check: the updated heads of #813 and #815 were applied together in a private checkout based on master78ec02b. The complete combined suite passed (289 passed, 1 skipped; Torch2.14 CPU; import path verified). This is local integration evidence, not an upstream merge or CUDA result.

Local compatibility check: the updated heads of #813, #815 and #816 were applied together in a private checkout based on master78ec02b. The complete combined suite passed (297 passed, 1 skipped; Torch2.14 CPU; import path verified). Only the changelog additions needed a conflict resolution, which retained all entries; the implementation changes applied cleanly. This is local integration evidence, not an upstream merge or CUDA result.

AHMETHAKANBEZIR1 and others added 2 commits October 23, 2026 04:38
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
@AHMETHAKANBEZIR1 AHMETHAKANBEZIR1 changed the title Reset CSRM connection spike history between trials Reset and resize CSRM connection spike history Oct 23, 2026
Hananel-Hazan added a commit that referenced this pull request Oct 29, 2026
…, CODEOWNERS (#828)

* test: golden-output and invariant regression tests, all-class smoke tests, API snapshot, coverage floor, PR template

Phases 1-4, 6, 7 of the test hardening plan (logs/test_hardening_2026-10/PLAN.md).

- test/regression/: 16 seeded networks ported from the review canaries; golden
  spike/voltage/trace/weight files (spikes exact, floats atol 1e-6, skipped on a
  different torch major.minor); invariants (split run, reset vs fresh, state_dict
  round trip, learning off, batch of copies, dt scaling). 100 passed, 15 strict xfail
  for known bugs (rule state outside state_dict, MulticompartmentConnection weights
  not saved, CSRM s_w window, PR #813 and #815 crashes).
- test/network/test_all_classes.py: every Nodes, connection, learning rule, feature
  and model class built and run; 25 strict xfail pin known crashes. Core coverage
  network 79-90% -> 91%, learning 84-87% -> 95%, models 43% -> 99%.
- test/test_api_surface.py + api_surface.json: public signatures pinned; regen
  scripts refuse to run without --reason.
- CI: pytest-cov in dev group, coverage floor script (network 90, learning 94),
  coverage.xml artifact.
- CONTRIBUTING.md, PR template, test/regression/README.md,
  bindsnet/learning/README.md known limitations.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* test: operation-count tests and A/B timing workflow (Phase 5)

- test/regression/test_op_counts.py + op_counts.json: kernel dispatch counts for one
  update() of every learning rule (batch 1 and 4), one DiehlAndCook2015 step
  (batch 1 and 16) and LIFNodes.forward; fails when a count grows, warns on a drop.
  regen_op_counts.py refuses without --reason. 32 tests, 3.9 s.
- .github/workflows/bench.yml + scripts/bench_ab.py: non-required PR workflow,
  merge base vs head, alternating rounds, median ratio with bootstrap interval,
  SLOWER above 1.25; report in the job summary and an artifact. Local no-change
  run: medians 0.965 to 1.012; a 0.5 ms/step sleep flagged on all workloads.
  Calibration on GitHub runners still pending.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* ci: test guard (fails-before-fix and weakened-tests checks) and CODEOWNERS

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

* ci: weakened-tests also checks helper functions and tolerance constants; document the guard checks

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

* ci: coverage floors from the first GitHub CI measurement (network 90.6%, learning 95.2%)

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

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.

1 participant