Why Error Correction?
Quantum states are fragile β interaction with the environment causes decoherence and errors. Unlike classical bits, qubits cannot be copied (no-cloning theorem), so classical error correction strategies don't directly apply.
Quantum error correction (QEC) encodes a single logical qubit into multiple physical qubits, enabling error detection and correction without measuring the logical information.
The Shor Code
The Shor code (1995) was the first quantum error correction code. It encodes 1 logical qubit into 9 physical qubits and can correct any single-qubit error.
The code is a concatenation of the 3-qubit bit-flip code and the 3-qubit phase-flip code:
The nine stabilizer generators are:
Steane Code
The Steane code is a [[7, 1, 3]] code that encodes 1 logical qubit into 7 physical qubits with distance 3 (correcting any single error).
It is a CSS (Calderbank-Shor-Steane) code constructed from classical Hamming codes:
where is the [7, 4] Hamming code. The stabilizers are:
- X stabilizers: , ,
- Z stabilizers: , ,
Stabilizer Formalism
The stabilizer formalism provides a systematic way to describe quantum error correcting codes. An code is defined by independent stabilizer generators that commute and satisfy:
The syndrome measurement projects the error into a coset of the stabilizer group, identifying the error without revealing the logical information.
For distance , the code can correct errors.
Surface Codes
Surface codes are the leading candidates for practical QEC due to their high threshold error rate (~1%) and local stabilizer measurements.
A surface code on a 2D lattice with physical qubits encodes logical qubit with distance .
The stabilizers are:
- X stabilizers: operators on faces (plaquettes)
- Z stabilizers: operators on vertices (stars)
Error correction is performed by minimum-weight perfect matching on the syndrome graph.
Threshold Theorem
The threshold theorem guarantees that if the physical error rate is below a threshold , then arbitrarily long quantum computations can be performed with arbitrarily small logical error rate.
For surface codes, . With code distance , the logical error rate scales as:
For example, with and , we achieve β sufficient for most applications.
Python: Stabilizer Code Simulation
import numpy as np
class StabilizerCode:
# Simple stabilizer code simulator.
def __init__(self, n, k, stabilizers):
self.n = n
self.k = k
self.stabilizers = stabilizers
def compute_syndrome(self, error):
# Compute syndrome for a given error (binary vector).
syndrome = []
for stab in self.stabilizers:
s = sum(int(stab[i]) * int(error[i]) for i in range(self.n)) % 2
syndrome.append(s)
return syndrome
code = StabilizerCode(n=3, k=1, stabilizers=["110", "011"])
error = "100"
syndrome = code.compute_syndrome(error)
print(f"Error: {error}")
print(f"Syndrome: {syndrome}")
This demonstrates syndrome computation for a simple stabilizer code.
CSS Codes
Calderbank-Shor-Steane (CSS) codes are constructed from pairs of classical codes:
Given two classical linear codes and with , the CSS code has parameters:
- physical qubits
- logical qubits
- distance
CSS codes have the property that X and Z errors can be corrected independently, simplifying the syndrome analysis.
Code Comparison
| Code | [[n,k,d]] | Qubits | Distance | Threshold |
|---|---|---|---|---|
| Shor | [[9,1,3]] | 9 | 3 | ~10^{-3} |
| Steane | [[7,1,3]] | 7 | 3 | ~10^{-4} |
| [[5,1,3]] | [[5,1,3]] | 5 | 3 | ~10^{-3} |
| Surface | [[d^2,1,d]] | d^2 | d | ~10^{-2} |
| Color | [[O(d^2),k,d]] | O(d^2) | d | ~10^{-2} |