Skip to content
Current section
The Quantum Computing Enthusiast’s Hub
Saved
All sections

All sections

Saved
Skip Learn navigation
Encyclopedia
Topic

Code distance

Code distance is the minimum weight of a nontrivial logical operator for a quantum code, with the error and weight conventions stated.

Edition released Entry updated Coverage: Overview · Technical · Research
On this page

Explanation and significance

Distance measures a worst-case combinatorial separation between valid logical states under the chosen error model. It does not equal the number of physical components, the measured logical lifetime, or a universal guarantee against correlated noise. A larger distance is valuable only if operations preserve the intended protection and the physical error regime supports improvement. For stabilizer codes, weight counts the number of data qubits on which a Pauli acts nontrivially.

Mechanism and mathematical structure

A distance-d code can correct every arbitrary error supported on at most t=floor((d-1)/2) qubits under ideal recovery. Every Pauli error of weight below d either changes a syndrome or acts trivially on the encoded information; none is a nontrivial logical Pauli. Known erasure locations change the counting: up to d-1 erasures are correctable, because the recovery does not also have to infer which positions were affected. A CSS code can have separate X and Z distances, with overall distance equal to their minimum. Circuit distance includes propagation and faulty syndrome extraction, so it can differ from an attractive static code distance.

Fully worked reference example

For a [[7,1,3]] code, d=3 gives t=floor(2/2)=1 arbitrary unknown single-qubit error. Two known erasures can be corrected in principle because 2<3. Two arbitrary unknown Pauli errors are outside the universal guarantee, even if some particular two-error patterns happen to be recoverable. A distance-five code guarantees correction of two arbitrary errors, not five. For independent bit flips in a length-five repetition code, a majority decoder fails when at least three bits flip: p_L=10p³(1-p)²+5p⁴(1-p)+p⁵. At p=0.01 this is 0.0000098506. That result belongs to the restricted bit-flip model and cannot be relabelled as arbitrary quantum-noise performance.

Limits and misconceptions

Do not infer a logical error probability from d alone. Different check circuits, leakage mechanisms, biased noise and decoders can produce very different performance at the same nominal distance. The number of data qubits and ancillas must be reported separately. A three-qubit repetition encoding has distance one against unrestricted Pauli noise because a single Z acts logically.

Scientific relationships

Is a property of a code and logical-operator structure. Is used in fault-tolerant resource estimation. Is distinct from code capacity, which concerns information transmission rates through a channel.

Detection, correction and known error locations

Distance gives different guarantees depending on what is known about the fault. For unknown Pauli errors, two possible errors E and F can be confused if E†F acts as a nontrivial logical operator. If each has weight at most t, their product has weight at most 2t. A distance d>2t excludes such a logical product, yielding correction of all errors up to t. This is the source of the factor of two in t=floor((d-1)/2).

For erasures on a known set S, both candidate errors are confined to that same set rather than arbitrary separate supports. Their product remains supported on S, so |S|<d is enough. That is why d-1 erasures can be corrected even though only roughly half as many unknown arbitrary errors are guaranteed. The extra power comes from classical information about support, not a weaker meaning of quantum coherence.

The detectability statement also requires precision. A code detects an error set when the relevant projected operators are proportional to the code projector. Stabilizers can be nonidentity physical operators of low weight yet act as identity on the code, so they are harmless rather than detectable as faults. Saying every nonidentity physical Pauli below distance must produce a nonzero syndrome would be false for degenerate codes. Distance excludes low-weight nontrivial logical operators, not low-weight stabilizers.

Asymmetric distance and circuit-level protection

Suppose a CSS code has d_X=7 and d_Z=3, where d_X denotes minimum weight of a nontrivial X-type logical operator and d_Z the Z-type counterpart. It can suppress X-type and Z-type error patterns differently, with overall arbitrary-Pauli distance 3. A statement that the code has distance 7 would hide its weaker direction. Under strongly biased physical noise, that asymmetry may still be a sensible design because the common error type receives more protection. The bias convention and logical-basis convention must accompany the distance pair.

Static distance can also overstate implemented protection. Imagine a distance-five code in which one faulty ancilla creates a weight-three data error aligned with a logical path. Two physical circuit faults may then form a logical operator even though three independent data errors would normally be required to defeat minimum-weight correction. The relevant circuit distance counts elementary fault locations and their propagated effects, not merely final data support. A careful circuit schedule or flag measurement can change that fault count without changing the abstract code’s stabilizers.

A numerical report can separate n, k, static d_X and d_Z, circuit distance for a named extraction schedule, physical noise, and measured p_L. In the example, five local data errors or fewer propagated correlated hooks can reach the same logical path. Operational fault distance matches combinatorial code distance only if the implementation preserves that protection.

A mixed error-and-erasure guarantee

Distance can be used when some faulty positions are flagged and others are unknown. Suppose e known erasures occur on a declared set S and up to t additional arbitrary errors occur outside it. For two candidate error histories consistent with those facts, their product is supported on at most e+2t positions: the erased support is shared, while the two unknown-error supports can differ. If e+2t<d, that product cannot be a nontrivial logical operator. Ideal recovery can therefore distinguish the required logical classes or identify their harmless degeneracy.

For a distance-seven code, e=2 and t=2 satisfy e+2t=6<7, so two erasures together with two additional unknown errors lie within this guarantee. Three erasures and two unknown errors give seven and fall outside it. Falling outside the bound does not imply that every such pattern fails; it means the code distance alone no longer guarantees correction of all patterns of that form. The location geometry and decoder can still make specific larger patterns recoverable.

The bound assumes the erasure flags correctly identify their stated support. A missed erasure may become an unlocated error or a leakage process with propagation, changing the model. False positive flags consume erasure-handling capacity without corresponding physical damage. An architecture that converts dominant errors into erasures must therefore report both conversion efficiency and false flag probability, as well as the residual unheralded error channel.

Distance as a limitation on local information

The correction condition for all operators supported on a set S says P O_S P=c(O_S)P whenever that set is correctable. Consequently every encoded basis state has the same reduced density operator on S, and cross terms carry no distinguishable logical information there. Small correctable regions cannot read the logical state. This is the information-theoretic content behind the combinatorial rule that a sufficiently small support cannot host a nontrivial logical operator.

For a pure encoded Bell state between a reference and the code, correctability of erasure S means the reference is uncorrelated with S. The remaining physical qubits retain enough information to reconstruct the reference entanglement. This does not mean each surviving qubit contains a full duplicate. The information can remain distributed among joint observables. Attempting to read it from two disjoint surviving subsets simultaneously would run into no-cloning constraints, which in turn restrict possible code parameters.

One resulting parameter restriction is the quantum Singleton bound n-k>=2(d-1) for a general quantum code encoding k qubits into n with distance d. For [[7,1,3]], the left side is six and the right side four, so the parameters are allowed without saturating the bound. For a hypothetical [[5,1,4]] code, four is less than six, so such parameters are impossible. The bound is necessary rather than sufficient: passing it does not construct a code, prove locality, or guarantee a practical decoder.

Enumerating distance in a small stabilizer model

For a small code, an exact distance calculation can enumerate Pauli strings in increasing weight. A candidate is relevant only if it commutes with every independent stabilizer generator. Among those normalizer elements, stabilizers themselves are removed. The first remaining weight is the code distance. For k>0, this searches for a nontrivial logical Pauli; for a stabilizer state with k=0, the ordinary encoded-information interpretation of distance needs a separate convention.

The search contains C(n,w)3^w weight-w Pauli strings. At n=7, there are 21 weight-one strings and 189 weight-two strings. Checking all 210 against the six Steane generators finds no commuting non-stabilizer. At weight three a logical representative appears, establishing d=3. These finite enumeration counts are manageable, but the number grows rapidly with n. Large-code distance claims therefore often rely on structural proofs, certified optimization bounds, or explicitly qualified search results.

A failed search is only a lower bound if its searched set is complete and its commutation and stabilizer-membership tests are correct. Finding a weight-w logical operator proves d<=w immediately; failing to find one under a heuristic search does not prove d>w. This asymmetry should be visible in any automated code catalogue, where a nominal distance might originate from a theorem, an exhaustive calculation, or an unresolved conjecture.

A code distance belongs to a workload, not a headline

A small logical error probability is meaningful only beside the number of opportunities for failure. A memory experiment, a short logical operation and a large algorithm can tolerate very different per-round rates. Choosing a code distance therefore starts with a workload and an explicit accounting convention, rather than a desired number of decimal places. The model assigns a simple distance-dependent logical error and makes each logical operation consume a number of correction rounds proportional to distance. Increasing distance improves one factor while increasing the exposure count, footprint and serial duration. The calculation then selects the smallest tested odd distance meeting a stated union-bound target. A union bound adds event probabilities and does not require the events to be independent, although the assumed per-location probabilities remain a strong physical modeling choice. This is an accounting exercise, not a surface-code resource estimate for a named algorithm. A real implementation must also count factories, routing, boundaries, correlated faults, logical gate constructions and recovery behavior. Moving from per-location protection to complete-workload protection requires an explicit exposure count. The footprint must also state which resources it excludes.

Model: p_L(d) = A × ratio^((d+1)/2); Counted locations = logical_registers × base_operations × d; Workload union bound = min(1, counted_locations × p_L); Toy patch footprint = logical_registers × (2d²-1) Assumptions: The error law and coefficients are invented. A serial sequence of logical operations lasts d correction rounds per operation; all stored registers, including idle ones, remain exposed. All counted locations share the stipulated per-location bound.

Distance 17 is the smallest tested odd distance meeting the stated target. The gate count alone is not the exposure count: this model makes each logical operation last d rounds. Its scaling prefactor and threshold ratio are invented. No threshold theorem or device forecast is inferred from the scan.

Limitations: A low bound based on an invalid physical noise model provides no assurance. The footprint excludes factories and routing regions.

Specified synthetic inputs
QuantityValue
Physical error / model threshold0.12
Scaling prefactor0.04
Base logical operations10000
Logical registers8
Workload failure bound0.001
Cycle time, microseconds1
Tested odd distances3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41
Calculated baseline results · Approximate values use up to 6 significant digits.
Calculated quantitySynthetic result
Smallest passing tested distance17
Chosen-distance logical error per location2.06391e-10
Counted fault locations1360000
Union-bound workload failure0.000280692
Illustrative physical-qubit footprint4616
Serial operation time, seconds0.17
Complete tested distance range · Approximate values use up to 6 significant digits.
DistancePer-location errorCounted locationsWorkload failure boundPhysical qubitsSeconds
30.00057624000011360.03
50.0000691240000013920.05
70.000008294456000017760.07
99.95328e-77200000.71663612880.09
111.19439e-78800000.10510719280.11
131.43327e-810400000.01490626960.13
151.71993e-912000000.0020639135920.15
172.06391e-1013600000.00028069246160.17
192.47669e-1115200000.000037645857680.19
212.97203e-1216800000.0000049930270480.21
233.56644e-1318400006.56225e-784560.23
254.27973e-1420000008.55946e-899920.25
275.13567e-1521600001.10931e-8116560.27
296.16281e-1623200001.42977e-9134480.29
317.39537e-1724800001.83405e-10153680.31
338.87444e-1826400002.34285e-11174160.33
351.06493e-1828000002.98181e-12195920.35
371.27792e-1929600003.78264e-13218960.37
391.5335e-2031200004.78453e-14243280.39
411.8402e-2132800006.03587e-15268880.41

Sources

  • Daniel Gottesman · · Thesis · arXiv · DOI 10.48550/arXiv.quant-ph/9705052
    Verification scope

    Stabilizer Codes and Quantum Error Correction
    Daniel Gottesman · · Thesis · Preprint recorded · arXiv

    Citation identity checked ·

    Stabilizer algebra and fault-tolerance foundations; no current experimental ranking.

  • Austin G. Fowler et al. · · Review article · Preprint recorded · arXiv
    Verification scope

    Surface codes: Towards practical large-scale quantum computation
    Austin G. Fowler et al. · · Review article · Preprint recorded · arXiv

    Citation identity checked ·

    Architecture and surface-code tutorial; numerical thresholds remain model-specific.

    Surface codes: Towards practical large-scale quantum computation
    Reference · arXiv

    Citation identity checked ·

    This check establishes the source title and link. Scientific claim review is separate.