AWS Quantum Technologies Blog

Error mitigation on Amazon Braket with program sets and Mitiq

To get the most out of today’s noisy quantum computers, quantum computational experiments commonly utilize quantum error mitigation (QEM) techniques. These methods include discarding known noisy results (post selection), modifying underlying pulse sequences, amplifying noise within a quantum circuit, and many more. QEM does not offer fault tolerant or error-free means of computation but can generally be used to improve the quality of a result, for example increasing signal from noise via repeated observations.

post, you will learn how Amazon Braket’s program sets can be used for error mitigation with toolkits such as Mitiq to improve quantum computational accuracy while substantially reducing task-related costs. Using program sets, we performed a 30-qubit error mitigation experiment on Rigetti’s Ankaa-3 processor that achieved more than 12x reduction in error with an 86x reduction in task costs. Here, we highlight some common error mitigation techniques, detailed in new notebooks in the Amazon Braket Examples repository.

Error mitigation and program sets

Amazon Braket’s program sets are well suited for common error mitigation tasks on today’s quantum devices, as many variations of a single quantum circuit are required. With program sets, you can submit multiple circuits in a single task, which speeds up execution times and decreases the total cost for task submissions.

Figure 1. Depicts how an error mitigated workflow can generate multiple copies – here from an observable, a set of noise amplified circuits for use in zero-noise extrapolation, and variations from Pauli twirling. These can all be executed in a single program set on Amazon Braket.

Figure 1. Depicts how an error mitigated workflow can generate multiple copies – here from an observable, a set of noise amplified circuits for use in zero-noise extrapolation, and variations from Pauli twirling. These can all be executed in a single program set on Amazon Braket.

In addition to increasing the number of circuits, error mitigation has a theoretical worst-case exponential scaling in the number of additional shots, leading to increased cost and execution time. The examples below and in the Example Notebooks, provide resources to help understand these overheads while using program sets for different error mitigation techniques.

Exploring error mitigation approaches with Mitiq

Mitiq is an open-source library that provides tools for implementing and researching error mitigation approaches. Mitiq natively supports most Braket circuit features and enables design-your-own executors, allowing Braket users to easily explore error mitigation primitives.

The Amazon Braket Examples repository includes examples demonstrating program sets with Mitiq, along with a collection of pre-built program-set-compatible executors.

from mitiq.zne import RichardsonFactory, execute_with_zne
# below is from examples 
from mitiq_braket_tools import braket_expectation_executor
from braket.circuits import Circuit
from braket.circuits.observables import Z

base_circ = Circuit().h(0).cnot(0,1)

executor = braket_expectation_executor(
    noisy_device, # bring any noisy Device
    Z(0) @ Z(1), 
    shots=10000, 
    verbatim=False, 
    batch_if_possible=False)

noisy_result = executor.evaluate(base_circ)[0]
print(f"Noisy Result: {noisy_result}")

zne_result = execute_with_zne(base_circ, executor)
print(f"Zero-Noise-Extrapolation Result: {zne_result}")

Below, we look at three common error mitigation techniques, further detailed in example notebooks. Mitiq supports additional approaches such as probabilistic error cancellation, Clifford data regression, quantum subspace expansion, dynamical decoupling, etc. Some of these methods require more detailed noise characterization but can benefit significantly from program sets.

Readout error mitigation (REM)

Readout error mitigation involves correcting the output distribution according to known state preparation and measurement errors. Full characterization of the confusion matrix, which is then inverted, scales exponentially with the number of qubits. This overhead can be reduced substantially by considering only local errors or by applying Pauli twirling for measurement channels.

Figure 2. Readout mitigated GHZ state for a 6-qubit system, using an inverse confusion matrix approach as well as a post-selection based approach, both supported with Mitiq.

Figure 2. Readout mitigated GHZ state for a 6-qubit system, using an inverse confusion matrix approach as well as a post-selection based approach, both supported with Mitiq.

A full characterization or the characterization of the randomized measurement channel shown above can be easily carried out in a single program set. Generally, readout error mitigation provides a constant overhead increase in the standard error, proportional to the system size. This size dependence can be removed when looking at observables that depend only on local observables, such as 1- or 2-local Pauli observables.

Zero-noise extrapolation (ZNE)

Zero-noise extrapolation is an additional error mitigation technique which models the density matrix or expectation value as a function of a tunable noise parameter. ZNE measures results at several points and extrapolates to the zero-noise limit. A single program set can be used to easily submit all noise-amplified points. Mitiq includes multiple folding strategies or gate insertion techniques (to increase noise), and extrapolating functions that you can test, visualize, and apply to your system.

Figure 3. Expectation values from noisy data and extrapolations to the zero-noise limit with different extrapolation methods, for a variety of simulated noisy circuits.

Figure 3. Expectation values from noisy data and extrapolations to the zero-noise limit with different extrapolation methods, for a variety of simulated noisy circuits.

The precision of the zero-noise limit depends on the extrapolation method used, which can vary from traditional least squares approaches to more complex logarithmic regressions or exact polynomial fitting. In Figure 4, we compare different extrapolation methods that are available with Mitiq.

Pauli twirling (PT)

Pauli twirling is a technique used in error mitigation to transform a noisy quantum channel to a standard form. Randomized Pauli twirling inserts specific gates around noisy operators that do not affect the ideal unitary behavior. When taken over many iterations, the effect is to normalize the noise channel with respect to many input states.

We can twirl a circuit many times and combine all the twirled variants into a single program set. This approach standardizes the fidelity and is especially useful for biased noise.

Figure 4. Equivalent CNOT gates representing different twirls from the Pauli group.

Figure 4. Equivalent CNOT gates representing different twirls from the Pauli group.

Combining error mitigation approaches also can lead to substantial complexity, as error mitigation procedures are applied at different points throughout a computational workflow. In the examples we dive into how a composite workflow with REM, PT, and ZNE can be built using program sets.

An error mitigation workflow on Rigetti’s Ankaa-3

Running error mitigated workflows on quantum hardware requires additional steps because device noise is non-uniform, and each device has native gates sets and device-specific characteristics. A final notebook demonstrates how to build, test, and run one such workflow using Amazon Braket.

We executed a 30-qubit linearly entangled circuit with Rigetti’s native iSWAP gates, using an error mitigated workflow consisting of readout error mitigation, Pauli twirling, and exponential zero-noise extrapolation. This approach reduced the expectation value error by 12-30x compared to the noisy result. The workload consists of 100 readout circuits and 320 circuit variations, requiring 4 program sets, which reduces the associated task costs by 86x. The circuit utilizes an 11x shot overhead: 4x from ZNE and ~2.5x from readout error mitigation

The first step optimizes the measurement basis distribution of our target observable to reduce variance. Next, we select a suitable circuit layout. Using the qiskit-braket-provider, we select qubits with low iSWAP, gate, and readout infidelities.

Figure 5. Laying out a 30Q circuit onto Ankaa-3. The colors (red worst, blue best) for nodes and edges are proportional to readout and iSWAP infidelities, respectively.

Figure 5. Laying out a 30Q circuit onto Ankaa-3. The colors (red worst, blue best) for nodes and edges are proportional to readout and iSWAP infidelities, respectively.

We incorporate additional optimizations including native Pauli twirling, sparse readout error mitigation with readout twirling, and distributing shots proportionally to the extrapolation method. The entire workflow can be verified on a smaller qubit system using the Ankaa-3 emulator, which validates nativization and can simulate smaller system to predict performance.

The resulting distribution in Figure 6, shows where the observable norm is normalized to 1. The error bounds and standard deviations fall within the expected precision (), showing how error mitigation improves our result.

Figure 6. Error mitigated result (EM) for a 30-qubit circuit with normalized error bars, against the ideal and noisy result from Ankaa-3.

Figure 6. Error mitigated result (EM) for a 30-qubit circuit with normalized error bars, against the ideal and noisy result from Ankaa-3.

Conclusion

Error mitigation is an important tool to maximize performance on today’s noisy quantum systems. In this post, you learned how common error mitigation techniques such as readout error mitigation, zero-noise extrapolation, and Pauli twirling, can be carried out using Amazon Braket’s program sets. Our 30-qubit example on Rigetti’s Ankaa-3 achieved a 12-30x error reduction with an 86-fold reduction in associated task cost using error mitigation with program sets.

To get started with error mitigation on Amazon Braket: