Overview
A topological code is a stabilizer code defined on a lattice drawn on a surface, with two properties: every check acts on a few neighbouring qubits, and no operator confined to a small region can read or change the encoded information. The encoded qubits are attached to the global shape of the surface, to its handles and boundaries, and not to any particular qubit.
The first example is the toric code of Kitaev. Its planar versions with boundaries (Bravyi and Kitaev; Freedman and Meyer) are the surface codes used in most current hardware demonstrations. Color codes and Floquet codes are relatives with different checks and the same underlying structure. This page gives the general construction, the toric code as the worked case, and the results that hold for the whole family: the homological formula for the parameters, the mapping of decoding to a disordered spin model, and the limits that locality imposes. Terhal's review covers the same ground at greater length.
Intuition
Draw a square grid on the surface of a doughnut and put a qubit on every edge. Measure two kinds of local parity: around every vertex, the product of on the four edges that meet there; around every square, the product of on its four sides. All of these commute, and the states on which they all equal form the code space.
A single error on an edge flips the two vertex checks at its ends. A chain of errors flips only the checks at the two ends of the chain: the interior is invisible. So the syndrome shows endpoints, and the decoder must guess how they were joined. If its guess together with the true error forms a closed loop that can be shrunk to a point, the product is a stabilizer and the state is restored. If the loop winds around the doughnut, a logical operator has been applied. A logical error therefore needs a chain of errors about half as long as the shortest winding loop, and the protection grows with the size of the lattice.
Physically, the endpoints behave like particles: they are created in pairs, can be moved by further errors, and annihilate when they meet. They are the anyons of the model, and error correction is the task of pairing them up before they travel around the surface. The lesson The surface code builds this picture with explicit small examples.
Prerequisites
The stabilizer formalism and CSS codes: stabilizer groups, logical operators as elements of the normalizer, and the fact that a CSS code has distance equal to the smaller of its and distances. From topology: chain complexes over , cycles, boundaries and the first homology group of a surface.
Mathematical Definitions
Let be a compact connected surface without boundary, divided into vertices , edges and faces (a cellulation). Over the binary field the cellulation defines a chain complex
where sends a face to the sum of the edges around it and sends an edge to the sum of its two endpoints. An element is a set of edges; it is a cycle if and a boundary if for some . A cocycle is a set of edges with (it meets every face in an even number of edges) and a coboundary is a set of the form with .
Put one qubit on every edge and write and . The homological code of the cellulation is the stabilizer code generated by
The generators commute because a vertex and a face share an even number of edges, which is the statement . The code is a CSS code with check matrices and , and its parameters are read from the topology:
- ;
- , which is for an orientable surface of genus ;
- commutes with every check exactly when is a cycle, and it is a product of the exactly when is a boundary; commutes with every check exactly when is a cocycle, and it is a product of the exactly when is a coboundary. The logical operators are therefore the cycles that are not boundaries and the cocycles that are not coboundaries;
- is the smaller of the minimum number of edges in a cycle that is not a boundary and the minimum number of edges in a cocycle that is not a coboundary.
For a surface with boundary the same construction with relative homology gives the planar codes of Bravyi and Kitaev and Freedman and Meyer. The construction on the torus is the toric code of Kitaev; the general homological formulation is developed by Bombin and Martin-Delgado and in section III of Dennis, Kitaev, Landahl and Preskill.
Lattice. Fix an integer . The vertices are the points of a square lattice with periodic boundary conditions. There are two edges per vertex: the horizontal edge from to and the vertical edge from to . One qubit sits on each edge, so .
Checks. For every vertex and every plaquette (unit square)
There are operators of each type. A vertex and a plaquette share either no edge or two edges, so all checks commute. They satisfy exactly two relations, and , leaving independent generators.
Parameters. , proved in the parameter theorem.
Logical operators. One choice of representatives is
and are strings of along the two non-contractible loops of the lattice. and are strings of on the edges crossed by non-contractible loops of the dual lattice. Each has weight ; anticommutes with and commutes with the other pair. Multiplying a representative by checks deforms the loop without changing its winding.
Properties. The code is a CSS code and the homological code of the square cellulation of the torus. Every check has weight 4 and every qubit is in two checks of each type, so it is a quantum LDPC code with geometrically local checks in two dimensions. Its code space is the ground space of the toric-code Hamiltonian. It was introduced by Kitaev; its use as a memory with repeated syndrome measurement is analysed by Dennis, Kitaev, Landahl and Preskill.
All terms commute and have eigenvalues , so the eigenstates are labelled by the values of the checks and have energy . The ground space is the code space of the toric code, where every check equals ; on the torus it is four-dimensional. A vertex with costs energy and a plaquette with costs . Because on a closed surface, violated checks of each type come in even numbers, so the gap above the ground space is , independent of . Kitaev introduced the model with and identified its point-like excitations as abelian anyons.
- Couplings ; and are the vertex and plaquette operators of the toric code.
Boundaries
A surface with boundary needs a rule for the checks at its edge. Bravyi and Kitaev introduced two kinds for the square lattice. At a smooth boundary the lattice ends on a line of edges, and the vertex checks on that line have three qubits instead of four. At a rough boundary the lattice ends on edges that stick out with no vertex at their far end, and the plaquette checks there have three qubits. A string of operators may end on a rough boundary without violating any check, because there is no vertex check at the dangling end; a string of operators on the dual lattice may end on a smooth boundary. A rectangle with rough boundaries on two opposite sides and smooth boundaries on the other two encodes one qubit: is a string joining the rough sides and is a dual string joining the smooth sides. In the anyon language the rough boundary absorbs the vertex excitation and the smooth boundary absorbs the plaquette excitation. The parameters of the resulting codes are given under surface codes.
Noise models used for thresholds
Three idealisations recur, and every threshold must name the one it refers to.
- Code capacity. Independent Pauli errors on the data qubits; every check is measured once, perfectly.
- Phenomenological. Data errors as above between rounds, and each measured check outcome is independently wrong with some probability; the syndrome is measured repeatedly.
- Circuit level. Every gate, preparation, measurement and idle step of the syndrome-extraction circuit can fail. Thresholds of this kind are discussed under surface codes.
Theorems
For every integer the toric code on the torus is a stabilizer code with parameters
More precisely:
- the vertex and plaquette operators generate a stabilizer group of rank ;
- a product of operators on a set of edges commutes with every check exactly when meets every vertex in an even number of edges, and it then acts non-trivially on the code space exactly when winds an odd number of times around at least one of the two directions of the torus; the same holds for products of on the dual lattice;
- every Pauli operator that acts non-trivially on the code space has weight at least , and the straight loops of weight attain the bound.
In homological terms and is the length of the shortest non-contractible loop. The code and these properties are due to Kitaev.
- Square lattice on a torus with sites in each direction and one qubit per edge.
- The distance is the minimum weight of a Pauli operator that commutes with every check and is not, up to a phase, a product of checks.
Proof · Proof of the toric-code parameters by counting and loop intersection
Notation is that of the toric code record: vertices , edges and , checks and .
Number of logical qubits. Let be a set of vertices. The product acts on an edge with if exactly one endpoint of the edge is in and trivially otherwise. It is the identity exactly when every edge has both endpoints in or neither, that is, when is a union of connected components of the lattice. The lattice is connected, so or is all of the vertices. Hence the vertex operators satisfy the single relation and generate a group of rank . Every edge lies on exactly two plaquettes, so the same argument on the dual lattice shows that the plaquette operators have rank . A product of -type operators equals a product of -type operators only if both are the identity, so the stabilizer group has rank and
A symplectic basis of logical operators. For each and define
A plaquette contains the horizontal edges and , so it meets the support of in two edges if and in none otherwise; likewise for and the vertical edges. So the operators commute with every check. A vertex meets the support of (a row of horizontal edges) in two edges or none, and likewise for , so the operators commute with every check. The supports of and share exactly the edge , the supports of and share exactly , and , have disjoint supports, as do , . Therefore
for any choice of the superscripts. No non-trivial product of these four operators commutes with all four, so none is in the stabilizer group, and they represent the cosets of logical Pauli operators of a code with : every Pauli operator commuting with all checks equals, up to a phase, with a product of checks.
Translated loops are equivalent. Multiply the vertex operators of column :
because each vertical edge of that column appears twice. Hence all , , differ by stabilizers, and their supports (the horizontal edges with first coordinate ) are pairwise disjoint. The same holds for the .
Distance. Let be a product of operators that commutes with all checks and is not a product of checks. Write in the form above. Since commutes with and , ; then is of type, and since is not a product of checks, . If , anticommutes with and therefore with every , since these differ from it by stabilizers, with which commutes. Anticommuting with requires to contain an odd number, so at least one, of the edges , . These sets of edges are disjoint, so . If the same argument with applies. By the symmetry of the construction under exchanging the lattice with its dual, every non-trivial -type logical operator also has weight at least .
A general Pauli operator is, up to a phase, . It commutes with the -type checks exactly when does and with the -type checks exactly when does. If it is not a product of checks, at least one of , is not either, and that factor has weight at least , so the whole operator does. The operator has weight exactly . Hence .
Homological reading. The first step computes for the chain complex of the homological code. The exponents are the homology class of the cycle , detected by its intersection numbers with the two dual loops. This is the argument indicated by Kitaev, written out with explicit coordinates.
Decoding as a disordered spin model
Consider errors on a set of edges of the toric code with qubits; errors are treated identically on the dual lattice. Two error sets have the same syndrome and the same effect on the code space exactly when they differ by a sum of plaquette boundaries. Write for this class. Put an Ising spin on every plaquette and a coupling on the edges of , elsewhere. The spin configuration with on a set of plaquettes corresponds to the error , whose edges are those with , where are the two plaquettes sharing . Summing the probabilities over the class gives
provided the inverse temperature is tied to the error rate by the second relation in the displayed equation. The factor appears because a spin configuration and its global flip give the same error set. The couplings are themselves drawn with a fraction of antiferromagnetic bonds, so the disorder strength and the temperature are locked together: this is the line in the phase diagram of the random-bond Ising model studied by Nishimori.
The other classes with the same syndrome are obtained by adding a non-contractible loop to , which inserts a domain wall around the torus. Maximum-likelihood decoding succeeds with probability tending to 1 exactly when, for typical , the free-energy cost of that domain wall diverges with , which is the definition of the ferromagnetically ordered phase. Hence the threshold is the disorder strength at which the Nishimori line leaves the ordered phase. The mapping is due to Dennis, Kitaev, Landahl and Preskill; the numerical value of is recorded in a separate result.
A decoder that returns the single most probable error, such as minimum-weight matching, corresponds to the zero-temperature axis of the same model and has a lower threshold (Wang, Harrington and Preskill).
- Toric code on the square lattice in the limit ; one type of error ( or ) considered at a time.
- Each qubit suffers the error independently with probability ; all checks are measured once, without error (code-capacity noise).
- Maximum-likelihood decoding, which returns a member of the most probable equivalence class of errors given the syndrome.
- The class-probability identity is exact. Identifying the threshold with the phase boundary uses the characterisation of the ordered phase by a domain-wall free energy that diverges with .
By the statistical-mechanics mapping the threshold is the critical concentration of antiferromagnetic bonds at the multicritical (Nishimori) point of the two-dimensional random-bond Ising model on the square lattice. Two independent numerical determinations agree:
| Source | Method | |
|---|---|---|
| Honecker, Picco and Pujol | transfer matrix, domain-wall free energy | |
| Hasenbusch, Parisen Toldin, Pelissetto and Vicari | Monte Carlo with finite-size scaling along the Nishimori line |
The second paper reports the concentration of ferromagnetic bonds, ; the table gives its complement. The commonly quoted "10.9%" is this number.
For comparison, the same model on the zero-temperature axis, which describes minimum-weight decoding, has critical concentration (Wang, Harrington and Preskill). The rate of random CSS codes on this channel vanishes at , the root of with the binary entropy; the numerical value of lies slightly below that point.
- Square-lattice toric code, , independent and errors each with probability per qubit, decoded separately.
- Perfect syndrome measurement and maximum-likelihood decoding.
- The value is a numerical estimate for the random-bond Ising model; the quoted uncertainties are those of the cited simulations.
The same construction applies to the other noise models, with other spin models.
- Phenomenological noise. With data and measurement errors both at rate , the relevant model is a three-dimensional random-plaquette gauge theory, the third dimension being time. Minimum-weight decoding corresponds to its zero-temperature transition, located numerically at by Wang, Harrington and Preskill. The optimal threshold is the transition on the Nishimori line of that model, estimated by Monte Carlo simulation at by Ohno, Arakawa, Ichinose and Matsui.
- Depolarizing noise, perfect measurement. If each qubit suffers , or with probability each and the decoder uses the correlation between and errors, the model is a disordered eight-vertex model and the threshold rises to (Bombin, Andrist, Ohzeki, Katzgraber and Martin-Delgado).
What locality forbids
Three results bound what any code with local checks in two dimensions can do.
- Parameters. For commuting local checks on a two-dimensional lattice of qubits, (Bravyi, Poulin and Terhal). The toric code, with , saturates the scaling. For local stabilizer codes on a -dimensional lattice of linear size the distance satisfies (Bravyi and Terhal). Codes that escape these bounds give up geometric locality; see quantum LDPC codes.
- Gates. A logical gate implemented by a constant-depth circuit on a two-dimensional local stabilizer code with large distance is a Clifford gate (Bravyi and König). A non-Clifford gate needs an extra ingredient such as magic states.
- Classification. Translation-invariant two-dimensional topological stabilizer codes are equivalent, under local unitary circuits and the addition of ancilla qubits, to a finite number of copies of the toric code (Bombin, Duclos-Cianci and Poulin).
Worked Examples
The smallest toric code
Take : four vertices, eight edges, four plaquettes, so . The Euler characteristic is , as it must be for a torus. There are four vertex operators with one relation and four plaquette operators with one relation, so six independent checks and . A row contains two horizontal edges, so has weight 2 and the code is : it detects any single-qubit error and corrects none.
Why distance 3 corrects one error and not two
Take : , with checks of which 16 are independent, giving . A single error flips and . The lowest-weight operator with that syndrome is itself, so minimum-weight decoding removes it.
Now suppose two errors occur on the same row, . The checks and are flipped; is flipped twice and reads . The two flipped vertices are also joined by the single edge , which runs the other way around the row. A minimum-weight decoder applies . The total operator is
a logical error. Two errors out of three on a winding loop are enough, in agreement with correctable error.
Reading the threshold numbers
Suppose bit-flip errors occur independently with and measurements are perfect. This is below the optimal threshold and above the minimum-weight value . For this noise a maximum-likelihood decoder makes the logical error probability go to zero as grows, while a minimum-weight matching decoder does not. At both succeed; at neither does. The same error rate under the phenomenological model, where the relevant thresholds are near , is far above threshold.
Limitations and Common Pitfalls
- A threshold is a property of a code family, a noise model and a decoder together. The value is a code-capacity number for independent and noise with optimal decoding. It says nothing directly about hardware, where the circuit-level threshold is roughly an order of magnitude lower.
- Optimal and minimum-weight decoding differ. Minimum-weight matching finds the most likely single error; the optimal decoder finds the most likely class of equivalent errors. The gap between and is the cost of ignoring the number of equivalent errors.
- The distance is topological, the constant is not. The number of logical qubits depends only on the surface, and the distance is the length of the shortest non-trivial loop, which depends on the lattice. Different cellulations of the same surface give different ratios .
- Locality costs rate. With , a two-dimensional local code with growing distance has vanishing rate. This is a theorem about local checks, not a weakness of a particular construction.
- A gapped Hamiltonian does not make a self-correcting memory. The toric-code Hamiltonian has a gap, but at any non-zero temperature its excitations diffuse at no energy cost and cause logical errors; see passive protection.
Related Research
Decoding algorithms for these codes (matching, union-find, tensor-network and neural decoders) are treated under quantum decoders. Logical operations by deforming boundaries and merging patches are treated under lattice surgery. The phases of matter behind the codes are the subject of topological order and anyons.