Skip to main content

Someone wanted to learn this too, so Grasp built them a personal learning path.

You can keep exploring this one or create your own

Quantum Process Tomography for Noisy Single-Qubit Gates

Hello! In our last lesson, we established the complete theoretical framework for Quantum Process Tomography (QPT), deriving the measurement scheme and the linear inversion method used to reconstruct the process -matrix. We saw that, in principle, a series of well-chosen state preparations and measurements contains all the information needed to fully characterize any quantum process.

Today, we will bridge the gap from theory to practice. Our objective is to implement quantum process tomography for a single-qubit noisy gate and analyze the reconstructed process matrix. You will use your Python skills to simulate a QPT experiment, apply the reconstruction algorithms we've discussed, and interpret the results to quantify the errors in a quantum gate. This will solidify your understanding of QPT as a practical tool for hardware characterization.

From the -Matrix to the Choi Matrix

In the last lesson, we focused on the -matrix, which represents a quantum map in a fixed operator basis (like the Pauli basis). An alternative, and in many ways more direct, representation is the Choi matrix, based on the Choi-Jamiolkowski isomorphism. This isomorphism establishes a one-to-one correspondence between a quantum channel and a positive semidefinite matrix.

The following resource provides a concise introduction to the theory of QPT and the central role of the Choi matrix.

Full Quantum Process Tomography of a Universal ...

The paper 'Full Quantum Process Tomography of a Universal Entangling Gate...' provides an excellent summary of the modern QPT formalism. We will use it to define the Choi matrix.

Please read sections II.1 ('Theory of QPT') and II.2 ('The Choi representation'). Focus on understanding how the process matrix \chi in Eq. (1) relates to the quantum map \mathcal{E}, and how the Choi matrix \mathcal{C_E} in Eq. (2) provides a unique and convenient representation of that same map. Note that the paper uses \chi for the process matrix in the Pauli basis and \mathcal{C_E} for the Choi matrix; these are different but related representations.

As the paper describes, the quantum map can be uniquely characterized by a matrix. The Choi matrix is particularly useful. For a process acting on a -dimensional system, is a matrix defined as:

where is a maximally entangled state between the system and an ancilla of the same dimension, and is the identity map on the ancilla.

Essentially, the Choi matrix is what you get if you apply your process to one half of a maximally entangled pair. This single matrix contains all the information about the process. Experimentally determining this matrix is the goal of QPT.

The QPT Algorithm in Practice

The paper you just read outlines a clear, step-by-step algorithm for performing QPT. This is the exact procedure we will be implementing.

Full Quantum Process Tomography of a Universal ...

Let's review the high-level algorithm for a QPT experiment.

Please read section II.3, 'QPT algorithm with the Choi representation'. This provides a 6-step summary of the experimental and computational workflow that we will follow.

The algorithm boils down to:

  1. Prepare a tomographically complete set of input states.
  2. Apply the unknown process to each input state.
  3. Measure the output states in a tomographically complete set of measurement bases.
  4. Use the measurement statistics to reconstruct the output density matrices.
  5. With the input-output state pairs, solve for the Choi matrix .
  6. Analyze the reconstructed matrix.

Implementing Single-Qubit QPT in Python

Now, let's translate this algorithm into code. We will use the forest-benchmarking library, which provides a convenient framework for characterization experiments. The following tutorial walks through the entire process for a single-qubit gate. We will follow it step-by-step, connecting the code to the theory we've discussed.

Quantum process tomography - Forest-Benchmarking

This notebook from the forest-benchmarking documentation provides a hands-on implementation of single-qubit QPT. We will use this as our guide.

Please open this tutorial and be prepared to follow its steps. We will go through the sections sequentially, from 'Quantum process tomography of a single qubit' to the end. The goal is not just to run the code, but to understand what each function call is doing in the context of the QPT algorithm.

Let's break down the implementation.

Step 1: Define the Process and its Ideal Representation

(Corresponds to Section: Step 1. Construct a process in the tutorial)

First, we define the gate we want to characterize. The tutorial chooses an RX(pi) gate, which is equivalent to the Pauli X gate up to a global phase. The code then calculates the ideal Choi matrix for this process.

# From the tutorial:
from pyquil import Program
from pyquil.gates import RX
import numpy as np

# The process we want to characterize
qubits = [0]
process = Program(RX(np.pi, qubits[0]))

# The ideal representation
from pyquil.gate_matrices import RX as RX_matrix
from forest.benchmarking.operator_tools import kraus2choi

# The RX(pi) gate is its own Kraus operator
kraus_true = [RX_matrix(np.pi)]
choi_true = kraus2choi(kraus_true)

print('Ideal Choi matrix for RX(pi):\n', np.real_if_close(np.round(choi_true, 2)))

The output shows a 4x4 matrix. This is the theoretical target we hope our experiment reconstructs.

Step 2: Generate the Tomography Experiments

(Corresponds to Section: Step 2. Construct a ObservablesExperiment...)

This is where the heavy lifting of designing the experiment happens. We need to prepare a basis of input states and measure in a basis of observables. For a single qubit, a standard choice is to prepare the six eigenstates of the Pauli operators () and for each, measure the expectation values of . This gives unique experimental settings.

The generate_process_tomography_experiment function automates this for us. It creates a list of pyQuil programs, each corresponding to one of these 18 settings (prepare state -> apply process -> measure observable).

Step 3: Acquire Data from a Simulator

(Corresponds to Section: Step 3. Acquire the data)

Here, we run the 18 programs on a quantum virtual machine (QVM). The estimate_observables function executes each program multiple times (takes many "shots") to estimate the expectation values. In a real experiment, this step would involve running the circuits on a physical QPU. The output is a list of ExperimentResult objects, containing the measured expectation values and their statistical uncertainties.

Step 4: Reconstruct the Choi Matrix

(Corresponds to Section: Step 4. Apply some estimators...)

This is the linear inversion step we derived in the last lesson. We now have the "inputs" (the states we prepared) and the "outputs" (the expectation values we measured).

  • Linear Inversion: The function linear_inv_process_estimate takes the experimental results and directly solves the linear system to find the process matrix. As noted in the tutorial, this method is fast but can yield an unphysical matrix (i.e., one that is not completely positive) due to experimental noise. The proj_choi_to_physical function can be used to find the closest physical matrix to this unphysical estimate.

  • Maximum Likelihood Estimation (MLE): The pgdb_process_estimate function implements a more advanced iterative algorithm. It finds the most likely physical process matrix that would have produced the observed data. MLE is generally preferred as it always returns a valid, physical Choi matrix, but it is computationally more intensive.

Step 5: Analyze the Reconstructed Matrix

(Corresponds to Section: Step 5. Compare estimated process... and Plot Pauli Transfer Matrix...)

Now we have our experimental estimate of the Choi matrix. How well did we do?

1. Quantitative Comparison:
We need a numerical measure of "closeness" between the ideal Choi matrix, , and our experimental one, .

  • Process Fidelity: This is a value between 0 and 1 that measures the overlap between the two processes. A fidelity of 1 means they are identical. The tutorial shows how to calculate it using process_fidelity.
  • Diamond Norm Distance: This is a more rigorous metric that measures the maximum distinguishability between two channels. A distance of 0 means they are identical.

2. Visual Comparison:
Often, a picture is more insightful than a single number. Instead of plotting the Choi matrix directly, it's common to visualize the Pauli Transfer Matrix (PTM). The PTM, which we can call , describes how the process transforms the Pauli operators. Specifically, it shows how the expectation value of an output Pauli operator depends on the input state being prepared along a specific Pauli axis .

The PTM is simply a change of basis from the Choi matrix. The function choi2pauli_liouville performs this conversion. The tutorial plots the ideal PTM alongside the experimental estimates.

Ideal PTM vs. Estimated PTMs

Comparison of Pauli Transfer Matrices. Left: The ideal PTM for an X gate. Middle: The PTM reconstructed using linear inversion. Right: The PTM reconstructed using MLE. The ideal X gate should map I->I, X->X, Y->-Y, and Z->-Z. Deviations from this pattern in the experimental plots indicate errors.

For an ideal X gate, the PTM should be diagonal with entries (1, 1, -1, -1) for the (I, X, Y, Z) components, respectively. Any non-zero off-diagonal elements or deviations in the diagonal elements represent coherent or incoherent errors in the gate implementation.

Test your understanding!

Look at the "MLE Estimate" PTM plot from the tutorial. If the Y-Y element was -0.9 instead of -1.0, and the I-Z element (row I, column Z) was 0.1 instead of 0, what would these two features physically imply about the errors in the implemented RX(pi) gate?

Show answer
  • Y-Y element of -0.9: The ideal value is -1.0. A smaller magnitude (closer to zero) indicates decoherence. It means that if you prepare a state on the Y-axis of the Bloch sphere, after the gate it has partially "shrunk" towards the center. This is characteristic of an incoherent error, like amplitude damping or dephasing.

  • I-Z element of 0.1: The ideal value is 0. An identity I input should always result in an identity I output for a unital map. A non-zero I-Z element means that a process that should do nothing on average to the polarization (I input) is creating some Z-polarization. This indicates a bias or coherent error, perhaps a small unwanted rotation around the Y-axis, which would rotate the identity into a state with a small Z component.

Conclusion

Today, we have completed the full cycle of Quantum Process Tomography. Building on last lesson's theory, you have now seen how to:

  • Implement the full QPT experimental procedure using a Python library.
  • Generate the required set of quantum circuits for preparing input states and measuring output observables.
  • Reconstruct the Choi matrix from simulated experimental data using both linear inversion and maximum likelihood estimation.
  • Analyze the resulting process matrix by visualizing its Pauli Transfer Matrix and calculating quantitative metrics like process fidelity.
  • Interpret the features of the reconstructed process matrix in terms of physical gate errors.

The arxiv paper you read shows these same plots (Choi matrices and Hinton diagrams) for a real two-qubit experiment on an IBM quantum computer, achieving a process fidelity of ~89%. The methods you've used today are exactly what researchers use to characterize the performance of today's noisy quantum hardware.

Preview of the next lesson:
QPT is a powerful tool, but it has a significant flaw: it assumes that our state preparations and measurements (SPAM) are perfect. Any errors in preparing the initial Pauli eigenstates or in the final measurements get incorrectly blamed on the gate itself. This is a major limitation for achieving high-precision characterization. In our next lesson, we will explore Gate Set Tomography (GST), an advanced technique designed to solve this very problem by simultaneously characterizing the gates, the state preparations, and the measurements.

Can't find a good explanation? Sign up and we'll make it for you

Sign up