Color code

On this page 7

A color code is a topological stabilizer code in quantum error correction that places qubits on the vertices of a lattice whose faces can be colored with three colors so that no two neighboring faces share a color. Every face carries both an X-type and a Z-type stabilizer, and this symmetric structure lets the two-dimensional color code implement the entire Clifford group transversally, which is its main advantage over the surface code.

Introduced by Héctor Bombín and Miguel Angel Martin-Delgado in 2006, color codes belong to the same family of local, planar codes as the surface code and the toric code, and they are now a serious candidate for fault-tolerant quantum computing in quantum computing hardware with nearest-neighbor connectivity.

How the color code lattice defines its stabilizers

The color code is built on a trivalent, three-colorable lattice: every vertex touches exactly three faces, one of each color, and every vertex holds one physical qubit. For each face, the code defines an operator that applies X to all qubits on that face and a second operator that applies Z to the same qubits. Because any two faces share an even number of qubits, all these operators commute, which is the defining requirement of a stabilizer code.

A logical qubit is stored in the joint state that satisfies every stabilizer. In the common triangular patch, the three boundaries carry the three colors, and a logical operator is a string of X or Z operators running along one boundary. The code distance equals the side length of the triangle, so a distance-d patch corrects any combination of up to (d-1)/2 errors.

The table below lists the two lattices used most often and how their face structure affects the hardware.

LatticeFace shapesStabilizer weightData qubits for distance d
6.6.6 (hexagonal)Hexagons6 in the bulk, 4 at edges(3d² + 1) / 4
4.8.8 (square-octagon)Squares and octagons4 and 8(d² – 1) / 2 + d
Rotated surface code (reference)Squares4 in the bulk, 2 at edgesd²
Common two-dimensional color code lattices

The smallest triangular 6.6.6 color code with distance 3 uses seven qubits and is identical to the Steane code, the well-known [[7,1,3]] CSS code. Larger color codes can therefore be read as a scalable, geometrically local generalization of the Steane code.

Transversal gates as the defining advantage

A transversal gate acts on each physical qubit independently, so a single physical fault cannot spread into several errors inside one code block. Transversal gates are therefore fault tolerant by construction and usually the cheapest way to apply a logical operation.

In the two-dimensional color code, the logical Hadamard, phase (S) and CNOT gates are all transversal. The surface code, by contrast, implements most Clifford operations through lattice surgery or code deformation, which costs extra rounds of syndrome measurement and extra qubits. Neither code has a transversal T gate in two dimensions, a limit set by the Eastin-Knill theorem and the Bravyi-König bound for local codes.

Logical gate2D color code3D color codeUsual surface code route
Hadamard (H)TransversalNot transversalPatch rotation or fold-transversal
Phase (S)TransversalTransversalLattice surgery with a Y state
CNOTTransversal between patchesTransversal between blocksLattice surgery
T gateMagic state requiredTransversalMagic state distillation
Logical gate options in color codes

Because 2D and 3D color codes complement each other, researchers have proposed code switching and gauge color codes that move a logical qubit between the two to obtain a universal gate set without distillation. These schemes are elegant, but their overhead in practice remains an open question.

Decoding a color code syndrome

Syndrome decoding in a color code is harder than in the surface code. A single qubit error flips the stabilizers of up to three adjacent faces, one of each color, so the syndrome forms triangles of defects rather than pairs. Standard minimum-weight perfect matching, which pairs defects, cannot be applied directly.

Practical decoders work around this structure in several ways, each with a different trade-off between speed and accuracy.

DecoderMain ideaStrengthWeakness
Restriction decoderMatches defects on lattices restricted to two colorsReuses fast matching softwareLower threshold than optimal
Möbius matchingBuilds a single matching graph that encodes all colorsGood accuracy with matching speedMore complex graph construction
Union-find variantsGrows clusters until defects neutralizeNear-linear runtimeReduced accuracy at high noise
Neural and tensor network decodersLearns or contracts the error likelihoodApproaches optimal performanceHard to run in real time
Decoder families for the color code

Under simple code capacity noise, the optimal color code threshold is close to 10 percent, similar to the surface code. Under realistic circuit-level noise, measuring weight-6 or weight-8 stabilizers requires longer circuits, and reported thresholds typically fall in the few tenths of a percent, below the roughly 1 percent of the surface code.

Color code versus surface code in practice

The choice between the two codes is a trade-off between qubit count, gate cost and noise tolerance. The color code stores a logical qubit more compactly and makes Clifford logic cheap, while the surface code tolerates more noise and decodes more easily.

  • Qubit efficiency: a distance-5 patch needs 19 data qubits on the 6.6.6 lattice, 17 on the 4.8.8 lattice and 25 in the rotated surface code.
  • Connectivity: color code syndrome extraction needs higher-weight checks, which suits trapped ions and neutral atoms with flexible coupling better than fixed square grids.
  • Clifford logic: transversal H and S remove much of the lattice surgery overhead in Clifford-heavy circuits.
  • Noise margin: the lower circuit-level threshold means the hardware must run further below threshold to gain the same logical error suppression.

Hardware groups have demonstrated both codes. Trapped-ion teams have run logical circuits on the seven-qubit color code, and superconducting experiments have reported that the logical error rate of color codes falls as distance grows from 3 to 5, which is the key signature of below-threshold operation.

Limitations and common misconceptions

Several misunderstandings appear often when the color code is compared with other codes in quantum error correction.

  • Transversal Clifford gates do not make the code universal: a two-dimensional color code still needs magic states for T gates.
  • Higher qubit efficiency does not guarantee lower overhead: the lower circuit-level threshold can require a larger distance for the same logical error rate.
  • The colors are not physical: they are a bookkeeping label for faces and say nothing about qubit frequencies or hardware layout.
  • Decoding is not solved: real-time color code decoding with near-optimal accuracy remains an active research area.

Color codes have also become central to magic state cultivation, a recent proposal that grows high-fidelity T states inside a small color code before transferring them to a larger code. If it performs as projected, it could make the color code valuable even in machines whose memory runs on the surface code.

Put simply

A color code is a way to protect fragile quantum information by spreading one reliable qubit across many unreliable ones. The qubits sit on the corners of a tiled pattern, and the tiles are painted in three colors so that no two touching tiles match. Each tile repeatedly checks its corner qubits, and a failed check reveals where an error happened.

The special benefit is that many basic operations become simple. Instead of a long sequence of steps, the computer can apply the same small action to every qubit at once. The price is that the checks are larger and the code tolerates a little less noise than its main rival, the surface code.

In practice

Consider a research team running a trapped-ion processor with about 50 qubits and all-to-all connectivity. The team wants to test a small logical circuit that relies heavily on Hadamard and CNOT gates. It encodes two logical qubits in seven-qubit color code blocks, each with distance 3, and uses spare ions as ancilla qubits for syndrome measurement.

Because the logical Hadamard and CNOT are transversal, each logical gate takes one layer of physical gates instead of a multi-round lattice surgery procedure. After repeated syndrome rounds and decoding with a lookup table, the team observes that the logical error rate per circuit stays below the physical two-qubit error rate, which shows that the encoding helps rather than hurts. The same test with a distance-3 surface code would need more qubits and noticeably more time steps.