---
title: Specify Estimator options
description: Specify options when building with the Estimator primitive.
source: https://eu-de.quantum.cloud.ibm.com/docs/en/guides/estimator-options
---

# Specify Estimator options

### Package versions

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

```
qiskit[all]~=2.5.1
qiskit-ibm-runtime~=0.47.0
```

You can use options to customize the Estimator primitive. While the interface of the primitives' `run()`  method is common across all implementations, their options are not. Consult the API references for information about the [`qiskit.primitives.BaseEstimatorV2`](/docs/api/qiskit/qiskit.primitives.BaseEstimatorV2) and [`qiskit_aer.BaseEstimatorV2`](https://qiskit.github.io/qiskit-aer/stubs/qiskit_aer.primitives.EstimatorV2.html) options.

Notes :

> **Notes about specifying options in the Estimator primitives**
>
> - You can see the available options and update option values during or after Estimator initialization.
> - Use the `update()` method to apply changes to the `options` attribute.
> - If you do not specify a value for an option, it is given a special value of `Unset` and the server defaults are used.
> - The `options` attribute is the `dataclass` Python type.  You can use the built-in `asdict` method to convert it to a dictionary.

## Set Estimator options

You can set options when initializing Estimator, after initializing Estimator, or (for `precision` only), in the `run()` method.

### Primitive initialization

You can pass in an instance of the options class or a dictionary when initializing Estimator, which then makes a copy of those options. Thus, changing the original dictionary or options instance doesn't affect the options owned by the primitive.

#### Options class

When creating an instance of the `EstimatorV2` class, you can pass in an instance of the options class. Those options will then be applied when you use `run()` to perform the calculation.  Specify the options in this format:  `options.option.sub-option.sub-sub-option = choice`.  For example: `options.dynamical_decoupling.enable = True`

Example:

```python
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime import EstimatorV2 as Estimator
from qiskit_ibm_runtime.options import EstimatorOptions

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

options = EstimatorOptions(
    resilience_level=2,
    resilience={"zne_mitigation": True, "zne": {"noise_factors": [1, 3, 5]}},
)

# or...
options = EstimatorOptions()
options.resilience_level = 2
options.resilience.zne_mitigation = True
options.resilience.zne.noise_factors = [1, 3, 5]

estimator = Estimator(mode=backend, options=options)
```

#### Dictionary

You can specify options as a dictionary when initializing Estimator.

```python
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 initialization
estimator = Estimator(
    backend,
    options={
        "resilience_level": 2,
        "resilience": {
            "zne_mitigation": True,
            "zne": {"noise_factors": [1, 3, 5]},
        },
    },
)
```

### Update options after initialization

You can specify the options in this format: `estimator.options.option.sub-option.sub-sub-option = choice` to take advantage of auto-complete, or use the `update()` method to make bulk updates.

The `EstimatorV2` options class ([`EstimatorOptions`](/docs/api/qiskit-ibm-runtime/options-estimator-options)) does not need to be instantiated if you are setting options after initializing the primitive.

```python
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(mode=backend)

# Setting options after initialization
# This uses auto-complete.
estimator.options.default_precision = 0.01
# This does bulk update.
estimator.options.update(
    default_precision=0.02, resilience={"zne_mitigation": True}
)
```

### Run() method

The only values you can pass to `run()` are those defined in the interface.  That is, `precision` for Estimator. This overwrites any value set for `default_precision` for the current run.

```python
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime import EstimatorV2 as Estimator
from qiskit.circuit.library import random_iqp
from qiskit.transpiler import generate_preset_pass_manager
from qiskit.quantum_info import SparsePauliOp

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

circuit1 = random_iqp(3)
circuit1.measure_all()
circuit2 = random_iqp(3)
circuit2.measure_all()

observable = SparsePauliOp("Z" * 3)

pass_manager = generate_preset_pass_manager(
    optimization_level=3, backend=backend
)

transpiled1 = pass_manager.run(circuit1)
transpiled2 = pass_manager.run(circuit2)
isa_observable1 = observable.apply_layout(transpiled1.layout)
isa_observable2 = observable.apply_layout(transpiled2.layout)

estimator = Estimator(mode=backend)
# Default precision to use if not specified in run()
estimator.options.default_precision = 0.01
# Run two circuits, requiring a precision of .02 for both.
estimator.run(
    [(transpiled1, isa_observable1), (transpiled2, isa_observable2)],
    precision=0.02,
)
```

Output:

```
<RuntimeJobV2('d9mqa0g8csec73fagtl0', 'estimator')>
```

### Special case: precision

The `EstimatorV2.run` method accepts two arguments: a list of PUBs, each of which can specify a PUB-specific value for precision, and a precision keyword argument. These precision values are a part of the Estimator execution interface, and are independent of the Runtime Estimator's options.  They take precedence over any values specified as options in order to comply with the Estimator abstraction.

However, if `precision` is not specified by any PUB or in the run keyword argument (or if they are all `None`), then the precision value from the options is used, most notably `default_precision`.

> **Note**
>
> These precision parameters are only for specifying *target* precision, and the results are not guaranteed to reach the specified precision.

Note that Estimator options contain both `default_shots` and `default_precision`. However, because gate-twirling is enabled by default, the product of `num_randomizations` and `shots_per_randomization` takes precedence over those two options.

Specifically, for any Estimator PUB:

1. If the PUB specifies precision, use that value.
2. If the precision keyword argument is specified in `run`, use that value.
3. If `twirling` is enabled  (True by default), then the product of `num_randomizations` and `shots_per_randomization`, as specified as  [`twirling` options](/docs/api/qiskit-ibm-runtime/options-twirling-options), is used.
4. If `estimator.options.default_shots` is specified, use that value to control the amount of data.
5. If `estimator.options.default_precision` is specified, use that value.

For example, if precision is specified in all four places, the one with highest precedence (precision specified in the PUB) is used.

> **Note**
>
> Although precision specified in the PUB and in `run` have higher precedence, the job fails if `twirling` is enabled and the product of `num_randomizations` and `shots_per_randomization` is smaller than the shots needed to achieve the precision. In this scenario, `EstimatorV2` is unable to allocate the shots among the specified `num_randomizations`.

> **Note**
>
> Precision scales inversely with usage.  That is, the lower the precision, the more QPU time it takes to run.

```python
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime import EstimatorV2 as Estimator
from qiskit.circuit.library import random_iqp
from qiskit.transpiler import generate_preset_pass_manager
from qiskit.quantum_info import SparsePauliOp

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

observable = SparsePauliOp("Z" * 3)

circuit = random_iqp(3)
circuit.measure_all()

pass_manager = generate_preset_pass_manager(
    optimization_level=3, backend=backend
)

isa_circuit = pass_manager.run(circuit)
isa_observable = observable.apply_layout(isa_circuit.layout)

# Setting precision during primitive initialization
estimator = Estimator(mode=backend, options={"default_precision": 0.05})

# Run with precision=0.02, overwriting the default.
estimator.run(
    [(isa_circuit, isa_observable1)],
    precision=0.02,
)
```

Output:

```
<RuntimeJobV2('d9mqa2o8csec73fagtpg', 'estimator')>
```

## Turn off all error mitigation and error suppression

You can turn off all error mitigation and suppression if you are, for example, doing research on your own mitigation techniques. To accomplish this, set `resilience_level = 0`.

Example:

```python
from qiskit_ibm_runtime import EstimatorV2 as Estimator, QiskitRuntimeService

# Define the service.  This allows you to access an IBM QPU.
service = QiskitRuntimeService()

# Get a backend
backend = service.least_busy(operational=True, simulator=False)

# Define Estimator
estimator = Estimator(backend)

options = estimator.options

# Turn off all error mitigation and suppression
options.resilience_level = 0
```

## Available options

The following table documents options from the latest version of `qiskit-ibm-runtime`. To see older option versions, visit the [`qiskit-ibm-runtime` API reference](/docs/api/qiskit-ibm-runtime) and select a previous version.

### \`default\_shots\`

The total number of shots to use per circuit per configuration.

**Choices**: Integer >= 0

**Default**: None

[`default_shots` API documentation](/docs/api/qiskit-ibm-runtime/options-estimator-options#default_shots)

### \`default\_precision\`

The default precision to use for any PUB or `run()` call that does not specify one.

**Choices**: Float > 0

**Default**: 0.015625 (1 / sqrt(4096))

[`default_precision` API documentation](/docs/api/qiskit-ibm-runtime/options-estimator-options#default_precision)

### \`dynamical\_decoupling\`

Control dynamical decoupling error mitigation settings.

[`dynamical_decoupling` API documentation](/docs/api/qiskit-ibm-runtime/options-estimator-options#dynamical_decoupling)

### \`dynamical\_decoupling.enable\`

**Choices**: `True`, `False`

**Default**: `False`

### \`dynamical\_decoupling.extra\_slack\_distribution\`

**Choices**: `middle`, `edges`

**Default**: `middle`

### \`dynamical\_decoupling.scheduling\_method\`

Choices: `asap`, `alap`
Default: `alap`

### \`dynamical\_decoupling.sequence\_type\`

Choices: `XX`, `XpXm`, `XY4`
Default: `XX`

### \`dynamical\_decoupling.skip\_reset\_qubits\`

Choices: `True`, `False`
Default: `False`

### \`environment\`

[`environment` API documentation](/docs/api/qiskit-ibm-runtime/options-estimator-options#environment)

### \`environment.callback\`

Callable function that receives the `Job ID` and `Job result`.

**Choices**: None

**Default**: None

### \`environment.job\_tags\`

List of tags.

**Choices**: None

**Default**: None

### \`environment.log\_level\`

**Choices**: DEBUG, INFO, WARNING, ERROR, CRITICAL

**Default**: WARNING

### \`environment.private\`

**Choices**: `True`, `False`

**Default**: `False`

### \`execution\`

[`execution` API documentation](/docs/api/qiskit-ibm-runtime/options-estimator-options#execution)

### \`execution.init\_qubits\`

Whether to reset the qubits to the ground state for each shot.

**Choices**: `True`, `False`

**Default**: `True`

### \`execution.rep\_delay\`

The delay between a measurement and the subsequent quantum circuit.

**Choices**: Value in the range supplied by `backend.rep_delay_range`

**Default**: Given by `backend.default_rep_delay`

### \`max\_execution\_time\`

Limits how long a job can run, in seconds. See the [maximum execution time](/docs/guides/max-execution-time) guide for details.

**Choices**: Integer number of seconds in the range \[1, 10800]

**Default**: 10800 (3 hours)

### \`resilience\`

Advanced resilience options to fine tune the resilience strategy.

[`resilience` API documentation](/docs/api/qiskit-ibm-runtime/options-estimator-options#resilience)

### \`resilience.layer\_noise\_learning\`

Options for learning layer noise.

[`resilience.layer_noise_learning` API documentation](/docs/api/qiskit-ibm-runtime/options-layer-noise-learning-options)

### \`resilience.layer\_noise\_learning.layer\_pair\_depths\`

**Choices**: list\[int] of 2-10 values in the range \[0, 200]

**Default**: `(0, 1, 2, 4, 16, 32)`

### \`resilience.layer\_noise\_learning.max\_layers\_to\_learn\`

**Choices**: None, Integer >= 1

**Default**: `4`

### \`resilience.layer\_noise\_learning.num\_randomizations\`

**Choices**: Integer >= 1

**Default**: `32`

### \`resilience.layer\_noise\_learning.shots\_per\_randomization\`

**Choices**: Integer >= 1

**Default**: `128`

### \`resilience.layer\_noise\_model\`

**Choices**: `NoiseLearnerResult`, `Sequence[LayerError]`

**Default**: None

### \`resilience.measure\_mitigation\`

**Choices**: `True`, `False`

**Default**: `True`

### \`resilience.measure\_noise\_learning\`

Options for measurement noise learning.

[`resilience.measure_noise_learning` API documentation](/docs/api/qiskit-ibm-runtime/options-measure-noise-learning-options)

### \`resilience.measure\_noise\_learning.num\_randomizations\`

**Choices**: Integer >= 1

**Default**: `32`

### \`resilience.measure\_noise\_learning.shots\_per\_randomization\`

**Choices**: Integer, `auto`

**Default**: `auto`

### \`resilience.pec\_mitigation\`

**Choices**: `True`, `False`

**Default**: `False`

### \`resilience.pec\`

Probabilistic error cancellation mitigation options.

[`resilience.pec` API documentation](/docs/api/qiskit-ibm-runtime/options-pec-options)

### \`resilience.pec.max\_overhead\`

**Choices**: `None`, Integer >= 1

**Default**: `100`

### \`resilience.pec.noise\_gain\`

**Choices**: `auto`, float in the range \[0, 1]

**Default**: `auto`

### \`resilience.zne\_mitigation\`

**Choices**: `True`, `False`

**Default**: `False`

### \`resilience.zne\`

[`resilience.zne` API documentation](/docs/api/qiskit-ibm-runtime/options-zne-options)

### \`resilience.zne.amplifier\`

**Choices**: `gate_folding`, `gate_folding_front`, `gate_folding_back`, `pea`

**Default**: `gate_folding`

### \`resilience.zne.extrapolated\_noise\_factors\`

**Choices**: List of floats

**Default**: `[0, *noise_factors]`

### \`resilience.zne.extrapolator\`

**Choices**: One or more of: `exponential`, `linear`, `double_exponential`, `polynomial_degree_(1 <= k <= 7)`, `fallback`

**Default**: `(exponential, linear)`

### \`resilience.zne.noise\_factors\`

**Choices**: List of floats; each float >= 1

**Default**: `(1, 1.5, 2)` for `PEA`, and `(1, 3, 5)` otherwise

### \`resilience\_level\`

How much resilience to build against errors. Higher levels generate more accurate results at the expense of longer processing times. See the [resilience levels](/docs/guides/estimator-noise-management#resilience) section in the Noise management topic to learn more.

**Choices**: `0`, `1`, `2`

**Default**: `1`

[`resilience_level` API documentation](/docs/api/qiskit-ibm-runtime/options-estimator-options#resilience_level)

### \`seed\_estimator\`

**Choices**: Integer

**Default**: None

[`seed_estimator`](/docs/api/qiskit-ibm-runtime/options-estimator-options#seed_estimator)

### \`simulator\`

Options to pass when simulating a backend

[`simulator` API documentation](/docs/api/qiskit-ibm-runtime/options-simulator-options)

### \`simulator.basis\_gates\`

**Choices**: List of basis gate names to unroll to

**Default**: The set of all basis gates supported by [Qiskit Aer simulator](https://qiskit.github.io/qiskit-aer/stubs/qiskit_aer.AerSimulator.html)

### \`simulator.coupling\_map\`

**Choices**: List of directed two-qubit interactions

**Default**: None, which implies no connectivity constraints (full connectivity).

### \`simulator.noise\_model\`

**Choices**: [Qiskit Aer NoiseModel](/docs/guides/build-noise-models), or its representation

**Default**: None

### \`simulator.seed\_simulator\`

**Choices**: Integer

**Default**: None

### \`twirling\`

Twirling options

[`twirling` API documentation](/docs/api/qiskit-ibm-runtime/options-twirling-options)

### \`twirling.enable\_gates\`

**Choices**: True, False

**Default**: False

### \`twirling.enable\_measure\`

**Choices**: True, False

**Default**: True

### \`twirling.num\_randomizations\`

**Choices**: `auto`, Integer >= 1

**Default**: `auto`

### \`twirling.shots\_per\_randomization\`

**Choices**: `auto`, Integer >= 1

**Default**: `auto`

### \`twirling.strategy\`

**Choices**: `active`, `active-circuit`, `active-accum`, `all`

**Default**: `active-accum`

### \`experimental\`

Experimental options, when available.

## Feature compatibility

Certain runtime features cannot be used together in a single job. Click the appropriate tab for a list of features that are incompatible with the selected feature:

### Fractional gates

Incompatible with:

- Gate twirling
- PEA
- PEC

### Gate-folding ZNE

Might not work when using custom gates. Incompatible with:

- PEA
- PEC

### Gate twirling

Incompatible with:

- Fractional gates
- Stretches

Other notes:

- Measurement twirling can only be applied to terminal measurements.
- Does not work with non-Clifford entanglers.

### PEA

Incompatible with:

- Fractional gates
- Gate-folding ZNE
- PEC

### PEC

Incompatible with:

- Fractional gates
- Gate-folding ZNE
- PEA

## Next steps

> **Recommendations**
>
> - Find more details about the `EstimatorV2` methods in the [Estimator API reference](/docs/api/qiskit-ibm-runtime/estimator-v2).
> - Decide what [execution mode](/docs/guides/execution-modes) to run your job in.
> - Learn about [noise management with Estimator](/docs/guides/estimator-noise-management).
