You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Stim implementation of the [[16,4,4]]Tesseract Code
2
2
3
-
This repository contains implementations and simulations of the Tesseract quantum error correction code using Stim and PyMatching.
3
+
This repository contains implementations and simulations of the Tesseract quantum error correction code [[1]](#references)using Stim [[3]](#references).
4
4
5
-
## Features
5
+
## Overview
6
+
### Motivation
7
+
The 16-qubit tesseract subsystem color code offers a useful comprosmise between protection against errors and overhead. It encodes 4 logical qubits with a code rate of 1/4. By reducing 2 logical qubit from the original [[16,6,4]] code, this code achieves single-shot error correction, with only 2 ancilla qubits. This makes this code practical for current trapped-ion platforms. Recent experiments on Quantinuum hardware[[1]](#references) demonstrated preparing high-fidelity encoded graph states of up to 12 logical qubits, as well as protecting encoded states through 5 rounds of error correction. This repository reproduces these results in simulation, providing modular Stim circuits, noise modelling, and verification tests to support further research on low-overhead fault tolerance.
6
8
7
-
- Circuit implementation of the Tesseract code
8
-
- Error simulation and correction
9
-
- Jupyter notebooks with various experiments and visualizations
10
-
- Utility functions for circuit manipulation and analysis
• All building blocks (encoding, noise, measurement, decoder) are implemented.
14
+
• The end-to-end error-correction success rate is **not yet at the target level**.
15
+
Community testing, bug-fixes, and feature PRs are highly appreciated!
16
+
17
+
**Disclaimer:** This repository is an independent, community-driven implementation.
18
+
It is **not** affiliated with Microsoft, Quantinuum, nor the authors of the original tesseract-code paper.
19
+
20
+
### Features
21
+
22
+
- Circuit implementation of the [[16,4,4]] Tesseract subsystem color code [[2]](#references) in Stim, including encoding, error correction rounds and final measurements.
23
+
- Simulation of an error correction experiment with configurable noise setting, rounds, shot and more.
24
+
- Plotting: sweeping of different parameters and obtaining acceptance rate and logical success rate.
25
+
26
+
### Implementation details
27
+
28
+
In order to mimic the original paper's error correction, the different parts of the experiment are implemented in the gate level, and not using Stim's `MPP` stabilizer measurements, or detectors, for example.
29
+
The experiment implemented here is an error correction experiment based on Microsoft's paper[[1]](#references), and resembles the experimental setup shown in Figure 8 below.
1.**Encoding** - The initial state is encoded using the circuits in Fig. 9a or 9b. This part is noiseless for simplicity.
36
+
2.**Channel Noise** - Optional noise is applied on all qubits.
37
+
3.**Error correction rounds** - Each round is composed of measureing rows/columns and X/Z stabilizers. Measurements results are saved.
38
+
4.**Logical measurements** - Qubits are measured by breaking apart the code into two smaller codes. Each code is the [[8,3,2]] color code [[4]](#references). See [measure_logical_operators_tesseract](tesseract_sim/error_correction/measurement_rounds.py) and [verify_final_state](tesseract_sim/error_correction/decoder_manual.py) for more details.
39
+
5.**Post processing** - Each shot is accepted or not (based on the error correction rounds); For accepted rounds, the qubits are corrected based on Pauli frame (if enabled in simulation). Next, logical qubits are measured and validated to determine the logical error rate.
40
+
41
+
### Code
42
+
#### Structure
43
+
44
+
```
45
+
tesseract-code-stim/
46
+
├── tesseract_sim/ # Main simulation package
47
+
│ ├── common/ # Shared utilities and base components
48
+
│ │ ├── circuit_base.py # Basic circuit operations and initialization
The main workflow is through Jupyter notebooks. After installation:
41
104
42
105
```bash
@@ -45,9 +108,9 @@ jupyter notebook
45
108
46
109
Then navigate to one of the notebooks to run experiments and simulations.
47
110
48
-
### Running Simulations with Noise
111
+
### Running Simulations
49
112
50
-
The `tesseract_sim/run.py` script now supports configurable noise injection during encoding and error correction phases. You can control whether noise is active and set independent 1-qubit and 2-qubit error rates for each phase.
113
+
The `tesseract_sim/run.py` script supports configurable noise injection during encoding and error correction phases. You can control whether noise is active and set independent 1-qubit and 2-qubit error rates for each phase.
51
114
52
115
```bash
53
116
python -m tesseract_sim.run --help
@@ -88,33 +151,47 @@ The `plotting/plot_acceptance_rates.py` script generates acceptance and logical
88
151
89
152
***Generate plots with Pauli frame correction enabled and 9a encoding:**
- **Acceptance Rate Plots**: Show how well the error correction accepts states across different noise levels and rounds
116
179
- **Logical Success Rate Plots**: Show the conditional probability of logical success given acceptance
117
180
181
+
**Example Results:**
182
+
183
+

184
+
185
+
## References
186
+
187
+
[1] B. W. Reichardt et al., "Demonstration of quantum computation and error correction with a tesseract code", (2024) [arXiv:2409.04628](https://arxiv.org/abs/2409.04628)
188
+
189
+
[2] "\([[16,6,4]]\) Tesseract color code", The Error Correction Zoo (V. V. Albert & P. Faist, eds.), 2024. https://errorcorrectionzoo.org/c/stab_16_6_4
190
+
191
+
[3] C. Gidney, "Stim: a fast stabilizer circuit simulator", Quantum 5, 497 (2021). https://doi.org/10.22331/q-2021-07-06-497
192
+
193
+
[4] E. Campbell, "The smallest interesting colour code", (2016). https://earltcampbell.com/2016/09/26/the-smallest-interesting-colour-code/
0 commit comments