File size: 6,898 Bytes
9c51b27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
---
license: cc-by-4.0
task_categories:
  - tabular-classification
  - time-series-forecasting
language:
  - en
tags:
  - quantum-computing
  - quantum-error-correction
  - surface-code
  - syndrome-decoding
  - physics
  - sequence-classification
pretty_name: "Surface Code Syndromes: Google Sycamore, ML-ready"
size_categories:
  - 1M<n<10M
configs:
  - config_name: default
    data_files:
      - split: train
        path: train.parquet
      - split: validation
        path: validation.parquet
      - split: test
        path: test.parquet
---

# Surface code syndromes, ML-ready

Real quantum error correction data from Google Quantum AI's Sycamore processor, reshaped so
you can train a model on it without knowing what a detector error model is.

**This is a reformatting, not new data.** The measurements are Google's, released under
CC-BY-4.0 alongside their 2023 Nature paper. What is added here is structure: a flat schema,
fixed splits, reshaping metadata, and the published decoder predictions bundled per shot.

## Why this exists

The original release is excellent and nearly unusable from a machine learning workflow. It
ships as bit-packed `.b8` files across 130 directories keyed by a naming convention, and
recovering the time-series structure means parsing the accompanying `stim` circuits to read
detector coordinates. You need to understand quantum error correction before you can look at
a single label.

Decoding a surface code is, stripped of physics, binary sequence classification on sparse
binary channels with exact labels. That should be accessible to anyone who trains models.
This dataset makes it so.

## The task

Each row is one experimental shot. The input is a syndrome: a multi-channel binary time
series of parity-check measurements. The label is whether the logical qubit ended up flipped.

```python
from datasets import load_dataset
import numpy as np

ds = load_dataset("Bauxitiego/surface-code-syndromes")
row = ds["train"][0]
syndrome = np.array(row["syndrome"], np.uint8).reshape(row["time_steps"], row["width"])
label = row["label"]
```

## Fields

| Field | Type | Description |
|---|---|---|
| `experiment` | string | Source directory name, e.g. `surface_code_bZ_d5_r25_center_5_5` |
| `basis` | string | Memory basis, `X` or `Z` |
| `distance` | int8 | Code distance, 3 or 5 |
| `rounds` | int16 | Syndrome extraction rounds, odd values 1 to 25 |
| `time_steps` | int8 | First dimension of the reshaped syndrome, always `rounds + 1` |
| `width` | int16 | Second dimension, the widest round |
| `round_widths` | list[uint8] | Real detectors per time step, for reconstructing the mask |
| `syndrome` | list[uint8] | Flattened `[time_steps, width]`, zero-padded |
| `label` | uint8 | Ground truth: did the logical observable flip |
| `pymatching` | uint8 | Minimum-weight perfect matching prediction |
| `correlated_matching` | uint8 | Correlated matching prediction |
| `tensor_network` | uint8 | Tensor network contraction prediction, null where not run |

### Padding matters

Rounds are **ragged**. The first time step carries only the stabilisers of the memory basis
and the last comes from the data qubit measurements, so both are half the width of the
middle rounds. A distance-5, 25-round experiment has widths `[12, 24, 24, ..., 24, 12]`.

Rows are right-padded to the widest round, so some slots are structurally empty. Use
`round_widths` to build a mask and make sure padding cannot reach your model's output:

```python
mask = np.zeros((row["time_steps"], row["width"]), np.uint8)
for t, w in enumerate(row["round_widths"]):
    mask[t, :w] = 1
```

A padded zero and an observed no-detection are different things. Treating them as the same
is a silent bug, and it will not show up as a training failure.

## Baselines come with the data

Google ran three decoders and published their per-shot predictions, so you can compute the
numbers you need to beat without installing a decoder:

```python
import numpy as np
sub = ds["test"].filter(lambda r: r["distance"] == 5 and r["rounds"] == 25 and r["basis"] == "Z")
label = np.array(sub["label"])
for name in ("pymatching", "correlated_matching"):
    print(name, (np.array(sub[name]) != label).mean())
```

On distance 5, 25 rounds, basis Z, test split (10,000 shots):

| Decoder | Logical error rate |
|---|---|
| Always predict "no flip" | 0.5098 |
| pymatching | 0.4399 |
| Correlated matching | 0.4028 |

Those look high because 25 rounds accumulate error. The meaningful quantity is error per
round, and the meaningful comparison is against these baselines rather than against zero.

**Correlated matching and tensor network contraction are strong.** Tensor network contraction
is close to optimal for these circuits. Beating pymatching is a reasonable target; beating
tensor network contraction is not, and a paper claiming to would need extraordinary evidence.

## Splits

70 / 10 / 20 train, validation, test, stratified within each experiment and shuffled with a
fixed seed (20260806) before splitting.

The shuffle is deliberate. Device shots arrive in acquisition order and calibration drifts
over a run, so an unshuffled split would train on one period of the experiment and test on
another, which measures drift rather than decoding.

| Split | Rows |
|---|---|
| train | 4,550,000 |
| validation | 650,000 |
| test | 1,300,000 |

130 experiments: two bases, distances 3 and 5, odd round counts 1 through 25, and for
distance 3 four different positions on the chip.

## Limitations

- One device, one calibration window, mid-2022. Error rates on current hardware are lower.
- Distance 3 and 5 only. The 2024 follow-up reached distance 7 below threshold; that data is
  a separate release and is not included here.
- 50,000 shots per experiment. Ample for evaluation, thin for training large models.
- No sweep over physical error rate. The device has the error rates it has.
- The four distance-3 chip positions have genuinely different noise. Pooling them trains a
  decoder that is worse on each than a per-position decoder would be. That is a real effect
  worth measuring, not a defect.

## Citation

Cite the original data. This dataset is a reformatting and claims no measurement credit.

```bibtex
@article{google2023suppressing,
  title   = {Suppressing quantum errors by scaling a surface code logical qubit},
  author  = {{Google Quantum AI}},
  journal = {Nature},
  volume  = {614},
  pages   = {676--681},
  year    = {2023},
  doi     = {10.1038/s41586-022-05434-1}
}
```

Original data: [zenodo.org/records/6804040](https://zenodo.org/records/6804040), CC-BY-4.0.

## License

CC-BY-4.0, inherited from the source release. Attribution to Google Quantum AI is required.

## Related

Conversion code, training code, and a study of when learned decoders beat matching:
[github.com/Bauxitiego/qec-neural-decoder](https://github.com/Bauxitiego/qec-neural-decoder)