Toric code

On this page 7

The toric code is a topological stabilizer code in quantum error correction that places physical qubits on the edges of a square lattice with periodic boundary conditions, so the lattice forms a torus, and encodes two logical qubits in global properties that no local error can change. Proposed by Alexei Kitaev in 1997, it is the conceptual parent of the surface code, the leading candidate for fault-tolerant quantum computing.

Its importance comes from a simple idea: information is stored nonlocally, in the topology of the lattice, so an error must stretch across the whole torus before it corrupts the encoded data. The toric code is also a central model in condensed matter physics, where it describes a phase of matter with topological order and anyonic excitations.

How the toric code lattice is built

The toric code is defined by two families of commuting stabilizers on an L × L lattice with one qubit per edge, which gives 2L² physical qubits. A vertex operator A_v is the product of Pauli X on the four edges touching a vertex. A plaquette operator B_p is the product of Pauli Z on the four edges around a face. Every vertex operator commutes with every plaquette operator because they always share an even number of edges.

The code space is the set of states with eigenvalue +1 for every stabilizer. On a torus the stabilizers are not all independent: the product of all vertex operators, and separately of all plaquette operators, equals the identity. Counting independent constraints leaves exactly two encoded qubits, regardless of lattice size.

The table summarizes the main elements of the construction and their scaling with the lattice size L.

ElementDefinitionCount
Physical qubitsOne per lattice edge2L²
Vertex stabilizersX on four edges at a vertexL² (L² − 1 independent)
Plaquette stabilizersZ on four edges of a faceL² (L² − 1 independent)
Logical qubitsSet by torus topology2
Code distanceShortest noncontractible loopL
Elements of the toric code on an L by L lattice

Logical operators and code distance

Logical operators of the toric code are strings of Pauli operators that wrap around the torus. A logical Z is a chain of Z operators along a noncontractible loop on the lattice, and a logical X is a chain of X operators along a loop on the dual lattice. Because the torus has two independent cycles, there are two pairs of logical operators, one for each encoded qubit.

Closed loops that can be shrunk to a point are products of stabilizers and act trivially on the code space. Only noncontractible loops change the logical state. The minimum length of such a loop is L, so the toric code has code distance d = L and parameters [[2L², 2, L]]. It can therefore correct any pattern of up to ⌊(L − 1)/2⌋ errors.

Errors, anyons and syndrome decoding

An error on the toric code appears as pairs of excitations called anyons at the ends of an error string. A Z error on one edge flips the two adjacent vertex operators, creating a pair of e-type anyons; an X error flips two plaquette operators, creating m-type anyons. Measuring all stabilizers reveals the positions of these anyons, which forms the error syndrome.

Decoding means pairing anyons with correction strings so that the combined error and correction form a contractible loop. If the pairing instead completes a loop around the torus, a logical error occurs. The following table compares common decoders.

DecoderPrincipleTrade-off
Minimum-weight perfect matchingPairs anyons by shortest total lengthHigh threshold, moderate speed
Union-findGrows clusters until syndromes neutralizeNear-linear time, slightly lower threshold
Renormalization groupMerges errors across scalesFast, parallelizable
Maximum-likelihoodSums over error equivalence classesOptimal but costly
Neural network decodersLearned mapping from syndromeFast inference, training cost
Decoders used for the toric code

Under independent bit-flip and phase-flip noise with perfect measurements, the toric code has an optimal threshold near 10.9 percent, related to a phase transition in the random-bond Ising model. With noisy syndrome measurements, the threshold drops to roughly 3 percent for optimal decoding and somewhat less for matching on a phenomenological model, and around 1 percent under full circuit-level noise.

The toric code belongs to a family of topological and stabilizer codes that differ in geometry, encoding rate and available logical gates. The table shows how it relates to its closest neighbors.

CodeGeometryLogical qubitsKey difference
Toric codePeriodic square lattice2Requires a torus
Surface codePlanar patch with boundaries1 per patchFabricable on flat chips
Color codeThree-colorable lattice1 or moreTransversal Clifford gates
Quantum LDPC codeExpander or hypergraph productManyHigher rate, long-range links
Shor codeNo lattice1Concatenated, not local
Toric code and neighboring codes

The planar surface code replaces periodic boundaries with rough and smooth boundaries, which removes the need for a physical torus while keeping the same local stabilizers. For that reason, almost all experimental work uses the surface code, while the toric code remains the cleanest theoretical model for threshold studies and topological phases.

Practical limitations of the toric code

The toric code is difficult to implement directly because periodic boundaries require connections that wrap around the chip. Hardware with a planar layout cannot realize these links without long-range couplers, which is why the planar variant dominates.

  • Low encoding rate: two logical qubits regardless of size, so the ratio falls as 1/L².
  • No transversal non-Clifford gate: universal computation needs magic state distillation or similar techniques.
  • Large overhead: reaching logical error rates near 10⁻¹² may require distances of about 25, meaning over a thousand physical qubits per logical qubit.
  • Finite-temperature instability in two dimensions: as a passive quantum memory, the toric code does not protect information at nonzero temperature without active correction.

Despite these limits, the toric code is the reference model for topological protection. Many proposals for quantum LDPC codes and for three- and four-dimensional self-correcting memories begin as generalizations of its stabilizer structure.

Explained without jargon

Picture a grid drawn on the surface of a doughnut, with a tiny quantum bit sitting on every line of the grid. Instead of storing information in any single bit, the toric code stores it in the overall pattern around the doughnut.

Small mistakes in one or two bits leave telltale marks, like footprints, that can be spotted and cleaned up. To actually damage the stored information, a mistake would have to run in an unbroken chain all the way around the doughnut. The key takeaway is that bigger grids make such chains far less likely, so information becomes safer as the grid grows.

A typical use case

A university group developing decoders for a future superconducting processor needs a clean benchmark before moving to messy hardware data. The group simulates the toric code at distances 9, 13 and 17 under a depolarizing noise model, with repeated rounds of noisy syndrome measurement.

Using a union-find decoder, the team plots the logical error rate against the physical error rate for each distance. The curves cross at roughly 2.6 percent, which identifies the phenomenological threshold of the decoder; below that point, larger lattices give lower logical error rates. Because the torus has no boundaries, edge effects do not distort the result. The outcome is a validated decoder that the group then adapts to the planar surface code layout used on the actual chip.