QUAVIS.CC
Numerical Simulations of Parallel Pauli Product Measurements on qLDPC Codes: Circuit-Level Noise, Routing Overhead, and Fault-Tolerant Decoding
#Quantum Computing #qLDPC Codes #Fault-Tolerant Quantum Computing

Numerical Simulations of Parallel Pauli Product Measurements on qLDPC Codes: Circuit-Level Noise, Routing Overhead, and Fault-Tolerant Decoding

Numerical Simulations of Parallel Pauli Product Measurements on qLDPC Codes: Circuit-Level Noise, Routing Overhead, and Fault-Tolerant Decoding

1. Introduction: The Qubit Scaling Bottleneck and the qLDPC Shift

Fault-tolerant quantum computing (FTQC) requires protecting quantum information from environmental decoherence and operational gate control errors. For over a decade, the 2D planar Surface Code has dominated fault-tolerant architecture design. Its popularity stems from its local nearest-neighbor 2D layout, high threshold ($\sim 1\%$), and simple syndrome extraction circuits.

However, the 2D surface code suffers from a severe efficiency bottleneck: its asymptotic encoding rate $k/n$ approaches zero as the code distance $d$ scales up ($n = \mathcal{O}(d^2)$ physical qubits per single logical qubit $k=1$). Implementing fault-tolerant quantum algorithms at scale—such as Shor’s algorithm or quantum chemistry simulations—would require millions of physical qubits primarily dedicated to parity checks and routing channels.

       SURFACE CODE (2D Planar)                      qLDPC CODE (High-Dimensional)
  +---------------------------------+           +---------------------------------+
  | (Q)---(Q)---(Q)---(Q)---(Q)    |           |    [Q1]-----\      /----[Q2]    |
  |  |     |     |     |     |      |           |      |       \    /       |      |
  | (Q)---(A)---(Q)---(A)---(Q)    |           |    [Check1]--[Q3]--[Check2]    |
  |  |     |     |     |     |      |           |      |       /    \       |      |
  | (Q)---(Q)---(Q)---(Q)---(Q)    |           |    [Q4]-----/      \----[Q5]    |
  +---------------------------------+           +---------------------------------+
    • Rate k/n -> 0                             • Constant Rate k/n = O(1)
    • Local 2D Connectivity                     • Non-Local Tanner Graph Expanders
    • High Physical Qubit Overhead              • 10x - 100x Fewer Physical Qubits

Quantum Low-Density Parity-Check (qLDPC) codes—most notably Hypergraph Product (HGP) codes, Lifted Product (LP) codes, and Bivariate Bicycle (BB) codes—have emerged as a paradigm shift. qLDPC codes maintain a constant encoding rate $k/n = \Omega(1)$ while achieving linear or sub-linear code distance scaling with constant check operator degrees $d_c, d_q = \mathcal{O}(1)$. Recent architectures show that qLDPC codes can reduce physical qubit overhead by an order of magnitude compared to planar surface codes.

However, moving to qLDPC codes introduces an operational bottleneck: logical operation execution. In surface codes, logical operations are executed via lattice surgery or defect braiding on a 2D plane. In qLDPC codes, logical operators have non-local support across non-trivial graph cycles. Executing universal fault-tolerant computation requires performing Pauli Product Measurements (PPM)—measuring multiqubit logical Pauli observables $\bar{P} = \bigotimes_{j} \bar{P}_j$—directly or across auxiliary connectivity channels.

To execute complex logic networks efficiently, these measurements must be executed in parallel. Numerical simulation of parallel Pauli Product Measurements on qLDPC codes is essential to quantify circuit-level error propagation, evaluate hook errors introduced during routing, and design real-time, fault-tolerant decoders.


2. Mathematical and Physical Formulation

2.1 qLDPC Code Geometry and Tanner Graphs

A stabilizer quantum code $[[n, k, d]]$ is defined by an abelian stabilizer group $\mathcal{S} \subset \mathcal{P}_n$ not containing $-\mathbb{I}$. In binary vector space representation $\mathbb{F}_2^{2n}$, $\mathcal{S}$ is generated by two sparse parity-check matrices: $H_X \in \mathbb{F}_2^{m_X \times n}$ and $H_Z \in \mathbb{F}_2^{m_Z \times n}$.

The fundamental commutativity condition requires that all $X$-checks commute with all $Z$-checks:

$$H_X H_Z^T = 0 \pmod 2$$

The code topology is represented by a bipartite Tanner graph $G = (V_Q \cup V_C, E)$, where $V_Q$ represents data qubits ($|V_Q| = n$), $V_C$ represents check nodes ($|V_C| = m_X + m_Z$), and edges $E$ denote non-zero entries in $H_X$ and $H_Z$. For qLDPC codes, the maximum vertex degrees satisfy $\max(\deg(v)) \le d_{\max} = \mathcal{O}(1)$.

2.2 Hypergraph Product (HGP) Code Construction

The Hypergraph Product, introduced by Tillich and Zémor, constructs a quantum code from two classical linear binary codes $C_1 = [n_1, k_1, d_1]$ and $C_2 = [n_2, k_2, d_2]$ with parity check matrices $H_1 \in \mathbb{F}_2^{r_1 \times n_1}$ and $H_2 \in \mathbb{F}_2^{r_2 \times n_2}$.

The quantum block length is $n = n_1 n_2 + r_1 r_2$, and the check matrices are defined via Kronecker products:

$$H_X = \begin{pmatrix} H_1 \otimes I_{n_2} & \Big| & I_{r_1} \otimes H_2^T \end{pmatrix}$$

$$H_Z = \begin{pmatrix} I_{n_1} \otimes H_2 & \Big| & H_1^T \otimes I_{r_2} \end{pmatrix}$$

To verify commutativity analytically over $\mathbb{F}_2$:

$$H_X H_Z^T = (H_1 \otimes I_{n_2})(I_{n_1} \otimes H_2^T) + (I_{r_1} \otimes H_2^T)(H_1 \otimes I_{r_2}) = (H_1 \otimes H_2^T) + (H_1 \otimes H_2^T) \equiv 0 \pmod 2$$

The logical dimension of the resulting HGP code scales as $k = k_1 k_2 + k_1^T k_2^T$, yielding a high encoding rate when constructed from good classical LDPC codes.

Classical Code C1 (r1 x n1)   x   Classical Code C2 (r2 x n2)
        |                                 |
        +----------------+----------------+
                         |
                         v
       qLDPC Block (n = n1*n2 + r1*r2)
       +-------------------+-------------------+
       |   H1 (X) I_n2     |    I_r1 (X) H2^T  |  --> H_X checks
       +-------------------+-------------------+
       |   I_n1 (X) H2     |    H1^T (X) I_r2  |  --> H_Z checks
       +-------------------+-------------------+

2.3 Parallel Pauli Product Measurements (PPM)

Let ${ \bar{X}i, \bar{Z}_i }{i=1}^k$ be the logical Pauli operators generating the logical Pauli group $\mathcal{L}(G) \cong \text{Ker}(H_X)/\text{Im}(H_Z^T) \times \text{Ker}(H_Z)/\text{Im}(H_X^T)$.

A parallel Pauli Product Measurement measures a set of $M$ commuting joint logical Pauli observables simultaneously:

$$\mathcal{O}m = \bigotimes{j=1}^n P_{m,j} \quad \text{for } m \in {1, 2, \dots, M}, \quad P_{m,j} \in {\mathbb{I}, X, Y, Z}$$

To perform parallel measurements without destructive back-action: 1. All observables must mutually commute: $[\mathcal{O}m, \mathcal{O}{m'}] = 0, \forall m, m'$. 2. Observables must commute with all stabilizer generators: $[\mathcal{O}_m, S_i] = 0, \forall m, i$.

Parallel PPM is implemented by coupling data qubits to auxiliary routing channels or ancilla registers using CNOT/CZ gate networks, followed by ancilla readout in the computational or diagonal basis.

2.4 Circuit-Level Noise and Phenomenological Error Propagation

During parallel syndrome extraction and PPM execution, noise affects every circuit component.

  1. Phenomenological Error Model:
  2. Data qubit Pauli flips ($X, Y, Z$) occur with probability $p_{\text{phys}}$.
  3. Measurement readout bit-flips occur with probability $p_{\text{meas}}$.

  4. Circuit-Level Noise Model:

  5. Single-qubit depolarizing channel: $\mathcal{E}_1(\rho) = (1-p)\rho + \frac{p}{3}(X\rho X + Y\rho Y + Z\rho Z)$.
  6. Two-qubit gate depolarizing channel: $\mathcal{E}2(\rho) = (1-p)\rho + \frac{p}{15} \sum{P \in {\mathbb{I}, X, Y, Z}^{\otimes 2} \setminus {\mathbb{I}\mathbb{I}}} P \rho P$.
  7. Ancilla state preparation ($|0\rangle, |+\rangle$) and measurement assignment error rates $p_{\text{prep}}, p_{\text{read}}$.
Data Qubit -----------------•------------------- (Depolarizing Error p_gate)
                            |
Ancilla Qubit ---|0>---[H]---(+)---[H]---[Meas]--- (Hook Error Propagation)

In qLDPC codes, a single two-qubit gate error during an ancilla interaction can propagate across the Tanner graph into a multi-qubit data error—a phenomenon known as a hook error. Because check degrees are bounded, hook errors propagate to a limited number of neighbors, but their non-local distribution requires rigorous space-time syndrome decoding.


3. Production-Ready Python Implementation

The following standard Python implementation constructs a Hypergraph Product qLDPC code using scipy.sparse, sets up parallel Pauli Product Measurement observables, simulates multi-round syndrome extraction under phenomenological/circuit noise, and evaluates syndrome stability.

"""
qLDPC Parallel Pauli Product Measurement Simulator
===================================================
Models Hypergraph Product (HGP) code structures, constructs commuting
Pauli product measurement observables, and executes multi-round syndrome
extraction simulations under phenomenological noise.

Dependencies: numpy, scipy
"""

import numpy as np
import scipy.sparse as sp
from typing import Tuple, List, Dict, Any


def build_hgp_code(h1: sp.csr_matrix, h2: sp.csr_matrix) -> Tuple[sp.csr_matrix, sp.csr_matrix]:
    """
    Constructs Hypergraph Product (HGP) parity check matrices H_X and H_Z
    from two classical linear binary parity check matrices h1 and h2.

    Args:
        h1: Classical parity check matrix (shape: r1 x n1)
        h2: Classical parity check matrix (shape: r2 x n2)

    Returns:
        Tuple (H_X, H_Z) as sparse CSR matrices in uint8 format.
    """
    r1, n1 = h1.shape
    r2, n2 = h2.shape

    I_n1 = sp.eye(n1, dtype=np.uint8, format='csr')
    I_n2 = sp.eye(n2, dtype=np.uint8, format='csr')
    I_r1 = sp.eye(r1, dtype=np.uint8, format='csr')
    I_r2 = sp.eye(r2, dtype=np.uint8, format='csr')

    # H_X = [h1 \otimes I_n2 , I_r1 \otimes h2^T]
    hx_left = sp.kron(h1, I_n2, format='csr')
    hx_right = sp.kron(I_r1, h2.T, format='csr')
    hx = sp.hstack([hx_left, hx_right], format='csr')

    # H_Z = [I_n1 \otimes h2 , h1^T \otimes I_r2]
    hz_left = sp.kron(I_n1, h2, format='csr')
    hz_right = sp.kron(h1.T, I_r2, format='csr')
    hz = sp.hstack([hz_left, hz_right], format='csr')

    return hx, hz


class ParallelPPMSimulator:
    """
    Numerical simulator for parallel Pauli Product Measurements (PPM)
    and space-time syndrome extraction on qLDPC codes.
    """

    def __init__(self, hx: sp.csr_matrix, hz: sp.csr_matrix):
        """
        Initializes the simulator with X and Z parity check matrices.
        """
        self.hx = hx
        self.hz = hz
        self.num_x_checks, self.num_qubits = hx.shape
        self.num_z_checks = hz.shape[0]

        # Verify quantum commutativity: H_X @ H_Z^T = 0 (mod 2)
        comm = (self.hx.dot(self.hz.T)).astype(np.uint8)
        comm.data %= 2
        comm.eliminate_zeros()
        assert comm.nnz == 0, "Invalid qLDPC parity matrices: H_X and H_Z do not commute!"

    def generate_pauli_error(self, p_error: float) -> Tuple[np.ndarray, np.ndarray]:
        """
        Generates independent Pauli X and Z errors across all data qubits.

        Args:
            p_error: Physical probability of a bit/phase flip error per qubit.

        Returns:
            Tuple (err_x, err_z) of binary vectors of length `num_qubits`.
        """
        err_x = (np.random.rand(self.num_qubits) < p_error).astype(np.uint8)
        err_z = (np.random.rand(self.num_qubits) < p_error).astype(np.uint8)
        return err_x, err_z

    def extract_syndrome_history(
        self, err_x: np.ndarray, err_z: np.ndarray, p_meas: float, rounds: int = 3
    ) -> Tuple[np.ndarray, np.ndarray]:
        """
        Simulates multi-round syndrome extraction with readout errors.

        Args:
            err_x: Binary vector representing physical X errors.
            err_z: Binary vector representing physical Z errors.
            p_meas: Readout flip probability for check measurements.
            rounds: Number of syndrome extraction rounds.

        Returns:
            Tuple (syn_z_history, syn_x_history) with dimensions (rounds, num_checks).
        """
        syn_z_hist = []
        syn_x_hist = []

        # Z-checks detect X-errors: s_z = H_Z * e_x (mod 2)
        # X-checks detect Z-errors: s_x = H_X * e_z (mod 2)
        exact_syn_z = (self.hz.dot(err_x)) % 2
        exact_syn_x = (self.hx.dot(err_z)) % 2

        for _ in range(rounds):
            readout_noise_z = (np.random.rand(self.num_z_checks) < p_meas).astype(np.uint8)
            readout_noise_x = (np.random.rand(self.num_x_checks) < p_meas).astype(np.uint8)

            syn_z_hist.append((exact_syn_z + readout_noise_z) % 2)
            syn_x_hist.append((exact_syn_x + readout_noise_x) % 2)

        return np.array(syn_z_hist), np.array(syn_x_hist)

    def simulate_parallel_ppm(
        self,
        observables: List[Tuple[np.ndarray, np.ndarray]],
        p_err: float,
        p_meas: float,
        rounds: int = 3,
        trials: int = 1000
    ) -> Dict[str, Any]:
        """
        Simulates simultaneous measurement of multiple commuting Pauli observables
        alongside multi-round syndrome extraction.

        Args:
            observables: List of tuples (obs_x, obs_z) defining target observables.
            p_err: Physical data qubit error rate.
            p_meas: Readout measurement error rate.
            rounds: Number of syndrome extraction rounds per trial.
            trials: Number of Monte Carlo simulation iterations.

        Returns:
            Dict containing clean syndrome fraction, observable outcome stats, and metadata.
        """
        clean_syndrome_count = 0
        all_measured_outcomes = []

        for _ in range(trials):
            err_x, err_z = self.generate_pauli_error(p_err)
            syn_z_hist, syn_x_hist = self.extract_syndrome_history(err_x, err_z, p_meas, rounds=rounds)

            # Evaluate joint Pauli observable outcomes
            trial_outcomes = []
            for obs_x, obs_z in observables:
                # Commutation relation sign flip: (-1)^(err_x . obs_z + err_z . obs_x) mod 2
                phase_flip = (np.dot(err_x, obs_z) + np.dot(err_z, obs_x)) % 2
                readout_err = 1 if np.random.rand() < p_meas else 0
                measured_val = (phase_flip + readout_err) % 2
                trial_outcomes.append(measured_val)

            all_measured_outcomes.append(trial_outcomes)

            # Check if final round returned zero syndrome defect
            if np.sum(syn_z_hist[-1]) + np.sum(syn_x_hist[-1]) == 0:
                clean_syndrome_count += 1

        clean_rate = clean_syndrome_count / trials
        return {
            "num_qubits": self.num_qubits,
            "x_checks": self.num_x_checks,
            "z_checks": self.num_z_checks,
            "clean_syndrome_rate": clean_rate,
            "sample_outcomes": all_measured_outcomes[:5]
        }


# --- Example Execution & Verification ---
if __name__ == "__main__":
    # Define a 7-bit Hamming code parity check matrix [7, 4, 3]
    H_hamming = sp.csr_matrix([
        [1, 1, 1, 0, 1, 0, 0],
        [0, 1, 1, 1, 0, 1, 0],
        [1, 0, 1, 1, 0, 0, 1]
    ], dtype=np.uint8)

    # Generate Hypergraph Product qLDPC Code: [[49, 16, 3]]
    Hx, Hz = build_hgp_code(H_hamming, H_hamming)
    simulator = ParallelPPMSimulator(Hx, Hz)

    print("==================================================")
    print("qLDPC Parallel PPM Numerical Simulation Initialized")
    print("==================================================")
    print(f"Total Data Qubits (N) : {simulator.num_qubits}")
    print(f"X Check Operators    : {simulator.num_x_checks}")
    print(f"Z Check Operators    : {simulator.num_z_checks}")

    # Define two parallel commuting Pauli product observables
    # Observable 1: Z-type Pauli product on Qubit partition 1
    obs1_x = np.zeros(simulator.num_qubits, dtype=np.uint8)
    obs1_z = np.zeros(simulator.num_qubits, dtype=np.uint8)
    obs1_z[:7] = 1

    # Observable 2: X-type Pauli product on Qubit partition 2
    obs2_x = np.zeros(simulator.num_qubits, dtype=np.uint8)
    obs2_x[7:14] = 1
    obs2_z = np.zeros(simulator.num_qubits, dtype=np.uint8)

    parallel_observables = [(obs1_x, obs1_z), (obs2_x, obs2_z)]

    # Execute simulation under phenomenological noise (p_err = 0.2%, p_meas = 0.2%)
    results = simulator.simulate_parallel_ppm(
        observables=parallel_observables,
        p_err=0.002,
        p_meas=0.002,
        rounds=3,
        trials=1000
    )

    print("\n--- Simulation Results ---")
    print(f"Clean Syndrome Rate (3 rounds) : {results['clean_syndrome_rate'] * 100:.2f}%")
    print(f"Sample Parallel Measurement Outcomes (First 5 trials):")
    for idx, sample in enumerate(results["sample_outcomes"]):
        print(f"  Trial {idx+1}: Obs1 = {sample[0]}, Obs2 = {sample[1]}")

4. Hardware Limitations and Future Outlook

While qLDPC codes and parallel Pauli Product Measurements dramatically reduce physical qubit counts, several architectural challenges remain for hardware deployment:

+-----------------------------------------------------------------------------------+
|                        HARDWARE IMPLEMENTATION BOTTLENECKS                        |
+-----------------------------------------------------------------------------------+
| 1. LONG-RANGE ROUTING                                                             |
|    • Non-planar Tanner graphs require 3D interconnects, photonic links,          |
|      or neutral-atom optical tweezers.                                            |
+-----------------------------------------------------------------------------------+
| 2. HOOK ERROR PROPAGATION                                                         |
|    • Non-local check circuits can spread single ancilla errors to multi-qubit      |
|      data chains. Requires flag-qubit circuits or fault-tolerant couplers.         |
+-----------------------------------------------------------------------------------+
| 3. REAL-TIME DECODING LATENCY                                                     |
|    • BP-OSD decoding complexity scales as O(N^3). Must process syndromes within   |
|      superconducting coherence windows (< 1 microsecond).                        |
+-----------------------------------------------------------------------------------+

4.1 Non-Local Connectivity vs. 2D Layout Constraints

Unlike surface codes, qLDPC Tanner graphs are non-planar expanders. Implementing them on 2D superconducting circuit layouts requires long-range couplers or multi-layer 3D wiring structures, which can introduce crosstalk and signal attenuation.

Conversely, reconfigurable neutral-atom architectures (using optical tweezers to physically shuttle atom arrays) and photonic quantum interconnects are well-suited for qLDPC codes, as they naturally support dynamically reconfigurable non-local connectivity.

4.2 Hook Errors and Ancilla Routing Overhead

During parallel PPM, measuring high-weight logical operators requires multi-qubit ancilla chains. A single fault in an ancilla gate sequence can introduce a high-weight logical error (a hook error). Mitigating hook errors requires adding flag qubits or using generalized Shor/Steane syndrome extraction gadgets, which increases the circuit depth and active qubit count during measurement cycles.

4.3 Real-Time Decoding Speed

To prevent error accumulation during long computations, syndromes must be decoded within the coherence window of the physical qubits (e.g., $\sim 1\ \mu\text{s}$ for superconducting qubits, $\sim 100\ \mu\text{s}$ for neutral atoms).

While Minimum-Weight Perfect Matching (MWPM) works well for 2D surface codes, qLDPC codes require advanced decoders like Belief Propagation with Ordered Statistics Decoding (BP-OSD) or Tensor Network decoders. BP-OSD achieves near-optimal logical error thresholds, but its matrix inversion step ($\mathcal{O}(N^3)$ complexity) demands specialized hardware acceleration—such as custom FPGA or GPU microarchitectures—for real-time execution.

4.4 Conclusion and Outlook

Numerical simulation of parallel Pauli Product Measurements is a critical tool for bridging the gap between qLDPC theory and fault-tolerant quantum hardware. By co-designing qLDPC code structures (like Bivariate Bicycle codes), parallel measurement scheduling, and hardware-accelerated decoders, fault-tolerant quantum processors can achieve universal computing capabilities with significantly fewer physical qubits.