# Complementary-gap postselection on Google Willow

*A reproducible validation on real surface-code hardware.*

> **What this is.** A validation study, not a product pitch. We ran the complementary gap, a
> published postselection method (Gidney et al., Yoked surface codes, arXiv:2312.04522), on Google's
> real Willow surface-code data and measured how much it cuts the logical error rate. Every number on this page regenerates
> from public data with the linked notebook.
>
> **What this is not.** We did not invent the method. Complementary-gap decoding is published work,
> and we cite it. We are showing that it works, reproducibly, on the field's flagship hardware, and
> that our packaging of it is honest.

## TL;DR

On real Google Willow surface-code data (Nature, 2024), discarding the least-confident **20%** of
shots via the complementary gap cuts the logical error rate by:

| Distance | Base logical error rate | Logical error rate cut (20% discard) | Ranking AUC |
|---|---|---|---|
| d = 3 | 24.1% | **+26%** | 0.736 |
| d = 5 | 17.8% | **+35%** | 0.792 |
| d = 7 | 11.6% | **+53%** | 0.848 |

Discarding the same 20% of shots *at random* does essentially nothing (+0.2 / -0.1 / +0.3%), so the
gain is the gap signal, not the throwing-away. The method is **training-free** and **correct by
construction** (its committed decode matches minimum-weight matching on every shot).

The ranking gets sharper as the base error rate falls: the AUC climbs from 0.74 at d = 3 (24% LER) to
0.85 at d = 7 (12% LER), and rises further toward ~0.94 on the lowest-error runs in the dataset (you
can verify this in the notebook by narrowing to the low-round experiments). Every number in the table
above regenerates from the linked notebook on public data.

## Background

A surface-code round either succeeds or suffers a logical error. Many workloads can afford to *throw
away* their least-trustworthy runs to buy fidelity: memory experiments, magic-state factories,
protocols with a retry budget. The question is how to rank shots by trustworthiness without a
trained model and without changing the decoder.

The **complementary gap** answers this. For each shot you decode once normally, then decode again
*forced into the opposite logical class*. The difference in matching weight between the two (the gap)
is a calibration-free confidence: a large gap means the decoder is sure; a small gap means the two
logical outcomes were nearly tied, and that shot is the one likely to be wrong. Discard the small-gap
shots and the surviving logical error rate falls. (The complementary gap is defined in Gidney et al., Yoked surface codes, arXiv:2312.04522, Sec. 4; this
study is an independent validation of it, not a new decoder.)

## Data

Google's Willow surface-code memory experiment (Nature, 2024), distances 3/5/7, publicly released.
We use the real detection events and the real recorded logical flips, not simulation. The notebook
downloads the public dataset and reproduces every figure.

## Results

- **The gain scales with code distance** (+26 / +35 / +53% at d = 3/5/7), the direction fault
  tolerance is heading.
- **Honest attribution:** most of that scaling is driven by the *lower base error rate* at larger
  distance (a lower error rate sharpens the gap), with only a modest pure-distance effect at matched
  error rate. We do not claim distance itself causes the gain.
- **Cost:** postselection discards ~20% of shots. It buys fidelity with throughput, a real
  trade-off, and only sensible where you can afford to drop shots.
- **Scope:** we excluded runs with a randomized logical outcome (the long dead-logical flow runs at
  44-50% LER) and near-trivial single-round data; both are outside the regime where postselection is
  meaningful.

## Reproduce it

The full study runs from public inputs:

```bash
# open notebook (public Willow data + open method)
jupyter notebook notebooks/22_willow_complementary_gap_validation.ipynb
```

Every number above is regenerated in the notebook. Run it on your own machine and check us.

## What it means for you

If you run surface-code memory or any protocol with a shot budget, complementary-gap postselection is
a cheap, training-free fidelity lever you can adopt today. In the QubitBoost stack it ships inside
**SafetyGate** with the governance around it: spend caps, drift gating, and a signed receipt that
records the payoff for each run, so the fidelity you bought is auditable, not just claimed.

The method is public; our contribution is validating it honestly on real hardware and wrapping it in
governance you can prove. That is the whole QubitBoost thesis in one study: **every number reproduces.**

## References

1. C. Gidney, M. Newman, P. Brooks, C. Jones, "Yoked surface codes," Nature Communications 16, 4498 (2025); arXiv:2312.04522. The complementary gap is defined in Section 4.
2. Google Quantum AI, Willow surface-code memory dataset, Zenodo record 13273331.
