Description
Block quantum code constructed using a tensor-network-based graphical framework from atomic tensors a.k.a. quantum Lego blocks [3], which can serve as encoding isometries for smaller quantum codes. The class of codes constructed using the framework depends on the choice of atomic Lego blocks.
The individual Lego blocks and resulting quantum Lego codes can be stabilizer [2,4] or non-stabilizer [3,5]. They need not be isometries, meaning that this class of codes generalizes planar-perfect tensor-network codes. However, both the logical and physical degrees of freedom must have the same local dimension.
For example, any stabilizer code can be built out of atomic blocks like the 2-site repetition code, single-site trivial stabilizer codes, and tensor products of the \(|0\rangle\) state. Specifically, the HaPPY holographic code is a quantum Lego code whose atomic Lego block is the five-qubit perfect qubit code.
Many known codes can be created using this code’s methods in order to further their understanding, including a 6-qubit implementation of the generalized Bacon-Shor code, the toric code, and the \([[7,1,3]]\) Steane code. Finite patches of the toric-code tensor network, equipped with boundary stopper tensors or repetition-code boundary tensors, reproduce surface-code patches and subsystem variants. Local Hadamard modifications of alternating tensors yield XZZX surface-code variants, while re-interpreting alternating rows of surface-code physical legs as logical legs yields 2D Bacon-Shor codes and makes their relation to the quantum compass model explicit [3]. The same framework also yields flat-geometry perfect-tensor codes, holographic Reed-Muller codes with transversal non-Clifford gates, and a 3D subsystem code built from Steane tensors with localized cube-like stabilizers [3]. For example, a simple \( [[4,2,2]] \) stabilizer code can be written as a rank 6 tensor. Attaching two of these via gluing together one logical leg from each can produce a \([[6,4,2]]\) stabilizer code. Code optimization in this framework can be done using reinforcement learning [6,7].
To construct a Lego code, the encoding map \(V\) for each code that is to be used in the construction is converted to a tensor by decomposing it using the formula \begin{align} V = \sum_{i_j} V_{i_1 \ldots i_{n+k}} | i_{k+1} \ldots i_{k+n} \rangle \langle i_1 \ldots i_k |~. \tag*{(1)}\end{align} We then look at the codes graphically, treating each \(i_j\) as an edge dangling out of the tensor vertex \(V_{i_1 \ldots i_{n+k}}\). These edges are either connected to another tensor vertex’s edges or left dangling. If the block codes are stabilizer, then each local tensor has unitary product stabilizers (UPS). The goal is to push each UPS through the tensor network until each dangling edge has only trivial support. Otherwise, a matching value is pushed through the edge and the process is repeated on the next tensor. If a UPS can be pushed through the whole network, then a UPS for the larger network has been found. The dangling legs (edges) and UPS of the whole network can then be converted to physical/logical elements and stabilizers/logical operators for a new quantum code.
Protection
Stabilizer code distance can be calculated by tensor contraction [4], which can be optimized [8]. Quantum weight enumerators are related to tensor-network structures like correlation tensor norms [9,10].Encoding
Unitary-circuit encoding exists for a restricted class of tensor networks contractible via isometries [3].Transversal Gates
The quantum Lego framework yields an \([[8,1,2]]\) stabilizer code that admits a transversal logical \(T\) gate that originates from that of a trivial (distance-one) \([[7,1]]\) code. This code, in turn, is obtained from the \([[15,1,3]]\) code [11].Decoding
The decoder is created by creating a decoding quantum circuit with dangling legs replaced with input/output wires, and tensors converted to unitary gates. Maximum likelihood decoding can be used when the tensors are stabilizer codes.Tensor-network decoder when the tensor network is contractible via stabilizer isometries [2]. Independent logical qubits can be decoded in parallel [12].Tensor-network-based decoder when the encoding unitary is known [1].Cousins
- \([[7,1,3]]\) Steane code— The Steane code can be built from two \([[4,2,2]]\) codes in the quantum Lego code framework [3].
- \([[6,4,2]]\) error-detecting code— The \([[6,4,2]]\) error-detecting code can be constructed out of two \([[4,2,2]]\) codes in the quantum Lego code framework [3].
- \([[4,2,2]]\) Four-qubit code— The Steane and \([[6,4,2]]\) error-detecting codes can be built from two \([[4,2,2]]\) codes in the quantum Lego code framework [3]. The toric code can be constructed by arranging \([[4,2,2]]\) tensors on a square lattice and recovering the star and plaquette operators by operator pushing [3].
- Rotated surface code— A tensor-network based modification of the rotated surface code improves performance against depolarizing noise by \(\approx 2\%\) [4].
- Honeycomb (6.6.6) color code— Larger 6.6.6 color codes can be constructed by contracting legs of tensors of smaller codes [4; Fig. 5].
- Asymmetric quantum code (AQC)— Quantum Lego and more general tensor-network code optimization for biased noise can be done using reinforcement learning [6,7].
- Reinforcement-learning quantum code— Quantum Lego and more general tensor-network code optimization for biased noise can be done using reinforcement learning [6,7].
- Kitaev surface code— Planar surface codes arise from finite patches of the toric-code tensor network by contracting boundary legs with stopper tensors or repetition-code boundary tensors [3]. The 2D Bacon-Shor code can also be obtained from a surface-code tensor network by reassigning every other row of dangling physical legs to logical legs; in this quantum-Lego picture, the gauge generators remain weight-two \(XX\) and \(ZZ\) operators and the construction makes explicit a connection to the quantum compass model [3].
- Branching MERA code— Encoders for branching MERA codes are related to branching MERA tensor networks [1,14].
- Quantum polar code— Quantum polar encoding circuits can be viewed as branching-tree tensor networks [1].
- XP stabilizer code— XP stabilizer codes can be understood through the Quantum Lego formalism [11].
- \([[8,1,2]]\) Shen-Wang-Cao code— The \([[8,1,2]]\) code can be obtained by contracting some of the legs of the \([[15,1,3]]\) encoding map and concatenating one leg with a repetition code [11,15].
- \([[15,1,3]]\) quantum RM code— The \([[15,1,3]]\) code serves as the local tensor in a holographic quantum-Lego code on a \(\{15,4\}\) tiling that supports a transversal non-Clifford operator [3].
- Toric code— The toric code can be constructed by arranging \([[4,2,2]]\) tensors on a square lattice and recovering the star and plaquette operators by operator pushing [3].
- Triangular surface code— Triangle surface codes can be reproduced by inserting a defect tensor and Hadamard-modified tensors into the surface-code tensor network [3].
- Bacon-Shor code— The 2D Bacon-Shor code can also be obtained from a surface-code tensor network by reassigning every other row of dangling physical legs to logical legs; in this quantum-Lego picture, the gauge generators remain weight-two \(XX\) and \(ZZ\) operators and the construction makes explicit a connection to the quantum compass model [3].
Primary Hierarchy
References
- [1]
- A. J. Ferris and D. Poulin, “Tensor Networks and Quantum Error Correction”, Physical Review Letters 113, (2014) arXiv:1312.4578 DOI
- [2]
- T. Farrelly, R. J. Harris, N. A. McMahon, and T. M. Stace, “Tensor-Network Codes”, Physical Review Letters 127, (2021) arXiv:2009.10329 DOI
- [3]
- C. Cao and B. Lackey, “Quantum Lego: Building Quantum Error Correction Codes from Tensor Networks”, PRX Quantum 3, (2022) arXiv:2109.08158 DOI
- [4]
- T. Farrelly, D. K. Tuckett, and T. M. Stace, “Local tensor-network codes”, New Journal of Physics 24, 043015 (2022) arXiv:2109.11996 DOI
- [5]
- C. Cao, M. J. Gullans, B. Lackey, and Z. Wang, “Quantum Lego Expansion Pack: Enumerators from Tensor Networks”, (2024) arXiv:2308.05152
- [6]
- V. P. Su, C. Cao, H.-Y. Hu, Y. Yanay, C. Tahan, and B. Swingle, “Discovery of optimal quantum codes via reinforcement learning”, Physical Review Applied 23, (2025) arXiv:2305.06378 DOI
- [7]
- C. Mauron, T. Farrelly, and T. M. Stace, “Optimization of Tensor Network Codes with Reinforcement Learning”, (2023) arXiv:2305.11470
- [8]
- B. Pato, J. Vanlerberghe, and K. R. Brown, “Hyper-optimized Quantum Lego Contraction Schedules”, (2026) arXiv:2510.08210
- [9]
- J. I. de Vicente and M. Huber, “Multipartite entanglement detection from correlation tensors”, Physical Review A 84, (2011) arXiv:1106.5756 DOI
- [10]
- W. Laskowski, M. Markiewicz, T. Paterek, and M. Żukowski, “Correlation-tensor criteria for genuine multiqubit entanglement”, Physical Review A 84, (2011) arXiv:1110.4108 DOI
- [11]
- R. Shen, Y. Wang, and C. Cao, “Quantum Lego and XP Stabilizer Codes”, Quantum 9, 1876 (2025) arXiv:2310.19538 DOI
- [12]
- T. Farrelly, R. J. Harris, N. A. McMahon, and T. M. Stace, “Parallel decoding of multiple logical qubits in tensor-network codes”, (2020) arXiv:2012.07317
- [13]
- J. Fan, M. Steinberg, A. Jahn, C. Cao, A. Sarkar, and S. Feld, “LEGO_HQEC: Automating the Analysis, Construction, and Decoding of Holographic Quantum Codes”, (2025) arXiv:2410.22861
- [14]
- A. J. Ferris and D. Poulin, “Branching MERA codes: a natural extension of polar codes”, (2013) arXiv:1312.4575
- [15]
- M. Vasmer and A. Kubica, “Morphing Quantum Codes”, PRX Quantum 3, (2022) arXiv:2112.01446 DOI
- [16]
- B. Ferté and X. Cao, “Solvable Model of Quantum-Darwinism-Encoding Transitions”, Physical Review Letters 132, (2024) arXiv:2305.03694 DOI
- [17]
- S. A. Yadavalli and I. Marvian, “Noisy quantum trees: infinite protection without correction”, npj Quantum Information 11, (2025) arXiv:2306.14294 DOI
Page edit log
- Victor V. Albert (2022-05-25) — most recent
- Thomas Wrona (2022-05-18)
Cite as:
“Tensor-network code”, The Error Correction Zoo (V. V. Albert & P. Faist, eds.), 2022. https://errorcorrectionzoo.org/c/quantum_lego