Document BB72 checkpoints for ultra-low p and high p
Browse filesAdds the new low-p fine-tuned BB72 checkpoint to the repository structure and usage example, while documenting that the original checkpoint remains recommended for high-p evaluation and transfer learning.
README.md
CHANGED
|
@@ -17,9 +17,7 @@ pipeline_tag: other
|
|
| 17 |
|
| 18 |
# NTU Neural Decoder Checkpoints
|
| 19 |
|
| 20 |
-
Pre-trained model weights for the neural decoders introduced in **Neural
|
| 21 |
-
Transfer Unification (NTU)**, an architecture-agnostic transfer-learning
|
| 22 |
-
framework for scalable quantum error correction.
|
| 23 |
|
| 24 |
π **Paper**: *Efficient Foundation Decoders for Fault-Tolerant Quantum Computing*
|
| 25 |
|
|
@@ -31,47 +29,46 @@ framework for scalable quantum error correction.
|
|
| 31 |
|
| 32 |
## Overview
|
| 33 |
|
| 34 |
-
NTU exploits the algebraic scale invariance of structured QEC code families to
|
| 35 |
-
transfer error knowledge from small codes to large-scale fault-tolerant regimes,
|
| 36 |
-
eliminating the cold-start optimization barrier. The framework is instantiated
|
| 37 |
-
with two backbone architectures:
|
| 38 |
|
| 39 |
| Backbone | Description | Code families |
|
| 40 |
|---|---|---|
|
| 41 |
| **NTU-Transformer** | Interleaved RNN-Transformer with 2D RoPE and cross-attention readout | Surface, BB |
|
| 42 |
| **NTU-Neural-BP** | Graph-neural belief propagation on the code Tanner graph | BB |
|
| 43 |
|
| 44 |
-
For planar surface codes under circuit-level depolarizing noise, NTU-Transformer
|
| 45 |
-
surpasses standard PyMatching at *d* = 25 within a ~10Β³β―GPU-hour training budget.
|
| 46 |
-
For the [[72,β―12,β―6]] bivariate-bicycle (BB) code, it outperforms BP+OSD across
|
| 47 |
-
all tested physical error rates and is competitive with multi-stage Relay BP.
|
| 48 |
-
Transfer from [[72,β―12,β―6]] to [[144,β―12,β―12]] reaches 93.1% block accuracy
|
| 49 |
-
within 2,500 steps (NTU-Transformer) and 95.3% within 500 steps (NTU-Neural-BP).
|
| 50 |
|
| 51 |
---
|
| 52 |
|
| 53 |
## Repository Structure
|
| 54 |
|
| 55 |
-
```
|
| 56 |
ntu-surface-code-decoder/
|
| 57 |
βββ README.md
|
| 58 |
-
βββ surface/
|
| 59 |
β βββ d7.pth (121 MB, trained from scratch)
|
| 60 |
β βββ d11.pth (121 MB, transferred from d=7)
|
| 61 |
β βββ d15.pth (121 MB, transferred from d=11)
|
| 62 |
β βββ d19.pth (121 MB, transferred from d=15)
|
| 63 |
β βββ d23.pth (121 MB, transferred from d=19)
|
| 64 |
β βββ d25.pth (122 MB, transferred from d=23)
|
| 65 |
-
βββ bb/
|
| 66 |
-
βββ bb72_transformer.pt
|
| 67 |
-
|
|
|
|
|
|
|
| 68 |
```
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
---
|
| 77 |
|
|
@@ -87,7 +84,6 @@ ckpt_path = hf_hub_download(
|
|
| 87 |
repo_id="Dreamworldsmile/ntu-surface-code-decoder",
|
| 88 |
filename="surface/d7.pth",
|
| 89 |
)
|
| 90 |
-
|
| 91 |
ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=False)
|
| 92 |
model.load_state_dict(
|
| 93 |
{k.replace("_orig_mod.", "").replace("module.", ""): v
|
|
@@ -98,20 +94,31 @@ model.load_state_dict(
|
|
| 98 |
|
| 99 |
### NTU-Transformer β BB code
|
| 100 |
|
|
|
|
|
|
|
| 101 |
```python
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
ckpt_path = hf_hub_download(
|
| 103 |
repo_id="Dreamworldsmile/ntu-surface-code-decoder",
|
| 104 |
-
filename="bb/
|
| 105 |
)
|
| 106 |
-
|
| 107 |
ckpt = torch.load(ckpt_path, map_location="cpu")
|
| 108 |
-
state_dict = {
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
| 110 |
# Filter to keys present in the target model (skip logical_readout_bias).
|
| 111 |
model_sd = model.state_dict()
|
| 112 |
-
filtered = {
|
| 113 |
-
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
| 115 |
model.load_state_dict(filtered, strict=False)
|
| 116 |
```
|
| 117 |
|
|
@@ -122,7 +129,6 @@ ckpt_path = hf_hub_download(
|
|
| 122 |
repo_id="Dreamworldsmile/ntu-surface-code-decoder",
|
| 123 |
filename="bb/neural_bp_bb72.pt",
|
| 124 |
)
|
| 125 |
-
|
| 126 |
ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=True)
|
| 127 |
state_dict = {k.replace("module.", ""): v for k, v in ckpt.items()}
|
| 128 |
model.load_state_dict(state_dict, strict=True)
|
|
@@ -136,15 +142,15 @@ cd ntu-decoder
|
|
| 136 |
|
| 137 |
# Surface code.
|
| 138 |
bash inference.sh --code surface --d 7 \
|
| 139 |
-
|
| 140 |
|
| 141 |
# BB code β NTU-Transformer.
|
| 142 |
bash inference.sh --code bb --model transformer --block_size 72 \
|
| 143 |
-
|
| 144 |
|
| 145 |
# BB code β NTU-Neural-BP.
|
| 146 |
bash inference.sh --code bb --model neural_bp --block_size 72 \
|
| 147 |
-
|
| 148 |
```
|
| 149 |
|
| 150 |
---
|
|
@@ -153,48 +159,33 @@ bash inference.sh --code bb --model neural_bp --block_size 72 \
|
|
| 153 |
|
| 154 |
### NTU-Transformer
|
| 155 |
|
| 156 |
-
The Transformer-based decoder combines standard multi-head self-attention
|
| 157 |
-
blocks with two QEC-specific components:
|
| 158 |
|
| 159 |
-
- **Scalable STEM embedding** β Encodes syndrome data from variable-size
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
- **
|
| 163 |
-
algebraic displacements defined by the code's shift set *M*(*x*,β―*y*,β―*t*;β―*d*),
|
| 164 |
-
preserving detector geometry across code distances.
|
| 165 |
-
- **Interleaved RNN-Transformer backbone** β 5 GRU-based recurrent blocks
|
| 166 |
-
alternating with 6 spatial self-attention blocks.
|
| 167 |
-
- **Cross-attention logical readout** β Learnable logical query tokens attend
|
| 168 |
-
over the encoded detector representations.
|
| 169 |
|
| 170 |
### NTU-Neural-BP
|
| 171 |
|
| 172 |
A graph-neural-network decoder operating on the bipartite Tanner graph:
|
| 173 |
|
| 174 |
-
- **Message passing** between variable and check nodes with gated recurrent
|
| 175 |
-
units (GRU) for message updates.
|
| 176 |
- **Syndrome-aware encoding** of check node states and prior LLRs.
|
| 177 |
- **Focal loss** with syndrome consistency regularization.
|
| 178 |
-
- Compact model (~300K parameters for the [[72,
|
| 179 |
|
| 180 |
---
|
| 181 |
|
| 182 |
## Authors
|
| 183 |
|
| 184 |
-
[Ge Yan](https://grahamyan.github.io)<sup>1</sup>,
|
| 185 |
-
Shanchuan Li<sup>1,β―2</sup>,
|
| 186 |
-
Shiyi Xiao<sup>1,β―3</sup>,
|
| 187 |
-
Pengyue Ma<sup>1</sup>,
|
| 188 |
-
Hanyan Cao<sup>4</sup>,
|
| 189 |
-
[Feng Pan](https://scholar.google.com/citations?user=Vp6hFhUAAAAJ)<sup>4,\*</sup>,
|
| 190 |
-
[Yuxuan Du](https://yuxuan-du.github.io)<sup>1,\*</sup>
|
| 191 |
-
|
| 192 |
-
<sup>1</sup> College of Computing and Data Science, Nanyang Technological University, Singapore<br>
|
| 193 |
-
<sup>2</sup> Department of Electrical Engineering and Computer Science, Tokyo University of Agriculture and Technology, Japan<br>
|
| 194 |
-
<sup>3</sup> School of Artificial Intelligence, Shanghai Jiao Tong University, China<br>
|
| 195 |
-
<sup>4</sup> Science, Mathematics and Technology Cluster, Singapore University of Technology and Design, Singapore
|
| 196 |
|
| 197 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
|
| 199 |
---
|
| 200 |
|
|
@@ -203,8 +194,7 @@ Hanyan Cao<sup>4</sup>,
|
|
| 203 |
```bibtex
|
| 204 |
@article{ntu2026,
|
| 205 |
title={Efficient Foundation Decoders for Fault-Tolerant Quantum Computing},
|
| 206 |
-
author={Yan, Ge and Li, Shanchuan and Xiao, Shiyi and Ma, Pengyue and
|
| 207 |
-
Cao, Hanyan and Pan, Feng and Du, Yuxuan},
|
| 208 |
year={2026},
|
| 209 |
}
|
| 210 |
```
|
|
|
|
| 17 |
|
| 18 |
# NTU Neural Decoder Checkpoints
|
| 19 |
|
| 20 |
+
Pre-trained model weights for the neural decoders introduced in **Neural Transfer Unification (NTU)**, an architecture-agnostic transfer-learning framework for scalable quantum error correction.
|
|
|
|
|
|
|
| 21 |
|
| 22 |
π **Paper**: *Efficient Foundation Decoders for Fault-Tolerant Quantum Computing*
|
| 23 |
|
|
|
|
| 29 |
|
| 30 |
## Overview
|
| 31 |
|
| 32 |
+
NTU exploits the algebraic scale invariance of structured QEC code families to transfer error knowledge from small codes to large-scale fault-tolerant regimes, eliminating the cold-start optimization barrier. The framework is instantiated with two backbone architectures:
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
| Backbone | Description | Code families |
|
| 35 |
|---|---|---|
|
| 36 |
| **NTU-Transformer** | Interleaved RNN-Transformer with 2D RoPE and cross-attention readout | Surface, BB |
|
| 37 |
| **NTU-Neural-BP** | Graph-neural belief propagation on the code Tanner graph | BB |
|
| 38 |
|
| 39 |
+
For planar surface codes under circuit-level depolarizing noise, NTU-Transformer surpasses standard PyMatching at *d* = 25 within a ~10Β³ GPU-hour training budget. For the [[72, 12, 6]] bivariate-bicycle (BB) code, it outperforms BP+OSD across all tested physical error rates and is competitive with multi-stage Relay BP. Transfer from [[72, 12, 6]] to [[144, 12, 12]] reaches 93.1% block accuracy within 2,500 steps (NTU-Transformer) and 95.3% within 500 steps (NTU-Neural-BP).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
---
|
| 42 |
|
| 43 |
## Repository Structure
|
| 44 |
|
| 45 |
+
```text
|
| 46 |
ntu-surface-code-decoder/
|
| 47 |
βββ README.md
|
| 48 |
+
βββ surface/ β Surface code (NTU-Transformer)
|
| 49 |
β βββ d7.pth (121 MB, trained from scratch)
|
| 50 |
β βββ d11.pth (121 MB, transferred from d=7)
|
| 51 |
β βββ d15.pth (121 MB, transferred from d=11)
|
| 52 |
β βββ d19.pth (121 MB, transferred from d=15)
|
| 53 |
β βββ d23.pth (121 MB, transferred from d=19)
|
| 54 |
β βββ d25.pth (122 MB, transferred from d=23)
|
| 55 |
+
βββ bb/ β BB code checkpoints
|
| 56 |
+
βββ bb72_transformer.pt (144 MB, high-p evaluation and transfer learning)
|
| 57 |
+
βββ bb72_transformer_lowp_finetuned.pt
|
| 58 |
+
β (144 MB, fine-tuned for ultra-low physical error rates)
|
| 59 |
+
βββ neural_bp_bb72.pt (1.2 MB, NTU-Neural-BP, [[72,12,6]])
|
| 60 |
```
|
| 61 |
|
| 62 |
+
### BB72 Transformer checkpoint selection
|
| 63 |
+
|
| 64 |
+
| Checkpoint | Recommended use |
|
| 65 |
+
|---|---|
|
| 66 |
+
| `bb/bb72_transformer.pt` | **High physical error rates (high p)** and **transfer learning** |
|
| 67 |
+
| `bb/bb72_transformer_lowp_finetuned.pt` | **Ultra-low physical error rates (ultra-low p)** |
|
| 68 |
+
|
| 69 |
+
The original `bb72_transformer.pt` checkpoint is retained unchanged. Use the low-p fine-tuned checkpoint only for evaluation or inference in the ultra-low-p regime.
|
| 70 |
+
|
| 71 |
+
Each surface code checkpoint contains `model_state` (OrderedDict of weights), `d` (code distance), `rounds` (syndrome extraction rounds), and `step` (training step). BB Transformer checkpoints additionally include `block_acc` and `output_convention` metadata. NTU-Neural-BP checkpoints store the raw `state_dict` directly.
|
| 72 |
|
| 73 |
---
|
| 74 |
|
|
|
|
| 84 |
repo_id="Dreamworldsmile/ntu-surface-code-decoder",
|
| 85 |
filename="surface/d7.pth",
|
| 86 |
)
|
|
|
|
| 87 |
ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=False)
|
| 88 |
model.load_state_dict(
|
| 89 |
{k.replace("_orig_mod.", "").replace("module.", ""): v
|
|
|
|
| 94 |
|
| 95 |
### NTU-Transformer β BB code
|
| 96 |
|
| 97 |
+
Select the checkpoint according to the target physical error-rate regime:
|
| 98 |
+
|
| 99 |
```python
|
| 100 |
+
# Use bb72_transformer.pt for high p and transfer learning.
|
| 101 |
+
# Use bb72_transformer_lowp_finetuned.pt for ultra-low p.
|
| 102 |
+
checkpoint_name = "bb72_transformer_lowp_finetuned.pt"
|
| 103 |
+
|
| 104 |
ckpt_path = hf_hub_download(
|
| 105 |
repo_id="Dreamworldsmile/ntu-surface-code-decoder",
|
| 106 |
+
filename=f"bb/{checkpoint_name}",
|
| 107 |
)
|
|
|
|
| 108 |
ckpt = torch.load(ckpt_path, map_location="cpu")
|
| 109 |
+
state_dict = {
|
| 110 |
+
k.replace("_orig_mod.", "").replace("module.", ""): v
|
| 111 |
+
for k, v in ckpt["model_state"].items()
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
# Filter to keys present in the target model (skip logical_readout_bias).
|
| 115 |
model_sd = model.state_dict()
|
| 116 |
+
filtered = {
|
| 117 |
+
k: v for k, v in state_dict.items()
|
| 118 |
+
if k in model_sd
|
| 119 |
+
and model_sd[k].shape == v.shape
|
| 120 |
+
and k != "logical_readout_bias"
|
| 121 |
+
}
|
| 122 |
model.load_state_dict(filtered, strict=False)
|
| 123 |
```
|
| 124 |
|
|
|
|
| 129 |
repo_id="Dreamworldsmile/ntu-surface-code-decoder",
|
| 130 |
filename="bb/neural_bp_bb72.pt",
|
| 131 |
)
|
|
|
|
| 132 |
ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=True)
|
| 133 |
state_dict = {k.replace("module.", ""): v for k, v in ckpt.items()}
|
| 134 |
model.load_state_dict(state_dict, strict=True)
|
|
|
|
| 142 |
|
| 143 |
# Surface code.
|
| 144 |
bash inference.sh --code surface --d 7 \
|
| 145 |
+
--hf_repo Dreamworldsmile/ntu-surface-code-decoder --shots 100000
|
| 146 |
|
| 147 |
# BB code β NTU-Transformer.
|
| 148 |
bash inference.sh --code bb --model transformer --block_size 72 \
|
| 149 |
+
--hf_repo Dreamworldsmile/ntu-surface-code-decoder --shots 100000 --p 0.005
|
| 150 |
|
| 151 |
# BB code β NTU-Neural-BP.
|
| 152 |
bash inference.sh --code bb --model neural_bp --block_size 72 \
|
| 153 |
+
--hf_repo Dreamworldsmile/ntu-surface-code-decoder --shots 100000 --p 0.005
|
| 154 |
```
|
| 155 |
|
| 156 |
---
|
|
|
|
| 159 |
|
| 160 |
### NTU-Transformer
|
| 161 |
|
| 162 |
+
The Transformer-based decoder combines standard multi-head self-attention blocks with two QEC-specific components:
|
|
|
|
| 163 |
|
| 164 |
+
- **Scalable STEM embedding** β Encodes syndrome data from variable-size lattices into a shared latent representation, absorbing the distance dependence into the input encoding (Eq. 2 in the paper).
|
| 165 |
+
- **QEC-aware 2D RoPE** β Applies rotary position embeddings to relative algebraic displacements defined by the code's shift set *M* (*x*, *y*, *t*; *d*), preserving detector geometry across code distances.
|
| 166 |
+
- **Interleaved RNN-Transformer backbone** β 5 GRU-based recurrent blocks alternating with 6 spatial self-attention blocks.
|
| 167 |
+
- **Cross-attention logical readout** β Learnable logical query tokens attend over the encoded detector representations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
### NTU-Neural-BP
|
| 170 |
|
| 171 |
A graph-neural-network decoder operating on the bipartite Tanner graph:
|
| 172 |
|
| 173 |
+
- **Message passing** between variable and check nodes with gated recurrent units (GRU) for message updates.
|
|
|
|
| 174 |
- **Syndrome-aware encoding** of check node states and prior LLRs.
|
| 175 |
- **Focal loss** with syndrome consistency regularization.
|
| 176 |
+
- Compact model (~300K parameters for the [[72, 12, 6]] code).
|
| 177 |
|
| 178 |
---
|
| 179 |
|
| 180 |
## Authors
|
| 181 |
|
| 182 |
+
[Ge Yan](https://grahamyan.github.io)<sup>1</sup>, Shanchuan Li<sup>1,2</sup>, Shiyi Xiao<sup>1,3</sup>, Pengyue Ma<sup>1</sup>, Hanyan Cao<sup>4</sup>, [Feng Pan](https://scholar.google.com/citations?user=Vp6hFhUAAAAJ)<sup>4,\*</sup>, [Yuxuan Du](https://yuxuan-du.github.io)<sup>1,\*</sup>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
|
| 184 |
+
<sup>1</sup> College of Computing and Data Science, Nanyang Technological University, Singapore
|
| 185 |
+
<sup>2</sup> Department of Electrical Engineering and Computer Science, Tokyo University of Agriculture and Technology, Japan
|
| 186 |
+
<sup>3</sup> School of Artificial Intelligence, Shanghai Jiao Tong University, China
|
| 187 |
+
<sup>4</sup> Science, Mathematics and Technology Cluster, Singapore University of Technology and Design, Singapore
|
| 188 |
+
<sup>\*</sup> Corresponding authors
|
| 189 |
|
| 190 |
---
|
| 191 |
|
|
|
|
| 194 |
```bibtex
|
| 195 |
@article{ntu2026,
|
| 196 |
title={Efficient Foundation Decoders for Fault-Tolerant Quantum Computing},
|
| 197 |
+
author={Yan, Ge and Li, Shanchuan and Xiao, Shiyi and Ma, Pengyue and Cao, Hanyan and Pan, Feng and Du, Yuxuan},
|
|
|
|
| 198 |
year={2026},
|
| 199 |
}
|
| 200 |
```
|