sara-qec 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sara_qec-0.1.0/PKG-INFO +372 -0
- sara_qec-0.1.0/README.md +353 -0
- sara_qec-0.1.0/pyproject.toml +27 -0
- sara_qec-0.1.0/qec/config.py +27 -0
- sara_qec-0.1.0/qec/data.py +43 -0
- sara_qec-0.1.0/qec/utils.py +600 -0
- sara_qec-0.1.0/sara_qec.egg-info/PKG-INFO +372 -0
- sara_qec-0.1.0/sara_qec.egg-info/SOURCES.txt +10 -0
- sara_qec-0.1.0/sara_qec.egg-info/dependency_links.txt +1 -0
- sara_qec-0.1.0/sara_qec.egg-info/requires.txt +12 -0
- sara_qec-0.1.0/sara_qec.egg-info/top_level.txt +1 -0
- sara_qec-0.1.0/setup.cfg +4 -0
sara_qec-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sara-qec
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Quantum Error Correction simulation and analysis tools
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: numpy
|
|
8
|
+
Requires-Dist: scipy
|
|
9
|
+
Requires-Dist: pandas
|
|
10
|
+
Requires-Dist: matplotlib
|
|
11
|
+
Requires-Dist: seaborn
|
|
12
|
+
Requires-Dist: xgboost
|
|
13
|
+
Requires-Dist: stim>=1.15.0
|
|
14
|
+
Requires-Dist: pymatching>=2.3.1
|
|
15
|
+
Requires-Dist: qiskit
|
|
16
|
+
Requires-Dist: qiskit-aer
|
|
17
|
+
Requires-Dist: qiskit-experiments
|
|
18
|
+
Requires-Dist: pylatexenc
|
|
19
|
+
|
|
20
|
+
# Quantum Error Correction (QEC) Study
|
|
21
|
+
## Purpose
|
|
22
|
+
Quantum computers are significantly more susceptible to noise than classical computers due to short qubit coherence times and imperfect gate operations. This repository contains implementations designed to study and benchmark Quantum Error Correction algorithms, specifically targeting IBM’s superconducting architectures, using calibration data and noise profiles from IBM Quantum's online backends. For more details about this study please read [these slides](QEC_IBM.pdf) .
|
|
23
|
+
|
|
24
|
+
## Technical Stack
|
|
25
|
+
This project uses a mix of:
|
|
26
|
+
|
|
27
|
+
- Simulation: Stim (High-speed Clifford circuit simulation)
|
|
28
|
+
- Decoding: PyMatching (Minimum Weight Perfect Matching decoder)
|
|
29
|
+
- Hardware Interface: Qiskit (Accessing IBM Quantum backend properties)
|
|
30
|
+
|
|
31
|
+
## Clone & Setting Environment
|
|
32
|
+
To clone this repository to your area:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
git clone https://github.com/snabili/QEC.git
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
To setup the proper environment create a conda environment:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
conda create --name qecenv python=3.10 # qiskit_aer does not work with newer python versions
|
|
42
|
+
conda activate qecenv
|
|
43
|
+
conda install pip
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Import the following packages:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
pip install stim # to simulate circuits using Google Quantum AI library, for high speed simulation of error correction
|
|
50
|
+
pip install pymatching # this will import numpy, matplotlib, scipy; used to decode the error
|
|
51
|
+
pip install qiskit
|
|
52
|
+
pip install qiskit_aer
|
|
53
|
+
pip install qiskit_experiments
|
|
54
|
+
pip install pylatexenc # to visualize circuits
|
|
55
|
+
pip install pandas
|
|
56
|
+
pip install seaborn
|
|
57
|
+
pip install xgboost
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The above packages are added to qec_env.yml, to skip the above commands and to buid the environment in one run:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
conda env create -f qec_env.yml
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This is a first time setup and for later use run the following command to set the environment every time you want to run the code:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
conda activate qecenv
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Datasets
|
|
73
|
+
To access the IBM calibrated dataset:
|
|
74
|
+
- Open an account from [ibm_webpage](https://cloud.ibm.com/login)
|
|
75
|
+
- Download the api key
|
|
76
|
+
|
|
77
|
+
The calibration datasets are categorized in three main classes:
|
|
78
|
+
- Coherence times in $\mu s$ including the decoherence and dephasing times
|
|
79
|
+
- Gate properties in terms of average errors for single-qubit, double-qubits (entangled qubits), and gate duration in $ns$
|
|
80
|
+
- Measurement errors including the readout error
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
## Code Structure:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
├── qec --> the source codes
|
|
87
|
+
│ ├── __init__.py
|
|
88
|
+
│ ├── config.py
|
|
89
|
+
│ ├── data.py
|
|
90
|
+
│ ├── functions.py
|
|
91
|
+
│ └── utils.py
|
|
92
|
+
├── qec_env.yml
|
|
93
|
+
├── Readme.md
|
|
94
|
+
├── test --> running codes
|
|
95
|
+
│ ├── comp_threshold.py --> to plot $P_L$ vs $P_{phys}$ to extract threshold
|
|
96
|
+
│ ├── heavyhex_lattice.py --> diagnozes surface code errors
|
|
97
|
+
│ ├── IQ_helper.ipynb --> helper to study readout errors mitigation techniques on the fly
|
|
98
|
+
│ ├── ibm_api.py --> keep it hidden in .gitignore file
|
|
99
|
+
│ ├── ibu_readout.py --> applies Bayes probability and makes readout mitigation matrix plot
|
|
100
|
+
│ ├── iq_data.py --> extract IQ level=1 data from IBM backends
|
|
101
|
+
│ ├── iq_plot.py --> makes IQ states plots + ML boundaries
|
|
102
|
+
│ ├── leakage.py --> computes leakage error based on pure simulation
|
|
103
|
+
│ ├── ml_gridsearch.py --> ML optimization
|
|
104
|
+
│ ├── ml_readout.py --> train, reports fidelity of ML algos
|
|
105
|
+
│ ├── noise_heterogeneity.py --> compares individual heterogeneous noise w.r.t. avg noise
|
|
106
|
+
│ ├── plotting.py
|
|
107
|
+
│ ├── simulate_noise_model.py --> plots errors from downloaded CSV file
|
|
108
|
+
│ ├── stabilizer.py --> running stabilizer on surface code
|
|
109
|
+
│ ├── xt_leakage.py --> crosstalk effect on EPC using fully simulated backend
|
|
110
|
+
│ └── xtalk_error.py --> crosstalk effect on EPC using online IBM backend; open-instance account have limited time usage
|
|
111
|
+
├── files
|
|
112
|
+
└── plots
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Surface Code
|
|
116
|
+
The gold standard of error correction code for QEC in industry (Google, IBM), because of its high fault-tolerance threshold (∼ 1%) & physical qubits space connectivity. It maps physical complex noises (e.g. leakage, decoherence) into discrete bit-flip
|
|
117
|
+
(X) and phase-flip (Z) errors. The elements of the surface code are:
|
|
118
|
+
|
|
119
|
+
### Logical Qubits
|
|
120
|
+
Software-designed qubits grouped from many physical qubits to act as a single, reliable unit to detect and collect errors.
|
|
121
|
+
|
|
122
|
+
To compute the logical error for various numbers of qubits, the following simulation strategy was used:
|
|
123
|
+
|
|
124
|
+
- Worst-Case Extraction: Identify the highest physical error rates (gate and readout) from the specific IBM backend topology to set a realistic "noise floor"
|
|
125
|
+
- Distance Scaling: Simulated the rotated surface code across distances $d=3$, $d=5$, and $d=7$ using Stim and the PyMatching decoder
|
|
126
|
+
- Threshold Mapping: Perform a log-log linear interpolation to find the exact coordinates ($x, y$) where the distance curves intersect, to determine if the current hardware calibration is within the "correcting" or "failing" regime.
|
|
127
|
+
|
|
128
|
+
To run the simulation:
|
|
129
|
+
```
|
|
130
|
+
python test/comp_threshold.py
|
|
131
|
+
```
|
|
132
|
+
The plot produced by this code:
|
|
133
|
+
|
|
134
|
+

|
|
135
|
+
|
|
136
|
+
Finally to extract the desired logical error, $p_L$, using the following formula:
|
|
137
|
+
|
|
138
|
+
$$p_L = C \times (\frac{p_{phys}}{p_{thresh}})^(\frac{d+1}{2})$$
|
|
139
|
+
|
|
140
|
+
Where $C$ and $p_{thresh}$ are the vertical and horizontal coordinates of the three plots intersection in the figure above, the resulted distance values neccessary for a range of desired logical errors are:
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
logical error: 1.00e-09, distance value = 56.86 --> d = 57 --> total number of qubits = 6497
|
|
144
|
+
logical error: 1.11e-06, distance value = 34.83 --> d = 35 --> total number of qubits = 2449
|
|
145
|
+
logical error: 2.22e-06, distance value = 32.65 --> d = 33 --> total number of qubits = 2177
|
|
146
|
+
logical error: 4.44e-06, distance value = 30.48 --> d = 31 --> total number of qubits = 1921
|
|
147
|
+
logical error: 1.00e-05, distance value = 27.93 --> d = 29 --> total number of qubits = 1681
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Stabilizers:
|
|
151
|
+
Operators that represent the health condition of the system.
|
|
152
|
+
First step in applying stabilizer in QEC code is to define the right patch with a desired distance. IBM heron heavy-hex machines are Heron class featuring 156 qubits.
|
|
153
|
+
|
|
154
|
+
To select the proper number of qubits and maitain their connectivity:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
python test/heavyhex_lattice.py X
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Where `X` is the central qubit in the patch. In `test/heavyhex_lattice.py` the patch distance is `d=3`, thus there are 17 qubits in total: $tot_{qubits} = 2d^2-1=17$, with $data_{qubit}=d^2=9$ and $ancilla_{qubit}=d^2-1=8$. In an ideal patch the number of X and Z stabilizers (ancillas that measure Z and X errors) should be the same.
|
|
161
|
+
|
|
162
|
+
The code above produces this plot:
|
|
163
|
+
|
|
164
|
+

|
|
165
|
+
|
|
166
|
+
Stabilizers role are to find qubit errors using a class of qubits called Syndrome or Ancillas. Based on the type of the errors, there are two types of stabilizers.
|
|
167
|
+
|
|
168
|
+
### X_Stabilizers:
|
|
169
|
+
Their roles is to identify the $\textbf{Phase-Flip}$ errors, the kind of errors that occurs due to Z-Pauli operation on a qubit. To identify this error, X-Syndromes are used. To identify the phase-flip error on quantum circuits:
|
|
170
|
+
|
|
171
|
+
- Reset data/ancilla qubits' state to $\ket{0}$
|
|
172
|
+
- Change qubit basis to X-Pauli basis by applying Hadamart gate; from $\ket{0} \Rightarrow \ket{+}$
|
|
173
|
+
- Apply Z (Phase-Flip) error to data qubits
|
|
174
|
+
- Apply CNOT gate by setting ancillas as control and data as target qubit: CNOT(A,D). This will cause the $\textbf{Phase Kickback}$ effect.
|
|
175
|
+
- Apply Hadamart gate to ancillas to change basis to Z-basis
|
|
176
|
+
- Measure ancillas
|
|
177
|
+
|
|
178
|
+
<img src="x_stabilizer.png" width="200">
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
### Z_Stabilizers:
|
|
182
|
+
To identify the $\textbf{Bit-Flip}$ errors, the kind of errors that occurs due to X-Pauli operation on a data qubit. To identify this error, Z-Syndromes are used. The steps to identify the bit-flip error on quantum circuits:
|
|
183
|
+
|
|
184
|
+
- Reset data/ancilla qubits' state to $\ket{0}$
|
|
185
|
+
- Apply X (Bit-Flip) error to data qubit
|
|
186
|
+
- Apply CNOT gate by setting data as control and ancillas as target qubit: CNOT(D,A)
|
|
187
|
+
- Measure ancillas
|
|
188
|
+
|
|
189
|
+
<img src="z_stabilizer.png" width="400">
|
|
190
|
+
|
|
191
|
+
### Running X and Z Stabilizers:
|
|
192
|
+
To run the X and Z stabilizer:
|
|
193
|
+
```
|
|
194
|
+
python test/stabilizer.py A B C
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Where `A` is the central qubit of the selected patch, `B` is the data qubit next to the Z-syndrome, and `C` is the data qubit adjacent to the X-syndrome. After running the above code the syndrome outcome will be shown as follow:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
python test/stabilizer.py 23 4 16
|
|
201
|
+
|
|
202
|
+
X_stabilizer (Should show flips in bits next to X-Syndrome qubits):
|
|
203
|
+
Syndrome Outcomes: {'00010100': 1024}
|
|
204
|
+
Z_stabilizer (Should show flip in bit for Qubit 4 error):
|
|
205
|
+
Syndrome Outcomes: {'00000010': 1024}
|
|
206
|
+
```
|
|
207
|
+
## QC Error Simulation
|
|
208
|
+
### Simulating Crosstalk effect:
|
|
209
|
+
Crosstalk arises from microwave‑pulse interference between neighboring qubits during any operation. In double-gate operation, it refers to how a two‑qubit gate applied to a target pair can unintentionally disturb the state or performance of a nearby spectator qubit.
|
|
210
|
+
|
|
211
|
+
To observe this effect cleanly, the target pair should be chosen from qubits with low intrinsic gate error, ensuring that crosstalk is not masked by unrelated noise sources.
|
|
212
|
+
|
|
213
|
+
In the simulation, the crosstalk effect is modeled as an unintended rotation $\theta$ induced on the spectator qubit. This rotation occurs because the spectator is coupled to the target pair through a tunable coupler with interaction frequency $\xi$. The induced rotation during a CZ‑gate of duration $t_{cz}$ is approximated by:
|
|
214
|
+
|
|
215
|
+
$$
|
|
216
|
+
\theta = 2 \times \pi \times \xi \times t_{cz}
|
|
217
|
+
$$
|
|
218
|
+
|
|
219
|
+
IBM’s tunable couplers typically limit $\xi$ to $1 kHz$, which makes the real crosstalk effect extremely small. To make the effect visible in simulation, the code scales $\xi$ by a factor of 100.
|
|
220
|
+
|
|
221
|
+
Because IBM’s open‑access accounts provide limited access to real hardware backends, the crosstalk analysis is performed entirely on a simulated backend. To run the simulation, run the following code:
|
|
222
|
+
|
|
223
|
+
``` python test/xtalk_error.py ```
|
|
224
|
+
|
|
225
|
+
The effect of crosstalk with $\xi = 100 kHz$ is shown below with `Simultaneus` being the Crosstalk included effect and the `Isolated` without the effect:
|
|
226
|
+
|
|
227
|
+
<img src="xt_effect.png" width="500">
|
|
228
|
+
|
|
229
|
+
### Simulating Leakage error:
|
|
230
|
+
Leakage occurs when a transmon qubit is excited to energy states beyond the computational subspace ($\ket{0}$ and $\ket{1}$). While the anharmonicity—provided by the nonlinear inductance (Josephson Junction) is designed to isolate the first two levels, high-speed microwave (MW) pulses can still inadvertently drive transitions to higher energy levels, such as the $\ket{2}$ state.
|
|
231
|
+
|
|
232
|
+
To analyze these effects, this simulation utilizes the following framework:
|
|
233
|
+
|
|
234
|
+
1. Gate Context: Analysis is focused on leakage induced during single-qubit gate operations.
|
|
235
|
+
2. Three-Level System: The transmon is modeled as a qutrit with states $\ket{0}$, $\ket{1}$, and $\ket{2}$.
|
|
236
|
+
3. Target Operation: The study simulates a standard X-gate (bit-flip), requiring a precise $\pi$-pulse calibration.
|
|
237
|
+
4. DRAG Compensation: Used Derivative Removal by Adiabatic Gate (DRAG) technique. This uses a parameter $\beta$ to scale the derivative of the Gaussian envelope, effectively canceling out-of-subspace (phase) transitions.
|
|
238
|
+
5. Parameter Optimization: Both the MW-pulse duration ($T$) and the DRAG coefficient ($\beta$) are swept to identify the "Leakage Floor" of the system.
|
|
239
|
+
6. Pulse Shaping: The drive utilizes a Gaussian envelope, where the complex component (phase shift) is determined by the $\beta$-scaled derivative.
|
|
240
|
+
|
|
241
|
+
To run the leakage estimation script, execute the following:
|
|
242
|
+
|
|
243
|
+
``` python test/leakage.py ```
|
|
244
|
+
|
|
245
|
+
The simulation generates a population plot (shown below) tracking the state evolution. The "Optimized" result minimizes the population in state $\ket{2}$ at the end of the gate duration.
|
|
246
|
+
|
|
247
|
+
<img src="leakage_population.png" width="550">
|
|
248
|
+
|
|
249
|
+
### Noise Heterogenity
|
|
250
|
+
Physical transmon qubits in a superconducting backend exhibit unique noise profiles that vary significantly across the chip. This section investigates how heterogeneous noise (the unique, real-world error rates of each qubit) affects a Surface Code compared to a simplified uniform average noise model.
|
|
251
|
+
|
|
252
|
+
For this study, data from the IBM Heavy-Hex architecture (as seen on the ibm_fez backend) was used to simulate a surface code patch The setup and assumptions of the noise heterogeneity code are as follow:
|
|
253
|
+
|
|
254
|
+
1. Scalable Geometry: The code accepts a distance parameter ($d$) to define the size of the logical surface code patch
|
|
255
|
+
2. Syndrome Extraction: Stabilizer measurements are performed over multiple rounds using CZ-gates and ancilla measurements to detect phase and bit-flip errors.
|
|
256
|
+
3. Error Sources: The model incorporates specific Readout Errors and Two-Qubit Gate (CZ) errors pulled directly from the backend's daily calibration data
|
|
257
|
+
4. Strategic Patch Selection: The simulation identifies and selects a "Golden Patch"—the subset of physical qubits with the highest fidelity. Because the code avoids "bad apples" on the chip, the Actual Heterogeneous Error is typically lower than the Global Average Error.
|
|
258
|
+
|
|
259
|
+
To run the noise heterogeneity simulation with a distance of $3$, execute:
|
|
260
|
+
|
|
261
|
+
``` python test/noise_heterogeneity.py 3 ```
|
|
262
|
+
|
|
263
|
+
The script generates a connectivity map of the backend where qubits are color-coded based on their current calibration health (readout and gate fidelity). This visualization helps identify the optimal regions for QEC placement.
|
|
264
|
+
|
|
265
|
+
<img src="backendhealth_dist.png" width="600">
|
|
266
|
+
|
|
267
|
+
Highest error is the readout error and therefore the study of readout error and the possibility of reducing it is the main goal hereby.
|
|
268
|
+
|
|
269
|
+
# Readout Error and its mitigation (REM)
|
|
270
|
+
Readout error occurs when the state of a qubit is mismeasured during readout (e.g., measuring a $\ket{0}$ as a $\ket{1}$ or vice versa). In superconducting qubit architectures, this degradation is typically driven by several physical and environmental factors:
|
|
271
|
+
|
|
272
|
+
1. Short Relaxation Times: Low $T_1$ times causing state decay during the measurement pulse
|
|
273
|
+
2. Thermal Population: Residual thermal excitations causing population mixing
|
|
274
|
+
3. Instrumentation Noise: Electronic noise in the cryogenic amplification chain (e.g., TWPAs, HEMTs)
|
|
275
|
+
4. Suboptimal Dispersive Shifts: Insufficient dispersive coupling ($\chi$) between the readout resonator and the qubit
|
|
276
|
+
5. Phase/Frequency Mismatches: Numerical Controlled Oscillator (NCO) frequency mismatches with the Intermediate Frequency (IF) signal
|
|
277
|
+
6. Crosstalk: Signal bleeding and residual interactions between adjacent qubits
|
|
278
|
+
7. Leakage Overlap: Population leakage to higher-order transmon states ($\ket{2}$, $\ket{3}$) mimicking standard computational states
|
|
279
|
+
|
|
280
|
+
For a comprehensive overview of superconducting readout hardware configurations, refer to the [QEC slides](QEC_IBM.pdf)
|
|
281
|
+
|
|
282
|
+
## Characterization & Data Extraction:
|
|
283
|
+
To analyze how these noise channels degrade readout fidelity, raw single-shot IQ voltage data is extracted using the `StateTomography` framework from the `qiskit_experiments` library. Detailed implementations of the linear, non-linear, and statistical classification methods used for state discrimination can be found in the [IQ Analysis Notebook](IQ_helper.ipynb).
|
|
284
|
+
|
|
285
|
+
### Running the Extraction Script:
|
|
286
|
+
To isolate a spectator-target qubit pair (specifically Target Qubit `127` and its highest-error nearest neighbor) and extract the raw data for the four computational basis states ($\ket{00}, \ket{01}, \ket{10}, \ket{11}$), execute the following command:
|
|
287
|
+
|
|
288
|
+
`python test/iq_data.py 127`
|
|
289
|
+
|
|
290
|
+
To plot and visualize the double-qubit IQ data for double-qubit run:
|
|
291
|
+
|
|
292
|
+
`python test/iq_plot.py`
|
|
293
|
+
|
|
294
|
+
<img src="iq_plot.png" width="600">
|
|
295
|
+
|
|
296
|
+
### Readout Error Mitigation via Outlier Rejection
|
|
297
|
+
To optimize the discriminative separation between multi-qubit single-shot $I/Q$ clusters, outlier mitigation is implemented using the Mahalanobis distance metric. This metric accounts for the directional variance and covariance of the distributed $I/Q$ voltage points, providing an effective threshold for filtering anomalous measurements.
|
|
298
|
+
|
|
299
|
+
To prevent leverage points and extreme anomalies from biasing the baseline cluster characteristics, we employ a modified approach leveraging the Minimum Covariance Determinant (MCD). The MCD algorithm provides a highly robust estimator for the location and scatter of the data, allowing the model to calculate uncorrupted Mahalanobis distances even in the presence of dense, overlapping noise in the diagonal $I/Q$ space.
|
|
300
|
+
|
|
301
|
+
Filtering these statistical outliers yields an moderate reduction in overlapping classification ambiguities, especially by improving the effective boundaries between the four joint computational states ($\ket{00}, \ket{01}, \ket{10}, \ket{11}$).
|
|
302
|
+
|
|
303
|
+
This mitigation framework demonstrates an impact on lower-performing hardware components. Specifically, the improvement is presented hereby for Qubit 127. At the baseline of this study, the raw unmitigated readout fidelities for Qubits 128 and 127 were recorded at $95\%$ and $92\%$, respectively; removing structured $I/Q$ outliers via robust distance thresholds serves as a first-line approach to mitigate the readout error and to improve the fidelity on the noisier channels.
|
|
304
|
+
|
|
305
|
+
<img src="maha_qu1-10_qu2-01.png" width="800">
|
|
306
|
+
|
|
307
|
+
### The Use of Machine Learning and State Discrimination
|
|
308
|
+
The efficacy of various supervised and unsupervised classification algorithms for multi-qubit state discrimination on the $I/Q$ voltage plane was evaluated. The benchmarked models include:
|
|
309
|
+
- Linear Baselines: Logistic Regression (LR) and Mahalanobis Distance Classifier (MAH)
|
|
310
|
+
- Non-Linear Classifiers: Support Vector Classification (SVC) with an RBF kernel and Boosted Decision Trees (BDT)
|
|
311
|
+
- Probabilistic Clustering: Gaussian Mixture Models (GMM).
|
|
312
|
+
|
|
313
|
+
### Data Preparation & Benchmarks
|
|
314
|
+
The dataset consists of single-shot $I/Q$ paired-qubit measurements prepared across the four computational basis states ($\ket{00}, \ket{01}, \ket{10}, \ket{11}$). The dataset was split into an $80/20\%$ train-test ratio using `scikit-learn`.
|
|
315
|
+
|
|
316
|
+
The resulting state-specific read-out fidelities and their corresponding ensemble means are detailed below:
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
State | LR Fidelity | SVC Fidelity | GMM Fidelity | MAH Fidelity | BDT Fidelity
|
|
320
|
+
----------------------------------------------------------------------------------------------------
|
|
321
|
+
|00> | 0.962 | 0.965 | 0.967 | 0.964 | 0.964
|
|
322
|
+
|01> | 0.958 | 0.961 | 0.958 | 0.962 | 0.959
|
|
323
|
+
|10> | 0.956 | 0.954 | 0.954 | 0.954 | 0.954
|
|
324
|
+
|11> | 0.944 | 0.940 | 0.940 | 0.940 | 0.942
|
|
325
|
+
mean: | 0.955 | 0.955 | 0.955 | 0.955 | 0.955
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
To evaluate a specific model and generate the corresponding $I/Q$ space decision boundaries (e.g., using svc), execute:
|
|
329
|
+
|
|
330
|
+
`python test/ml_readout.py svc`
|
|
331
|
+
|
|
332
|
+
This command produces this plot:
|
|
333
|
+
|
|
334
|
+
<img src="iqmap_ml-svc_boundaries.png" width="600">
|
|
335
|
+
|
|
336
|
+
To perform hyperparameter optimization via grid search for the non-linear models (e.g., bdt), run:
|
|
337
|
+
|
|
338
|
+
`python test/ml_gridsearch.py bdt`
|
|
339
|
+
|
|
340
|
+
### Architectural Outlook & Readout Bottlenecks
|
|
341
|
+
|
|
342
|
+
As indicated by the benchmark table, the performance discrepancy across all models is negligible ($\le 0.5\%$), with the mean fidelity converging identically at $95.5\%$. This behavioral equivalence implies that the state clusters are fundamentally linearly separable within the time-integrated $I/Q$ feature space. Consequently, introducing non-linear kernel mappings or tree-based splits yields no statistical advantage over a simple linear hyperplane.
|
|
343
|
+
|
|
344
|
+
To surpass this hardware-bound classification ceiling, two independent error mitigation paths are available:
|
|
345
|
+
- Time-Resolved Single-Shot Trajectories (Level-0 Data): Bypassing time-integration to analyze raw, time-dependent voltage traces. This approach allows noise filters to account for transient resonator dynamics (filling/depletion) and enables the algorithmic detection of mid-readout longitudinal relaxation ($\ket{1} \rightarrow \ket{0}$ transitions)
|
|
346
|
+
- Statistical Readout Error Mitigation (REM): Utilizing classical post-processing techniques to invert the stochastic assignment errors introduced during the measurement process.
|
|
347
|
+
|
|
348
|
+
Given that open-source cloud architectures abstract away time-resolved Level-0 traces, this framework implements Readout Error Mitigation via Iterative Bayesian Unfolding (IBU)
|
|
349
|
+
|
|
350
|
+
### Readout Mitigation via Iterative Bayesian Unfolding (IBU)
|
|
351
|
+
The IBU method minimizes assignment errors by probabilistically redistributing misclassified counts. The process begins by extracting the classical assignment probability behavior from a selected baseline classifier (e.g., svc) following hyperparameter optimization.
|
|
352
|
+
|
|
353
|
+
To map these assignment errors using the standardized `scikit-learn`, the confusion matrix ($CM$) convention should be identified to avoid wrong result. The $CM$ rows designate the prepared target state ($T_{ij}$) and columns represent the measured/predicted state ($M_{ij}$):
|
|
354
|
+
|
|
355
|
+
$$CM = \begin{bmatrix}
|
|
356
|
+
P(M_{00} \mid T_{00}) & P(M_{01} \mid T_{00}) & P(M_{10} \mid T_{00}) & P(M_{11} \mid T_{00}) \\
|
|
357
|
+
P(M_{00} \mid T_{01}) & P(M_{01} \mid T_{01}) & P(M_{10} \mid T_{01}) & P(M_{11} \mid T_{01}) \\
|
|
358
|
+
P(M_{00} \mid T_{10}) & P(M_{01} \mid T_{10}) & P(M_{10} \mid T_{10}) & P(M_{11} \mid T_{10}) \\
|
|
359
|
+
P(M_{00} \mid T_{11}) & P(M_{01} \mid T_{11}) & P(M_{10} \mid T_{11}) & P(M_{11} \mid T_{11})
|
|
360
|
+
\end{bmatrix}$$
|
|
361
|
+
|
|
362
|
+
The IBU core algorithm iteratively applies Bayes' theorem to solve the inverse problem:
|
|
363
|
+
|
|
364
|
+
Calculating the conditional probability that a system was prepared in a true state given a specific noisy measurement observation, expressed as $P(T_j \mid M_i)$.
|
|
365
|
+
|
|
366
|
+
To compute the unfolded state distributions and mitigate misidentified single-shot outcomes using a given model configuration (e.g., `svc`), run:
|
|
367
|
+
|
|
368
|
+
`python test/ibu_readout.py svc`
|
|
369
|
+
|
|
370
|
+
This execution generates the raw and mitigated comparison confusion matrices:
|
|
371
|
+
|
|
372
|
+
<img src="readout_cm_svc.png" width="800">
|