NoiseLearner¶
- class NoiseLearner(mode=None, options=None)[source]¶
Bases:
objectClass for executing noise learning experiments.
The noise learner class allows characterizing the noise processes affecting the gates in one or more circuits of interest, based on the Pauli-Lindblad noise model described in [1].
The
run()method allows running a noise learner job for a list of circuits. After the job is submitted, the gates are collected into independent layers, and subsequently the resulting layers are characterized individually.The way in which the gates are collected into layers depends on the twirling
strategyspecified in the givenoptions(seeNoiseLearnerOptionsfor more details). Note that all strategies obey barriers. For example, if you have three ISA entangling layers of interest, consider putting them into one circuit separated by barriers acting on the qubits you wish to twirl, and selectstrategy="active-circuit".The following snippet shows an example where the noise learner is used to characterized the layers of two GHZ circuits.
from qiskit.circuit import QuantumCircuit from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager from qiskit_ibm_runtime import QiskitRuntimeService from qiskit_ibm_runtime.noise_learner import NoiseLearner from qiskit_ibm_runtime.options import NoiseLearnerOptions service = QiskitRuntimeService() backend = service.least_busy(operational=True, simulator=False) # a circuit returning a two-qubit GHZ state ghz = QuantumCircuit(2) ghz.h(0) ghz.cx(0, 1) # another circuit returning a two-qubit GHZ state another_ghz = QuantumCircuit(3) another_ghz.h(0) another_ghz.cx(0, 1) another_ghz.cx(1, 2) another_ghz.cx(0, 1) pm = generate_preset_pass_manager(backend=backend, optimization_level=1) circuits = pm.run([ghz, another_ghz]) # set the options options = NoiseLearnerOptions() options.layer_pair_depths = [0, 1, 10] # run the noise learner job learner = NoiseLearner(backend, options) job = learner.run(circuits)
- Parameters:
mode (Optional[Union[BackendV2, Session, Batch]]) –
The execution mode used to make the primitive query. It can be:
A
Backendif you are using job mode.A
Sessionif you are using session execution mode.A
Batchif you are using batch execution mode.
Refer to the Qiskit Runtime documentation for more information about the execution modes.
options (Optional[Union[Dict, NoiseLearnerOptions, EstimatorOptions]]) –
NoiseLearnerOptions. Alternatively,EstimatorOptionscan be provided for convenience, in which case the estimator options get reformatted into noise learner options and all the irrelevant fields are ignored.
References
E. van den Berg, Z. Minev, A. Kandala, K. Temme, Probabilistic error cancellation with sparse Pauli–Lindblad models on noisy quantum processors, Nature Physics volume 19, pages 1116–1121 (2023). arXiv:2201.09866 [quant-ph]
Attributes
- options¶
The options in this noise learner.
Methods
- run(circuits)[source]¶
Submit a request to the noise learner program.
This function breaks the given list of circuits into a list of unique layers, following the strategy set by the
twirling_strategyfield specified in theoptions(seeNoiseLearnerOptionsfor more details) and sorting them based on the number of times they occur in the various circuits. Then, it runs the noise learning experiment for as many layers as specified by themax_layers_to_learnfield in theoptions, prioritizing layers that occur more frequently.- Parameters:
circuits (Iterable[QuantumCircuit | EstimatorPubLike]) – An iterable of circuits to run the noise learner program for. Alternatively, estimator pub-like (primitive unified bloc) objects can be specified, such as tuples
(circuit, observables)or(circuit, observables, parameter_values). In this case, the pub-like objects are converted to a list of circuits, and all the other fields (such asobservablesandparameter_values) are ignored.- Returns:
The submitted job.
- Return type: