qiskit-sqd-dashboard
Live convergence diagnostics for qiskit-addon-sqd's self-consistent configuration recovery loop, rendered as an in-notebook Plotly widget.
qiskit-addon-sqd is a pure compute library with no visualization layer — this package fills that gap without modifying or wrapping the addon itself.
Why a notebook widget, not a standalone app
SQD workflows are already Jupyter-native: the whole configuration-recovery loop is a Python call inside a notebook cell. This package hooks directly into that loop via the callback parameter that diagonalize_fermionic_hamiltonian already exposes — no separate server, no data hand-off between processes.
Install
pip install -e .
No extra system dependencies needed beyond the packages above — earlier versions of this package used Plotly's FigureWidget (which requires anywidget), but that approach was dropped in favor of a clear_output() + redraw pattern after discovering FigureWidget is currently broken in Google Colab (plotly/plotly.py#5027). See the note in diagnostics.py for details.
Usage
from qiskit_sqd_dashboard import SQDDiagnostics
from qiskit_addon_sqd.fermion import diagonalize_fermionic_hamiltonian
diag = SQDDiagnostics()
diag.display() # renders the live figure in the notebook cell
result = diagonalize_fermionic_hamiltonian(
hcore, eri, bit_array,
samples_per_batch=samples_per_batch,
norb=norb, nelec=nelec,
callback=diag.callback, # <-- this is the whole integration
)
print(diag.summary())
That's it — diag.callback matches diagonalize_fermionic_hamiltonian's own callback: Callable[[list[SCIResult]], None] signature exactly, so there's no adapter code to write.
See sqd_dashboard_colab.ipynb for a complete, self-contained, Colab-ready example against a real N2 active-space problem (LUCJ ansatz from CCSD amplitudes, via ffsim, with realistic hardware noise injected). Everything needed is inlined in the notebook — no separate package install required to try it.
What it tracks, per iteration
- Energy convergence — best energy found (min across batches), plus min/max spread across batches
- Subspace dimension per batch —
len(ci_strs_a) * len(ci_strs_b)for each batch'sSCIResult - Orbital occupancy convergence — max absolute change in average orbital occupancies vs. the previous iteration (this is the quantity configuration recovery uses internally to correct noisy samples, so watching it flatten is a direct convergence signal)
Project layout
qiskit_sqd_dashboard/
└── diagnostics.py # SQDDiagnostics: the callback + live Plotly redraw logic
tests/
└── test_diagnostics.py # unit tests (real SCIResult/SCIState objects) + one real-SQD integration test
.github/workflows/tests.yml # CI: runs the test suite on Python 3.10/3.11/3.12
sqd_dashboard_colab.ipynb # self-contained, executed, working example against a real N2 active-space run
Development
pip install -e ".[test]"
pytest tests/ -v
The test suite includes a real integration test that runs the actual qiskit_addon_sqd.fermion.diagonalize_fermionic_hamiltonian workflow end-to-end against a tiny H2 molecule — not just mocked unit tests — so a breaking change in qiskit-addon-sqd's own API would be caught here.
To build distribution artifacts (sdist + wheel):
pip install build twine
python -m build
twine check dist/*
Current limitations (v1)
- Validated against a real N2 active-space run (8 orbitals, 10 electrons, STO-3G, LUCJ ansatz built from CCSD amplitudes via
ffsim, with realistic 2% per-bit hardware noise injected) — this showed genuine multi-iteration convergence dynamics (4-6 iterations, energy improving monotonically, subspace dimension growing from ~380 to ~700, occupancy deltas rising then falling toward zero). Seesqd_dashboard_colab.ipynb. Not yet validated at the full scale of IBM's own N2/6-31g tutorial (59 qubits) — this was a smaller but still genuinely correlated multi-orbital system, not a 2-orbital toy. - No persistence: diagnostics live only for the notebook session. A "save iteration history to disk" option would be needed to support the planned Streamlit comparison-across-runs view.
- Single-run view only — comparing multiple runs (e.g. different
samples_per_batchsettings) side by side is out of scope for v1; see Roadmap. - Not yet published to PyPI —
python -m build+twine checkboth pass, so the package builds cleanly and could be published, but this hasn't been done yet (pip install -e .from source is the only install path today).
Roadmap
- Validate against the full-scale N2/6-31g tutorial workflow (59 qubits)
- Optional history persistence (save/load iteration logs)
- Secondary Streamlit app for comparing multiple saved runs side by side
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qiskit_sqd_dashboard-0.1.0.tar.gz.
File metadata
- Download URL: qiskit_sqd_dashboard-0.1.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99695e69580f33d1b1184e3518974fabf8adf2a7133bffb1a16a29c63b8d1086
|
|
| MD5 |
37d4e2ec2ba737ef11770c63fcd50bb7
|
|
| BLAKE2b-256 |
d14bdb0b342c5415b5ad4c64a5e8f50285da29ec2d17329f3dd5f5211819d4e1
|
File details
Details for the file qiskit_sqd_dashboard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: qiskit_sqd_dashboard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7df086c9ee3e9b814c1f48fa0e174d66002019d7e8f19548a6c73afa0d5eacc2
|
|
| MD5 |
8081434b72a212a4f8968849675dac96
|
|
| BLAKE2b-256 |
a560be9f0cd455483ee65a5f1e1916b45a5a26ecfcf8b4dd05ee0a8df60a5d24
|