Frontends and Backends#

Mitiq-specific types#

There are a number of types that are specific to Mitiq defined in mitiq._typing, the most important being mitiq.QPROGRAM and QuantumResult. These types are both unions of a number of other types that make it easier to annotate other functions in Mitiq, independent of the user choice of frameworks. The Mitiq-defined type mitiq.QPROGRAM uses any of the program types from the supported platforms that are installed on the system. For example, if you haven’t installed PyQuil, then even though Mitiq supports it, you will not be able to use PyQuil programs in Mitiq until it is installed.


Mitiq only supports non-adaptive quantum programs without classical control flow or mid-circuit measurements. This class of programs is more commonly known as circuits by many other tools and frameworks in quantum computing.

The Mitiq-defined type QuantumResult is a union of the types defined in mitiq._typing that are used to represent the results of running a quantum program. For example, for hardware, the result can be a list of bitstrings (representing raw measurements) or an expectation value expressed as a real number. For simulators, more information can be made available like the resulting density matrix, which is a valid object of the QuantumResult type.


Mitiq can accept quantum circuit representations in a variety of formats from different tools or platforms. These input formats are referred to here as frontends. The frameworks currently supported are:

import mitiq

dict_keys(['cirq', 'pyquil', 'qiskit', 'braket', 'pennylane'])

with Cirq being used for the internal implementations of the mitigation methods. There is also frontend support for any circuit description that complies with the OpenQASM 2.0 standard.

With any of these frontends (with the exception of Cirq), the circuit representation will be converted internally to a Cirq circuit object with the relevant conversion methods in mitiq.interface for each frontend. For example, you can use mitiq.interface.mitiq_braket.conversions.from_braket() to convert a Braket circuit to a Cirq circuit.

Examples for using each of the frameworks to represent the input to a mitigation method are linked below.


A backend is any simulator or hardware device that can be used to execute programs that are valid mitiq.QPROGRAM objects. These backends are usually installed separately as needed by the user. Backends are used by Mitiq in the Executor class to run the mitigated mitiq.QPROGRAM objects.

Executing programs#

Once you have selected a frontend and backend combination that are compatible, the next step is to set up the execution of a quantum program. The Executor class is used to execute quantum programs, and is constructed by providing a function with the following signature: mitiq.QPROGRAM -> QuantumResult. For more information on executors, see the Executors section of this guide.

Batch execution of programs#

You can also use the Executor class to execute a batch of quantum programs all in one go. To perform batched execution, you can use the same mitiq.Executor class constructor and pass a function with the following signature: T[mitiq.QPROGRAM] -> T[{class}".QuantumResult"] where T is Sequence, List, Tuple, or Iterable.

For more information on batched executors and example code, see the Executors section of this guide.