View on GitHub
Open this notebook in GitHub to run it yourself
Randomized Benchmarking
This notebook explains how to perform a full, end-to-end, randomized benchmarking (RB) experiment using the Classiq platform. The notebook is divided into several parts describing the different steps of the workflow: model definition, synthesis, execution, and analysis.1) Model Definition
Start by defining the model, then the high-level function and its constraints: a) Define the number of qubits and number of cliffords that will define each benchmark model. b) Define hardware settings for the problem. Set transpilation preferences to None, to avoid gate cancellation. c) Define the clifford gates and how to apply them. d) Create a set of models for the RB, where num_of_qubits determines the width and num_of_cliffords determines the depth. For each model draw a random choice of Clifford gates.2) Synthesis
Synthesize the constructed models using the synthesize_async command to get the quantum program of each model.3) Execution
When you have the programs you are ready to run. Classiq allows running multiple programs on multiple backends in a single command. You specify the hardware (see details in the executor user guide ). This example runs on IBM Quantum simulators but may be replaced by any hardware with the proper access credentials. For IBM Quantum hardware access, for example, replaceibmq_access_t with an API token from IBMQ’s website and specify the hardware name in the backend_name field of the BackendPreferences objects.
4) Analysis
The final step is to analyze the RB data. While the last two steps were independent of the problem at hand, this part is RB unique. Start by reordering the data, which is given in a ‘batch’. For RB analysis, match a program to the number of Clifford gates it represents, hence theclifford_number_mapping variable. Then, reorder the data according to the hardware, calling the RBAnalysis class to present the hardware comparison histograms.
Note: If the backends are not replaced with real hardware, expect the trivial result of 100% fidelity for both backends.