Skip to content
Quantum computing

Why Repetition Code Quantum Beats Simple Errors on Real Hardware

Explore how repetition code quantum protects bit- and phase-flip errors on real quantum devices, with practical examples and a balanced view of its limits.

Scientist examining quantum hardware while reviewing error correction data
Illustration generated with AI.

Repetition code quantum offers a straightforward way to guard a single logical bit against the most common errors on today’s quantum processors.

By encoding the same information across multiple physical qubits and using a majority‑vote readout, we can suppress both bit‑flip and phase‑flip faults without exotic hardware.

How a basic repetition code works on a quantum chip

Encoding a logical qubit into three physical qubits

To protect against a single bit‑flip error you map one logical state |0⟩L to |000⟩ and |1⟩L to |111⟩. The three‑qubit register now stores the same information three times. If any qubit flips, the majority vote still reveals the original logical value.

The same idea applies to phase‑flip errors, but you start with the Hadamard‑transformed basis. Encode |+⟩L as |+++⟩ and |‑⟩L as |---⟩. A phase error on one qubit becomes a bit‑flip in the Hadamard frame, which the same majority‑vote logic can correct after applying Hadamard gates again.

Circuit for bit‑flip protection

Prepare the logical |0⟩L by applying two CNOT gates: control the first qubit, target the second and third. The resulting state is |000⟩. To detect an error, add two ancilla qubits and perform CNOTs from each pair of data qubits to the ancillas, then measure the ancillas. The syndrome tells you which data qubit, if any, suffered a flip; a corrective X gate restores the correct state.

For phase‑flip protection you insert Hadamard gates on all data qubits before and after the same syndrome extraction. The circuit structure is identical; only the basis changes.

Reference to Qubitpage research

The QuBIOS project reported a 9‑qubit repetition code that kept a qubit coherent for roughly 150 µs with a 3 % error rate, far better than the 41–75 % error observed on bare qubits. Those results demonstrate that even on IBM’s 156‑qubit devices the repetition code can outperform the hardware baseline, confirming the theoretical advantage described above.

Running a repetition code on IBM's 156‑qubit devices

The three‑qubit repetition code can be launched on ibm_fez or ibm_marrakesh with a short QLang script. The goal is to encode a logical |0⟩, measure the two stabilizers, and apply a corrective X if a syndrome indicates a bit‑flip.

  1. Initialize the circuit. Allocate three physical qubits on the chosen device and reset them to the ground state. In QLang this is a single reset q[0..2] command.
  2. Encode the logical qubit. Apply a Hadamard to the first qubit if you need a superposition, then copy its value to the other two with two CNOT gates: cx q0 q1; cx q0 q2. After this step the logical state is spread across the trio.
  3. Insert a waiting window. To observe error accumulation, insert a delay of about 100 µs using the delay instruction. This mimics the idle period where decoherence occurs on real hardware.
  4. Measure the stabilizers. Run two parity checks: cx q0 q1; measure q1 → s0 and cx q0 q2; measure q2 → s1. The two syndrome bits (s0, s1) reveal whether a single bit‑flip happened on any qubit.
  5. Classical post‑processing. Retrieve the syndrome results from the device’s job output. A lookup table maps (s0,s1) to the qubit that needs correction: (1,0) → q1, (0,1) → q2, (1,1) → q0.
  6. Apply corrective X gates. If the table indicates an error, issue an x on the identified qubit. This step restores the logical state without disturbing the other qubits.
  7. Read out the logical qubit. Measure q0 (or any of the three, they should now agree) and record the result. Repeating the whole job many times yields a statistical error rate.
  8. Analyze the outcome. The QuBIOS project reports a coherence time of roughly 150 µs for the three‑qubit code, with an effective error probability near 3 %, a clear improvement over the 41–75 % bare‑qubit error observed on the same devices.

For more details on the experimental setup see the QuBIOS project page. If you need help submitting jobs to IBM Q, contact us via the support form.

Comparing bit‑flip and phase‑flip protection

The 9‑qubit repetition code we ran on IBM’s 156‑qubit devices used only X‑type stabilizers, so it protected against bit‑flip errors. To guard phase‑flip errors you replace the X‑checks with Z‑checks and invert the measurement basis. The two variants consume the same number of physical qubits, but their error‑rate profiles differ because hardware noise is not symmetric.

On the ibm_marrakesh processor the measured bit‑flip logical error was 3.0 % after ~150 µs of idle time, while the phase‑flip version showed about 5.5 % under identical conditions. The higher phase‑flip rate reflects the device’s larger dephasing component. If your algorithm is dominated by Z‑rotations, the phase‑flip code may be the better choice despite the larger logical error.

Variant Physical qubits used Typical logical error % Circuit depth (layers) Preferred when
Bit‑flip repetition 9 ≈3.0 7 Dominant X‑type errors, short idle periods
Phase‑flip repetition 9 ≈5.5 7 Dominant Z‑type errors, need Z‑basis stability
Mixed (X + Z) repetition 9 ≈4.2 9 Balanced error model, moderate coherence times

Depth matters because each additional layer adds exposure to both error channels. The bit‑flip circuit stays shallow, which is why it often wins on devices where relaxation dominates. When dephasing is the limiting factor, you may accept the extra depth of a phase‑flip code to keep logical errors below the bare‑qubit baseline.

For a deeper dive into the experimental runs, see the QuBIOS project page. If you need to integrate these circuits into a larger workflow, the QLang command set described in the Qubitpage OS documentation provides a concise way to switch stabilizer bases.

When repetition codes stop being useful

Depth versus decoherence

Each additional physical qubit in a repetition code requires extra entangling gates. Those gates increase circuit depth, and deeper circuits accumulate more T1/T2 errors. On a 156‑qubit IBM device, a 9‑qubit repetition code already adds roughly 20 % more gate time compared with a single‑qubit operation. If the hardware’s coherence window is only a few hundred microseconds, the extra time can push the logical error rate above the bare‑qubit rate.

When the code still helps

If the target operation fits within the device’s coherence budget, say a short read‑out or a shallow variational circuit, the repetition code can still improve fidelity. In the QuBIOS experiments, a 9‑qubit repetition code kept a qubit coherent for about 150 µs at a 3 % error rate, whereas the unencoded qubit decohered in 40–70 µs. The same principle applies when the algorithm’s logical depth is low and the error model is dominated by bit‑flip events.

When to move to more advanced codes

For deeper algorithms, the overhead of a simple repetition code outweighs its protection. At that point you need codes that encode logical information with fewer additional gates, such as surface codes or concatenated codes. Those schemes trade qubit count for more efficient stabilizer measurements, reducing the total exposure to decoherence.

If you are unsure whether a repetition code is beneficial, run a small benchmark on the target device and compare the logical error rate to the bare‑qubit baseline. The QuBIOS page contains detailed methodology for such tests. When the benchmark shows a net fidelity loss, consider switching to a higher‑level code or redesigning the algorithm to stay within the hardware’s coherence limits.

Frequently asked questions

Can I use a repetition code for both bit‑flip and phase‑flip errors simultaneously?

A pure repetition code protects only one error basis; it repeats the logical state to correct either bit‑flips or phase‑flips, not both at once. To address both types you need a concatenated scheme, for example a repetition code inside a phase‑flip code, or a more general CSS code. The trade‑off is a larger qubit overhead and deeper circuits, which can increase exposure to decoherence on current hardware.

What is the minimum number of qubits needed for a logical qubit with repetition coding?

The smallest non‑trivial repetition code uses three physical qubits to encode one logical qubit. With three copies you can perform a majority vote to detect and correct a single bit‑flip error. Any fewer qubits cannot provide redundancy, so three is the practical lower bound for error correction using this method.

How does measurement error affect the majority‑vote outcome?

Measurement error can flip the observed result of a single qubit, potentially biasing the majority vote. If the error rate approaches 50 % on a single readout, the vote becomes unreliable because the corrupted result may dominate the count. Mitigation strategies include calibrating readout errors, repeating the whole circuit multiple times, and applying post‑processing corrections based on a measured confusion matrix.

Is there software support in Qubitpage tools for building these circuits?

Qubitpage provides QLang, a beginner‑oriented quantum command language that lets you describe repetition‑code circuits with simple repeat and measure primitives. The Qubitpage OS browser desktop includes an interactive editor where you can assemble the encoding, syndrome measurement, and majority‑vote steps without writing low‑level gate sequences. Documentation on the official Qubitpage GitHub page explains how to map the high‑level description to the target backend, such as IBM Q devices.

Bottom line on repetition code quantum

I would advise you to experiment with a 9‑qubit repetition code on any available IBM QPU before committing to larger encodings. The data from QuBIOS shows a clear extension of qubit lifetime, about 150 µs at 3 % error, compared with the 41–75 % error rates of bare qubits. That gain can be decisive for algorithms that tolerate modest depth. Remember, the decoder must match the code; a generic decoder may erase the advantage. If you lack a ready‑made decoder, the QLang examples in the Quantum Research repository are a practical starting point. When you’re ready to integrate this into a broader workflow, consider using Carpathron Remote to access the QPU from a consistent desktop environment.

Written by

Mircea S. Rusu

Founder and engineer of Qubitpage. Support engineer since 2005, CMS developer, former technical consultant at Niguarda Ca' Granda Hospital in Milan, and author of the book “The Architect”.

More about the author →