Skip to main content

View on GitHub

Open this notebook in GitHub to run it yourself
Quantum volume is a measurement of the errors characterizing a chosen quantum hardware. The quantum volume is a result of running a circuit based on principles of randomness and statistical analysis, which provides a single number to compare different hardware backends. The scheme of the quantum volume [1]:
  1. For a number of qubits nn, a circuit is made of the nn quantum layer.
  2. Each layer consists of a unitary operation between pairs of nn qubits.
The pairs are chosen at random. If nn is odd, one of them does not have an operation.
  1. The unitary operation between each pair is the Haar random matrix; i.e., an SU(4) operation containing a random complex number in such a manner that the probability of measuring a quantum state is kept with uniform distribution.
  2. A single circuit of nn qubits is measured and the heavy output probability (i.e., the probability of measuring the states above the median value) is calculated.
Due to the nature of the distribution of random complex numbers, one can evaluate that for an ideal case (no noises), the heavy output probability should be ~
8
  1. For an assessment of the quantum volume, the demand subsides to the following inequality: (1) Pheavy_outputs≤2/3.P_{\rm heavy\_ outputs} \leq 2/3.
  2. For a given output, to get the quantum volume, repeat Items 1-4 for an increasing number of qubits until the inequality described in Item 4 does not hold. To ensure it, the circuits are created many times and the average and standard deviation are taken into account.
  3. The quantum volume is two to the power of the number of qubits, such that they pass inequality (1) as per the procedure described in Items 1-
  4. The heavy output probability is a good measurement of the quality of the circuit, as noise reduces the probabilities of uniform distribution.
While this is so, consider that there are many components to the results of the procedure - not only the hardware noises, but also the connectivity map, the quality of the transpilation, and even the quantum software that translates the circuit into basis gates for the hardware, thus contributing to the circuit depth. This demonstration shows the code for implementing the steps to calculate the quantum volume using the Classiq platform and an example of such calculations for several quantum simulators and hardware backends.

Step 1: Create a Haar Random Unitary Matrix

Create a function, generating a (n,n) sized Haar random unitary matrix [2]. This matrix contains a random complex number that is distributed evenly in the 2n2^n space of quantum states. The Haar distribution indicates how to weight the elements of U(N)U(N) such that uniform distribution occurs in the parameter space.

Step 2: Create a Quantum Volume Circuit

The qv_model function creates the quantum volume model for a given NN number of qubits. For NN qubits, the circuit must include NN quantum volume layers. The layers are built using the qv_layer function, which creates random pairing between the NN qubits. (For an odd number, a randomly chosen qubit is not operational.) Between each pair, a unitary gate operates, consisting of a Haar random unitary matrix of size

Step 3: Execute and Analyze

The execution and analysis part consists of these functions:
  • execute_qv sends a quantum program for execution on a given quantum hardware with a specified number of shots.
The function returns the results of the execution from the hardware.
  • heavy_outputs_prob analyzes the results from execution and returns the heavy output probability; i.e., the probability for a single state in the space to be greater than the median value (median = “middle” of a sorted list of numbers).
The round_significant function rounds a number for one significant figure.

Step 4: Find the Quantum Volume Algorithm

Using the previously defined functions, find_qv finds the quantum volume value for defined parameters including hardware definitions. The find_qv function sends the value of heavy output probability for each number of qubits defined (between min_qubit and max_qubits). This repeats num_trials times. Then, the heavy output probability is averaged, and the standard deviation is calculated. If the number of qubits chosen for the circuit is less than the number of qubits in the chosen hardware, the qubits are randomly picked to run according to the rules of the hardware provider. The quantum volume qubits number is defined as the larger number of qubits for which the heavy output probability, decreased by two sigma (twice the standard deviation), is greater than or equal to 2/
  1. The quantum volume is two to the power of the number of quantum volume qubits.
Note that if the result given for the log2 of the quantum volume is the same as the chosen max_qubits, there is a possibility that the quantum volume is greater than found by the function. In this case, run the program for a greater span.

Examples

Run the code to find the quantum volume of several quantum simulators and hardware backends.

Running with the Classiq Simulator

Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Since this is a simulator with no errors, we expect the heavy output probability for any number of qubits to be approximately 0.

Running with Rigetti Aspen M-3

Running with IBM Cloud Targets

Run on a few IBM machines:
  • ibm_fez with a reported quantum volume of 8
  • ibm_marrakesh with a reported quantum volume of 16
  • ibm_sherbrooke with a reported quantum volume of 32
Refer to the IBM website

References

[1] Andrew W. Cross, Lev S. Bishop, Sarah Sheldon, Paul D. Nation, and Jay M. Gambetta (2019). Validating quantum computers using randomized model circuits. [2] Maris Ozols (2009). How to generate a random unitary matrix.