Skip to content

feat(solver): add dynamical bias hook and filtered state to CaSuDaSolver - #116

Open
gcattan wants to merge 1 commit into
IBM:mainfrom
gcattan:feat/dynamical-pbit-solver-hook
Open

feat(solver): add dynamical bias hook and filtered state to CaSuDaSolver#116
gcattan wants to merge 1 commit into
IBM:mainfrom
gcattan:feat/dynamical-pbit-solver-hook

Conversation

@gcattan

@gcattan gcattan commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Step 1 of the dynamical / RTRBM direction. Backward-compatible, opt-in.

  • bias_func(run, m, m_filt): per-timestep hook that replaces the static h, enabling recurrence (RTRBM) and adaptive biasing. Defaults to None, in which case behavior is bit-for-bit identical to before.
  • m_filt: leaky-integrator companion state (graded [-1, 1]), controlled by a new solver tau param. It carries step (run-1) when bias_func is called, giving the hook temporal memory; never affects the hard +/-1 sampler unless a bias_func consumes it.
  • return_filtered: opt-in to append the m_filt trajectory to the return; the default return contract is unchanged for both n_shots==1 and n_shots>1.
  • Energy E now uses the effective (biased) h so it stays consistent with all_I when a bias_func is active.

Adds tests/test_dynamical.py covering backward compatibility, filtered-state bounds, the hook feeding the dynamics, energy-reflects-bias, multi-shot shapes and per-shot broadcasting, and tau=0/tau=1 filter invariants.

Step 1 of the dynamical / RTRBM direction. Backward-compatible, opt-in.

- bias_func(run, m, m_filt): per-timestep hook that replaces the static h,
  enabling recurrence (RTRBM) and adaptive biasing. Defaults to None, in
  which case behavior is bit-for-bit identical to before.
- m_filt: leaky-integrator companion state (graded [-1, 1]), controlled by
  a new solver `tau` param. It carries step (run-1) when bias_func is called,
  giving the hook temporal memory; never affects the hard +/-1 sampler unless
  a bias_func consumes it.
- return_filtered: opt-in to append the m_filt trajectory to the return; the
  default return contract is unchanged for both n_shots==1 and n_shots>1.
- Energy E now uses the effective (biased) h so it stays consistent with
  all_I when a bias_func is active.

Adds tests/test_dynamical.py covering backward compatibility, filtered-state
bounds, the hook feeding the dynamics, energy-reflects-bias, multi-shot
shapes and per-shot broadcasting, and tau=0/tau=1 filter invariants.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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