Tatopenn commited on
Commit
eebadfa
·
verified ·
1 Parent(s): 0ff2618

Sync v8.1.39: correct phaseflip/amplitude_damping finding (was Monte Carlo undersampling)

Browse files
README.md CHANGED
@@ -624,6 +624,11 @@ All circuits stored as OpenQASM 2.0 strings in `QASM_LIBRARY`.
624
 
625
  ## ▍ Changelog
626
 
 
 
 
 
 
627
  ### v8.1.38
628
  - **Documented**: `zne_density_matrix`'s docstring extended with a broader honest finding beyond v8.1.37's original single-configuration result. `experiments/matrix_healing_zne_sweep.py` (new) sweeps GHZ states from 2 to 5 qubits across all 5 `NoiseModel` channels (depolarizing, bitflip, phaseflip, amplitude_damping, combined), 3 seeds each, 60 runs total: 54/60 positive, mean delta +0.09. The effect is consistently positive and *grows with qubit count* for depolarizing/bitflip/combined noise (up to +0.23 at 5 qubits), but is unreliable for phaseflip and amplitude_damping -- small or even net-negative average deltas at some qubit counts (e.g. phaseflip averages -0.01 at 4 qubits). No code behavior changed -- this is a documentation update reflecting a materially fuller picture than the original 2-qubit/depolarizing-only result, so the docstring doesn't understate how conditional the improvement actually is.
629
 
 
624
 
625
  ## ▍ Changelog
626
 
627
+ ### v8.1.39
628
+ - **Corrected**: v8.1.38's claim that density-matrix ZNE healing (`zne_density_matrix`) is "unreliable for phaseflip and amplitude_damping" was investigated further and found to be wrong -- a Monte Carlo undersampling artifact (`experiments/matrix_healing_zne_sweep.py`'s K=150 trajectories / 3 seeds was too few), not a real limitation of the technique. `richardson_extrapolate`'s 3-point Lagrange coefficients (3, -3, 1) amplify statistical noise in their inputs (sum of squares 19x a single raw measurement's variance) -- an undersampled density-matrix estimate makes the *corrected* result noisy even when the underlying correction is sound. Re-running the exact same previously-failing configurations at higher K (300-1200 trajectories, 10 seeds) turned "unreliable, sometimes net-negative" into consistently and strongly positive.
629
+ - Re-ran the full sweep properly (K=400, 5 seeds, still 2-5 qubits x all 5 `NoiseModel` channels, 100 runs total): **96/100 positive, mean delta +0.12**, every single (qubit count, noise channel) combination net positive on average, growing to +0.20-0.25 at 5 qubits for depolarizing/bitflip. The 4 remaining negative runs are small (worst -0.02), consistent with residual Monte Carlo noise rather than a systematic failure.
630
+ - `zne_density_matrix`'s docstring rewritten with the corrected numbers and an explicit practical caveat for callers: correction quality depends on `rho_at_scales` being a low-noise (large-enough-K) estimate to begin with -- an inherent property of Richardson-style extrapolation's noise amplification, not a bug in this function.
631
+
632
  ### v8.1.38
633
  - **Documented**: `zne_density_matrix`'s docstring extended with a broader honest finding beyond v8.1.37's original single-configuration result. `experiments/matrix_healing_zne_sweep.py` (new) sweeps GHZ states from 2 to 5 qubits across all 5 `NoiseModel` channels (depolarizing, bitflip, phaseflip, amplitude_damping, combined), 3 seeds each, 60 runs total: 54/60 positive, mean delta +0.09. The effect is consistently positive and *grows with qubit count* for depolarizing/bitflip/combined noise (up to +0.23 at 5 qubits), but is unreliable for phaseflip and amplitude_damping -- small or even net-negative average deltas at some qubit counts (e.g. phaseflip averages -0.01 at 4 qubits). No code behavior changed -- this is a documentation update reflecting a materially fuller picture than the original 2-qubit/depolarizing-only result, so the docstring doesn't understate how conditional the improvement actually is.
634
 
dense_evolution.egg-info/PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
  Metadata-Version: 2.4
2
  Name: dense-evolution
3
- Version: 8.1.38
4
  Summary: Micro-optimized High-Performance NISQ Statevector Quantum Circuit Simulator (Hardware-Adaptive Integration of Native NumPy, CUDA-Accelerated CuPy, and Linear Kernel Fusion via JAX JIT/XLA Compilation)
5
  Author-email: Salvatore Pennacchio <jtatopenn@libero.it>
6
  License: Business Source License 1.1
@@ -680,6 +680,11 @@ All circuits stored as OpenQASM 2.0 strings in `QASM_LIBRARY`.
680
 
681
  ## ▍ Changelog
682
 
 
 
 
 
 
683
  ### v8.1.38
684
  - **Documented**: `zne_density_matrix`'s docstring extended with a broader honest finding beyond v8.1.37's original single-configuration result. `experiments/matrix_healing_zne_sweep.py` (new) sweeps GHZ states from 2 to 5 qubits across all 5 `NoiseModel` channels (depolarizing, bitflip, phaseflip, amplitude_damping, combined), 3 seeds each, 60 runs total: 54/60 positive, mean delta +0.09. The effect is consistently positive and *grows with qubit count* for depolarizing/bitflip/combined noise (up to +0.23 at 5 qubits), but is unreliable for phaseflip and amplitude_damping -- small or even net-negative average deltas at some qubit counts (e.g. phaseflip averages -0.01 at 4 qubits). No code behavior changed -- this is a documentation update reflecting a materially fuller picture than the original 2-qubit/depolarizing-only result, so the docstring doesn't understate how conditional the improvement actually is.
685
 
 
1
  Metadata-Version: 2.4
2
  Name: dense-evolution
3
+ Version: 8.1.39
4
  Summary: Micro-optimized High-Performance NISQ Statevector Quantum Circuit Simulator (Hardware-Adaptive Integration of Native NumPy, CUDA-Accelerated CuPy, and Linear Kernel Fusion via JAX JIT/XLA Compilation)
5
  Author-email: Salvatore Pennacchio <jtatopenn@libero.it>
6
  License: Business Source License 1.1
 
680
 
681
  ## ▍ Changelog
682
 
683
+ ### v8.1.39
684
+ - **Corrected**: v8.1.38's claim that density-matrix ZNE healing (`zne_density_matrix`) is "unreliable for phaseflip and amplitude_damping" was investigated further and found to be wrong -- a Monte Carlo undersampling artifact (`experiments/matrix_healing_zne_sweep.py`'s K=150 trajectories / 3 seeds was too few), not a real limitation of the technique. `richardson_extrapolate`'s 3-point Lagrange coefficients (3, -3, 1) amplify statistical noise in their inputs (sum of squares 19x a single raw measurement's variance) -- an undersampled density-matrix estimate makes the *corrected* result noisy even when the underlying correction is sound. Re-running the exact same previously-failing configurations at higher K (300-1200 trajectories, 10 seeds) turned "unreliable, sometimes net-negative" into consistently and strongly positive.
685
+ - Re-ran the full sweep properly (K=400, 5 seeds, still 2-5 qubits x all 5 `NoiseModel` channels, 100 runs total): **96/100 positive, mean delta +0.12**, every single (qubit count, noise channel) combination net positive on average, growing to +0.20-0.25 at 5 qubits for depolarizing/bitflip. The 4 remaining negative runs are small (worst -0.02), consistent with residual Monte Carlo noise rather than a systematic failure.
686
+ - `zne_density_matrix`'s docstring rewritten with the corrected numbers and an explicit practical caveat for callers: correction quality depends on `rho_at_scales` being a low-noise (large-enough-K) estimate to begin with -- an inherent property of Richardson-style extrapolation's noise amplification, not a bug in this function.
687
+
688
  ### v8.1.38
689
  - **Documented**: `zne_density_matrix`'s docstring extended with a broader honest finding beyond v8.1.37's original single-configuration result. `experiments/matrix_healing_zne_sweep.py` (new) sweeps GHZ states from 2 to 5 qubits across all 5 `NoiseModel` channels (depolarizing, bitflip, phaseflip, amplitude_damping, combined), 3 seeds each, 60 runs total: 54/60 positive, mean delta +0.09. The effect is consistently positive and *grows with qubit count* for depolarizing/bitflip/combined noise (up to +0.23 at 5 qubits), but is unreliable for phaseflip and amplitude_damping -- small or even net-negative average deltas at some qubit counts (e.g. phaseflip averages -0.01 at 4 qubits). No code behavior changed -- this is a documentation update reflecting a materially fuller picture than the original 2-qubit/depolarizing-only result, so the docstring doesn't understate how conditional the improvement actually is.
690
 
dense_evolution/__init__.py CHANGED
@@ -14,4 +14,4 @@ from .mps import MPSSimulator
14
  from .mitigation import (richardson_extrapolate, zero_noise_extrapolation,
15
  project_to_physical, uhlmann_fidelity, zne_density_matrix)
16
 
17
- __version__ = "8.1.38"
 
14
  from .mitigation import (richardson_extrapolate, zero_noise_extrapolation,
15
  project_to_physical, uhlmann_fidelity, zne_density_matrix)
16
 
17
+ __version__ = "8.1.39"
dense_evolution/mitigation.py CHANGED
@@ -199,19 +199,31 @@ def zne_density_matrix(rho_at_scales, noise_factors) -> jnp.ndarray:
199
  noise, K=200-trajectory estimate per scale, averaged over 4 seeds --
200
  raw fidelity ~0.865, corrected ~0.947 (+0.08), positive on every seed
201
  tested.
202
- - `experiments/matrix_healing_zne_sweep.py`: broader sweep, 2-5 qubits
203
- x 5 noise channels (depolarizing, bitflip, phaseflip,
204
- amplitude_damping, combined) x 3 seeds, K=150 per scale (60 runs
205
- total) -- 54/60 positive, mean delta +0.09. Effect is consistently
206
- positive and *grows with qubit count* for depolarizing/bitflip/
207
- combined noise (up to +0.23 at 5 qubits); it is unreliable for
208
- phaseflip and amplitude_damping (small or even net-negative deltas at
209
- some qubit counts, e.g. -0.01 average at 4 qubits for phaseflip).
210
-
211
- Net: this is a real, measured, reproducible improvement for Pauli-type
212
- noise (depolarizing/bitflip/combined), not a general guarantee across
213
- every noise channel -- run the sweep script yourself before relying on
214
- this for a noise model or circuit not covered above.
 
 
 
 
 
 
 
 
 
 
 
 
215
 
216
  Do not pass a target/ideal density matrix into this function or use one
217
  to pick among candidate corrections -- see `uhlmann_fidelity`'s
 
199
  noise, K=200-trajectory estimate per scale, averaged over 4 seeds --
200
  raw fidelity ~0.865, corrected ~0.947 (+0.08), positive on every seed
201
  tested.
202
+ - `experiments/matrix_healing_zne_sweep.py`: 2-5 qubits x all 5
203
+ `NoiseModel` channels (depolarizing, bitflip, phaseflip,
204
+ amplitude_damping, combined) x 5 seeds, K=400 trajectories per scale
205
+ (100 runs total) -- **96/100 positive, mean delta +0.12**, and every
206
+ single (qubit count, noise channel) combination is net positive on
207
+ average, growing to +0.20-0.25 at 5 qubits for depolarizing/bitflip.
208
+ The 4 remaining negative runs are small (worst -0.02) and consistent
209
+ with residual Monte Carlo noise, not a systematic failure mode.
210
+
211
+ An earlier version of this sweep (K=150, 3 seeds) had reported
212
+ phaseflip/amplitude_damping as "unreliable" -- re-investigated directly
213
+ rather than trusted, and confirmed to be a Monte Carlo undersampling
214
+ artifact, not a real limitation of the technique: `richardson_extrapolate`'s
215
+ 3-point Lagrange coefficients (3, -3, 1) amplify statistical noise in
216
+ their inputs (sum of squares 19x a single raw measurement's variance),
217
+ so an undersampled density-matrix estimate makes the *corrected* result
218
+ noisy even when the correction itself is sound. Re-running the same
219
+ failing configurations at higher K (300-1200) turned them consistently
220
+ and strongly positive. Practical implication for callers: this
221
+ function's correction quality depends on `rho_at_scales` being a
222
+ low-noise estimate to begin with (large enough K, or equivalent) --
223
+ feeding it a high-variance estimate can genuinely produce a worse
224
+ result than not correcting at all, which is not a bug in
225
+ `zne_density_matrix` itself but an inherent property of Richardson-style
226
+ extrapolation that any caller needs to budget sample size for.
227
 
228
  Do not pass a target/ideal density matrix into this function or use one
229
  to pick among candidate corrections -- see `uhlmann_fidelity`'s
experiments/matrix_healing_zne_sweep.py CHANGED
@@ -8,6 +8,18 @@ Same honesty constraint as the original experiment: rho_ideal is used
8
  ONLY to grade raw vs. corrected fidelity at the end, never as input to
9
  the noise ensemble, the extrapolation, or the physical projection.
10
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  python experiments/matrix_healing_zne_sweep.py
12
  """
13
  import os
@@ -26,8 +38,8 @@ QUBIT_COUNTS = (2, 3, 4, 5)
26
  NOISE_MODELS = ("depolarizing", "bitflip", "phaseflip", "amplitude_damping", "combined")
27
  BASE_P = 0.05
28
  SCALES = (1.0, 2.0, 3.0)
29
- K_TRAJECTORIES = 150
30
- SEEDS = (0, 1, 2)
31
 
32
 
33
  def ghz_sv(n_qubits):
@@ -63,8 +75,9 @@ def run_one(n_qubits, model, seed):
63
 
64
 
65
  def main():
66
- print(f"{'qubits':>6} {'noise':>18} {'avg_raw':>10} {'avg_corr':>10} {'avg_delta':>11} {'wins/total':>11}")
67
- print("-" * 72)
 
68
  overall_deltas = []
69
  for n_qubits in QUBIT_COUNTS:
70
  for model in NOISE_MODELS:
@@ -78,7 +91,7 @@ def main():
78
  overall_deltas.extend(deltas.tolist())
79
  wins = int(np.sum(deltas > 0))
80
  print(f"{n_qubits:>6} {model:>18} {np.mean(raws):>10.4f} {np.mean(corrs):>10.4f} "
81
- f"{np.mean(deltas):>+11.4f} {wins}/{len(deltas):>9}")
82
 
83
  overall_deltas = np.array(overall_deltas)
84
  print("-" * 72)
 
8
  ONLY to grade raw vs. corrected fidelity at the end, never as input to
9
  the noise ensemble, the extrapolation, or the physical projection.
10
 
11
+ K_TRAJECTORIES/SEEDS were originally 150/3 -- too few. richardson_extrapolate's
12
+ 3-point Lagrange coefficients (3, -3, 1) amplify statistical (shot) noise in
13
+ the input by a factor related to their sum of squares (19x) relative to a
14
+ single raw measurement, so an undersampled Monte Carlo density-matrix
15
+ estimate makes the *corrected* result unreliable even when the correction
16
+ itself is sound -- confirmed directly: re-running the original phaseflip/
17
+ amplitude_damping failures at higher K (300-1200) with more seeds turned
18
+ "unreliable, sometimes net-negative" into "consistently and strongly
19
+ positive" (see git history for the isolation test). K_TRAJECTORIES=400 and
20
+ 5 seeds here is chosen to keep this Monte Carlo noise floor well below the
21
+ effect size being measured, not because more is free.
22
+
23
  python experiments/matrix_healing_zne_sweep.py
24
  """
25
  import os
 
38
  NOISE_MODELS = ("depolarizing", "bitflip", "phaseflip", "amplitude_damping", "combined")
39
  BASE_P = 0.05
40
  SCALES = (1.0, 2.0, 3.0)
41
+ K_TRAJECTORIES = 400
42
+ SEEDS = (0, 1, 2, 3, 4)
43
 
44
 
45
  def ghz_sv(n_qubits):
 
75
 
76
 
77
  def main():
78
+ print(f"{'qubits':>6} {'noise':>18} {'avg_raw':>10} {'avg_corr':>10} {'avg_delta':>11} "
79
+ f"{'std_delta':>10} {'wins/total':>11}")
80
+ print("-" * 84)
81
  overall_deltas = []
82
  for n_qubits in QUBIT_COUNTS:
83
  for model in NOISE_MODELS:
 
91
  overall_deltas.extend(deltas.tolist())
92
  wins = int(np.sum(deltas > 0))
93
  print(f"{n_qubits:>6} {model:>18} {np.mean(raws):>10.4f} {np.mean(corrs):>10.4f} "
94
+ f"{np.mean(deltas):>+11.4f} {np.std(deltas):>10.4f} {wins}/{len(deltas):>9}")
95
 
96
  overall_deltas = np.array(overall_deltas)
97
  print("-" * 72)
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
 
5
  [project]
6
  name = "dense-evolution"
7
- version = "8.1.38"
8
  description = "Micro-optimized High-Performance NISQ Statevector Quantum Circuit Simulator (Hardware-Adaptive Integration of Native NumPy, CUDA-Accelerated CuPy, and Linear Kernel Fusion via JAX JIT/XLA Compilation)"
9
  readme = "README.md"
10
  requires-python = ">=3.9"
 
4
 
5
  [project]
6
  name = "dense-evolution"
7
+ version = "8.1.39"
8
  description = "Micro-optimized High-Performance NISQ Statevector Quantum Circuit Simulator (Hardware-Adaptive Integration of Native NumPy, CUDA-Accelerated CuPy, and Linear Kernel Fusion via JAX JIT/XLA Compilation)"
9
  readme = "README.md"
10
  requires-python = ">=3.9"