Error mitigation with Mitiq and PennyLane

Mitiq and PennyLane teams

We are excited to announce that PennyLane is now integrated with Mitiq, a software toolkit from the Unitary Fund for mitigating errors on quantum hardware. You can now bring error mitigation to noisy circuits in PennyLane! 📢🚫

If you have ever run a circuit on current quantum hardware, you’ll have noticed a significant amount of noise in your results. Although the long-term plan of quantum computing is to work towards error-corrected hardware, we still need to get the most out of today’s devices. The goal of error mitigation is to minimize the effects of noise by executing a family of related circuits on hardware and using the results to estimate an error-free value.

As of version 0.19 of PennyLane and version 0.11 of Mitiq, you can now get to grips with error mitigation in PennyLane with Mitiq as a backend. The easiest way to get started is through the mitigate_with_zne circuit transform, which provides access to the zero-noise extrapolation (ZNE) method of error mitigation. If you have a noisy device dev_noisy, a mitigated circuit can be constructed by simply adding the mitigate_with_zne decorator:

import pennylane as qml
from mitiq.zne.scaling import fold_global as folding
from mitiq.zne.inference import RichardsonFactory

extrapolate = RichardsonFactory.extrapolate
scale_factors = [1, 2, 3]
n_wires = 4

@qml.transforms.mitigate_with_zne(scale_factors, folding, extrapolate)
def circuit(w1, w2):
    qml.SimplifiedTwoDesign(w1, w2, wires=range(n_wires))
    return qml.expval(qml.PauliZ(0))

Now executions of circuit will be error-mitigated automatically! The code above leverages the fold_global and RichardsonFactory functionality available in Mitiq.

If you’d like to know more, you can check out our error mitigation demo to gain a greater understanding of how things work behind the scenes. This demo also showcases the use of error mitigation for a more practical task in quantum chemistry: calculating the potential energy surface of molecular hydrogen.


As showcased in this plot, error mitigation lets us get closer to the ideal noise-free surface. 👨‍🔬🧪⚗️👍

The Mitiq and PennyLane teams will keep working to make error mitigation as easy as possible. Let us know about your experiences and we’ll be happy to help!

Tags: hardware, mitiq, transforms
Last modified: 14:11, 29 Nov 2021