Directional codes are a new family of quantum low-density parity-check (qLDPC) codes that run on standard square-grid superconducting hardware, and in some cases on the sparser hexagonal grid, with no long-range connections. In our simulations, the best family matches the logical error rate of the rotated toric code at a physical error rate of 0.1% while using only a quarter to a third of the physical qubits. The paper, which I wrote with David Byfield and Archibald Ruban, was recently published in Nature Communications.
We first shared this work as a preprint in July 2025. Since then, the manuscript has been substantially strengthened through peer review, and several research groups have published work that builds directly on it. That second point is the one I find most encouraging, and it is why I want to explain the idea in more detail here.
What problem are directional codes trying to solve?
Directional codes tackle the overhead of quantum error correction without asking for more complex hardware. Error correction spreads one logical qubit across many physical qubits, and the surface code, today's workhorse, needs a lot of them. Quantum LDPC codes promise to encode more logical qubits with fewer physical ones.
The catch is connectivity. Most high-performing qLDPC codes need qubits to talk to partners that are far away on the chip, or to more neighbours than a square grid provides. The Gross code, for example, needs two extra non-local connections at every qubit, taking each qubit from four connections to six. Extra connections make chips harder to build and tend to add substantial noise. The working assumption in the field has been that good qLDPC codes and simple connectivity do not go together.
What are directional codes?
Directional codes are qLDPC codes whose syndrome extraction circuits use only local connections on a square grid. Each code is defined by a sequence of compass directions, north, east, south and west, and each step in the sequence is one layer of two-qubit gates. Our main example, which we write as N²E³N², takes two steps north, three east and two north. It measures checks on seven qubits at a time and encodes twelve logical qubits.
How does the iSWAP gate make this possible?
The iSWAP gate exchanges the states of the two qubits it acts on, and we use that movement to reach qubits that are not physically connected. The iSWAP is a native gate on several superconducting platforms. Its swapping behaviour is usually treated as a nuisance, because it makes circuits harder to design. We decided to put it to work.
Up to single-qubit Clifford rotations, an iSWAP is a controlled-NOT followed by a SWAP. Apply one layer of these gates across the grid and the whole lattice of auxiliary qubits shifts one step in one direction, while the data qubits shift one step the opposite way. Think of two rows of dancers stepping past each other: nobody leaves the floor, but everyone ends up facing someone new. After each layer, every auxiliary qubit sits next to three data qubits it could not reach before.
The wiring never changes, but the effective connectivity changes with every layer. Chain several layers together, and each auxiliary qubit gathers information from a snake-shaped set of data qubits spread across the chip. In the paper, we prove a theorem that says exactly which arrangements of these checks give a valid circuit, then wrap the construction onto a torus to produce a working code.
How do directional codes perform?
In simulation, directional codes beat the rotated toric code on qubit count while staying on square-grid hardware. We ran quantum memory experiments under SI-1000, a standard circuit-level noise model for superconducting qubits, sampled with Stim and decoded with the Tesseract decoder. The full study took about 45 CPU-core-years, which, when spread across 200 CPUs, translates to approximately 3 months of simulations.
For our twelve-logical-qubit codes, we compared against six copies of the rotated toric code, so both sides encode the same number of logical qubits:
At equal code distance, the rotated N2E3N2 code uses half the physical qubits of the rotated toric code.
Its logical error rate also falls faster as the physical error rate drops from 1% to 0.1%. At 0.1% it is more than ten times lower at distances 6 and 8.
At around 40 physical qubits per logical qubit, the rotated N2E3N2 code reduces the per-logical per-round logical error rate by a factor of 500 relative to the rotated toric code.
Extrapolating from these results to higher distances, the rotated family reaches the same logical error rate as the rotated toric code with roughly a quarter to a third of the physical qubits.
Code family | Logical qubits | Hardware connectivity | Physical qubits needed vs rotated toric code |
NE³N (rectangular) | 4 | Hexagonal grid | ~73% |
N²E²N² (rotated) | 6 | Square grid | ~30% |
N²E²N² (rectangular) | 6 | Square grid | ~56% |
N²E³N² (rotated) | 12 | Square grid | ~29% |
N²E³N² (rectangular) | 12 | Square grid | ~50% |
N²E⁴N² (rotated) | 18 | Square grid | ~33% |
Table 1: Summary of code families benchmarked at a physical error rate of 0.1%.
Bivariate bicycle codes still outperform directional codes in our simulations. That comparison flatters them, though, because the SI-1000 model does not add noise for their extra long-range connections. Once the engineering cost of those connections is counted, directional codes may become a serious alternative.
Why does designing codes from the hardware up matter?
As far as we know, this is the first systematic method for discovering new qLDPC codes by starting from hardware constraints. Most qLDPC research runs the other way: invent a code family, then work out how hardware might support it. We asked which codes would become possible if a realistic hardware constraint is the starting point rather than an afterthought.
That shift matters more to me than any single code in the paper. The iSWAP trick is one tool, and the search space it opens is large. An obvious open question is what other codes iSWAP circuits could unlock on the richer connectivity that the Gross code already assumes.
What has happened since the preprint?
Other groups have taken the ideas further, which is the best evidence that the approach is useful. The most pressing gap in our paper was boundaries: our codes live on a torus, while most real chips are flat. Three groups have since proposed planar versions on a square grid: vine codes, directional tile codes and bunny codes. Separately, Sahay, Williamson and Brown adapted minimum-weight perfect matching decoding to several qLDPC codes, including directional codes. We summarise this follow-on work in the discussion section of the journal paper.
What are the limitations, and what comes next?
This paper shows directional codes work as quantum memories in simulation; turning them into a full fault-tolerant architecture needs more work. The main open items are:
Logical Operations: We studied memory only. Computation will need lattice surgery that respects square-grid connectivity, plus a route to non-Clifford gates, such as magic states prepared on surface codes or directly on planar directional codes.
Architecture: One route is a modular machine with directional codes on toric modules, similar to IBM's proposed design but with far fewer connections. Our preferred rout is planar directional codes on a general-purpose square-grid chip with iSWAP gates.
Decoding: Tesseract is accurate but too slow for real time. Belief-propagation decoders such as BP-Relay, the matching approach above, or a bespoke decoder are all candidates. Real-time decoding is core to Riverlane's work, so this is a question we care about.
Gate Maturity: CZ gates have had more than a decade of optimisation. iSWAP gates have been demonstrated with high fidelity and good leakage suppression but experiments also show larger conditional-phase errors that need further work. Our noise model treats iSWAP and CZ errors as equal.
One caveat cuts in our favour: the decoder setting we used (short-beam) becomes less and less accurate as circuits grow, and directional code circuits are larger than surface code circuits of the same distance. Our headline numbers may therefore understate the advantage.
If you would like to find out more, the paper is now available in Nature Communications and the simulation circuits and data are on Zenodo.