This repository contains the code for the noise resilient quantum approximate circuit synthesis scheme proposed in Peephole Optimization for Quantum Approximate Synthesis (paper), which is based on BQSKit's Quest (paper). Like Quest, this scheme is composed of several stages, which we have named mapping, partitioning, expansion, recombination, and simulation.
The paper proposes a series of improvements to the recombination phase of this architecture, which includes the addition of error awareness and better methods of approximating the correctness of the result. We evaluated these proposed improvements on a set of benchmark circuits using the IBMQ FakeWashington simulator. The results demonstrate that our best-performing method provides an average reduction in Total Variational Distance (TVD) and Jensen-Shannon Divergence (JSD) of 18.2% and 15.8%, respectively, compared with the Qiskit optimizer. This also constitutes an improvement in TVD of 11.4% and JSD of 9.0% over Quest.
Because the paper investigates improvements to the recombination step, the code focuses on evaluating the effect of different recombination methods on result quality. The code structure does, however, allow for arbitrary variation of the other parameters. It should be noted that the expansion step used in our code (Leap) is identical to the one used in Quest (except a couple of minor bug fixes), while our partitioning step uses GTQCP, another work of ours.
The scheme is built on the BQSKit quantum synthesis toolkit, and is loosely based on the provided code for Quest (although little of the original code remains, the structure is very similar).
To install this code, clone the repo and run the following command from the base directory in your desired Python environment to install required the required Python packages.
pip install -r requirements.txt
Retrieve the correct version of the LEAP compiler by downloading the code for Quest (link) and copying the leap_compiler directory into this repo's base directory, then run the following command to apply some (required) minor changes/fixes.
git apply --ignore-space-change --ignore-whitespace leap.patch
Within this framework, work is divided into projects (created by new_project.py), which the framework then operates on (using run_circuit.py). A summary of results (in CSV format) for all projects can then be produced (using evaluate_all.py).
Steps to create a project for, run the pipeline on, and evaluate results for a given circuit:
- Running
new_project.pyafter modifying thecircuit_namevariable to point at the desired QASM circuit in theinput_qasm_filesdirectory (i.e. foradder_4.qasmsetcircuit_nametoadder_4). - Run
run_circuit.pyafter modifying theproject_namevariable to point at the desired project (by default the circuit and project names are the same). This will run all variations of the pipeline (currently only the recombination stage is varied) and write the results to theprojectsfolder. - Run the
evaluate_all.pyfile after modifyingproject_namesto include the desired project name(s). Results will be written to a series of CSV files in theprojectsdirectory.
Clark, J., & Thapliyal, H. (2024, April). Peephole optimization for quantum approximate synthesis. In 2024 25th International Symposium on Quality Electronic Design (ISQED) (pp. 1-8). IEEE.
This research used resources of the Oak Ridge Leadership Computing Facility, which is a DOE Office of Science User Facility supported under Contract DE-AC05-00OR22725. Also, this material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. 1938092.