Background · Chapter 5
Measurement, feedback and decoding
Error correction turns a quantum computer into a real-time classical system. Every round, thousands of measured bits have to reach a decoder, be turned into a correction, and be ready before the next operation that depends on them. This chapter follows that path from a readout window to a Pauli frame, compares published decoder latencies, and explains the system-call model of the fault-tolerant virtual machine that this simulator measures.
The readout chain and the board hub are explained in chapters 2 and 3. No prior knowledge of error-correcting codes is assumed. Lessons E1, E2 and E3 do the hands-on version of this chapter.
1From a readout window to a conditioned pulse
What happens between a measurement and the gate that depends on it?
In this section: the stages a measured bit crosses on the transmon ring, with the times the model gives for each.
In feed-forward, a later operation depends on a result obtained during the same run. Lesson A1's program measures qubit 0 and flips qubit 2 if the result is 1. On the ring each qubit has its own core, so the bit is produced on one core and consumed on another. It crosses five stages:
- Acquisition. The readout tone plays, the demodulation window integrates the returning signal, and the window closes.
- Decision and report. The readout decoder thresholds the IQ point (9 batches) and reports the bit up the link to the
measuring core's result sink, where a stalled load of
resreturns it. - Publication. The measuring core stores the bit, writes it to the host window, and publishes it to a shared group word of the hub.
- Distribution. The hub's arbiter passes the message and the new group word reaches every core's
boardregister. - Synchronization and issue. The cores meet at a barrier, read the bit, and the consuming core issues the conditioned pulse one lead ahead of its start time.
The simulator's system-call report (riscq/syscalls.mjs, feedbackSamples) measures these stages on the
feed-forward run. Run for this chapter, it gives the result at the measuring core 34 ns after the window closes, published at the
hub at 70 ns, and at every other core at 86 ns. The conditioned pulse opens 344 ns after the window closes
(docs/riscq-controller.md). Most of the gap between 86 ns and 344 ns is the barrier and the 96-batch lead: the cores have
to agree on a time base, and the pulse has to be issued far enough ahead to land exactly
(chapter 4).
riscq/syscalls.mjs and docs/riscq-controller.md. Model results, not hardware measurements.2Syndromes and codes
How can you detect an error without measuring the data?
In this section: stabilizer checks, the repetition code, the surface code, and rounds.
Quantum error correction spreads one logical qubit over many physical ones. An [[n, k, d]] stabilizer code encodes k logical qubits in n physical qubits and detects any error of weight below the code distance d. Its checks are multi-qubit Pauli operators whose values are +1 on every valid encoded state. Measuring a check does not disturb the encoded information; it only tells you whether an error has flipped that check. The set of measured check values is the syndrome (review: Terhal, Rev. Mod. Phys. 87, 307 (2015), arXiv:1302.3428).
A check is measured with an ancilla qubit: entangle the ancilla with the check's data qubits through CNOT or CZ gates, then
measure the ancilla. The simplest example is the three-qubit repetition code against bit flips. Data qubits 0, 2 and 4 hold
the encoded bit; ancilla 1 measures the parity of data 0 and 2, ancilla 3 the parity of data 2 and 4. A single flip on data 0 sets
only the first parity, on data 4 only the second, on data 2 both. That is exactly the simulator's
superconducting-repetition example: four cx gates, two measurements into syndrome bits s0 and
s1, and a decode.
The surface code is the workhorse of superconducting proposals. It encodes one logical qubit in a d × d patch with d² − 1 checks, each acting on up to four neighboring qubits on a square lattice (Dennis et al., J. Math. Phys. 43, 4452 (2002); Fowler et al., Phys. Rev. A 86, 032324 (2012), arXiv:1208.0928). Because the measurements themselves can be wrong, the checks are measured repeatedly, once per round, and a decoder looks at the changes between rounds, the detection events, across space and time. Google's 2023 experiment ran rounds of 921 ns: 500 ns measurement, 160 ns reset, and the gates in between (Google Quantum AI, Nature 614, 676 (2023), Fig. 1); their 2025 processor runs rounds of 1.1 µs (Nature 638, 920 (2025)). Every round produces about d² new bits per patch, forever.
3Decoders
Given a syndrome, which error happened?
In this section: lookup tables, union-find, matching and clustering decoders, and what makes them fast or accurate.
A decoder is the classical algorithm that turns syndromes into a correction. Many errors produce the same syndrome; the decoder picks the most likely one, or a good approximation.
- Lookup table. For a tiny code, precompute the correction for every possible syndrome. The repetition example uses the
table
[0, 1, 4, 2]: syndrome (s1 s0) = 01 flips data 0 (bit e0), 10 flips data 4 (e2), 11 flips data 2 (e1). The table grows as 2checks, so this works only for a few bits; the simulator's lookup decode takes 1 to 10 syndrome bits. - Minimum-weight perfect matching (MWPM). Detection events in the surface code come in pairs at the ends of error chains. Pair them up so that the total weight of the connecting paths is minimal, using Edmonds' blossom algorithm (Edmonds, Can. J. Math. 17, 449 (1965)). Sparse Blossom is a fast software implementation (Higgott and Gidney, Quantum 9, 1600 (2025), arXiv:2303.15933).
- Union-find. Grow clusters around detection events and merge them until every cluster holds an even number, then peel a correction inside each. Almost linear time, slightly less accurate than matching (Delfosse and Nickerson, Quantum 5, 595 (2021), arXiv:1709.06218). Its simple, local operations map well onto FPGA logic.
- Clustering in hardware. Riverlane's Collision Clustering decoder is a union-find variant designed for FPGAs and ASICs (Barber et al., Nature Electronics 8, 84 (2025), arXiv:2309.05558).
4The decoding deadline
How fast does a decoder have to be?
Two different numbers matter, and they are often confused. Throughput: the decoder must process syndromes at least as fast as rounds produce them. A decoder slower than the syndrome stream falls behind by a growing backlog and never recovers (Terhal 2015). Latency: the time from the last measurement a decision depends on to the decoded value. Clifford gates can be tracked without waiting, but a logical measurement whose outcome selects the next operation, as in a non-Clifford gate by teleportation, must wait for its decoded value. That wait is the reaction time, and it sets the speed of a fault-tolerant computer (Fowler, arXiv:1210.4626 (2012)). Gidney and Ekerå's RSA-2048 estimate assumes a 10 µs reaction time (Quantum 5, 433 (2021), arXiv:1905.09749).
Google's 2025 below-threshold experiment shows the distinction. Its real-time decoder kept up with a 1.1 µs cycle for up to a million cycles at distance 5, with an average latency of 63 µs (Google Quantum AI 2025, abstract): enough throughput, but a reaction time of tens of microseconds.
A decoder keeps up with a 1.1 µs round indefinitely, but each decoded value is ready 63 µs after its last round. What does that mean?
- It is too slow: the backlog grows without bound.
- It is fast enough for every purpose, because throughput is all that matters.
- Its throughput is sufficient, but any operation that must wait for a decoded value waits about 63 µs.
- The round time must be raised to 63 µs.
5Pauli frames
Most corrections are never played as pulses. Because Pauli errors commute or anticommute with Clifford gates in a known way, a correction can be recorded in software and applied to the interpretation of later measurement results instead. That record is the Pauli frame (Terhal 2015; Fowler et al. 2012). A frame update costs a few classical instructions and no quantum operation.
In the simulator a frame update is the system call pauli_frame_update. On the ring with a decoder core, it flips bits of
the qubit's frame word in the decoder core's RAM and reports the word to the host. It plays no pulse. In the repetition run the
first update is stored 22 ns after the decode and the second 16 ns later (docs/riscq-controller.md).
6Published decoder latencies
In this section: what real decoders achieve, under which conditions, and how that compares with a decoder run as firmware in this model.
| Decoder | Platform | Condition | Latency | Source |
|---|---|---|---|---|
| Helios (union-find) | FPGA (VCU129) | d = 21, phenomenological noise 0.1% | 11.5 ns per round, average | Liyanage et al., IEEE QCE 2023, arXiv:2301.08419; IEEE TQE 2024, arXiv:2406.08491 |
| Helios in RISC-Q's QEC system | FPGA | d = 3, worst-case pattern | 56 ns per decode | Liu et al., arXiv:2603.16203, Sec. V-B |
| Helios in RISC-Q's QEC system | FPGA | d = 5 and 7, p = 0.001 | 65 ns, 90 ns per decode | same, Sec. V-C |
| RISC-Q with Helios, end to end | three ZCU216 boards | d = 3 surface code, 3 rounds; syndrome at the leaves to correction back at the leaves | 446 ns | same, abstract and Sec. V-B |
| Micro Blossom (MWPM) | FPGA (VMK180), 62 MHz | d = 13, circuit-level p = 0.1% | 0.8 µs average | Wu, Liyanage and Zhong, ASPLOS 2025, arXiv:2502.14787 |
| Collision Clustering | FPGA (XCVU3P) | 881-qubit surface code (d = 21), circuit-level noise | 810 ns per round | Barber et al. 2025, arXiv:2309.05558 |
| Collision Clustering | 12 nm ASIC | 1,057-qubit surface code (d = 23) | 240 ns per round | same, abstract and Table II |
| Google real-time decoder | software | d = 5, 1.1 µs cycle, up to 10⁶ cycles | 63 µs average | Google Quantum AI, arXiv:2408.13687 |
The numbers are not directly comparable: they differ in code distance, noise model, whether latency is per round or per decode, and what the clock starts and stops on. The 446 ns breaks down, in the paper, into leaf aggregation 29 ns, fibre to the root 157 ns, root aggregation and pre-decode 20 ns, Helios 56 ns, root distribution 25 ns, network back 155 ns and leaf distribution 9 ns.
The simulator runs a real decoder too. Helios's repository carries a C program, software_code/union_find.c, that computes
what the hardware computes. Compiled for RV32I with RISC-Q's own start-up code and run on one RISC-Q core in the model, it decodes
distance 3 in 17 µs with no defect and 34 µs to 58 µs with defects, distance 5 in 94 µs to 285 µs, and distance 7 in 274 µs to 813 µs,
and agrees with Helios's own test vectors (docs/riscq-controller.md; lesson E3). That is a
thousand times slower than Helios in FPGA logic, for two reasons: the C program is a reference model that visits every edge on every
pass, and it runs on a soft core with the model's assumed cost of one batch per instruction. The comparison shows what
decoding in control-core software costs, not what Helios costs.
7The system-call model
How can a scheduler reason about a million-qubit machine without simulating every pulse?
In this section: the fault-tolerant virtual machine's services, its rate formula, its decode duration, and what this simulator measures for it.
The companion paper of this project describes a fault-tolerant quantum virtual machine (FTQVM). It virtualizes the resources of a fault-tolerant computer behind a small set of system calls, so that one program runs on superconducting, ion and atom machines alike. The paper's premise is that, to first order, each mechanism is described by one latency and one capacity. A program obtains services only through system calls, and a machine is a declaration of their latencies and capacities. The calls are:
| Call | What it does on hardware | Demand |
|---|---|---|
request_ancilla N | N qubits reset to |0⟩, usable after the preparation latency λp | qubits + N; preparation rate r(N, λp) |
route q₁ … qₙ | brings qubits together so that two-qubit gates among them are allowed: AOD moves, shuttles or SWAP chains | routing rate r(n, λr) |
gate | pulses for the gate, for example H · CZ · H for a CNOT | one gate slot |
measure q -> c[i] | readout and IQ threshold | classical rate r(1, λm) |
decode_syndrome | the decoder computes a correction from syndrome bits | one decoder; classical rate r(n, I) during its input phase |
pauli_frame_update | frame bits flip, no pulse | classical rate r(n, λu) |
request_magic | one factory run produces a magic state | one factory, plus the factory contract's demands |
release_ancilla N | frees N qubits | qubits − N |
An operation that moves N items (bits or qubits) in D nanoseconds reserves, for its whole interval,
and concurrent reservations add up, so that at no instant may the sum on a service exceed its capacity C. Since r(N, D) ≤ C exactly when 1000 N ≤ C D, moving N bits over a link of capacity C takes at least ⌈1000 N / C⌉ ns however it is placed. A decode of n bits on a decoder with input bandwidth b, and cap = min(b, C), lasts
δ = I + λd(n), I = ⌈1000 n / cap⌉ otherwise
The paper's model of Gidney and Ekerå's machine splits the 10 µs reaction time into a 550 ns measurement and a 9.45 µs decoder latency with b = 728 bits/µs. A decode of the 27 rounds of one lattice-surgery operation reads 19,656 bits, more than 728 bits/µs over its latency allows, so it needs an input phase of exactly 27 µs, and its outcome is ready 37 µs after the last measurement starts.
A decode reads 19,656 syndrome bits during an input phase of 27 µs. What rate r(N, D) does it reserve on the classical link?
What the simulator realizes and measures
On the transmon ring the simulator accepts a program of system calls on physical qubits: gate, measure,
decode_syndrome and pauli_frame_update. The build then has one more RISC-Q core, the decoder. The measuring cores
publish their bits through the hub; after a barrier, the decoder reads the syndrome as one field of a shared word, looks the correction
up in a table in its RAM, stores the decoded bits, and publishes those that condition a gate. request_ancilla, route
and request_magic are rejected on this machine: its calibration has no reset pulse, its couplers are fixed, and it has no
factory. The repetition example is compiled into three segments: the syndrome circuit and measurements, the decode and frame updates,
and the conditioned x on data qubit 2.
| Quantity | Run | Model result |
|---|---|---|
| Syndrome to decoder | Repetition round, 2 syndrome bits | last bit in the decoder's board register 86 ns after its window closes |
| Decode | Lookup decoder on a RISC-Q core | reads the syndrome at 112 ns; 64 ns for three decoded bits; decoded at 176 ns |
| Decoded bit at every core | same | 196 ns; the conditioned pulse opens at 490 ns, against 344 ns for a pulse conditioned directly on a measured bit |
| Hub bandwidth | n cores publish on one batch | one bit per batch for the whole board, 500 bits/µs at 500 MHz |
| Route latency | ZAC 14-qubit program, 26 rearrangement jobs | 90.5 µs to 145.1 µs, median 101.2 µs; one declared latency of 145.1 µs overcharges the median route by 43% |
From riscq/syscalls.mjs reports on the superconducting-repetition and neutral-bv14 runs,
reproduced for this chapter, and docs/riscq-controller.md. Times after the close of the readout window.
The last row is the paper's own caveat made concrete: the FTQVM gives a route one latency regardless of distance, and atom moves whose duration depends on distance are one of the two mechanisms in its corpus that one latency does not describe. The hub row shows the other direction of the comparison: one bit per message is fine for a repetition code, but syndrome traffic at the rate the paper's factory model needs, 132,496 bits/µs, would need a much wider path than this hub.
Run the repetition-code example. Into how many segments does the compiler split its hardware instructions?
What to remember
- A measured bit crosses acquisition, decision, publication, distribution and synchronization before a conditioned pulse can play.
- On the modeled ring: result at the core 34 ns, at the hub 70 ns, at every core 86 ns, conditioned pulse 344 ns after the window.
- Checks measured each round give the syndrome; the surface code has d² − 1 checks per patch and needs repeated rounds.
- Decoders range from lookup tables to union-find and matching. Union-find suits hardware; matching is more accurate.
- Throughput keeps the backlog bounded. Latency is the reaction time every decision on a decoded value waits for.
- Corrections are usually tracked in a Pauli frame, not played.
- The FTQVM charges each call one latency and one capacity, with rate r(N, D) = ⌈1000 N / D⌉ items/µs.