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

Configure noise management with Estimator

  • The code on this page was developed using the following requirements. We recommend using these versions or newer.

    qiskit-ibm-runtime~=0.45.1
    

There are several ways to manage noise, typically by using various error mitigation and error suppression techniques to avoid errors before they happen. These techniques usually cause pre-processing overhead. Therefore, it is important to achieve a balance between perfecting your results and ensuring that your job completes in a reasonable amount of time.

Estimator supports the following noise management techniques. See Error mitigation and suppression techniques for an explanation of each. See the Custom error settings section for instructions to enable these techniques.


Resilience level

The resilience_level specifies how much resilience to build against errors. Higher levels generate more accurate results, at the expense of longer processing times. Resilience levels can be used to configure the cost/accuracy trade-off when applying noise management to your primitive query. Noise management reduces errors (bias) in results by processing the outputs from a collection, or ensemble, of related circuits. The degree of error reduction depends on the method applied. The resilience level abstracts the detailed choice of noise management method to allow users to reason about the cost/accuracy trade that is appropriate to their application.

Given this, each level corresponds to a method or methods with increasing level of quantum sampling overhead to enable you experiment with different time-accuracy tradeoffs. The following table shows you which levels and corresponding methods are available for each of the primitives.

Resilience Level
Description
Technique
0No mitigationNone
1 [Default]Minimal mitigation costs: Mitigate error associated with readout errorsTwirled Readout Error eXtinction (TREX) measurement twirling
2Medium mitigation costs. Typically reduces bias in estimators, but is not guaranteed to be zero-bias.Level 1 + Zero Noise Extrapolation (ZNE) and gate twirling
Attention

Resilience levels are currently in beta so sampling overhead and solution quality will vary from circuit to circuit. New features, advanced options, and management tools will be released on a rolling basis. Specific noise management methods are not guaranteed to be applied at each resilience level.

Configure Estimator with resilience levels

You can use resilience levels to specify noise management techniques, or you can set custom techniques individually as described in Custom error settings.

Important

Any options you manually specify in addition to the resilience level are applied in addition to the base set of options defined by the resilience level. Therefore, in principle, you could set the resilience level to 1, but then turn off measurement mitigation, although this is not advised.

For example, setting the resilience level to 0 turns off zne_mitigation, but estimator.options.resilience.zne_mitigation = True overrides that value.

Example

The following code enables ZNE, TREX, and gate twirling by setting resilience_level 2.

from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime import EstimatorV2 as Estimator

service = QiskitRuntimeService()
backend = service.least_busy(operational=True, simulator=False)

# Setting options during primitive initialization
estimator = Estimator(backend, options={"resilience_level": 2})

Custom noise management settings

You can turn on and off individual noise management methods by using the Estimator options.

Note

Not all options work together on all types of circuits. See the feature compatibility table for details.

Example

from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime import EstimatorV2 as Estimator

service = QiskitRuntimeService()
backend = service.least_busy(operational=True, simulator=False)

estimator = Estimator(backend)
options = estimator.options
# Turn on gate twirling.
options.twirling.enable_gates = True
# Turn on measurement error mitigation.
options.resilience.measure_mitigation = True

print(
    f">>> gate twirling is turned on: {estimator.options.twirling.enable_gates}"
)
print(
    f">>> measurement error mitigation is turned on: {estimator.options.resilience.measure_mitigation}"
)

Turn off all error mitigation

For instructions to turn off all error mitigation see the Turn off all error suppression and mitigation section in the Estimator options guide.


Next steps

Recommendations