Skip to main contentIBM Quantum Documentation Mirror

Algorithmiq Tensor-network error mitigation API reference

  • Qiskit Functions

    Qiskit Functions — pre-built tools created by partner organizations — abstract away parts of the software development workflow to simplify and accelerate utility-scale algorithm discovery and application development. Click to view the guide for this Qiskit Function.


Inputs

Caution

TEM currently has the following limitations:

  • Parametrized circuits are not supported. The parameters argument should be set to None if precision is specified. This restriction will be removed in future versions.
  • Only circuits without loops are supported. This restriction will be removed in future versions.
  • Non-unitary gates, such as reset, measure, and all forms of control flow are not supported. Support for reset will be added in upcoming releases.

Parameters

pubs

Type: Iterable[EstimatorPubLike]

An iterable of PUB-like (primitive unified bloc) objects, such as tuples (circuit, observables) or (circuit, observables, parameters, precision). See Overview of PUBs for more information. If a non-ISA circuit is passed, it will be transpiled with optimal settings. If an ISA circuit is passed, it will not be transpiled; in this case, the observable must be defined on the whole QPU.

  • Required: Yes
  • Example: (circuit, observables)

backend_name

Type: str

Default value: Least busy backend

Name of the backend to make the query

  • Required: No
  • Example: "ibm_fez"

Options

Type: dict

Input options for this function are specified as a nested dictionary. See the full list of options and their default values.

  • Required: No
  • Example: {"max_bond_dimension": 100}

A dictionary containing the advanced options for the TEM. The dictionary may contain the keys in the following list. If any of the options are not provided, the default value listed in the list will be used. The default values are good for typical use of TEM.

Options list

tem_max_bond_dimension

Type: int

Default value: 500

The maximum bond dimension to be used for the tensor networks.

tem_compression_cutoff

Type: float

Default value: 1e-16

The cutoff value to be used for the tensor networks.

compute_shadows_bias_from_observable

Type: bool

Default value: False

A boolean flag indicating whether the bias for the classical shadows measurement protocol should be tailored to the PUB observable or not. If False, the classical shadows protocol (equal probability of measuring Z, X, Y) will be used.

shadows_bias

Type: np.ndarray

Default value: np.array([1 / 3, 1 / 3, 1 / 3])

The bias to be used for the randomized classical shadows measurement protocol, a 1d or 2d array of size 3 or shape (num_qubits, 3) respectively. Order is ZXY.

max_execution_time

Type: int or None

Default value: None

The maximum execution time on the QPU in seconds. If the runtime exceeds this value, the job will be canceled. If None, a default limit set by Qiskit Runtime will apply.

num_randomizations

Type: int

Default value: 32

The number of randomizations to be used for noise learning and gate twirling.

max_layers_to_learn

Type: int

Default value: True

The maximum number of unique layers to learn.

mitigate_readout_error

Type: bool

Default value: True

A boolean flag indicating whether to perform readout error mitigation or not.

num_readout_calibration_shots

Type: int

Default value: 10000

The number of shots to be used for readout error mitigation.

default_precision

Type: float

Default value: 0.02

The default precision to be used for the PUBs for which the precision is not specified.

seed

Type: int or None

Default value: None

Set the seed of the random number generator for reproducibility. If None, don't set the seed.

shots_per_randomization

Type: int

Default value: 128

The total number of shots to use per random learning circuit.

layer_pair_depths

Type: list[int]

Default value: [0, 1, 2, 4, 16, 32]

The circuit depths (measured in number of pairs) to use in learning experiments.

layer_noise_model

Type: NoiseLearnerResult, Sequence[LayerError], or None

Default value: None

The precomputed noise learner result from a previously executed run.

private

Type: bool

Default value: False

Whether the QPU jobs should be private. Setting it to True will prevent subsequent downloads of the experiment data and is recommended for confidential jobs.

tem_enforce_linear_circuit

Type: bool

Default value: False

Whether to enforce the circuit to be in linear topology.

Precision

The precision of the results can be requested in three ways. The precision can be passed in the PUB, and it will apply to that PUB only. Otherwise, a default_precision can be passed in the options as specified above. Finally, for advanced use, the specific number of shots per PUB can be passed in the options with default_shots, and it will override any other precision option.

If a default_precision or a per-PUB value is passed, the number of shots is estimated in order to achieve the desired precision. This is done based on the chosen QPU parameters and error rates as follows:

  • Calculating the error per layered gate (EPLG), which quantifies the noise introduced by layers of two-qubit gates. If backend properties are available, it extracts the relevant fidelity; otherwise, it uses a default value.
  • Counting the number of two-qubit gates in the circuit, as these are typically the main contributors to noise.
  • Computing a noise prefactor based on the number of two-qubit gates and the EPLG.
  • Using the requested precision, it estimates the required number of shots by scaling with the noise prefactor and the inverse of the square of the precision.

This approach ensures that the number of shots is sufficient to achieve the desired precision, taking into account both the circuit structure and the backend's noise characteristics.


Outputs

A Qiskit PrimitiveResults containing the TEM-mitigated result. The result for each PUB is returned as a PubResult containing the following fields:

data

Type: Databin

A Qiskit DataBin containing the TEM mitigated observable and its standard error. The DataBin has the following fields:

  • evs: The TEM-mitigated observable value.
  • stds: The standard error of the TEM-mitigated observable.

metadata

Type: dict

A dictionary containing additional results. The dictionary contains the following keys:

  • "evs_non_mitigated": The observable value without error mitigation.
  • "stds_non_mitigated": The standard error of the result without error mitigation.
  • "evs_mitigated_no_readout_mitigation": The observable value with error mitigation but without readout error mitigation.
  • "stds_mitigated_no_readout_mitigation": The standard error of the result with error mitigation but without readout error mitigation.
  • "evs_non_mitigated_with_readout_mitigation": The observable value without error mitigation but with readout error mitigation.
  • "stds_non_mitigated_with_readout_mitigation": The standard error of the result without error mitigation but with readout error mitigation.
  • "resource_usage": A dictionary containing the time resources used by the TEM.