Skip to content

🐛 Make RL sampling and Qiskit actions user-seedable - #797

Draft
flowerthrower wants to merge 2 commits into
v3/paper-tket-passesfrom
v3/reproducible-rl-seeding
Draft

flowerthrower wants to merge 2 commits into
v3/paper-tket-passesfrom
v3/reproducible-rl-seeding

Conversation

@flowerthrower

@flowerthrower flowerthrower commented Aug 27, 2026

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Makes RL training-circuit sampling, seeded inference, and Qiskit's randomized
passes reproducible only when the user supplies a seed.

On a fresh environment, reset() uses Gymnasium's entropy-seeded generator for
circuit sampling and passes no seed to Qiskit. Native pass settings therefore
remain unchanged, including SABRE's CPU-dependent trial defaults.
Predictor.train_model(seed=...) and PredictorEnv.reset(seed=...) opt into
reproducible mode: they control circuit selection and supply derived native
seeds to QiskitSabreMapping, SabreSwap, VF2Layout, and VF2PostLayout.
Later seedless resets continue the initialized Gymnasium RNG stream, matching
Gymnasium and Stable-Baselines3.

Seeded SABRE execution uses one native layout and swap trial so results do not
depend on CPU-count-based defaults. Candidate QASM paths are sorted before
indexed selection. compile_as_predicted retains stochastic policy and native
pass behavior by default; supplying seed=... selects deterministic masked
argmax inference and reproducibly seeds randomized Qiskit actions.

This does not add the repeated figure-of-merit-aware wrapper tracked in #667,
change BQSKit's established fixed pass seed, or alter unrelated ML estimators.

This is position 6 of the stack. It depends on #796 and is followed by #798. No
new package dependencies are introduced.

Part of #664

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our AI Usage Guidelines.
  • Every agent-authored or agent-edited public text body begins with the visible disclosure 🤖 *AI text below* 🤖 (titles are exempt).
  • I have disclosed AI assistance in the PR description.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

@flowerthrower flowerthrower added major Part of a major release fix Fix for something that is not working labels Aug 27, 2026
@flowerthrower flowerthrower self-assigned this Aug 27, 2026
@flowerthrower
flowerthrower force-pushed the v3/reproducible-rl-seeding branch from 161f01b to af74f07 Compare August 27, 2026 14:46
@flowerthrower flowerthrower changed the title 🐛 Make RL circuit sampling reproducible 🐛 Make RL sampling and randomized Qiskit actions reproducible Aug 27, 2026
@flowerthrower
flowerthrower force-pushed the v3/reproducible-rl-seeding branch from af74f07 to 261f5b6 Compare August 27, 2026 15:02
@flowerthrower
flowerthrower force-pushed the v3/paper-tket-passes branch 2 times, most recently from 1ce6b4f to 65c9d98 Compare August 27, 2026 15:07
@flowerthrower
flowerthrower force-pushed the v3/reproducible-rl-seeding branch from 261f5b6 to d37a988 Compare August 27, 2026 15:07
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/mqt/predictor/rl/helper.py 0.0% 2 Missing ⚠️
src/mqt/predictor/rl/actions/qiskit_actions.py 90.9% 1 Missing ⚠️
src/mqt/predictor/rl/predictor.py 85.7% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@flowerthrower
flowerthrower force-pushed the v3/reproducible-rl-seeding branch from d37a988 to 71115b6 Compare August 28, 2026 07:29
@flowerthrower flowerthrower changed the title 🐛 Make RL sampling and randomized Qiskit actions reproducible 🐛 Make RL sampling and Qiskit actions user-seedable Aug 28, 2026
@flowerthrower
flowerthrower force-pushed the v3/reproducible-rl-seeding branch 2 times, most recently from 5a8e054 to bb645a9 Compare August 28, 2026 08:13
@flowerthrower
flowerthrower force-pushed the v3/paper-tket-passes branch 2 times, most recently from 3853b60 to 2ba8e5a Compare August 28, 2026 08:30
@flowerthrower
flowerthrower force-pushed the v3/reproducible-rl-seeding branch from bb645a9 to 7fe4c45 Compare August 28, 2026 08:30
@flowerthrower
flowerthrower force-pushed the v3/reproducible-rl-seeding branch from 7fe4c45 to 47f02c1 Compare August 28, 2026 09:57
Signed-off-by: flowerthrower <flowerthrower@users.noreply.github.com>
Assisted-by: GPT 5.6 via Codex
@flowerthrower
flowerthrower force-pushed the v3/reproducible-rl-seeding branch from 47f02c1 to 144229c Compare August 28, 2026 10:18
Assisted-by: GPT-5.6 via Codex

Signed-off-by: flowerthrower <flowerthrower@users.noreply.github.com>
Assisted-by: GPT 5.6 via Codex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Fix for something that is not working major Part of a major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant