Creating entangled logical qubits in the heavy-hex lattice with topological codes
Bence Hetényi James R. Wootton




bence.hetenyi@ibm.com

IBM Quantum, IBM Research Zurich, Switzerland 



Designs for quantum error correction depend strongly on the connectivity of the qubits. For solid state qubits, the most straightforward approach is to have connectivity constrained to a planar graph. Practical considerations may also further restrict the connectivity, resulting in a relatively sparse graph such as the heavy-hex architecture of current IBM Quantum devices. In such cases it is hard to use all qubits to their full potential. Instead, in order to emulate the denser connectivity required to implement well-known quantum error correcting codes, many qubits remain effectively unused. In this work we show how this bug can be turned into a feature. By using the unused qubits of one code to execute another, two codes can be implemented on top of each other, allowing easy application of fault-tolerant entangling gates and measurements. We demonstrate this by realizing a surface code and a Bacon-Shor code on a 133 qubit IBM Quantum device. Using transversal CX gates and lattice surgery we demonstrate entanglement between these logical qubits with code distance up to d = 4 and five rounds of stabilizer measurement cycles. The nonplanar coupling between the qubits allows us to simultaneously measure the logical XX, YY, and ZZ observables. With this we verify the violation of Bell’s inequality for both the d=2 case with post selection featuring a fidelity of 94%, and the d=3 instance using only quantum error correction.


Creating entangled logical qubits in the heavy-hex lattice with topological codes
    James R. Wootton
    April 29, 2024
=================================================================================





§ INTRODUCTION



Fault-tolerant quantum computing requires several ingredients. Firstly, a scalable hardware with high-quality physical qubits that can carry the burden of the large qubit overhead imposed by quantum error correcting (QEC) codes. Error rates of the  physical qubits need to be below a threshold error rate, such that logical errors can be arbitrarily suppressed with increasing code distance d. Superconducting qubit platforms are approaching this regime as indicated by quantum memory experiments on single logical qubits (LQs) <cit.>. On the other hand, in order to perform fault-tolerant quantum computation in the future, one also needs to demonstrate single-qubit control and entanglement between logical qubits.

A logical Bell state with a d=2 surface code has been performed with trapped ions using lattice surgery (with fidelity of ℱ = 75% using post-selection) <cit.> and even higher fidelities have been achieved with the d=3
color code using transversal CX and error correction <cit.>. Recently neutral atoms have been the first platform where entangled logical qubits were prepared for multiple code distances with the surface code (with an estimated fidelity of 93% for d=7) <cit.>. On the other hand, experimental realization of entangled logical qubits with superconducting quantum processors have been hitherto limited to low-distance non-topological codes <cit.>. Furthermore, there is no demonstration of logical qubit entanglement to date over various code distances and stabilizer measurement rounds in any qubit platform.

Logical gates typically have large qubit overhead for topological error correcting codes. In planar architectures, as currently seen for superconducting qubits, transversal CX gates are usually not feasible, as the SWAP overhead would rapidly grow with the code distance. Braiding of hole- or twist defects require additional space in the qubit lattice in order to maintain the code distance during the operation <cit.>. Even lattice surgery, which has a modest qubit overhead, would require ∼ 150 physical qubits to implement a logical CX gate between two distance-5 logical qubits in the surface code <cit.>.

Quantum error correction on the heavy-hexagonal lattice faces the additional challenge of the low connectivity. Flag qubit-based QEC codes proposed for this connectivity typically offer lower error thresholds than the surface code <cit.>. A recently proposed variant of the surface code, know as the 3CX surface code, can be implemented on a hexagonal connectivity without a major compromise in performance <cit.>. However, the qubits at the links of the heavy-hex lattice remain unused or utilized as flag qubits <cit.>.

In this work we realize the 3CX surface code on a 133 qubit IBM Quantum device, and show that link qubits can be used to simultaneously implement a Bacon-Shor code <cit.> on the same patch of physical qubits. Since the stabilizer operators of the 3CX code are compatible with those of the Bacon-Shor code, one can utilize transversal CX gates as well as lattice surgery to establish and probe the entanglement between the two logical qubits <cit.>. We execute such schemes for multiple code distances (d ∈{2,3,4}) and several rounds (up to T=5), demonstrating logical qubit entanglement for the first time in a superconducting device using topological QEC codes. 

The nonplanar connectivity between the two codes allows for simultaneous XX and ZZ lattice surgery measurements, indirectly measuring the YY logical, which is sufficient to calculate the fidelity and verify the violation of Bell's inequality. We report violation of Bell's inequality using both error correction and post selection, with fidelities up to ℱ = 93.7% in the latter case. 

The paper is organized as follows. In Sec. <ref> we show how the 3CX and the Bacon-Shor codes can be implemented on the heavy-hex lattice and present the data on the logical performance of each code. Sec. <ref> concerns itself with entangling the two logical qubits and probing the resulting logical Bell-state. We confirm the fault-tolerance of our protocol and the scaling of logical error rate through simulations in Sec. <ref>. Finally, we present the experimental data on the entangled logical qubits in Sec. <ref>. The experimental and simulated results are supported by additional details in Apps. <ref>-<ref>.



§ 3CX AND BACON-SHOR CODES ON THE HEAVY-HEX LATTICE



In this work we directed our attention to two topological codes, the 3CX surface code <cit.> and the Bacon-Shor code <cit.>. While none of these codes fit directly with the heavy-hexagonal connectivity of IBM devices <cit.>, by making a few observations we can easily embed both of them to this coupling map simultaneously with a constant qubit overhead. Dividing the heavy-hex lattice into two sublattices, one with vertices only, and another including only the links, we get a hexagonal lattice and a heavy-square grid –i.e., having an extra qubit on every edge of a square grid– as shown in  Fig. <ref>(a) and (c). Effective next-nearest neighbour CX gates can be implemented using four CXs of the original connectivity regardless of the state of the middle qubit (see Fig. <ref>(b)). This scheme provides means to couple the qubits of each sublattice, without affecting the qubits of the other sublattice.

The 3CX code inherits the high error threshold and well-established tools to implement logical gates from the rotated surface code <cit.>. Even accounting for the connectivity of the heavy-hex lattice, the threshold error rate is ∼ 0.3% both with and without flag qubits <cit.>. Our method with the next-nearest-neighbour CX gates matches this performance, as shown in App. <ref>, while freeing up the link qubits. This is a major improvement compared to the heavy-hex code, which has no threshold in the thermodynamic limit and its pseudo-thresholds are below 0.1%.

The 127- and 133-qubit IBM Quantum devices can accommodate the 3CX code up to code distance d=4 (see Fig. <ref> (a)). See App. <ref> for the benchmark data corresponding to the 133-qubit device. Performing stabilizer measurements for up to T=5 rounds, we perform error correction using a standard minimum-weight perfect-matching decoder <cit.>. The results are shown in Fig. <ref>(d). While the code is clearly operating above threshold, the fidelity of the logical |0⟩_L state, i.e., ℱ = ⟨0|_Lρ_exp|0⟩_L, remains above 50% even after five rounds for the highest code distance (d=4). Post selection of the results for ambiguous matchings further enhances the logical performance reaching 99.3% in the case of d=2 and T=1.

In order to use the full potential of the even-distance variants, we employ a post-selection strategy, discarding shots where the matching implies error strings of length d/2. To this end, we introduce a trivial boundary node on the edge opposite to the logical edge and check if the optimal matchings include the same number of edges when matching to the trivial (logical) boundary is enforced <cit.>. The fact that the post-selection notably affects the logical error rates of the d=3 data as well indicates that the (d+1)/2-long error strings are not yet the dominant source of logical errors for the noise levels of the device.

On the other hand, the Bacon-Shor code can be naturally implemented on a heavy-square lattice. While this code has no threshold in the thermodynamic limit, logical error rates below 10^-8 can be achieved using lattice surgery (LS) and code concatenation, without modifying the connectivity requirements of the code <cit.>. Here, due to the restricted code distance, we focus on the traditional variant without concatenation <cit.>. In this case, we do require the bearded edge of the latest 133-qubit device to implement the d=4 version of the code (lower edge on Fig. <ref>(c)). The corresponding results with and without post-selection are presented in Fig. <ref>(e). Although the error rates at low code distance match that of the 3CX code (99.4% in the case of d=2 and T=1 with post selection), the decay of fidelity is faster for increasing code distances. Nonetheless, the BS code is still a valuable addition to the set of QEC codes that are compatible with the heavy-hex lattice.

Interleaving the two codes gives rise to correlated errors between the two codes, resulting from CX errors. Decomposing the resulting hyperedges we obtain, slightly reduced threshold values. e.g., p_th = 0.2% for the 3CX code, and similarly reduced pseudo-threshold values for the BS code. Importantly, however, we maintain the correct scaling of the logical error rate with physical error rate for both codes (see App. <ref>). Experimental data for the simultaneous execution of the two codes can be found in App. <ref>.



§ ENTANGLING LOGICAL QUBITS WITH TRANSVERSAL CXS AND LATTICE SURGERY



In this section we show that overlaying the 3CX and the BS codes allows us to use both transversal CX gates and the available lattice surgery tools of the BS code <cit.> thereby entangling the logical qubits of the two codes. In the following subsections we first describe the stabilizers of the 3CX and the BS codes and show that their logical subspaces are compatible, i.e., a transversal CX gate (CX_⊥) can be used to entangle the two LQs from these two different codes. We identify some special cases, when the codes can be decoded during the CX_⊥ with conventional tools using ,  and  <cit.>.



 §.§ Compatibility of the 3CX and the Bacon-Shor codes


Logical subspace. Taking a d× d square grid of code qubits, the logical operators of both the BS and the 3CX codes can be defined as Pauli X (Z) operators acting on any row (column) of physical qubits (e.g., the first one was chosen for each logical on Fig. <ref>(a) and (c)). Any odd-element product of these equivalent logical operators is also a valid logical operator of the same type. Therefore acting on every physical qubit with the same Pauli, transversally, is also a logical operation for odd code distance d.

Stabilizer generators. Since the even-element product of any (logical or physical) Pauli is the identity, even products of valid logical  operators are logical identities, i.e., stabilizer operators. In fact, the stabilizer group of the BS code is defined as the product of pairs of Pauli-X(Z) logicals acting on adjacent rows (columns) of qubits (as shown in Fig. <ref>(c)). While these stabilizers are also included in the stabilizer group of the 3CX code, the group of the latter is richer containing d^2-1 plaquette operators which act on four nearest-neighbor qubits that are located on the corners of an elementary unit cell. At the boundaries of the 3CX lattice weight-two stabilizers need to be introduced that commute with the bulk stabilizers as well as the logicals (see Fig. <ref>(a)). There are two equivalent choices of boundary stabilizers: e.g., the first row can either start with a boundary (as in Fig. <ref>(a)) or a full plaquette and the rest of the boundaries are unambiguous. The 3CX code alternates round-by-round between these two options, however, BS-like stabilizers remain valid stabilizers in both subcycles.

Gauge groups. The stabilizer generators of the BS code are highly nonlocal. In practice one would rather measure a set of local observables that commute with the logicals as well as the stabilizers, even if they do not commute with each other. I.e., the individual measurements have random outcomes, but certain products of them (the stabilizers) are deterministic. Such a group of operators is called the gauge group. As we have seen before, the stabilizers of the 3CX code are gauges in the BS code, however, the lowest-weight gauge group is a set of two-qubit parity measurements. E.g., the X gauges are Pauli-Xs acting on every nearest-neighbour qubit pair (d(d-1)) that live on adjacent rows.

We conclude this subsection by noting that the 3CX code can be downgraded to a BS code on-demand by changing the stabilizer measurements that are compared in subsequent rounds. In such a round transversal logical CX can be applied between the two codes. After the logical gate stabilizer measurements can continue according to the respective stabilizer groups.



 §.§ Stabilizers and detectors during the transversal CX gate



Detectors are comparisons of gauge or stabilizer measurements that are deterministic in the absence of errors. For the BS code this means a comparison of the same subsets of gauge measurements round-by-round. In the case of the 3CX code the modified CX schedule of the stabilizer measurements, that reduces the required connectivity, transforms the stabilizer group in a nontrivial way such that X (Z) stabilizers of subsequent rounds are shifted by one site in their respective row (column) <cit.>. Transversally applied CX gates also transform the joint stabilizer group of the two codes in a nontrivial way. In order to ensure that the detectors are deterministic in the absence of errors we need to compare each stabilizer outcome before the CX_⊥ with the image thereof after the operation.

Let us define the downgraded stabilizer group of the 3CX code as 𝒮̃^3CX = 𝒮̃^3CX_X + 𝒮̃^3CX_Z where the X and Z subgroups are


    𝒮̃^3CX_X = {∏_j S_ij  |  S_ij∈𝒮^3CX_X  S_ij∈ ith row}


    𝒮̃^3CX_Z = {∏_j S_ij  |  S_ij∈𝒮^3CX_Z  S_ij∈ ith column}


with 𝒮^3CX_X(Z) being the X (Z) stabilizer subgroup of the 3CX code. The transversal CXs transform a Z stabilizer S^BS_Z,i of the BS code according to the stabilizer flow, or equivalently

    CX_⊥( 
            I^3CX⊗ S^BS_Z,i)
         = 
        ( 
        S̃^3CX_Z,i⊗ S^BS_Z,i) 
        CX_⊥.

Therefore the measurement outcome of the stabilizer S^BS_Z,i before the CX_⊥ needs to be compared to the product of S^BS_Z,i and S̃^BS_Z,i. Similarly, the BS-like X stabilizers of the 3CX code after the CX_⊥ read as

    CX_⊥(
            S̃^3CX_X,i⊗ I^BS)  =
        (
        S̃^3CX_X,i⊗ S^BS_X,i)
        CX_⊥.


Finally, X stabilizers on the BS code (i.e., generators of 𝒮^BS_X) and the original Z stabilizers of the 3CX code (generators of 𝒮^3CX_Z) remain unchanged. Therefore the X detectors of the BS and the Z detectors of the 3CX code are not affected by CX_⊥ if controlled on the data qubits of the 3CX code.



In both the 3CX and the BS code any single X or Z error is detected by a pair of detectors making them amenable for decoding via perfect-matching. In general, the transversal CX gate does not conserve this property, inducing up to four detection events of Z or X type. E.g., let us consider a phase-flip error in the (i+1)th row of data qubits in the BS code right after CX_⊥. This will be detected by the two conventional X detectors of the BS code, when comparing stabilizers S^BS_X,i (or S^BS_X,i+1) between subsequent rounds. Simultaneously, however, it will also be detected by a pair of X detectors where the outcome of S̃^3CX_X,i⊗ S^BS_X,i after CX_⊥ is compared to that of S̃^3CX_X,i before it (or similarly for i+1). In the Tanner-graph representation of the decoding problem, such an error corresponds to a hyperedge connecting the four nodes corresponding to the four detectors that observed it. This issue has also been pointed out in Ref. <cit.> and further supporting information using the detecting region picture of Ref. <cit.> is available in App. <ref>. 

There are two special cases, however, for which some stabilizers that contribute to the excess of detection events (i.e., two out of four) are not in the stabilizer group at the time of applying CX_⊥. E.g., when the 3CX (control) LQ is prepared in the |+⟩_L = |+⟩^⊗ d^2 state and the BS (target) in the |0⟩_L= |0⟩^⊗ d^2 state before the first stabilizer measurement (see Fig. <ref>(a)) which we call transversal Bell-state preparation. The stabilizer group of the freshly initialized LQs consists only of the X (Z) stabilizers of the 3CX (BS) code. After the CX_⊥ both of these stabilizer types will spread to the other code resulting in a set of delocalized stabilizers as in Eq. (<ref>) and (<ref>). These delocalized BS-like stabilizers are the only valid stabilizers in the group, and every qubit touches at most two from each type, resulting in a matching graph without any hyperedges (these arguments are further elaborated on in App. <ref>). Fig. <ref>(b) shows the second special case which is –in a stabilizer-flow sense– the time-reversed partner of the previous, i.e., the transversal Bell-state measurement. That is when the final measurement in the X (Z) basis for the 3CX (BS) code is performed right after CX_⊥. Note that the measurement in an arbitrary basis in Fig. <ref>(a) is not analogous to the first case and it can still induce hyperedges depending on the measurement basis of the given logical as in Ref. <cit.>.




 §.§ Figures of merit for the logical Bell pair


Let us define some quantities of interest for the two LQs to identify which logical expectation values are necessary to demonstrate the entanglement. Taking the two-qubit density matrix ρ_L12, the fidelity of the Bell-state |ϕ_1⟩ = (|00⟩+|11⟩)/√(2) can rewritten as

    ℱ_Bell   = Tr(|ϕ_1⟩⟨ϕ_1|ρ_L12) 
        = 1/4 (1+ X_L1X_L2 - Y_L1Y_L2 + Z_L1Z_L2),

highlighting the importance of measuring the logical YY expectation value. The second figure of merit is the violation of the CHSH inequality. The formulation based on Bell's inequality suggests that the state should be measured in a 45^∘ rotated basis, however Ref. <cit.> showed that the left-hand side of the inequality can be evaluated using the matrix of expectation values

    (T_ρ)_ij = P^i_1P^j_2  ,

where P^i_1 ∈{ X_1, Y_1, Z_1} are Pauli operators. The CHSH inequality is then violated iff

    ℬ = 2√(m_1 + m_2) > 2,

where m_1,2 are the largest two eigenvalues of M_ρ = T_ρ^T T_ρ. Note that M_ρ is a real symmetric matrix with squared Pauli-products in the diagonals. If we construct the matrix assuming that certain (T_ρ)_ij Pauli products are zero, we are (i) underestimating the diagonals of M_ρ and (ii) neglect some off-diagonals that cannot reduce the average of the highest two eigenvalues m_1 and m_2. Therefore estimating ℬ from the three simultaneously measurable Pauli products X_1X_2, Y_1Y_2 and Z_1Z_2 is a lower bound and hence a good indicator for the violation of the inequality.




 §.§ Measuring observables of the logical Bell state using lattice surgery



As we have seen, measuring the XX, YY and ZZ Pauli operators is sufficient to calculate the fidelity and verify the violation of Bell's inequality. Furthermore, since the Bell states only have finite expectation value with these three Paulis an approximately good state tomography can also be obtained from them. Measurement of the Y observable is difficult in CSS codes defined by X and Z type stabilizers as it would require a logical S gate with a substantial space-time overhead. On the other hand, simultaneous XX and ZZ measurements also allow one to compute the YY observable in a shot-by-shot basis. The simplest way to achieve this is to disentangle the logical Bell-state as in Fig. <ref>(c). However, this would defeat the purpose of the experiment. Namely, we want to catch the entanglement in the act, measuring correlations between logical qubits.

Lattice surgery is a well-established method to measure the XX or ZZ expectation values of two logical qubits. This is done by performing stabilizer measurements between two adjacent code patches, creating a connected lattice of size 2d× d. For BS code patches if the new stabilizer measurements connects the two patches on the edges where the logical Xs (Zs) are located, the outcome of the new X (Z) stabilizers will provide the logical observable X_L1X_L2 (Z_L1Z_L2). Usually, this method requires d rounds of joint logical measurement to ensure fault tolerance against measurement errors. Combining LS with the transversal Bell measurement (as in Fig. <ref>(d)), we can exploit that the final measurement of the disentangled X (Z) logical (which is on its own fault-tolerant) needs to agree with XX (ZZ) measured in the LS scheme which lifts the aforementioned constraint. A detailed process diagram for the measurement comparisons can be found in App. <ref>.


The LS measurements are performed using XX or ZZ parity measurements on the edge qubits between the two codes as shown in Fig. <ref>. Similarly to the gauge measurements of the BS code, these parity measurements are performed using ancilla qubits that are located next to the edge of the two qubit patches. Each LS gauge measurement requires one conventional and one next-nearest-neighbour CX gate. We note that the new XX (ZZ) gauge measurements do not commute with some of the original Z (X) stabilizers. Therefore one needs to connect the ends of the 2× d (d× 2) stabilizer stripes forming a  2× 2d (2d× 2) stabilizer in the round right after the LS measurement <cit.>. However, during the transversal CX, we can only use product stabilizers anyway, so this peculiarity of the BS lattice surgery does not pose additional restrictions on the protocol.

Thanks to the non-planar coupling between our two codes, XX and ZZ lattice surgery operations can be implemented simultaneously, allowing for the extraction of YY. This facilitates the direct extraction of the fidelity which was only estimated in Ref. <cit.> from the separately performed X and Z measurements of the two logical qubits.




§ SIMULATED (PSEUDO-)THRESHOLDS




In order to verify that the LS with the transversal Bell-state measurement is indeed fault-tolerant and features the correct scaling with the code distance, we simulated the logical infidelity 1-ℱ_Bell as a function of physical error rate, under circuit level noise accounting for the decomposition of the next-nearest neighbour CX gates for the heavy-hex lattice as shown in Fig. <ref>(b). In our simulations initialization, readout, single- and two-qubit gates are all assumed to be depolarizing channels with the same physical error rate p. For the simulations we used the same Qiskit circuits as for the real hardware experiments, converted into  circuits using . Sampling and the weighting of the decoding graph were handled by  <cit.> and the decoding has been performed using  <cit.>. In order to determine the correct stabilizer comparisons for each step with nontrivial logical operations, we used the considerations discussed in Sec. <ref>.

For the simulations we used the conventional BS code without concatenations that would improve the logical error rates <cit.>. Therefore we expect the infidelity as a function of physical error rate to have pseudo-thresholds, i.e., the crossing point of distance-d and d+2 is higher than that of d+2 and d+4. Decoding each shot for both XX and ZZ logicals simultaneously, we infer YY and calculate the infidelity of the logical Bell-pair. From Fig. <ref>(a) we indeed observe pseudo-thresholds and the sub-threshold scalings seem to follow 1 - ℱ∼ p^⌊ d/2+1 ⌋.

Using the post-selection scheme described in Sec. <ref>, we decode and post select the same samples. Indeed the scaling of the logical infidelity in Fig. <ref>(b) improves for even distances, however the scaling of the ideal case 1 - ℱ∼ p^⌈ d/2+1 ⌉ is not clearly reached for every code distance. Note that below the respective sub-threshold the post-selection yield remains sufficiently close to 1, and can be approximated as 1 - c_d  p^⌊ d/2+1 ⌋ with some distance-dependent constant c_d.



§ FIDELITY OF LOGICAL BELL STATES ON QUANTUM HARDWARE



We have tested the logical qubit protocol described in Fig. <ref>(d) on the latest quantum hardware, . Circuits were executed on the cloud services using Qiskit, without any application-specific tuning of the device <cit.>. There are a number of optimization strategies though that were employed in order to improve the logical fidelity:

    
  * interleaving the CX layers in the stabilizer measurements of the two codes, the CX schedule was chosen such that the number of CX gates and gate layers reduced by ∼ 20% after transpilation;
    
  * dynamical decoupling was used, i.e., a sequence of XZX-XZX gates in every idling location in the circuit;
    
  * in the final measurement round, measurement of data, ancilla, and the LS ancilla qubits are performed simultaneously (except for one LS ancilla for d=4).

On the other hand, we did not investigate systematically different locations for the d=2 and d=3 instances, hence better results may be achievable by choosing a location with better error rates. The chosen location for these lower code distances has been the one, where the upper corner of the respective lattice coincides with that of the d=4 instance (see Fig. <ref>).

We performed the decoding with minimum-weight perfect-matching as described in Sec. <ref> according to the median error rates of the device. That is a single-qubit error rate of 0.03%, two-qubit errors of 0.4% and readout errors of 1.74%. Interestingly, incorporating more detailed information from the hardware, i.e., different readout error rates for vertex- and link qubits, resulted in slightly worse logical error rates, and therefore we did not pursue further optimizations in that direction. 

The result of d=2 and T=1 rounds is shown in Fig. <ref>(a). The state tomography is obtained using the approximation ρ_2 ≈⟨ XX ⟩σ^x_1σ^x_2 + ⟨ YY ⟩σ^y_1σ^y_2 + ⟨ ZZ ⟩σ^z_1σ^z_2. We expect that the expectation value of the Pauli products that were not measured would only slightly change the picture, since there is no indication of bias, i.e., logical states seem to converge the maximally mixed state instead of the ground state. Without post selection the logical fidelity of the d=3 code with T=1 round is ℱ_Bell = 74.7 ± 0.5 % and the Bell's inequality is violated as ℬ = 2.05 ± 0.02 confirming the violation within 2σs. Using the post selection strategy introduced above for d=2 and T=1 we obtain ℱ_Bell = 93.7 ± 0.04 % and the expectation value ℬ = 2.63 ± 0.01 implies an even stronger violation of the inequality, close to the maximal value ℬ_max≈ 2.83.

The decreasing fidelity for higher code distances in Fig. <ref>(b) implies that the error rates of the device are above the threshold of our protocol. However, this is to be expected considering the low error threshold of the protocol (see Fig. <ref>), which is a common property of codes that require a low-degree connectivity <cit.>. In our case, the low connectivity of the device manifests itself not in the QEC code but in the large overhead of the next-nearest-neighbour two-qubit gates (N_CX∼ 32d^2T). 

Logical error rate after a single stabilizer round paints an overly optimistic picture of the logical error rate. This is due to the fact, that the first stabilizer round projects a product state into the code space rather than probing the logical qubit that is already in the code space. In order to gain a better insight into the decoherence of the logical qubit during stabilizer measurements, we present the decay of logical fidelity for code distances d∈{2,3,4} over multiple rounds in Fig. <ref>(b)-(c). Together with the post-selected data, we also show the logical Bell-state fidelity with QEC only, and provide the post-selection yield (for an additional data set in App. <ref>).



§ CONCLUSION


We have realized two different topological codes the 3CX and the Bacon-Shor code in the heavy-hex lattice. Using transversal CX gate and simultaneous XX and ZZ lattice surgery we entangled the logical qubits of the two codes for the first time in the superconducting qubit platform. Moreover, we have have verified the entanglement between the two logical qubits over multiple code distances and stabilizer measurement rounds. Our results show violation of Bell's inequality implying that non-classical correlations can be restored using quantum error correction.

Our results also allow the 3CX code to be compared to the heavy-hex code <cit.>, which has also been implemented on IBM Quantum hardware <cit.>. Comparable results show largely similar performance. The sparse implementation of the 3CX code therefore does not suffer significantly in comparison to a code tailored to the connectivity.


Finally, it is worth noting that non-planar coupling is also possible in solid state approaches, as would be required for high-rate LDPC codes <cit.>. Nevertheless, we hope that our techniques will inspire even the most sophisticated coupling schemes to make the most out of what they have.




§ DATA AVAILABILITY


The python scripts used to generate the  and  circuits as well as those for the decoding and post selection are available at <cit.>.



§ ACKNOWLEDGEMENTS


The authors would like to thank Ben Brown and Ian Hesner for helpful discussions. We are grateful for the donation of IBM Quantum resources to complete this project. BH acknowledges support from the NCCR SPIN, a National Centre of Competence in Research, funded by the Swiss National Science Foundation (grant number 51NF40-180604).





§ THRESHOLD PLOTS OF THE 3CX AND BACON-SHOR CODES WITH HEAVY-HEX CONNECTIVITY




Under circuit-level noise, accounting for the CX overhead of the next-nearest-neighbour CX gates we obtain approximate threshold rates of p_th = 0.3% and p̃_(3,9)≈ 0.1% for the 3CX and BS codes, respectively (see Fig. <ref>). Here p̃_(3,9) indicates an averaged pseudo-threshold. Similarly, when the two codes are executed simultaneously with interleaved CX gate layers we find p_th = 0.2% and p̃_(3,9)≈ 0.06% for the 3CX and BS codes, respectively. Importantly, the sub-threshold scaling is maintained also for the interleaved case, indicating that the next-nearest neighbour CX gates do not reduce the code distance of either of the codes.



§ DEVICE BENCHMARKS




The device benchmarks summarized in Tab. <ref> correspond to the calibration data of  on the 11th February, 2024, when the data has been taken. It is worth noting that the readout errors are considerably worse on the vertex qubits. Furthermore, errors on idling qubits are not accurately described by T_1 and T_2, due to the `XZX-XZX' dynamical decoupling sequence applied on the data qubits while idling.



§ ADDITIONAL DATA






Here we present additional data taken on the same device () for isolated and interleaved 3CX and BS codes as well as for logical qubits prepared in the |0⟩ and |+⟩ states as shown in Fig. <ref>. The location of the smaller-distance codes have been chosen to match at the upper corner with the d=4 variant shown in Fig. <ref>.

First, we analyzed performance of the 3CX code, without link qubits, i.e., initializing the link qubits in the state |0⟩ in the beginning. Performing a quantum memory experiment on the logical |0⟩_L and  |+⟩_L state produced encouraging results with non-trivial logical fidelity up to d=4 and T=5 (see Fig. <ref>(a)-(b)).

Next, we studied the Bacon-Shor code on the link qubits separately (vertex qubits initialized in |0⟩). While the results for lower code distances are good enough to build on them, there is a substantial difference between the |0⟩_L and |+⟩_L states, especially for higher code distances (see Fig. <ref>(c)-(d)).

Furthermore, we have repeated the experiments above, using the interleaved CX layers and executing the stabilizer measurements of the two codes simultaneously. Respecting the order of the CX gates in the 3CX code, we found that the lowest number of entangling gates and gate layers is obtained for the following schedule: 3CX round-0, BS Z-rounds 0 and 1, 3CX rounds 1 and 2, BS X-rounds 0 and 1, and 3CX round-3. This reduced the gate count to ≈ 80% compared to the subsequent evaluation of the 3CX and BS next-nearest-neighbour CX layers. Results for both |0⟩_L and |+⟩_L initial states have been obtained preparing the two logical qubits either in the |0⟩_3CX|+⟩_BS states or in the |+⟩_3CX|0⟩_BS states (see Fig. <ref>(e)-(h)). For the interleaved case, the post-selected results are only plotted for reference. Our post-selection strategy –that is based on the ambiguity of matching to different boundaries– does not increase the code distance in this case, since there are internal edges in the decoding graph (i.e., edges that are not connected to any boundary node) that also imply logical flip(s).

Finally, we show an additional data set taken at an earlier time (January 13th, 2024) on Fig. <ref>. This data set shows similar performance to that of Fig. <ref>. For this dataset the the location of the d=2,3 instances are such that they match on their left corner with the d=4 case.



§ LOGICAL CX AND HYPEREDGES IN THE DECODING GRAPH



While, considering the codespace, it is straightforward to show that the CX gate can be applied transversally for two BS qubits, the detectors, i.e., comparison of stabilizer measurements, need to be adjusted in the round that incorporates the transversal operation <cit.>. Here we use the detecting region picture introduced by Ref. <cit.>, which can be considered as a pictorial representation of how the stabilizer group evolves upon the application of physical gates. 

Let us consider a Z stabilizer outcome of the BS code and an appropriate set of stabilizer outcomes of the 3CX code at a given time t as in Fig. <ref>(a). The qubitwise CX gates will extend the dashed blue detecting region from the BS side to the 3CX side of the two LQ system. Consequently, the BS stabilizer at time t needs to be compared not only to that of t+1 but also to the BS-like subset of stabilizer measurements at round t+1 of the 3CX code. This process is shown in Fig. <ref>(a)-(b) along with the propagation of X errors which helps verifying that the expanded BS region does not signal an error that is transplanted from the 3CX code during the transversal CX. This picture is equivalent to multiplying certain measurements into the detection events from the previous round as suggested by Ref. <cit.>.

Note that Z (X) stabilizers of the 3CX (BS) code are unaffected by the CX gates, validating the respective stabilizer comparisons. Therefore the original Z (X) detecting regions will overlap with the extended ones, discussed above. The overlapping structure of detecting regions gives rise to hyperedges in the decoding graph. E.g., 3CX (BS) qubits that are not at the edge of the lattice will be covered by four Z (X)-type detecting regions, implying that an error in the appropriate location in the circuit results in four detection events, i.e., a hyperedge connecting four nodes in the decoding graph. Depending on the number of rounds, the code distance, and the error model these hyperedges can be decomposed by . E.g., hyperedges can be decomposed for T=2 for any code distance if the logical CX is applied after the first round of measurements, or for an arbitrary setting for d=3 if two-qubit errors are allowed (hook errors create effectively non-local syndromes, as opposed to d≥4 where these are only 2-local). The smallest example where a single readout error triggers a hyperedge is T=3, logical CX at T=1 for any d≥ 4.






§ TRANSVERSAL BELL-STATE PREPARATION AND MEASUREMENT



Here we consider the detecting regions associated with the transversal preparation and measurement of a logical Bell pair and show that their decoding problem is compatible with a conventional matching decoder. 

As discussed in App. <ref>, detecting regions overlap after the CX_⊥ gates. However, detecting regions, similar to stabilizer operators, are generators of a group with the product operation, implying that the product of overlapping region is also a valid detecting region. Therefore, an equivalent choice of detecting region in Fig. <ref>(a)-(b) would be a contracting Z (X) region that terminates on the BS (3CX) side. 

This raises the question, what happens if the CXs are applied before the first or after the last round of regular stabilizer measurements? In the former case, the CXs couple unentangled qubits rather than LQs. This case is interesting nonetheless, since it can be used to prepare a logical Bell state. If every 3CX (BS) qubits have been initialized on the X (Z) basis, the qubitwise CXs prepare d^2 Bell states each of which are eigenstates of the XX and ZZ stabilizers acting on the respective pairs of physical qubits (see Fig. <ref>(c)). Consequently, the product of compatible 3CX and BS stabilizers are deterministic in the first round such that two (one) detecting regions of each type cover every bulk (edge) qubit (see Fig. <ref>(d)).

Importantly, none of the stabilizers of the individual codes commute with all of the Bell-pair stabilizers of the initial stabilizer group. Only the brick-shaped regions are valid detecting regions meaning that at most two regions cover each qubit leading to regular edges in the decoding graph. After the first round, the regular stabilizer outcome comparisons can be performed for both of the codes. Similarly, applying the qubitwise CXs before the final X and Z measurements of the 3CX and BS LQs, implements a logical measurement on the Bell basis. Note that any other final measurement (e.g., X_L1 and X_L2) will continue to have the hyperedge problem.



§ DETECTORS DURING THE BELL-STATE PREPARATION AND LATTICE SURGERY




As we described in App. <ref>, the compatible products of 3CX and BS stabilizer measurements are deterministic in the first round if we start by entangling physical qubit pairs. Since we prepare every Bell pair in the same state, only the stabilizer outcomes in the first stabilizer measurements need to be compared to detect errors in the initialization. This is represented on the leftmost colored lines in Fig. <ref>(a). In total there are d-1 such detectors from each type which is a reminiscent from the number of stabilizers in the BS code. 

In subsequent stabilizer rounds, stabilizer comparisons can continue according to the respective codes. As opposed to a quantum memory experiment on a single logical qubit, here we need to keep of track both types of stabilizers to identify both bit- and phase-flip errors in the logical Bell state. In the last round of stabilizer measurements, however, we can only use the 2(d-1) product stabilizers to compare them with appropriate products of the final Bell-pair measurements. 

The former scheme only allows us to measure the logical observables after they are disentangled. However, performing a lattice surgery the X_L1X_L2 and Z_L1Z_L2 logical observables can be measured without measuring the logical qubits separately (see the corresponding diagram in Fig. <ref>(b)). This can be considered as a straightforward extension of the previous case, in a sense that we obtain the same information before (e.g., X_L1X_L2) and after (e.g., X_L1) disentangling the logical qubits. Importantly, we can choose the LS measurement outcomes (that are on their own not fault-tolerant after a single round of measurements) and compare them with the final measurement of the disentangled observables that is fault-tolerant. This latter comparison will be an additional detector that tells us if the LS measurement needs to be flipped or not.



