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:

  1. Acquisition. The readout tone plays, the demodulation window integrates the returning signal, and the window closes.
  2. 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 res returns it.
  3. Publication. The measuring core stores the bit, writes it to the host window, and publishes it to a shared group word of the hub.
  4. Distribution. The hub's arbiter passes the message and the new group word reaches every core's board register.
  5. 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).

These are model numbers. They are costs of the classical controller as modeled, with RISC-Q's documented stage counts and three assumed latencies. They are not measurements of hardware, and they say nothing about gate fidelity.
0 nswindow closes 34result at core 70at the hub 86at every core barrier, time base, 96-batch lead, issue of the conditioned pulse 344conditioned pulse opens
Feedback on the ring, to scale. Times after the close of qubit 0's demodulation window in the feed-forward run, from 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.

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?

  1. It is too slow: the backlog grows without bound.
  2. It is fast enough for every purpose, because throughput is all that matters.
  3. Its throughput is sufficient, but any operation that must wait for a decoded value waits about 63 µs.
  4. The round time must be raised to 63 µs.
Throughput and latency are separate requirements. A pipelined decoder can process many rounds at once and still take a long time on each. The latency becomes the reaction time of every feed-forward on a decoded value.

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.

DecoderPlatformConditionLatencySource
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 systemFPGAd = 3, worst-case pattern56 ns per decodeLiu et al., arXiv:2603.16203, Sec. V-B
Helios in RISC-Q's QEC systemFPGAd = 5 and 7, p = 0.00165 ns, 90 ns per decodesame, Sec. V-C
RISC-Q with Helios, end to endthree ZCU216 boardsd = 3 surface code, 3 rounds; syndrome at the leaves to correction back at the leaves446 nssame, abstract and Sec. V-B
Micro Blossom (MWPM)FPGA (VMK180), 62 MHzd = 13, circuit-level p = 0.1%0.8 µs averageWu, Liyanage and Zhong, ASPLOS 2025, arXiv:2502.14787
Collision ClusteringFPGA (XCVU3P)881-qubit surface code (d = 21), circuit-level noise810 ns per roundBarber et al. 2025, arXiv:2309.05558
Collision Clustering12 nm ASIC1,057-qubit surface code (d = 23)240 ns per roundsame, abstract and Table II
Google real-time decodersoftwared = 5, 1.1 µs cycle, up to 10⁶ cycles63 µs averageGoogle 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.

The compiled Helios decoder running on a RISC-Q core
A decoder as firmware. The Helios union-find program, compiled C, running on one RISC-Q core in the model. The workspace shows the C source, the RV32I firmware and the decoding graph as it runs. Photographed from the running workspace.

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:

CallWhat it does on hardwareDemand
request_ancilla NN qubits reset to |0⟩, usable after the preparation latency λpqubits + 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 chainsrouting rate r(n, λr)
gatepulses for the gate, for example H · CZ · H for a CNOTone gate slot
measure q -> c[i]readout and IQ thresholdclassical rate r(1, λm)
decode_syndromethe decoder computes a correction from syndrome bitsone decoder; classical rate r(n, I) during its input phase
pauli_frame_updateframe bits flip, no pulseclassical rate r(n, λu)
request_magicone factory run produces a magic stateone factory, plus the factory contract's demands
release_ancilla Nfrees N qubitsqubits − N

An operation that moves N items (bits or qubits) in D nanoseconds reserves, for its whole interval,

r(N, D) = ⌈1000 · N / D⌉ items/µs

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

δ = λd(n)   if r(n, λd(n)) ≤ cap
δ = 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?

r = ⌈1000 · 19,656 / 27,000⌉ = ⌈728⌉ = 728 bits/µs, exactly the decoder's input bandwidth b. That is why the input phase is 27 µs: it is the shortest time in which 19,656 bits fit through 728 bits/µs.

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.

QuantityRunModel result
Syndrome to decoderRepetition round, 2 syndrome bitslast bit in the decoder's board register 86 ns after its window closes
DecodeLookup decoder on a RISC-Q corereads the syndrome at 112 ns; 64 ns for three decoded bits; decoded at 176 ns
Decoded bit at every coresame196 ns; the conditioned pulse opens at 490 ns, against 344 ns for a pulse conditioned directly on a measured bit
Hub bandwidthn cores publish on one batchone bit per batch for the whole board, 500 bits/µs at 500 MHz
Route latencyZAC 14-qubit program, 26 rearrangement jobs90.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?

Each segment boundary is a point where a bit produced on one core is needed by another: the syndrome bits must reach the decoder core, and the decoded bit e1 must reach qubit 2's core. Each crossing costs a barrier.

What to remember

  1. A measured bit crosses acquisition, decision, publication, distribution and synchronization before a conditioned pulse can play.
  2. 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.
  3. Checks measured each round give the syndrome; the surface code has d² − 1 checks per patch and needs repeated rounds.
  4. Decoders range from lookup tables to union-find and matching. Union-find suits hardware; matching is more accurate.
  5. Throughput keeps the backlog bounded. Latency is the reaction time every decision on a decoded value waits for.
  6. Corrections are usually tracked in a Pauli frame, not played.
  7. The FTQVM charges each call one latency and one capacity, with rate r(N, D) = ⌈1000 N / D⌉ items/µs.