From beda4856eaf79bc41a3f9cb66fd59314d3658093 Mon Sep 17 00:00:00 2001 From: Ian Hincks Date: Tue, 14 May 2024 14:03:38 -0400 Subject: [PATCH 1/3] Add resilience.zne.amplifier to EstimatorV2 options --- qiskit_ibm_runtime/options/zne_options.py | 28 +++++++++++++++++++++++ test/integration/test_estimator_v2.py | 1 + 2 files changed, 29 insertions(+) diff --git a/qiskit_ibm_runtime/options/zne_options.py b/qiskit_ibm_runtime/options/zne_options.py index 00bb4fd98..2b0779b15 100644 --- a/qiskit_ibm_runtime/options/zne_options.py +++ b/qiskit_ibm_runtime/options/zne_options.py @@ -37,6 +37,18 @@ class ZneOptions: """Zero noise extrapolation mitigation options. Args: + amplifier: Which technique to use for amplifying noise. One of: + + * `"gate_folding"` (default) uses 2-qubit gate folding to amplify noise. If the noise + factor requires amplifying only a subset of the gates, then these gates are chosen + randomly. + * `"gate_folding_front"` uses 2-qubit gate folding to amplify noise. If the noise + factor requires amplifying only a subset of the gates, then these gates are selected + from the front of the topologically ordered DAG circuit. + * `"gate_folding_back"` uses 2-qubit gate folding to amplify noise. If the noise + factor requires amplifying only a subset of the gates, then these gates are selected + from the back of the topologically ordered DAG circuit. + noise_factors: Noise factors to use for noise amplification. Default: (1, 3, 5). extrapolator: Extrapolator(s) to try (in order) for extrapolating to zero noise. @@ -50,6 +62,22 @@ class ZneOptions: Default: ("exponential", "linear"). """ + amplifier: Union[ + UnsetType, Literal["gate_folding", "gate_folding_front", "gate_folding_back"] + ] = Unset + """ + + * `"pea"` corresponds to probabilistic error amplification based on learned + layer noise models will be used. + * `"gate_folding"` uses 2-qubit gate folding to amplify noise. If the noise + factor requires amplifying a the subset gates these gates are chosen randomly. + * `"gate_folding_front"` uses 2-qubit gate folding to amplify noise. If the noise + factor requires amplifying a the subset gates these gates are selected from the + front of the topologically ordered DAG circuit. + * `"gate_folding_back"` uses 2-qubit gate folding to amplify noise. If the noise + factor requires amplifying a the subset gates these gates are selected from the + back of the topologically ordered DAG circuit. + """ noise_factors: Union[UnsetType, Sequence[float]] = Unset extrapolator: Union[UnsetType, ExtrapolatorType, Sequence[ExtrapolatorType]] = Unset diff --git a/test/integration/test_estimator_v2.py b/test/integration/test_estimator_v2.py index 12439dd8c..c6f3b42c0 100644 --- a/test/integration/test_estimator_v2.py +++ b/test/integration/test_estimator_v2.py @@ -82,6 +82,7 @@ def test_estimator_v2_options(self, service): estimator.options.seed_estimator = 42 estimator.options.resilience.measure_mitigation = True estimator.options.resilience.zne_mitigation = True + estimator.options.resilienc.zne.amplifier = "gate_folding_back" estimator.options.resilience.zne.noise_factors = [3, 5] estimator.options.resilience.zne.extrapolator = "linear" estimator.options.resilience.pec_mitigation = False From cd773c69ea7b4572f9d74de1a56711faedaccb7b Mon Sep 17 00:00:00 2001 From: Ian Hincks Date: Tue, 14 May 2024 14:23:27 -0400 Subject: [PATCH 2/3] add reno --- release-notes/unreleased/1679.feat.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 release-notes/unreleased/1679.feat.rst diff --git a/release-notes/unreleased/1679.feat.rst b/release-notes/unreleased/1679.feat.rst new file mode 100644 index 000000000..73362acaf --- /dev/null +++ b/release-notes/unreleased/1679.feat.rst @@ -0,0 +1,11 @@ +The `ZneOptions.amplifier` option was added, which can be one of these strings: + +* `"gate_folding"` (default) uses 2-qubit gate folding to amplify noise. If the noise + factor requires amplifying only a subset of the gates, then these gates are chosen + randomly. +* `"gate_folding_front"` uses 2-qubit gate folding to amplify noise. If the noise + factor requires amplifying only a subset of the gates, then these gates are selected + from the front of the topologically ordered DAG circuit. +* `"gate_folding_back"` uses 2-qubit gate folding to amplify noise. If the noise + factor requires amplifying only a subset of the gates, then these gates are selected + from the back of the topologically ordered DAG circuit. \ No newline at end of file From 38ab857999a993e5fc5be10b7ca952b5e828f735 Mon Sep 17 00:00:00 2001 From: Ian Hincks Date: Tue, 14 May 2024 14:28:22 -0400 Subject: [PATCH 3/3] remove redundant docstring --- qiskit_ibm_runtime/options/zne_options.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/qiskit_ibm_runtime/options/zne_options.py b/qiskit_ibm_runtime/options/zne_options.py index 2b0779b15..ff15521d1 100644 --- a/qiskit_ibm_runtime/options/zne_options.py +++ b/qiskit_ibm_runtime/options/zne_options.py @@ -65,19 +65,6 @@ class ZneOptions: amplifier: Union[ UnsetType, Literal["gate_folding", "gate_folding_front", "gate_folding_back"] ] = Unset - """ - - * `"pea"` corresponds to probabilistic error amplification based on learned - layer noise models will be used. - * `"gate_folding"` uses 2-qubit gate folding to amplify noise. If the noise - factor requires amplifying a the subset gates these gates are chosen randomly. - * `"gate_folding_front"` uses 2-qubit gate folding to amplify noise. If the noise - factor requires amplifying a the subset gates these gates are selected from the - front of the topologically ordered DAG circuit. - * `"gate_folding_back"` uses 2-qubit gate folding to amplify noise. If the noise - factor requires amplifying a the subset gates these gates are selected from the - back of the topologically ordered DAG circuit. - """ noise_factors: Union[UnsetType, Sequence[float]] = Unset extrapolator: Union[UnsetType, ExtrapolatorType, Sequence[ExtrapolatorType]] = Unset