---
title: TwirlingOptions (latest version)
description: API reference for qiskit_ibm_runtime.options_models.TwirlingOptions in the latest version of qiskit-ibm-runtime
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit-ibm-runtime/options-models-twirling-options
---

# qiskit\_ibm\_runtime.options\_models.TwirlingOptions

*pydantic model* `TwirlingOptions`

[GitHub](https://github.com/Qiskit/qiskit-ibm-runtime/tree/stable/0.50/qiskit_ibm_runtime/options_models/twirling.py#L24-L85)

Bases: `BaseOptionsModel`

Twirling options.

**Config**

- **validate\_assignment**: *bool = True*
- **extra**: *str = forbid*

### enable\_gates

*field*

Type: `bool` | `None`

Default value: `None`

Whether to apply 2-qubit Clifford gate twirling.

If `None`:

- For the Sampler, it defaults to `False`.
- For the Estimator, it is determined by the server according to the resilience level: it is `False` for resilience levels `0` and `1`, and `True` for resilience level `2`.

### enable\_measure

*field*

Type: `bool` | `None`

Default value: `None`

Whether to enable twirling of measurement instructions.

> **Note**
>
> Twirling is only applied to measurements that are not involved in a conditional block.

If `None`:

- For the Sampler, it defaults to `False`.
- For the Estimator, it is determined by the server according to the resilience level: it is `False` for resilience level `0`, and `True` for resilience levels `1` and `2`.

### group

*field*

Type: `Literal`\[`'pauli'`, `'balanced_pauli'`, `'local_c1'`, `'local_pauli'`]

Default value: `'pauli'`

The group used to twirl the content of the identified layers.

- `'pauli'` uses the Pauli group.
- `'balanced_pauli'` uses the Pauli group with a balanced distribution.
- `'local_c1'` uses the subgroup of single-qubit Cliffords that are conjugated to single-qubit Cliffords on any entangling gates in the box, and the Pauli group everywhere else.
- `'local_pauli'` uses the Pauli subgroup that commutes with an entangler for non-Clifford gates, and the Pauli group everywhere else.

### num\_randomizations

*field*

Type: `Annotated`\[`int`, `Field`(`ge``=``1`)] | `Literal`\[`'auto'`]

Default value: `'auto'`

The number of random samples to use when twirling or performing sampled mitigation.

If `"auto"`, the value is determined automatically based on the input PUB and other options.

### shots\_per\_randomization

*field*

Type: `Annotated`\[`int`, `Field`(`ge``=``1`)] | `Literal`\[`'auto'`]

Default value: `'auto'`

The number of shots to run for each random sample.

If `"auto"`, the value is determined automatically based on the input PUB and other options.

### strategy

*field*

Type: `Literal`\[`'active'`, `'active-accum'`, `'active-circuit'`, `'all'`]

Default value: `'active-accum'`

Specify the strategy of twirling qubits in identified layers of 2-qubit twirled gates.

- `"active"`: Only the instruction qubits in each individual twirled layer will be twirled.
- `"active-circuit"`: The union of all instruction qubits in the circuit will be twirled in each twirled layer.
- `"active-accum"`: The union of instructions qubits in the circuit up to the current twirled layer will be twirled in each individual twirled layer.
- `"all"`: All qubits in the input circuit will be twirled in each twirled layer.

### update

`update(**kwargs)`

[GitHub](https://github.com/Qiskit/qiskit-ibm-runtime/tree/stable/0.50/qiskit_ibm_runtime/options_models/base.py#L46-L54)

Update the options.

**Parameters**

**kwargs** (*Any*)

**Return type**

None
