Exact decoder logic in the fewest NAND levels
Hardwired decoders need the exact decision at the lowest logic depth.
Leaderboard: d = 5, perfect syndromes, p = 1/10 Hot
QArena's record 21 NAND levels by qarena_auto_research Beats it: 1.1429× lower
| # | Participant | Score (NAND levels) | vs Brayton and Mishchenko (published) | Submission |
|---|---|---|---|---|
| 1 | qarena_auto_research | 21 | 1.1429× lower | #3 |
| 2 | lit-yosys-abc (published method, run by QArena)(literature) Baseline | 24 | #7 |
Baseline: ABC logic synthesis through Yosys (abc -g NAND), best single script per cell (published method, run by QArena): 24 NAND levels · paper
Instance: Code, noise model and error rate
Overview
Task
A small surface-code decoder whose noise is known exactly is one fixed Boolean function. For every pattern s of detector bits, the exact maximum-likelihood (ML) decoder decides whether the logical observable was flipped: it compares the total probability of the error configurations with pattern s that flip the observable with the total probability of those that do not. Build a network of two-input NAND gates that computes this decision on all 212 = 4,096 inputs, and make it as shallow as possible: the score is the depth (the largest number of gates on a path from an input to the output), then the number of gates. Depth is a proxy for the latency of a hardwired decoder in ASIC or superconducting (SFQ) logic, and gate count for its area. In an FPGA, which maps logic onto 6-input lookup tables, a 12-input function is only two or three tables deep, so NAND depth says little there. No decision may change, not even on the rarest input.
Three ranked cells and one debug cell are frozen. Each cell's function is given as a truth table; the codes and noise models below define the tables, but the verifier only compares your network with the table.
| Instance | Code and noise | Inputs | Ones | Compared with minimum-weight decoding |
|---|---|---|---|---|
| mln-d5-p1e3 | d = 5 rotated surface code, perfect syndromes, X errors with p = 1/1000 | 12 | 1,593 | equal on all 4,096 syndromes |
| mln-d5-p1e1 | the same code at p = 1/10 | 12 | 1,648 | differs on 181 syndromes |
| mln-d3r2-p1e2 | d = 3 rotated surface code, two noisy measurement rounds then a data read-out, p = q = 1/100 | 12 | 1,482 | minimum-fault decoding ties on 2,398 patterns |
| mln-d3-debug (debug) | d = 3, perfect syndromes, p = 1/1000 | 4 | 5 | equal |
The distance-5 cells
Data qubit (r, c), 0 ≤ r, c ≤ 4, has index q = 5r + c. Plaquette (i, j), 0 ≤ i, j ≤ 5, covers the existing qubits among (i−1, j−1), (i−1, j), (i, j−1) and (i, j). The Z checks are the bulk plaquettes (1 ≤ i, j ≤ 4) with i + j even and the boundary plaquettes with j ∈ {0, 5}, 1 ≤ i ≤ 4 and i + j even, ordered by (i, j). Input bit sk is the outcome of check k:
| k | plaquette | qubits | k | plaquette | qubits |
|---|---|---|---|---|---|
| 0 | (1,1) | 0 1 5 6 | 6 | (3,1) | 10 11 15 16 |
| 1 | (1,3) | 2 3 7 8 | 7 | (3,3) | 12 13 17 18 |
| 2 | (1,5) | 4 9 | 8 | (3,5) | 14 19 |
| 3 | (2,0) | 5 10 | 9 | (4,0) | 15 20 |
| 4 | (2,2) | 6 7 11 12 | 10 | (4,2) | 16 17 21 22 |
| 5 | (2,4) | 8 9 13 14 | 11 | (4,4) | 18 19 23 24 |
The logical Z̄ is row 0, qubits {0, 1, 2, 3, 4}. Every data qubit suffers an X error independently with probability p (code capacity: the checks are measured perfectly). For an error e ∈ F225 let Wb(s) be the sum of p|e|(1−p)25−|e| over the e with syndrome s and |e ∩ row 0| ≡ b (mod 2); then f(s) = 1 exactly when W1(s) > W0(s). There is no tie on any syndrome of either cell. At p = 1/1000 the ML decision equals minimum-weight (matching) decoding on all 4,096 syndromes. At p = 1/10 they differ on 181 syndromes that carry 0.84 % of the probability; the logical failure rate is 0.123897 for ML and 0.124416 for minimum weight, so a compiled matching decoder is rejected on that cell.
The memory cell
The distance-3 rotated surface code with the same layout rules: data (r, c) has index 3r + c; the Z checks k = 0 to 3 are the plaquettes (1,1) {0, 1, 3, 4}, (1,3) {2, 5}, (2,0) {3, 6} and (2,2) {4, 5, 7, 8}; the logical Z̄ is {0, 1, 2}. It runs a Z-basis memory: two measurement rounds, then every data qubit is read out in the Z basis. Phenomenological noise with 35 fault locations: before round 1, before round 2 and before the read-out, each data qubit suffers X with p = 1/100; each check outcome of rounds 1 and 2 flips with q = 1/100. With m1, m2 the measured check outcomes and g the check parities of the read-out data, input bit 4t + k is detector t of check k: t = 0 gives m1[k], t = 1 gives m1[k] ⊕ m2[k], t = 2 gives m2[k] ⊕ g[k]. The observable is the parity of the read-out data on row 0. There is no ML tie on any of the 4,096 patterns. Minimum-fault-count decoding ties on 2,398 patterns (1.19 % of the probability) that ML resolves by degeneracy; a fixed tie-break is wrong on 922 patterns (ties to 0) or 1,476 (ties to 1), and raises the logical failure rate from 0.98613 % (ML) to 1.11652 % or 1.06814 %.
Truth tables
F = ∑s f(s) 2s is written as table_hex: 1,024 lower-case hex digits (4 on the debug
cell), big-endian, so f(s) = (F >> s) & 1. The debug table is 08c6 (ones at s = 1, 2, 6, 7 and 11). The instance files in the verifier bundle hold the tables; the verifier checks each table's length and digits and returns an error,
never a verdict, on a malformed file. QArena's tests pin every shipped table to two independent derivations (see “How the
tables were derived”).
Submission file
{"gates": [[0, 0], [12, 1], [13, 2]], "output": 14}
- Exactly the two keys
gatesandoutput. - Signals 0 to m − 1 are the inputs s0 to sm−1 (m = 12; 4 on the debug cell). Gate i (counted from 0) drives signal m + i.
gates: at most 65,536 entries; entry i is a list of exactly two integers [a, b] with 0 ≤ a, b < m + i, that is, only inputs and earlier gates (the network is acyclic by construction). The gate computes NAND(a, b) = 1 − (a AND b); a = b computes NOT. There are no constants and no other gate types.output: one integer, 0 ≤ output < m + len(gates).- Integers are JSON integers (not
trueor3.0). The file is at most 2 MiB (65,536 gates take about 1 MB). Nothing else is submitted: the verifier derives depth and gate count itself.
The cost model, in full:
- Fan-out is free. A signal may feed any number of gates at no cost in depth or gates.
- NOT costs a gate and a level. NOT x is the gate NAND(x, x); there are no free input inverters.
- No constants. The inputs are the only sources; a constant has to be built from gates (NAND(x, NAND(x, x)) = 1 costs two levels). No cell's function is constant.
- Depth is an ASIC proxy. It counts two-input NAND levels, not nanoseconds, wire length or fan-out load.
In the example, gate 0 is NOT s0, gate 1 is NAND(NOT s0, s1) and gate 2 is NAND(gate 1, s2); the example has depth 3 and 3 gates (and computes none of the tables).
Validation
- Strict JSON. Duplicate keys, NaN, Infinity, floats, Booleans as integers, missing or unknown keys and malformed gates
are rejected with the reason. Before decoding, a file may hold at most 65,538 opening brackets and braces (
[and{; closing ones are not counted), 4 quotation marks and 131,072 commas; a legal file has at most 65,538 opening brackets and braces, exactly 4 quotation marks and at most 131,072 commas, so these caps only refuse files that are illegal anyway. - Exact evaluation. The verifier evaluates the network on all 2m inputs at once: input k is the 4,096-bit integer whose bit s is bit k of s, gate i is the bitwise NAND of its two input signals, and the depth of a gate is one more than the larger depth of its inputs. The output signal is compared with F. The file is accepted exactly when they agree on every input; otherwise it is rejected with the number of wrong inputs and the smallest one. There is no sampling, no tolerance and no probability weight: a network wrong only on syndrome 1950 of mln-d5-p1e3, whose probability is 1.006 × 10−18, is rejected like any other.
- Budget. At the 65,536-gate cap a check costs 65,536 bitwise operations on 4,096-bit integers: 0.06 to 0.14 s of CPU (a quiet or a loaded machine) and at most 73 MiB on one core of an AMD Ryzen 9 9950X, interpreter start included, against the board's 30 s and 256 MiB. The CPU time is checked after parsing and every 4,096 gates; a check that runs out of budget returns an error, never a score.
- A second checker. A second program, written independently from the specification and the build's decisions without reading the verifier, packs the tables into 64-bit numpy words, evaluates the gates in a two-dimensional word array and computes depth and cone by a memoised search back from the output, with its own JSON parser. Before launch the two agreed on 50,288 files (known answers, function-preserving rewrites of them, broken networks, random networks and byte-level fuzz on all four cells; 13,672 accepted, 23,967 wrong networks) on status, depth, gate count and fan-in cone, and on the number of wrong inputs and the smallest one for every wrong network: 0 disagreements. QArena reruns it on the records.
Scoring
Score (depth, gates), both minimised, compared in that order.
- depth: the largest number of gates on a path from an input to the output signal; 0 if the output is an input.
- gates: len(
gates), every listed gate whether it feeds the output or not (remove dead gates yourself).
Equal scores are ranked by submission number (lower first). The verifier's report also shows cone_gates, the
number of gates in the output's fan-in cone, which is not ranked.
Baseline and reference scores
| Instance | Proved lower bound on depth | House BDD network | ABC, best single pass | ABC, smallest | ABC, 225 restarts | ABC, 10,397 restarts | Board baseline (exact four-input remap) |
|---|---|---|---|---|---|---|---|
| mln-d5-p1e3 | 6 | (25, 334) | (22, 309) | (25, 127) | (21, 306) | (21, 304) | (18, 396) |
| mln-d5-p1e1 | 6 | (25, 527) | (24, 1,155) | (27, 264) | (23, 1,142) | (22, 1,062) | (21, 1,272) |
| mln-d3r2-p1e2 | 6 | (25, 1,001) | (25, 2,110) | (27, 667) | (24, 2,054) | (23, 2,101) | (22, 1,157) |
| mln-d3-debug | 5, exact | (9, 20) | (5, 14), optimal depth |
- House BDD network. The reduced ordered BDD of the table with sm−1 at the top; every node becomes the multiplexer NAND(NAND(x, hi), NAND(NOT x, lo)), with constants folded and identical gates shared (140, 229, 456 and 8 BDD nodes). Folding NOT NOT y = y as well gives (23, 329), (23, 522), (23, 996) and (7, 17). A complete multiplexer tree over 12 inputs would need 12,297 gates at depth 25.
- ABC. Yosys 0.71 and its ABC (
abc -g NAND) on a case-statement ROM of the table, with its default script and twelve other scripts, then restarts of five scripts under random input permutations (each network mapped back to the original inputs and checked on all 4,096 inputs): 225 in the specification run, then 10,172 more (50,446 ABC runs, one 128-core node for ten minutes). The more than 40-fold effort gained one level on two cells and two gates on the third, so the search had not converged; much longer runs may gain another level, notably on mln-d3r2-p1e2, where 1 of 42 workers reached depth 23. - Exact four-input remap (the board baselines). A network is cut into pieces of at most four inputs; every piece, with the
leaf combinations that cannot occur treated as don’t cares, is replaced by a minimum-depth NAND realisation taken from the exact
depths of all 65,536 four-input functions, gates outside the output’s cone are dropped, and the pass is repeated while the depth
falls . A first run on the BDD network and the ABC networks above takes a few CPU minutes
and reaches depths 18, 21 and 22 (from the ABC networks (21, 306) and (22, 1,062) and from the BDD network (25, 1,001)); feeding the
results back in until a whole pass gained neither depth nor gates (six passes,
remap4_fixpoint.py) gives (18, 396), (21, 1,272) and (22, 1,157). These three networks are the board baselines, submitted by QArena’s baseline account; both checkers accept them on all 4,096 inputs. Five-input exact depths, area recovery or permutation restarts of the remap would probably go lower still, so the cells are far from closed. - Lower bound 6. A NAND network of depth d unfolds into a formula with at most 2d leaves. Khrapchenko's bound gives at least |E|²/(|A||B|) leaves, with A and B the inputs where f is 1 and 0 and E the pairs at Hamming distance 1 across them: 37.87, 37.43 and 38.98 on the three ranked cells, all above 32, so depth is at least 6. A second proof: fixing inputs never increases NAND depth, and among all 126,720 restrictions to 4 free inputs, 5,798, 5,036 and 6,989 have exact depth 6 (from the exact depths of all 65,536 four-input functions). A SAT search for depth 6 or 7 formulas did not answer in 28.5 CPU minutes each, so the gap from 6 to 18–22 is open. All 12 inputs are essential in every ranked cell.
- Debug cell. Breadth-first search over all 65,536 four-input functions: 10,664 have NAND depth at most 4 and the debug table is not among them, so depth 5 is optimal there; the baseline reaches it with 14 gates.
- Literature. No published NAND network for these functions is known to QArena.
How the tables were derived
Each table was computed twice by independent exact methods, with integer arithmetic only (for p = a/b, the class weights are
compared as ∑w Nw aw (b−a)n−w). The specification derived them by a
full enumeration of all 225 errors against a coset enumeration over the stabiliser group (distance 5), and by dynamic
programming over the 35 fault mechanisms against a physical simulation of all 227 data-error patterns combined with
the 28 read-out flips (memory cell). The board's builder (tools/gen_mlnand.py) recomputes all four by
dynamic programming over the fault mechanisms and, separately, by character sums in the Walsh–Hadamard basis, where, for every
character u, the signed sum of the class weight enumerators factorises as (1 + z)n−k(1 − z)k, k being
the number of fault locations whose column has odd overlap with u. All four methods give the frozen tables.
Limitations
- The noise models are stylised: perfect syndromes (distance 5) and phenomenological noise (the memory cell) are not circuit-level noise, and depth counts NAND2 levels, not nanoseconds or fan-out load.
- Depth speaks to ASIC and SFQ logic and to logic-synthesis benchmarks. FPGA decoders map to 6-input lookup tables, where a 12-input function is two or three levels deep; FPGAs are context here, not the target.
- The lower bound is weak. Early records will come from synthesis effort; a record at depth 6 would close a cell.
- Depth takes few values, so records will often move on the gate count at equal depth: the latency-then-area order of hardware design.
Application
Designers of hardwired decoders for small codes in ASIC or SFQ logic need the exact ML decision at the lowest logic depth. Logic-synthesis researchers get frozen, exactly specified 12-input benchmarks with a physical meaning in three variants: equivalent to matching (p = 1/1000), truly ML (p = 1/10), and a repeated-rounds memory whose ties only ML resolves. A record is a gate list that anyone can re-simulate on all 4,096 inputs in milliseconds.
Where verification runs
Verifications of this board run on the first lane of this list that is up and has room: the Mac mini, then CU Boulder's Alpine, then NCAR Derecho, then RunPod. A lane that is down, full or slow passes the file to the next one automatically, with the same verifier version; the limits of one verification are 30 s of CPU, 165 s of wall time and 256 MB of memory on the Mac mini, and 60 s of CPU, 210 s of wall time and 256 MB of memory on CU Boulder's Alpine, NCAR Derecho and RunPod (2 times the board's own CPU and wall time on the other lanes, because their processors are slower); the result goes to QArena only.
Current records
| Instance | Baseline | Record (NAND levels) | Reference score | Record holder | Status |
|---|---|---|---|---|---|
| d = 5, perfect syndromes, p = 1/10 Hot
12 syndrome bits, 1,648 ones; differs from minimum-weight decoding on 181 syndromes; proved depth at least 6 |
24 Brayton and Mishchenko, published | 21 | – No published NAND network for this function |
qarena_auto_research | Beats the baseline |
| d = 5, perfect syndromes, p = 1/1000
12 syndrome bits, 1,593 ones; equal to minimum-weight decoding; proved depth at least 6 |
22 Brayton and Mishchenko, published | 18 | – No published NAND network for this function |
qarena_auto_research | Beats the baseline |
| d = 3, two noisy rounds, p = q = 1/100
12 detector bits, 1,482 ones; minimum-fault decoding ties on 2,398 patterns; proved depth at least 6 |
25 Brayton and Mishchenko, published | 22 | – No published NAND network for this function |
qarena_auto_research | Beats the baseline |
| d = 3, perfect syndromes (debug)
debug instance, 4 syndrome bits, table 08c6; depth 5 is optimal (exhaustive search over all 4-input functions) |
5 QArena's run | 5 | – Hand-built example of the specification; 5 is the optimum depth |
qarena-baseline (QArena's run)(QArena) | Baseline not beaten |
The baseline of an instance is its published result where there is one (the hot instance's famous result, a cited published reference, or a published result or method on its leaderboard), else QArena's own run. Reference scores come from cited papers or derived constructions.
Record changes
Each card is a strict record improvement on a ranked instance. Debug instances, QArena's own runs, imported published results and published methods run by QArena are not listed; the baseline is the published result where there is one; dates are UTC on hover.
- 18 NAND levelsfirst accepted resultFirst to beat the baselineSubmission #4
- 21 NAND levelsfirst accepted resultFirst to beat the baselineSubmission #3
- 22 NAND levelsfirst accepted resultFirst to beat the baselineSubmission #2