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:2510.08210 · Quantum

Hyper-optimized Quantum Lego Contraction Schedules

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

Published May 5, 2026• 0 citations
arXivHTMLPDF

Abstract

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.

DOI
10.22331/q-2026-05-05-2092

Related papers

Quantum Lego Expansion Pack: Enumerators from Tensor Networks

ChunJun Cao, Michael J. Gullans, Brad Lackey +1 more

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

arXiv:2308.05152•PRX Quantum•Jul 22, 2024•18 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

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

SAQ: Stabilizer-Aware Quantum Error Correction Decoder

David Zenati, Eliya Nachmani

Quantum Error Correction (QEC) decoding faces a fundamental accuracy-efficiency tradeoff. Classical methods like Minimum Weight Perfect Matching (MWPM) exhibit variable performance across noise models and suffer from polynomial complexity, while tensor network decoders achieve high accuracy but at prohibitively high computational cost. Recent neural decoders reduce complexity but lack the accuracy needed to compete with computationally expensive classical methods. We introduce SAQ-Decoder, a unified framework combining transformer-based learning with constraint aware post-processing that achieves both near Maximum Likelihood (ML) accuracy and linear computational scalability with respect to the syndrome size. Our approach combines a dual-stream transformer architecture that processes syndromes and logical information with asymmetric attention patterns, and a novel differentiable logical loss that directly optimizes Logical Error Rates (LER) through smooth approximations over finite fields. SAQ-Decoder achieves near-optimal performance, with error thresholds of 10.99% (independent noise) and 18.6% (depolarizing noise) on toric codes that approach the ML bounds of 11.0% and 18.9% while outperforming existing neural and classical baselines in accuracy, complexity, and parameter efficiency. Our findings establish that learned decoders can simultaneously achieve competitive decoding accuracy and computational efficiency, addressing key requirements for practical fault-tolerant quantum computing systems.

quant-pharXiv:2512.08914•Dec 10, 2025•0 citations

Maximum Likelihood Decoding of Quantum Error Correction Codes

Hanyan Cao, Ge Yan, Yuxuan Du +1 more

Quantum error correction (QEC) is indispensable for realizing fault-tolerant quantum computation, yet its effectiveness hinges critically on the classical decoding algorithm that interprets noisy syndrome measurements. Among all possible decoding strategies, maximum likelihood decoding (MLD) is provably optimal, since it identifies the logical group with largest likelihood by summing over all possible errors within logical class consistent with the observed syndrome. Despite its optimality, MLD is computationally intractable in general (#P-hard), motivating a rich landscape of exact and approximate algorithms. In this topical review, we provide a unified perspective on MLD by surveying recent advances through three complementary lenses: statistical mechanics, tensor networks, and artificial intelligence. From the statistical mechanics viewpoint, the MLD problem maps onto evaluating partition functions of disordered spin models, enabling exact solutions for certain codes and noise models as well as threshold estimation via phase-transition analysis. From the tensor network perspective, approximate contraction of tensor networks on the code's factor graph yields decoders that closely approach MLD accuracy with polynomial computational cost. From the artificial intelligence perspective, neural-network-based decoders, including autoregressive generative models and recurrent transformers, learn to approximate the MLD distribution from data, achieving high accuracy with the parallelism afforded by modern hardware accelerators. We discuss the connections among these three approaches, review their application to both simulated and experimental quantum hardware, and outline open challenges including real-time decoding, scalability to large code distances, and generalization to high-rate quantum low-density parity-check codes.

quant-pharXiv:2605.17230•May 19, 2026•0 citations

Constructing Optimal Contraction Trees for Tensor Network Quantum Circuit Simulation

Cameron Ibrahim, Danylo Lykov, Zichang He +2 more

One of the key problems in tensor network based quantum circuit simulation is the construction of a contraction tree which minimizes the cost of the simulation, where the cost can be expressed in the number of operations as a proxy for the simulation running time. This same problem arises in a variety of application areas, such as combinatorial scientific computing, marginalization in probabilistic graphical models, and solving constraint satisfaction problems. In this paper, we reduce the computationally hard portion of this problem to one of graph linear ordering, and demonstrate how existing approaches in this area can be utilized to achieve results up to several orders of magnitude better than existing state of the art methods for the same running time. To do so, we introduce a novel polynomial time algorithm for constructing an optimal contraction tree from a given order. Furthermore, we introduce a fast and high quality linear ordering solver, and demonstrate its applicability as a heuristic for providing orderings for contraction trees. Finally, we compare our solver with competing methods for constructing contraction trees in quantum circuit simulation on a collection of randomly generated Quantum Approximate Optimization Algorithm Max Cut circuits and show that our method achieves superior results on a majority of tested quantum circuits. Reproducibility: Our source code and data are available at https://github.com/cameton/HPEC2022_ContractionTrees.

arXiv:2209.02895•IEEE High Performance Extreme Computing Conference•Sep 19, 2022•10 citations
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.
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 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 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.
Quantum Error Correction (QEC) decoding faces a fundamental accuracy-efficiency tradeoff. Classical methods like Minimum Weight Perfect Matching (MWPM) exhibit variable performance across noise models and suffer from polynomial complexity, while tensor network decoders achieve high accuracy but at prohibitively high computational cost. Recent neural decoders reduce complexity but lack the accuracy needed to compete with computationally expensive classical methods. We introduce SAQ-Decoder, a unified framework combining transformer-based learning with constraint aware post-processing that achieves both near Maximum Likelihood (ML) accuracy and linear computational scalability with respect to the syndrome size. Our approach combines a dual-stream transformer architecture that processes syndromes and logical information with asymmetric attention patterns, and a novel differentiable logical loss that directly optimizes Logical Error Rates (LER) through smooth approximations over finite fields. SAQ-Decoder achieves near-optimal performance, with error thresholds of 10.99% (independent noise) and 18.6% (depolarizing noise) on toric codes that approach the ML bounds of 11.0% and 18.9% while outperforming existing neural and classical baselines in accuracy, complexity, and parameter efficiency. Our findings establish that learned decoders can simultaneously achieve competitive decoding accuracy and computational efficiency, addressing key requirements for practical fault-tolerant quantum computing systems.
Quantum error correction (QEC) is indispensable for realizing fault-tolerant quantum computation, yet its effectiveness hinges critically on the classical decoding algorithm that interprets noisy syndrome measurements. Among all possible decoding strategies, maximum likelihood decoding (MLD) is provably optimal, since it identifies the logical group with largest likelihood by summing over all possible errors within logical class consistent with the observed syndrome. Despite its optimality, MLD is computationally intractable in general (#P-hard), motivating a rich landscape of exact and approximate algorithms. In this topical review, we provide a unified perspective on MLD by surveying recent advances through three complementary lenses: statistical mechanics, tensor networks, and artificial intelligence. From the statistical mechanics viewpoint, the MLD problem maps onto evaluating partition functions of disordered spin models, enabling exact solutions for certain codes and noise models as well as threshold estimation via phase-transition analysis. From the tensor network perspective, approximate contraction of tensor networks on the code's factor graph yields decoders that closely approach MLD accuracy with polynomial computational cost. From the artificial intelligence perspective, neural-network-based decoders, including autoregressive generative models and recurrent transformers, learn to approximate the MLD distribution from data, achieving high accuracy with the parallelism afforded by modern hardware accelerators. We discuss the connections among these three approaches, review their application to both simulated and experimental quantum hardware, and outline open challenges including real-time decoding, scalability to large code distances, and generalization to high-rate quantum low-density parity-check codes.
One of the key problems in tensor network based quantum circuit simulation is the construction of a contraction tree which minimizes the cost of the simulation, where the cost can be expressed in the number of operations as a proxy for the simulation running time. This same problem arises in a variety of application areas, such as combinatorial scientific computing, marginalization in probabilistic graphical models, and solving constraint satisfaction problems. In this paper, we reduce the computationally hard portion of this problem to one of graph linear ordering, and demonstrate how existing approaches in this area can be utilized to achieve results up to several orders of magnitude better than existing state of the art methods for the same running time. To do so, we introduce a novel polynomial time algorithm for constructing an optimal contraction tree from a given order. Furthermore, we introduce a fast and high quality linear ordering solver, and demonstrate its applicability as a heuristic for providing orderings for contraction trees. Finally, we compare our solver with competing methods for constructing contraction trees in quantum circuit simulation on a collection of randomly generated Quantum Approximate Optimization Algorithm Max Cut circuits and show that our method achieves superior results on a majority of tested quantum circuits. Reproducibility: Our source code and data are available at https://github.com/cameton/HPEC2022_ContractionTrees.