Skip to main content

Mitiq is an open source toolkit for implementing error mitigation techniques on most current intermediate-scale quantum computers.

Project description

Mitiq logo

build Documentation Status codecov PyPI version arXiv Downloads License Repository Unitary Foundation Discord Chat

Mitiq [mitt • tick] is a Python toolkit for implementing error mitigation techniques on quantum computers.

Current quantum computers are noisy due to interactions with the environment, imperfect gate applications, state preparation and measurement errors, etc. Error mitigation seeks to reduce these effects at the software level by compiling quantum programs in clever ways.

Want to know more?

  • Check out our documentation.
  • For code, repo, or theory questions, especially those requiring more detailed responses, submit a Discussion.
  • For casual or time sensitive questions, chat with mitiq developers on the #mitiq channel on Discord.
  • Contributions to Mitiq are eligible for compensation! More details here, and all payouts can be found on our wiki!

Quickstart

Installation

pip install mitiq

Example

Define a function which takes a circuit as input and returns an expectation value you want to compute, then use Mitiq to mitigate errors.

import cirq
from mitiq import zne, benchmarks


def execute(circuit, noise_level=0.005):
    """Returns Tr[ρ |0⟩⟨0|] where ρ is the state prepared by the circuit
    with depolarizing noise."""
    noisy_circuit = circuit.with_noise(cirq.depolarize(p=noise_level))
    return (
        cirq.DensityMatrixSimulator()
        .simulate(noisy_circuit)
        .final_density_matrix[0, 0]
        .real
    )


circuit = benchmarks.generate_rb_circuits(n_qubits=1, num_cliffords=50)[0]

true_value = execute(circuit, noise_level=0.0)      # Ideal quantum computer
noisy_value = execute(circuit)                      # Noisy quantum computer
zne_value = zne.execute_with_zne(circuit, execute)  # Noisy quantum computer + Mitiq

print(f"Error w/o  Mitiq: {abs((true_value - noisy_value) / true_value):.3f}")
print(f"Error w Mitiq:    {abs((true_value - zne_value) / true_value):.3f}")

Sample output:

Error w/o  Mitiq: 0.264
Error w Mitiq:    0.073

Calibration

Unsure which error mitigation technique or parameters to use? Try out the calibration module demonstrated below to help find the best parameters for your particular backend!

See our guides and examples for more explanation, techniques, and benchmarks.

Quick Tour

Error mitigation techniques

You can check out currently available quantum error mitigation techniques by calling

mitiq.qem_methods()
Technique Documentation Mitiq module Paper Reference(s)
Zero-noise extrapolation ZNE mitiq.zne 1611.09301
1612.02058
1805.04492
Probabilistic error cancellation PEC mitiq.pec 1612.02058
1712.09271
1905.10135
(Variable-noise) Clifford data regression CDR mitiq.cdr 2005.10189
2011.01157
Digital dynamical decoupling DDD mitiq.ddd 9803057
1807.08768
Readout-error mitigation REM mitiq.rem 1907.08518
2006.14044
Quantum Subspace Expansion QSE mitiq.qse 1903.05786
Robust Shadow Estimation 🚧 RSE mitiq.shadows 2011.09636
2002.08953
Layerwise Richardson Extrapolation LRE mitiq.lre 2402.04000
Probabilistic Error Amplification 🚧 Coming soon mitiq.pea Nature
Virtual Distillation 🚧 Coming soon mitiq.vd APS

🚧: Technique is currently a work in progress or is untested and may have some rough edges. If you try any of these techniques and have suggestions, please open an issue!

In addition, we also have Pauli Twirling which is a noise tailoring technique:

Noise-tailoring Technique Documentation Mitiq module Paper Reference(s)
Pauli Twirling PT mitiq.pt 1512.01098

If there is a technique you are looking for not listed here, please file a feature request.

Interface

We refer to any python quantum programming SDK you can write quantum circuits in as a frontend, and any quantum computer / simulator you can simulate circuits on as a backend.

Supported frontends

Cirq Qiskit pyQuil Braket PennyLane Qibo OpenQASM 3
Cirq logo Qiskit logo Rigetti logo AWS logo PennyLane logo Qibo logo

You can install Mitiq support for these frontends by specifying them during installation, as optional extras, along with the main package. To install Mitiq with one or more frontends, you can specify each frontend in square brackets as part of the installation command.

For example, to install Mitiq with support for Qiskit and Qibo:

pip install mitiq[qiskit,qibo]

Here is an up-to-date list of supported frontends.

Note: Currently, Cirq is a core requirement of Mitiq and is installed when you pip install mitiq.

Supported backends

You can use Mitiq with any backend you have access to that can interface with supported frontends.

Citing Mitiq

If you use Mitiq in your research, please reference the Mitiq whitepaper using the bibtex entry found in CITATION.bib.

A list of papers citing Mitiq can be found on Google Scholar / Semantic Scholar.

License

GNU GPL v.3.0.

Contributing

We welcome contributions to Mitiq including bug fixes, feature requests, etc. To get started, check out our contribution guidelines and/or documentation guidelines.

Contributions of all kinds are welcome!

Contributors ✨

Thank you to all of the wonderful people that have made this project possible. Non-code contributors are also much appreciated, and are listed here. Thank you to

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mitiq-0.49.0.tar.gz (255.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mitiq-0.49.0-py3-none-any.whl (338.0 kB view details)

Uploaded Python 3

File details

Details for the file mitiq-0.49.0.tar.gz.

File metadata

  • Download URL: mitiq-0.49.0.tar.gz
  • Upload date:
  • Size: 255.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mitiq-0.49.0.tar.gz
Algorithm Hash digest
SHA256 50df3232e80c59d397fa210a8dd0e032f93fc6fcb5363db0e7d529ba01ed90df
MD5 39257cd0870abefbec64d360def4fed0
BLAKE2b-256 3eaf164545b2fd4186ccf27b4acbcac8bf89fc5e2b20f06d2e194be40ef6affe

See more details on using hashes here.

Provenance

The following attestation bundles were made for mitiq-0.49.0.tar.gz:

Publisher: publish-pypi.yml on unitaryfoundation/mitiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mitiq-0.49.0-py3-none-any.whl.

File metadata

  • Download URL: mitiq-0.49.0-py3-none-any.whl
  • Upload date:
  • Size: 338.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mitiq-0.49.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98779233a19471346512c5151b3b319362e775e6db5b60d4e89eea8e73c26dc5
MD5 da50cce4d66a1ca0f233fa5c0d88b7a2
BLAKE2b-256 fb9830f36b2352197c8c501e6c3e73d2b1d83638587b87ccb2b2821c20c3cb07

See more details on using hashes here.

Provenance

The following attestation bundles were made for mitiq-0.49.0-py3-none-any.whl:

Publisher: publish-pypi.yml on unitaryfoundation/mitiq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page