Skip to main contentIBM Quantum Documentation Preview
This is a preview build of IBM Quantum™ documentation. Refer to docs.quantum.ibm.com for the official documentation.

QESEM: A Qiskit Function by Qedma

Note

Qiskit Functions are an experimental feature available only to IBM Quantum™ Premium Plan users. They are in preview release status and subject to change.


Overview

While quantum processing units have vastly improved in recent years, errors due to noise and imperfections in existing hardware remain a central challenge for quantum algorithm developers. As the field approaches utility-scale quantum computations that cannot be verified classically, solutions for canceling noise with guaranteed accuracy are becoming increasingly important. To overcome this challenge, Qedma has developed Quantum Error Suppression and Error Mitigation (QESEM), seamlessly integrated on IBM Quantum Platform as a Qiskit Function.

With QESEM, users can run their quantum circuits on noisy QPUs to obtain highly accurate error-free results with highly efficient QPU-time overheads, close to fundamental bounds. To achieve this, QESEM leverages a suite of propriety methods developed by Qedma, for the characterization and reduction of errors. Error reduction techniques include gate optimization, noise-aware transpilation, error suppression (ES), and unbiased error mitigation (EM). With this combination of these characterization-based methods, users can achieve reliable, error-free results for generic large-volume quantum circuits, unlocking applications that cannot be accomplished otherwise.


Description

You can use the QESEM function by Qedma to easily estimate and execute your circuits with error suppression and mitigation, achieving larger circuit volumes and higher accuracies. To use QESEM, you provide a quantum circuit, a set of observables to measure, a target statistical accuracy for each observable, and a chosen QPU. Before you run the circuit to the target accuracy, you can estimate the required QPU time based on an analytical calculation that does not require circuit execution. Once you are satisfied with the QPU time estimation, you can execute the circuit with QESEM.

When you execute a circuit, QESEM runs a device characterization protocol tailored to your circuit, yielding a reliable noise model for the errors occurring in the circuit. Based on the characterization, QESEM first implements noise-aware transpilation to map the input circuit onto a set of physical qubits and gates, which minimizes the noise affecting the target observable. These include the natively available gates (CX/CZ on IBM® devices), as well as additional gates optimized by QESEM, forming QESEM’s extended gate set. QESEM then runs a set of characterization-based ES and EM circuits on the QPU and collects their measurement outcomes. These are then classically post-processed to provide an unbiased expectation value and an error bar for each observable, corresponding to the requested accuracy.

Qedma QESEM overview

QESEM has been demonstrated to provide high-accuracy results for a variety of quantum applications and on the largest circuit volumes achievable today. QESEM offers the following user-facing features, demonstrated in the benchmarks section below:

  • Guaranteed accuracy: QESEM outputs unbiased estimations for expectation values of observables. Its EM method is equipped with theoretical guarantees, which - together with Qedma’s cutting-edge characterization - ensure the mitigation converges to the noiseless circuit output up to the user-specified accuracy. In contrast to many heuristic EM methods that are prone to systematic errors or biases, QESEM’s guaranteed accuracy is essential for ensuring reliable results in generic quantum circuits and observables.
  • Scalability to large QPUs: QESEM’s QPU time depends on circuit volumes, but is otherwise independent of the number of qubits. Qedma has demonstrated QESEM on the largest quantum devices available today, including the IBM Quantum 127-qubit Eagle and 133-qubit Heron devices.
  • Application-agnostic: QESEM has been demonstrated on a variety of applications, including Hamiltonian simulation, VQE, QAOA, and amplitude estimation. Users can input any quantum circuit and observable to be measured, and obtain accurate error-free results. The only limitations are dictated by the hardware specifications and allocated QPU time, which determine the accessible circuit volumes and output accuracies. In contrast, many error reduction solutions are application-specific or involve uncontrolled heuristics, rendering them inapplicable for generic quantum circuits and applications.
  • Extended gate set: QESEM supports fractional-angle gates, and provides Qedma-optimized fractional-angle Rzz(θ)Rzz(\theta) gates on IBM Quantum Eagle devices. This extended gate set enables more efficient compilation and unlocks circuit volumes larger by a factor of up to 2 compared to default CX/CZ compilation.
  • Multibase observables: QESEM supports input observables composed of many non-commuting Pauli strings, such as generic Hamiltonians. The choice of measurement bases and the optimization of QPU resource allocation (shots and circuits) is then performed automatically by QESEM to minimize the required QPU time for the requested accuracy. This optimization, which takes into account hardware fidelities and execution rates, enables you to run deeper circuits and obtain higher accuracies.

Benchmarks

QESEM has been tested on a wide variety of use cases and applications. The following examples can assist you with assessing which types of workloads you can run with QESEM.

A key figure of merit for quantifying the hardness of both error mitigation and classical simulation for a given circuit and observable is active volume: the number of CNOT gates affecting the observable in the circuit. The active volume depends on the circuit depth and width, on the observable weight, and on the circuit structure, which determines the light cone of the observable. For further details, see the talk from the 2024 IBM Quantum Summit. QESEM provides particularly large value in the high-volume regime, giving reliable results for generic circuits and observables.

Active volume
ApplicationNumber of qubitsDeviceCircuit descriptionAccuracyTotal timeRuntime usage
VQE circuit8Eagle (r3)21 total layers, 9 measurement bases, 1D chain98%35 min14 min
Kicked Ising28Eagle (r3)3 unique layers x 3 steps, 2D heavy-hex topology97%22 min4 min
Kicked Ising28Eagle (r3)3 unique layers x 8 steps, 2D heavy-hex topology97%116 min23 min
Trotterized Hamiltonian simulation40Eagle (r3)2 unique layers x 10 Trotter steps, 1D chain97%3 hours25 min
Trotterized Hamiltonian simulation119Eagle (r3)3 unique layers x 9 Trotter steps, 2D heavy-hex topology95%6.5 hours45 min
Kicked Ising136Heron (r2)3 unique layers x 15 steps, 2D heavy-hex topology99%52 min9 min

Accuracy is measured here relative to the ideal value of the observable: OidealϵOideal\frac{\langle O \rangle_{ideal} - \epsilon}{\langle O \rangle_{ideal}}, where 'ϵ\epsilon' is the absolute precision of the mitigation (set by the user input), and Oideal\langle O \rangle_{ideal} is the observable at the noiseless circuit. 'Runtime usage' measures the usage of the benchmark in batch mode (sum over usage of individual jobs), whereas 'total time' measures usage in session mode (experiment wall time), which includes additional classical and communication times. QESEM is available for execution in both modes, so that users can make the best use of their available resources.

The 28-qubit Kicked Ising circuits simulate the Discrete Time Quasicrystal studied by Shinjo et al. (see arXiv 2403.16718 and Q2B24 Tokyo) on three connected loops of ibm_kawasaki. The circuit parameters taken here are (θx,θz)=(0.9π,0)(\theta_x, \theta_z) = (0.9 \pi, 0), with a ferromagnetic initial state ψ0=0n| \psi_0 \rangle = | 0 \rangle ^{\otimes n}. The measured observable is the absolute value of the magnetization M=128i=027ZiM = |\frac{1}{28} \sum_{i=0}^{27} \langle Z_i \rangle|. The utility-scale Kicked Ising experiment was run on the 136 best qubits of ibm_fez; this particular benchmark was run at the Clifford angle (θx,θz)=(π,0)(\theta_x, \theta_z) = (\pi, 0), at which the active volume grows slowly with circuit depth, which - together with the high device fidelities - enables high accuracy at a short runtime.

Trotterized Hamiltonian simulation circuits are for a Transverse-Field Ising model at fractional angles: (θzz,θx)=(π/4,π/8)(\theta_{zz}, \theta_x) = (\pi / 4, \pi /8) and (θzz,θx)=(π/6,π/8)(\theta_{zz}, \theta_x) = (\pi / 6, \pi / 8) correspondingly (see Q2B24 Tokyo). The utility-scale circuit was run on the 119 best qubits of ibm_brisbane, whereas the 40-qubit experiment was run on the best available chain. The accuracy is reported for the magnetization; high-accuracy results were obtained for higher-weight observables as well.

The VQE circuit was developed together with researchers from the Center for Quantum Technology and Applications at the Deutsches Elektronen-Synchrotron (DESY). The target observable here was a Hamiltonian consisting of a large number of non-commuting Pauli strings, emphasizing QESEM's optimized performance for multi-basis observables. Mitigation was applied to a classically-optimized ansatz; although these results are still unpublished, results of the same quality will be obtained for different circuits with similar structural properties.


Get started

Authenticate using your IBM Quantum Platform API token, and select the QESEM Qiskit Function as follows:

import qiskit
 
from qiskit_ibm_catalog import QiskitFunctionsCatalog
 
catalog = QiskitFunctionsCatalog(token="<YOUR_IQP_API_TOKEN>")
 
qesem_function = catalog.load("qedma/qesem")

Example

To get started, try this basic example of estimating the required QPU time to run the QESEM for a given pub:

circ = qiskit.QuantumCircuit(5)
circ.cx(0, 1)
circ.cx(2, 3)
circ.cx(1, 2)
circ.cx(3, 4)
 
avg_magnetization = qiskit.quantum_info.SparsePauliOp.from_sparse_list(
    [("Z", [q], 1 / 5) for q in range(5)], num_qubits=5
)
other_observable = qiskit.quantum_info.SparsePauliOp.from_sparse_list(
    [("ZZ", [0, 1], 1.0), ("XZ", [1, 4], 0.5)], num_qubits=5
)
 
job = qesem_function.run(
    instance="hub1/group1/project1",
    pubs=[(circ, [avg_magnetization, other_observable])],
    options={
        "estimate_time_only": True,
    },
    backend_name="ibm_brisbane",
)

The following example executes a QESEM job:

job = qesem_function.run(
    instance="hub1/group1/project1",
    pubs=[(circ, [avg_magnetization, other_observable])],
    backend_name="ibm_brisbane",
)

You can use the familiar Qiskit Serverless APIs to check your Qiskit Function workload's status or return results:

print(job.status())
result = job.result()

Function parameters

NameTypeDescriptionRequiredDefaultExample
pubsEstimatorPubLikeThis is the main input. The Pub contains 2-4 elements: a circuit, one or more observables, 0 or a single set of parameter values, and an optional precision. If a precision was not specified, then the default_precision from options will be usedYesN/A[(circuit, [obs1,obs2,obs3], parameter_values, 0.03)]
backend_namestringName of the backend to useNoQESEM will get least busy device reported by IBM"ibm_fez"
instancestringThe hub/group/project to use in that formatNoN/A“hub1/group1/project1”
optionsdictionaryInput options. See Options section for more details.NoSee the Options section for details.{ default_precision = 0.03, "max_execution_time" = 3600, "transpilation_level" = 0, "estimate_time_only" = False}

Options

OptionChoicesDescriptionDefault
estimate_time_onlyTrue / FalseSpecifies whether to execute the mitigation process or only get QPU time estimation. Please note that the QPU time estimation process does not consume QPU time.False
default_precision0 < floatWill apply to pubs that don't have presicion. The precision signifies the acceptable error on the expectation values of the observables in absolute value. Namely, the QPU runtime for mitigation will be determined to provide output values for all the observables of interest that fall within a confidence interval of the target precision. If multiple observables are provided, the mitigation will run until the target precision is reached for each of the input observables.0.02
max_execution_time0 < integer < 28,800 (8 hours)Allows you to limit the QPU time, specified in seconds, to be used for the entire QESEM process. Please find additional details below.3,600 (one hour)
transpilation_level0 / 1See description below1
Caution
The QPU time estimation changes from one backend to another. Therefore, when executing the QESEM function, make sure to run it on the same backend that was selected when obtaining the QPU time estimation.
Note
QESEM will end its run when it reaches the target precision or when it reaches max_execution_time, whichever comes first.
  • max_execution_time: Allows you to limit the QPU time, specified in seconds, to be used for the entire QESEM process. Since the final QPU time required to reach the target accuracy is determined dynamically during the QESEM job, this parameter enables you to limit the cost of the experiment. If the dynamically-determined QPU time is shorter than the time allocated by the user, this parameter will not affect the experiment. The max_execution_time parameter is particularly useful in cases where the analytical time estimate provided by QESEM before the job starts is too pessimistic and the user wants to initiate a mitigation job anyway. After the time limit it reached, QESEM stops sending new circuits. Circuits that have already been sent continue running (so the total time may surpass the limit by up to 30 minutes), and the user receives the processed results from the circuits that ran up to that point. If you want to apply a QPU time limit shorter than the analytical time estimate, consult with Qedma to obtain an estimate for the accuracy achievable within the time limit.

  • transpilation_level: After a circuit is submitted to QESEM, it automatically prepares several alternative circuit transpilations and chooses the one that minimizes QPU time. For instance, alternative transpilations might utilize Qedma-optimized fractional RZZ gates to reduce the circuit depth. Of course, all transpilations are equivalent to the input circuit, in terms of their ideal output. To exert more control over the circuit transpilation, set the transpilation level in the options. While "transpilation_level": 1 corresponds to the default behavior described above, "transpilation_level": 0 includes only minimal modifications required to the original circuit; for example, ‘layerification’ - the organization of circuit operations into ‘layers’ of simultaneous two-qubit gates. Note that automatic hardware-mapping onto high-fidelity qubits is applied in any case.

transpilation_leveldescription
1Default QESEM transpilation. Prepares several alternative transpilations and chooses the one that minimizes QPU time. Barriers may be modified in the layerification step.
0Minimal transpilation: the mitigated circuit will closely resemble the input circuit structurally. Circuits provided in level 0 should match the device connectivity and should be specified in terms of the following gates: CX, Rzz(α), and standard single-qubit gates (U, x, sx, rz, and so on). Barriers will be respected in the layerification step.
Note

Barriers operations are typically used to specify the layers of two-qubit gates in quantum circuits. In level 0, QESEM preserves the layers specified by the barriers. In level 1, the layers specified by the barriers are considered as one transpilation alternative when minimizing QPU time.

Outputs

The output of a Circuit function is a PrimitiveResult, which contains two fields:

  • One PubResult object. It can be indexed directly from the PrimitiveResult.

  • Job-level metadata.

Each PubResult contains a data and a metadata field.

  • The data field contains at least an array of expectation values (PubResult.data.evs) and an array of standard errors (PubResult.data.stds). It can also contain more data, depending on the options used.

  • The metadata field contains PUB-level metadata (PubResult.metadata).

The following code snippet describes how to retrieve the QPU time estimation (i.e., estimate_time_only is True):

print(f"The estimated QPU time for this PUB is: \n{result[0].metadata}")

Output:

The estimated QPU time for this PUB is: 
{'time_estimation_sec': 3600}

The following code snippet describes how to retrieve the mitigation results (i.e., estimate_time_only is False).

print(f"The result of the submitted job had {len(result)} PUB")
print(
    f"The expectation values measured from this PUB are: \n{result[0].data.evs}"
)
print(f"The error-bar values are: \n{result[0].data.stds}")
print(
    f"And the associated metadata contains the original observables, making the results easier to interpret: \n{result[0].metadata}"
)

Output:

The result of the submitted job had 1 PUB
The expectation values measured from this PUB are: 
[0.98, 1.01]
The error-bar values are: 
[0.028, 0.015]
And the associated metadata contains the original observables, making the results easier to interpret: 
{
    'observables': [
        SparsePauliOp(
            ['IIIIZ', 'IIIZI', 'IIZII', 'IZIII', 'ZIIII'],
            coeffs=[0.2 + 0.0j, 0.2 + 0.0j, 0.2 + 0.0j, 0.2 + 0.0j, 0.2 + 0.0j]
        ),
        SparsePauliOp(
            ['IIIZZ', 'ZIXII'],
            coeffs=[1.0 + 0.0j, 0.5 + 0.0j]
        )
    ]
}

Fetch error messages

If your workload status is ERROR, use job.result() to fetch the error message to fetch the error message as follows:

print(job.result())

Get support

The Qedma support team is here to help! If you encounter any issues or have questions about using the QESEM Qiskit Function, please don't hesitate to reach out. Our knowledgeable and friendly support staff are ready to assist you with any technical concerns or inquiries you may have.

You can email us at support@qedma.com for assistance. Please include as much detail as possible about the issue you're experiencing to help us provide a swift and accurate response. You can also contact your dedicated Qedma POC representative via email or phone.

To help us assist you more efficiently, please provide the following information when you contact us:

  • A detailed description of the issue
  • The job ID
  • Any relevant error messages or codes

We are committed to providing you with prompt and effective support to ensure you have the best possible experience with our Qiskit Function.

We are always looking to improve our product and we welcome your suggestions! If you have ideas on how we can enhance our services or features you'd like to see, please send us your thoughts at support@qedma.com


Next steps