Skip to content

Mirror circuit fidelity estimation support and introduction of benchmarking interface (name TBD) #628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 39 commits into
base: develop
Choose a base branch
from

Conversation

ndsieki
Copy link

@ndsieki ndsieki commented Aug 5, 2025

This PR adds a benchmark creation tool we are calling B-Sqale (for the time being), integrates mirror circuit benchmarking into pyGSTi, and improves Qiskit interfacing.

Circuit mirroring functionality is supported by:

  • A RandomCompilation class, which OOP-ifies both the central Pauli (https://www.nature.com/articles/s41567-021-01409-7) and random compilation (https://arxiv.org/abs/2204.07568) mirroring routines.
  • Circuit mirroring functions in pygsti.protocols.mirror_edesign. The core routine is make_mirror_edesign, which creates a CombinedExperimentDesign whose circuits can be executed to perform mirror circuit fidelity estimation (MCFE). There are three other functions - qiskit_circuits_to_mirror_edesign, qiskit_circuits_to_fullstack_mirror_edesign, and qiskit_circuits_to_subcircuit_mirror_edesign - which build on make_mirror_edesign to create different kinds of benchmarks directly from Qiskit circuits.
  • An added from_mirror_experiment class method for the VBDataFrame class, which streamlines the analysis process for MCFE. The VBDataFrame class also now includes plotting functionality for creating volumetric benchmarking plots from subcircuit mirror experiments.

This PR also adds B-Sqale (name subject to change), a scalable and robust benchmark creation tool, to pyGSTi. More information will be available in a forthcoming paper. The submodule pygsti.tools.bsqale provides wrappers for the mirror benchmarking functionality:

  • noise_mirror_benchmark (wrapper for qiskit_circuits_to_mirror_edesign)
  • fullstack_mirror_benchmark (wrapper for qiskit_circuits_to_fullstack_mirror_edesign)
  • subcircuit_mirror_benchmark (wrapper for qiskit_circuits_to_subcircuit_mirror_edesign)
  • calculate_mirror_benchmark_results (wrapper for VBDataFrame.from_mirror_experiment)

These wrappers are provided in anticipation of expanding B-Sqale to scalable benchmarking techniques beyond MCFE.

Interfacing with Qiskit is supported by the addition of a from_qiskit class method and convert_to_qiskit method to the Circuit class.

ndsieki and others added 20 commits November 21, 2024 13:43
… uses a more reasonable test-ref match verification
…re reference circuit does not use ancillae, other changes
@ndsieki ndsieki requested review from tjproct and coreyostrove August 5, 2025 16:36
@ndsieki ndsieki self-assigned this Aug 5, 2025
@ndsieki ndsieki added this to the 0.9.14 milestone Aug 5, 2025
@ndsieki ndsieki changed the title Feature mcfe integration Mirror circuit fidelity estimation support and introduction of B-Sqale benchmarking interface Aug 11, 2025
@@ -1893,7 +1893,7 @@ def to_native(self):
"""
return tuple(self)

def replacename(self, oldname, newname):
def replace_name(self, oldname, newname):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every other class that inherits from Label calls its corresponding function replace_name(). Calling Circuit.replace_gatename() would also return an error if any of the labels were of type LabelTupWithArgs due to this inconsistency.

@@ -878,7 +878,7 @@ def subgraph(self, nodes_to_keep, reset_nodes=False):
qubit_labels = nodes_to_keep

edges = []
for edge in self.edges():
for edge in self.edges(include_directions=True):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having subgraphs retain the directions of their parent graph makes it easier to use stencils on subgraphs. I can't think of a downside to this behavior. If there is a good reason to discard the direction information in a subgraph, I think it would make sense to add a include_directions flag to subgraph().

@@ -23,7 +26,7 @@ class Gzr(_UnitaryGateFunction):
shape = (2, 2)

def __call__(self, theta):
return _np.array([[1., 0.], [0., _np.exp(-1j * float(theta[0]))]])
return _np.array([[1., 0.], [0., _np.exp(1j * float(theta[0]))]])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defining the Gzr gate with a minus rotation is inconsistent with other resources. It is also internally inconsistent with the definition of the Gzpi2 / C14 gate: _np.array([[1, 0], [0, 1j]], complex).

@ndsieki ndsieki changed the title Mirror circuit fidelity estimation support and introduction of B-Sqale benchmarking interface Mirror circuit fidelity estimation support and introduction of (name TBD) benchmarking interface Aug 12, 2025
@ndsieki ndsieki changed the title Mirror circuit fidelity estimation support and introduction of (name TBD) benchmarking interface Mirror circuit fidelity estimation support and introduction of benchmarking interface (name TBD) Aug 12, 2025
@ndsieki ndsieki marked this pull request as ready for review August 12, 2025 20:56
@ndsieki ndsieki requested review from rileyjmurray and a team as code owners August 12, 2025 20:56
@ndsieki ndsieki requested a review from adhumu August 12, 2025 20:56
@coreyostrove
Copy link
Contributor

Quick note: I expect to be able to merge in #379 tomorrow morning. Once that is on develop I'll ping you and then let's merge develop into your branch to use as the baseline for reviewing. This will knock out a decent number of changes and reduce any redundancy.

@coreyostrove
Copy link
Contributor

Update: #379 is now merged into develop. It looks like there might be a couple conflicts to resolve when merging develop into your branch, so hopefully those won't be tricky. I'll start my review once that merge is done.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was identical to run_me_with_mpirun.py.

@ndsieki
Copy link
Author

ndsieki commented Aug 13, 2025

Merged in develop and fixed a couple of minor things. @coreyostrove, should be ready for your review.

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.

3 participants