Sample-based quantum diagonalization (SQD)
This package implements sample-based quantum diagonalization (SQD) -- a technique for finding eigenvalues and eigenvectors of quantum operators, such as a quantum system Hamiltonian [1-6]. It can target Hamiltonians expressed as linear combinations of Pauli operators or second-quantized Fermionic operators. SQD-based workflows can be run on current quantum computers and have been shown to scale to problem sizes beyond what was possible with variational methods — and even beyond the reach of exact classical diagonalization methods.
SQD-based workflows involve first preparing one or more quantum states on a quantum device and sampling from them. Then, classical distributed computing is used to process those noisy samples. This processing occurs iteratively in two steps: first, a configuration recovery step corrects noisy samples using information about the input problem; second, the Hamiltonian is projected and diagonalized in the subspace spanned by those samples. These steps are repeated self-consistently until convergence. The result is an approximated lowest eigenvalue (energy) and lowest energy eigenstate of a given Hamiltonian. SQD is robust to samples corrupted by quantum noise; in fact, as long as a useful signal can be retrieved out of the quantum computer, the outcome of SQD will be insensitive to noisy bitstrings.
qiskit-addon-sqd can be used to classically process samples drawn from a variety of quantum circuits in practice. For example:
-
A variational circuit ansatz with parameters chosen such that sampling the circuit produces electronic configurations on which the target wavefunction (for example, the ground state) has significant support. This is appealing for chemistry applications where Hamiltonians can have millions of interaction terms [1]. For an example of this approach applied to chemistry using an LUCJ circuit see the tutorial for approximating the ground state energy of the N2 molecule.
-
A set of Krylov basis states prepared over increasing time intervals. Assuming a good initial state and sparsity of the ground state, this approach is proven to converge efficiently. As one needs to prepare Trotterized time evolution circuits on a quantum device, this approach is best for applications to lattice models [2] instead of complex many-body Hamiltonians like those for quantum chemistry. For an example of this approach applied to Fermionic lattice Hamiltonians, see the tutorial for approximating the ground state energy of a simplified single-impurity Anderson model.
-
A set of Krylov basis states implemented with qDRIFT randomized compilation of the time evolution operator. This approach yields shorter-depth circuits compared to Trotter-based decompositions of the time evolution and so can be used for quantum chemistry Hamiltonians. This technique has been applied to the ground state energy of polycyclic aromatic hydrocarbons [6].
Documentation
All documentation is available at https://quantum.cloud.ibm.com/docs/addons/qiskit-addon-sqd.
Installation
We encourage installing this package via pip, when possible:
pip install 'qiskit-addon-sqd'
For more installation information refer to these installation instructions.
Getting started
A simple guide to help you get started quickly with this package is available here.
Use case examples
The sample-based quantum diagonalization technique can be used to implement a diverse set of workflows. Some examples of where it has been used include:
- Electronic structure calculations of the ground state energies of iron-sulfur clusters
- Estimating ground state energies to predict band gaps of dielectrics
- Estimating low-lying molecular excited states
- Simulating interactions between molecules
- Studying solute-solvent interactions in simulations of electronic structure
- Open-shell analysis of molecular dissociation
- Modeling reaction pathways for photochemistry problems
- Combining with entanglement forging to study reaction pathways for materials degradation via hydrogen abstraction
- Constructing subspaces from quantum Krylov basis states to perform ground state simulations of impurity models for Fermionic systems
- Using qDRIFT randomized compilation to lower the overhead of implementing Krylov basis states for chemistry Hamiltonians and with application to a molecule exhibiting a half-Mobius electronic topology
- Using SQD as a solver used in the context of embedding and fragmentation methods for molecular systems, such as to compute energies of hydrogen rings and cyclohexane and of bi- and tri-metallic complexes, study oxygen reduction reaction, estimate energies of proteins and protein–ligand complexes, and to predict tritium speciation.
Technical discussion
Computational requirements
The computational cost of SQD is dominated by the eigenstate solver calls. At each step of the self-consistent configuration recovery iteration, n_batches of eigenstate solver calls are performed. The different calls are embarrassingly parallel. In this tutorial, those calls are inside a for loop. It is highly recommended to perform these calls in parallel.
The qiskit_addon_sqd.fermion.solve_fermion() function is multithreaded and capable of handling systems with ~25 spatial orbitals and ~10 electrons with subspace dimensions of ~$10^7$, using ~10-30 cores.
Choosing subspace dimensions
The choice of the subspace dimension affects the accuracy and runtime of the eigenstate solver. The larger the subspace the more accurate the calculation, at the cost of increasing the runtime and memory requirements. The optimal subspace size for a given system is not known, thus a convergence study with the subspace dimension may be performed as described in this example.
Bounding the subspace dimension
The samples_per_batch argument of qiskit_addon_sqd.fermion.diagonalize_fermionic_hamiltonian() sets the number of bitstrings contained in each batch, and thereby controls the subspace dimension indirectly: in the case of quantum chemistry applications, its value sets an upper bound to the subspace dimension. The dimension that actually results depends on how many of the sampled bitstrings are distinct, and it grows over the course of the self-consistent configuration recovery iterations, so it is not known in advance. See this example for more details.
The max_dim argument of the same function bounds the dimension directly, by limiting the number of CI strings retained in each spin sector. Since the subspace is spanned by the Cartesian product of the two spin sectors, max_dim=d caps the subspace dimension at d**2, while a tuple max_dim=(d_a, d_b) limits the spin-alpha and spin-beta sectors separately, capping the subspace dimension at d_a * d_b (with symmetrize_spin=True, the two limits must be equal). When a batch yields more CI strings than the limit allows, the strings requested through include_configurations and those carried over from the previous iteration are retained preferentially, and the remaining slots are filled with the most frequently sampled strings. Because it caps the size of the largest diagonalization that the eigenstate solver will be asked to perform, max_dim is a convenient way to keep the solver within a runtime and memory budget. See this example for more details.
Solvers
This package contains the functionality for the classical processing of user-provided samples. It can target Hamiltonians expressed as linear combinations of Pauli operators or second-quantized Fermionic operators. The projection and diagonalization steps are performed by a classical solver. We provide here two generic solvers, one for Fermionic systems and another for qubit systems. Other solvers that might be more efficient for specific systems can be interfaced by the users.
Trim SQD
Standard SQD diagonalizes each subsampled batch independently and keeps the best result, so the number of configurations it can consider is limited to what one affordable subspace can hold. Trim SQD instead partitions the bitstrings into batches, performs an intermediate diagonalization of each batch, then performs a larger diagonalization using the highest-weight determinants from each partition. This method is based on joint research from the Cleveland Clinic Foundation, RIKEN, and IBM [7], and can be enabled by passing a TrimPolicy object to the diagonalize_fermionic_hamiltonian function.
Contributing
The source code is available on GitHub.
The developer guide is located at CONTRIBUTING.md in the root of this project's repository. By participating, you are expected to uphold Qiskit's code of conduct.
Citing this package
If you use this package in your research, use the CITATION.bib file in this project’s repository to cite the appropriate reference(s).
Acknowledgements
This package includes an optional sampling strategy within the self-consistent
configuration recovery loop that trims determinants based on intermediate
diagonalization results. The implementation is based on joint research from
the Cleveland Clinic Foundation, RIKEN, and IBM. If you use this feature in
your research, please also use the citation for the paper, which can be found
in the CITATION.bib file with citation key merz2026crossing. An
implementation of the full workflow from that paper is expected to be available on GitHub
soon.
License
Deprecation policy
We follow semantic versioning. We may occasionally make breaking changes in order to improve the user experience. When possible, we will keep old interfaces and mark them as deprecated, as long as they can co-exist with the new ones. Each substantial improvement, breaking change, or deprecation will be documented in the release notes.
References
[1] Javier Robledo-Moreno, et al., Chemistry Beyond Exact Solutions on a Quantum-Centric Supercomputer, arXiv:2405.05068 [quant-ph].
[2] Jeffery Yu, et al., Quantum-Centric Algorithm for Sample-Based Krylov Diagonalization, arXiv:2501.09702 [quant-ph].
[3] Keita Kanno, et al., Quantum-Selected Configuration Interaction: classical diagonalization of Hamiltonians in subspaces selected by quantum computers, arXiv:2302.11320 [quant-ph].
[4] Kenji Sugisaki, et al., Hamiltonian simulation-based quantum-selected configuration interaction for large-scale electronic structure calculations with a quantum computer, arXiv:2412.07218 [quant-ph].
[5] Mathias Mikkelsen, Yuya O. Nakagawa, Quantum-selected configuration interaction with time-evolved state, arXiv:2412.13839 [quant-ph].
[6] Samuele Piccinelli, et al., Quantum chemistry with provable convergence via randomized sample-based Krylov quantum diagonalization, arXiv:2508.02578 [quant-ph].
[7] Kenneth M. Merz Jr., et al., Crossing the 12,000-atom barrier with heterogeneous quantum-classical supercomputing: quantum chemistry of protein-ligand complexes, arXiv:2605.01138 [quant-ph].
Metadata
Release files for qiskit-addon-sqd 0.14.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qiskit_addon_sqd-0.14.0.tar.gz | 555.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qiskit_addon_sqd-0.14.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 606.2 kB
Release files / qiskit_addon_sqd-0.14.0.tar.gz
| Download URL | qiskit_addon_sqd-0.14.0.tar.gz |
|---|---|
| Size | 555.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6bda4553c1a8eceae6544c38c17760f3e56b83819bde233c12b59e1388b2c0a
|
|
BLAKE2b-256 checksum How to use checksums |
a6d149f8976c179a73e94173d02f0299118cb1d548ee5a3f2dcabc133cd52e82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / qiskit_addon_sqd-0.14.0-py3-none-any.whl
| Download URL | qiskit_addon_sqd-0.14.0-py3-none-any.whl |
|---|---|
| Size | 50.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4363814cd7da8121bcd12a1df892b77675a9ad7679986ab7ec55be65e56d7474
|
|
BLAKE2b-256 checksum How to use checksums |
34aee161934e7ffb474588f35c085a5704cad3fbfe3d0c16901ee72e82c2beb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency log