Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Log inSign up
Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Blog
Job Board
Q3AS

© 2026 Aqora Quantum S.A.S.

TermsPrivacyLegal Notice

arXiv:2308.05152 · PRX Quantum

Quantum Lego Expansion Pack: Enumerators from Tensor Networks

ChunJun Cao, Michael J. Gullans, Brad Lackey, Zitao Wang

Published Jul 22, 2024• 18 citations
arXivHTMLPDF

Abstract

We provide the first tensor-network method for computing quantum weight enumerator polynomials in the most general form. If a quantum code has a known tensor-network construction of its encoding map, our method is far more efficient, and in some cases exponentially faster than the existing approach. As a corollary, it produces decoders and an algorithm that computes the code distance. For non-(Pauli)-stabilizer codes, this constitutes the current best algorithm for computing the code distance. For degenerate stabilizer codes, it can be substantially faster compared to the current methods. We also introduce novel weight enumerators and their applications. In particular, we show that these enumerators can be used to compute logical error rates exactly and thus construct (optimal) decoders for any independent and identically distributed single qubit or qudit error channels. The enumerators also provide a more efficient method for computing nonstabilizerness in quantum many-body states. As the power for these speedups rely on a quantum Lego decomposition of quantum codes, we further provide systematic methods for decomposing quantum codes and graph states into a modular construction for which our technique applies. As a proof of principle, we perform exact analyses of the deformed surface codes, the holographic pentagon code, and the two-dimensional Bacon-Shor code under (biased) Pauli noise and limited instances of coherent error at sizes that are inaccessible by brute force. Published by the American Physical Society 2024

DOI
10.1103/prxquantum.5.030313

Related papers

Quantum Lego: Building Quantum Error Correction Codes from Tensor Networks

ChunJun Cao, Brad Lackey

We introduce a flexible and graphically intuitive framework that constructs complex quantum error correction codes from simple codes or states, generalizing code concatenation.More specifically, we represent the complex code constructions as tensor networks built from the tensors of simple codes or states in a modular fashion.Using a set of local moves known as operator pushing, one can derive properties of the more complex codes, such as transversal non-Clifford gates, by tracing the flow of operators in the network.The framework endows a network geometry to any code it builds and is valid for constructing stabilizer codes as well as nonstabilizer codes over qubits and qudits.For a contractible tensor network, the sequence of contractions also constructs a decoding or encoding circuit.To highlight the framework's range of capabilities and to provide a tutorial, we lay out some examples where we glue together simple stabilizer codes to construct nontrivial codes.These examples include the toric code and its variants, a holographic code with transversal non-Clifford operators, a three-dimensional stabilizer code, and other stabilizer codes with interesting properties.Surprisingly, we find that the surface code is equivalent to the two-dimensional Bacon-Shor code after "dualizing" its tensor-network encoding map.

arXiv:2109.08158•PRX Quantum•May 11, 2022•36 citations

Quantum Lego and XP Stabilizer Codes

Ruohan Shen, Yixu Wang, ChunJun Cao

We apply the recent graphical framework of "Quantum Lego" to XP stabilizer codes where the stabilizer group is generally non-Abelian. We show that the idea of operator matching continues to hold for such codes and is sufficient for generating all their XP symmetries provided the resulting code is XP. We provide an efficient classical algorithm for tracking these symmetries under tensor contraction or conjoining. This constitutes a partial extension of the algorithm implied by the Gottesman-Knill theorem beyond Pauli stabilizer states and Clifford operations. Because conjoining transformations generate quantum operations that are universal, the XP symmetries obtained from these algorithms do not uniquely identify the resulting tensors in general. Using this extended framework, we provide examples of novel XP stabilizer codes with a higher distance than existing non-trivial XP regular codes and a [[8,1,2]] Pauli stabilizer code with a fault-tolerant T gate. For XP regular codes, we also construct a tensor-network-based maximum likelihood decoder for any independently and identically distributed single qubit error channel using weight enumerators.

arXiv:2310.19538•Quantum•Oct 6, 2025•3 citations

Hyper-optimized Quantum Lego Contraction Schedules

Bálint Pató, June Vanlerberghe, Kenneth R. Brown

Calculating the quantum weight enumerator polynomial (WEP) is a valuable tool for characterizing quantum error-correcting (QEC) codes, but it is computationally hard for large or complex codes. The Quantum LEGO (QL) framework provides a tensor network approach for WEP calculation, in some cases offering superpolynomial speedups over brute-force methods, provided the code exhibits area law entanglement, that a good QL layout is used, and an efficient tensor network contraction schedule is found. We analyze the performance of a hyper-optimized contraction schedule framework across QL layouts for diverse stabilizer code families. We find that the intermediate tensors in the QL networks for stabilizer WEPs are often highly sparse, invalidating the dense-tensor assumption of standard cost functions. To address this, we introduce an exact, polynomial-time Sparse Stabilizer Tensor (SST) cost function based on the rank of the parity check matrices for intermediate tensors. The SST cost function correlates perfectly with the true contraction cost, providing a significant advantage over the default cost function, which exhibits large uncertainty. Optimizing contraction schedules using the SST cost function yields substantial performance gains, achieving up to orders of magnitude improvement in actual contraction cost compared to using the dense tensor cost function. Furthermore, the precise cost estimation from the SST function offers an efficient metric to decide whether the QL-based WEP calculation is computationally superior to brute force for a given QL layout. These results, enabled by PlanqTN, a new open-source QL implementation, validate hyper-optimized contraction as a crucial technique for leveraging the QL framework to explore the QEC code design space.

arXiv:2510.08210•Quantum•May 5, 2026•0 citations

Quantum Lego Power-up: Designing Transversal Gates with Tensor Networks

ChunJun Cao, Brad Lackey

Transversal gates are the simplest form of fault-tolerant gates and are relatively easy to implement in practice. Yet designing codes that support useful transversal operations -- especially non-Clifford or addressable gates -- remains difficult within the stabilizer formalism or CSS constructions alone. We show that these limitations can be overcome using tensor-network frameworks such as the quantum lego formalism, where transversal gates naturally appear as global or localized symmetries. Within the quantum lego formalism, small codes carrying desirable symmetries can be "glued" into larger ones, with operator-flow rules guiding how logical symmetries are preserved. This approach enables the systematic construction of codes with addressable transversal single- and multi-qubit gates targeting specific logical qubits regardless of whether the gate is Clifford or not. As a proof of principle, we build new finite-rate code families that support strongly transversal $T$, $CCZ$, $SH$, and Gottesman's $K_3$ gates, structures that are challenging to realize with conventional methods. We further construct holographic and fractal-like codes that admit addressable transversal inter-, meso-, and intra-block $T$, $CS$, and $C^\ell Z$ gates. As a corollary, we demonstrate that the heterogeneous holographic Steane-Reed-Muller black hole code also supports fully addressable transversal inter- and intra-block $CZ$ gates, significantly lowering the overhead for universal fault-tolerant computation.

quant-pharXiv:2603.03542•Mar 5, 2026•0 citations

Quantum Weight Enumerators and Tensor Networks

ChunJun Cao, Brad Lackey

We examine the use of weight enumerators for analyzing tensor network constructions, and specifically the quantum lego framework recently introduced. We extend the notion of quantum weight enumerators to so-called tensor enumerators, and prove that the trace operation on tensor networks is compatible with a trace operation on tensor enumerators. This allows us to compute quantum weight enumerators of larger codes, such as the ones constructed through tensor network methods, more efficiently. We also provide a general framework for quantum MacWilliams identities that includes tensor enumerators as a special case.

arXiv:2211.02756•IEEE Transactions on Information Theory•Dec 7, 2023•11 citations

Low-weight high-distance error-correcting fermionic encodings

Fedor Šimkovic, Martin Leib, Francisco Revson F. Pereira

We perform an extended numerical search for practical fermion-to-qubit encodings with error-correcting properties. Ideally, encodings should strike a balance between a number of the seemingly incompatible attributes, such as having a high minimum distance, low-weight fermionic logical operators, a small qubit to fermionic mode ratio and a simple qubit connectivity graph including ancilla qubits for the measurement of stabilizers. Our strategy consists of a three-step procedure in which we: First generate encodings with code distances up to d ≤ 4 by a brute-force enumeration technique; subsequently, we use these encodings as starting points and apply Clifford deformations to them which allows us to identify higher-distance codes with d ≤ 7 ; finally, we optimize the hardware connectivity graphs of resulting encodings in terms of the graph thickness and the number of connections per qubit. We report multiple promising high-distance encodings which significantly improve the weights of stabilizers and logical operators compared to previously reported alternatives. Published by the American Physical Society 2024

arXiv:2402.15386•Physical Review Research•Nov 12, 2024•2 citations
We provide the first tensor-network method for computing quantum weight enumerator polynomials in the most general form. If a quantum code has a known tensor-network construction of its encoding map, our method is far more efficient, and in some cases exponentially faster than the existing approach. As a corollary, it produces decoders and an algorithm that computes the code distance. For non-(Pauli)-stabilizer codes, this constitutes the current best algorithm for computing the code distance. For degenerate stabilizer codes, it can be substantially faster compared to the current methods. We also introduce novel weight enumerators and their applications. In particular, we show that these enumerators can be used to compute logical error rates exactly and thus construct (optimal) decoders for any independent and identically distributed single qubit or qudit error channels. The enumerators also provide a more efficient method for computing nonstabilizerness in quantum many-body states. As the power for these speedups rely on a quantum Lego decomposition of quantum codes, we further provide systematic methods for decomposing quantum codes and graph states into a modular construction for which our technique applies. As a proof of principle, we perform exact analyses of the deformed surface codes, the holographic pentagon code, and the two-dimensional Bacon-Shor code under (biased) Pauli noise and limited instances of coherent error at sizes that are inaccessible by brute force. Published by the American Physical Society 2024
We introduce a flexible and graphically intuitive framework that constructs complex quantum error correction codes from simple codes or states, generalizing code concatenation.More specifically, we represent the complex code constructions as tensor networks built from the tensors of simple codes or states in a modular fashion.Using a set of local moves known as operator pushing, one can derive properties of the more complex codes, such as transversal non-Clifford gates, by tracing the flow of operators in the network.The framework endows a network geometry to any code it builds and is valid for constructing stabilizer codes as well as nonstabilizer codes over qubits and qudits.For a contractible tensor network, the sequence of contractions also constructs a decoding or encoding circuit.To highlight the framework's range of capabilities and to provide a tutorial, we lay out some examples where we glue together simple stabilizer codes to construct nontrivial codes.These examples include the toric code and its variants, a holographic code with transversal non-Clifford operators, a three-dimensional stabilizer code, and other stabilizer codes with interesting properties.Surprisingly, we find that the surface code is equivalent to the two-dimensional Bacon-Shor code after "dualizing" its tensor-network encoding map.
We apply the recent graphical framework of "Quantum Lego" to XP stabilizer codes where the stabilizer group is generally non-Abelian. We show that the idea of operator matching continues to hold for such codes and is sufficient for generating all their XP symmetries provided the resulting code is XP. We provide an efficient classical algorithm for tracking these symmetries under tensor contraction or conjoining. This constitutes a partial extension of the algorithm implied by the Gottesman-Knill theorem beyond Pauli stabilizer states and Clifford operations. Because conjoining transformations generate quantum operations that are universal, the XP symmetries obtained from these algorithms do not uniquely identify the resulting tensors in general. Using this extended framework, we provide examples of novel XP stabilizer codes with a higher distance than existing non-trivial XP regular codes and a [[8,1,2]] Pauli stabilizer code with a fault-tolerant T gate. For XP regular codes, we also construct a tensor-network-based maximum likelihood decoder for any independently and identically distributed single qubit error channel using weight enumerators.
Calculating the quantum weight enumerator polynomial (WEP) is a valuable tool for characterizing quantum error-correcting (QEC) codes, but it is computationally hard for large or complex codes. The Quantum LEGO (QL) framework provides a tensor network approach for WEP calculation, in some cases offering superpolynomial speedups over brute-force methods, provided the code exhibits area law entanglement, that a good QL layout is used, and an efficient tensor network contraction schedule is found. We analyze the performance of a hyper-optimized contraction schedule framework across QL layouts for diverse stabilizer code families. We find that the intermediate tensors in the QL networks for stabilizer WEPs are often highly sparse, invalidating the dense-tensor assumption of standard cost functions. To address this, we introduce an exact, polynomial-time Sparse Stabilizer Tensor (SST) cost function based on the rank of the parity check matrices for intermediate tensors. The SST cost function correlates perfectly with the true contraction cost, providing a significant advantage over the default cost function, which exhibits large uncertainty. Optimizing contraction schedules using the SST cost function yields substantial performance gains, achieving up to orders of magnitude improvement in actual contraction cost compared to using the dense tensor cost function. Furthermore, the precise cost estimation from the SST function offers an efficient metric to decide whether the QL-based WEP calculation is computationally superior to brute force for a given QL layout. These results, enabled by PlanqTN, a new open-source QL implementation, validate hyper-optimized contraction as a crucial technique for leveraging the QL framework to explore the QEC code design space.
Transversal gates are the simplest form of fault-tolerant gates and are relatively easy to implement in practice. Yet designing codes that support useful transversal operations -- especially non-Clifford or addressable gates -- remains difficult within the stabilizer formalism or CSS constructions alone. We show that these limitations can be overcome using tensor-network frameworks such as the quantum lego formalism, where transversal gates naturally appear as global or localized symmetries. Within the quantum lego formalism, small codes carrying desirable symmetries can be "glued" into larger ones, with operator-flow rules guiding how logical symmetries are preserved. This approach enables the systematic construction of codes with addressable transversal single- and multi-qubit gates targeting specific logical qubits regardless of whether the gate is Clifford or not. As a proof of principle, we build new finite-rate code families that support strongly transversal TTT, CCZCCZCCZ, SHSHSH, and Gottesman's K3K_3K3​ gates, structures that are challenging to realize with conventional methods. We further construct holographic and fractal-like codes that admit addressable transversal inter-, meso-, and intra-block TTT, CSCSCS, and CℓZC^\ell ZCℓZ gates. As a corollary, we demonstrate that the heterogeneous holographic Steane-Reed-Muller black hole code also supports fully addressable transversal inter- and intra-block CZCZCZ gates, significantly lowering the overhead for universal fault-tolerant computation.
We examine the use of weight enumerators for analyzing tensor network constructions, and specifically the quantum lego framework recently introduced. We extend the notion of quantum weight enumerators to so-called tensor enumerators, and prove that the trace operation on tensor networks is compatible with a trace operation on tensor enumerators. This allows us to compute quantum weight enumerators of larger codes, such as the ones constructed through tensor network methods, more efficiently. We also provide a general framework for quantum MacWilliams identities that includes tensor enumerators as a special case.
We perform an extended numerical search for practical fermion-to-qubit encodings with error-correcting properties. Ideally, encodings should strike a balance between a number of the seemingly incompatible attributes, such as having a high minimum distance, low-weight fermionic logical operators, a small qubit to fermionic mode ratio and a simple qubit connectivity graph including ancilla qubits for the measurement of stabilizers. Our strategy consists of a three-step procedure in which we: First generate encodings with code distances up to d ≤ 4 by a brute-force enumeration technique; subsequently, we use these encodings as starting points and apply Clifford deformations to them which allows us to identify higher-distance codes with d ≤ 7 ; finally, we optimize the hardware connectivity graphs of resulting encodings in terms of the graph thickness and the number of connections per qubit. We report multiple promising high-distance encodings which significantly improve the weights of stabilizers and logical operators compared to previously reported alternatives. Published by the American Physical Society 2024