Introduction

Quantum error correction (QEC) is essential for protecting quantum information from the noise and errors that inevitably arise in quantum systems1,2,3,4,5,6. A deeper understanding of the structure of the set given by all possible coefficients \(\left\{{\lambda }_{ij}\right\}\), which arise from the Knill-Laflamme (KL) conditions \(P{E}_{i}^{\dagger }{E}_{j}P={\lambda }_{ij}P\)7, can provide valuable insights into the performance and underlying properties of quantum error-correcting codes. However, achieving this understanding is challenging. Nonadditive codes, which lie outside the stabilizer formalism, are particularly difficult to analyze, as relatively few examples have been systematically studied8,9,10. Moreover, degenerate codes–where multiple errors produce the same effect on the code space–exhibit inherently quantum phenomena, such as overlapping error syndromes, that lack classical analogues and remain poorly understood11,12. These complexities make it difficult to systematically explore the structure of the set of all possible \(\{{\lambda }_{ij}\}\) values. As a result, there is currently no comprehensive framework for understanding the distribution of these coefficients, leaving important questions about their structure and implications for quantum error correction unanswered.

We analyze the structure defined by the set of all possible values of \(\{{\lambda }_{ij}\}\) that satisfy the KL conditions, which govern how pairs of errors interact within the code subspace defined by P. To encapsulate these interactions, we introduce signature vector \(\overrightarrow{\lambda }(P)\), composed of the off-diagonal elements \(\left\{{\lambda }_{ij}\right\}\) (with each coefficient corresponding to equivalent errors counted only once), which capture the non-trivial correlations between errors. The overall strength of these interactions is quantified by λ*(P), the Euclidean norm of the signature vector. This scalar value provides a measure of the total strength of error interactions within the code subspace, offering a new perspective on the role of these interactions in QEC. Crucially, for ((n, K, d)) codes, λ* is a function of the purity of the local reduced density matrices (RDMs) of the codewords, making it invariant under local unitary operations. This local unitary invariance allows λ* to serve as a powerful tool for distinguishing locally unitary inequivalent quantum codes and identifying different codes based on their error interaction structures.

The focus of this paper is to study the range of λ*: to understand the minimum and maximum values of λ* (denoted by \({\lambda }_{\min }^{* }\) and \({\lambda }_{\max }^{* }\)), and to determine whether the range of λ* is connected between these extrema. As a baseline, in the stabilizer-code setting under a Pauli error model, the KL coefficients satisfy λij {0, ± 1} after fixing a consistent phase convention. Identifying each off-diagonal equivalence class only once (i.e., whenever \({E}_{i}^{\dagger }{E}_{j}\) and \({E}_{{i}^{{\prime} }}^{\dagger }{E}_{{j}^{{\prime} }}\) coincide up to phase), we obtain \({\lambda }^{* }{(P)}^{2}={\sum }_{i < j}{\lambda }_{ij}^{2}\in {\mathbb{N}}\), so stabilizer codes admit a discrete spectrum of λ*. This stands in sharp and interesting contrast to the continuous ranges of λ* that we will establish for nonadditive codes.

Using our method, we find that for the ((6, 2, 3)) quantum code, \({\lambda }_{\min }^{* }=\sqrt{0.6}\) and \({\lambda }_{\max }^{* }=1\). The value λ* = 1 corresponds to the degenerate stabilizer code described in13. However, there were no known codes corresponding to \({\lambda }^{* }=\sqrt{0.6}\). We construct families of nonadditive codes, parameterized by four mutually orthogonal real vectors \(a,b,c,d\in {{\mathbb{R}}}^{5}\), with λ* parameterized by a vector \(e\in {{\mathbb{R}}}^{5}\), orthogonal to a, b, c, d, which varies continuously over the interval \([\sqrt{0.6},1]\). This confirms that the range of λ* for the ((6, 2, 3)) code is indeed \([\sqrt{0.6},1]\). For each distinct value of \({\lambda }^{* }\in [\sqrt{0.6},1]\), our construction yields locally inequivalent codes, parameterized by the vector \(e\in {{\mathbb{R}}}^{5}\).

For the ((7, 2, 3)) code, we find that \({\lambda }_{\min }^{* }=0\) and \({\lambda }_{\max }^{* }=\sqrt{7}\), where λ* = 0 corresponds to the non-degenerate Steane code14,15, and \({\lambda }^{* }=\sqrt{7}\) corresponds to the permutation-invariant code proposed by Pollatsek and Ruskai16. We identify families of cyclic ((7, 2, 3)) codes that trace continuous paths in the solution space. These paths, each characterized by a single parameter, which is simply λ*, with λ* varies continuously over the interval \([0,\sqrt{7}]\), directly connecting the Steane code and the permutation-invariant code. This finding demonstrates that it is possible to smoothly connect these two distinct codes while preserving cyclic symmetry, offering new insights into the relationship between different locally inequivalent quantum codes and their symmetry properties.

Our approach offers a systematic method to explore the range of λ*, resulting in the construction of numerous new nonadditive codes for ((6, 2, 3)) and ((7, 2, 3)), with λ* varying continuously from \({\lambda }_{\min }^{* }\) to \({\lambda }_{\max }^{* }\). The ability to identify and quantify the range of λ* provides novel insights into the structure of quantum codes, particularly in nonadditive cases. This framework opens new avenues for investigating the intricate relationships between code subspaces and error interactions, offering a deeper understanding of the mathematical structure underlying quantum error correction.

We organize our paper as follows. In Section II A, we discuss preliminaries on quantum error correction and code parameters. In Section II B, we define the signature vector and its norm λ*, show that λ* is invariant under local unitary operations by linking it to the purity of the RDMs of codewords, and develop an algorithm to find the maximum and minimum values of λ*. In Sections II D and II E, we apply our method to the ((6, 2, 3)) and ((7, 2, 3)) quantum codes, respectively, demonstrating how λ* varies and constructing new nonadditive codes.

Results

Preliminary

In quantum error correction, it is our goal to protect quantum information from errors caused by a noisy quantum channel. Quantum error-correcting codes (QECCs) are constructed to correct a specified set of errors {Ei}. The Knill-Laflamme (KL) condition for quantum error correction can be expressed as:

$$P{E}_{i}^{\dagger }{E}_{j}P={\lambda }_{ij}P,\quad \forall i,j,$$
(1)

where P denotes the projector onto the code subspace, Ei and Ej represent the Kraus operators corresponding to the possible errors, and \(\left\{{\lambda }_{ij}\right\}\) are complex scalars that characterize how the pair of errors Ei and Ej interact within the code subspace. This condition ensures that errors are correctable, provided that they act within the designated subspace and satisfy this equation.

The dimension of the code subspace is denoted as K, and if the logical information is encoded in a subspace of K-dimensional logical qubits within an n-dimensional physical qubit system, then P is an n × n matrix, and its rank equals K. The code subspace \({\mathcal{C}}\) can be written as the span of orthonormal basis vectors \(\{\left\vert {\psi }_{1}\right\rangle ,\left\vert {\psi }_{2}\right\rangle ,\ldots ,\left\vert {\psi }_{K}\right\rangle \}\), which span the logical space. The projector onto the code subspace is given by

$$P=\mathop{\sum }\limits_{i=1}^{K}\left\vert {\psi }_{i}\right\rangle \left\langle {\psi }_{i}\right\vert .$$
(2)

The quantum error correction condition can then be expressed in terms of the basis vectors spanning the code subspace:

$$\langle {\psi }_{k}| {E}_{i}^{\dagger }{E}_{j}| {\psi }_{l}\rangle ={\lambda }_{ij}{\delta }_{kl},\quad \forall i,j$$
(3)

where the scalars \(\left\{{\lambda }_{ij}\right\}\) describe how the errors Ei and Ej affect the code subspace.

A non-degenerate QECC is characterized by the Hermitian matrix \(\{{\lambda }_{ij}\}\) being non-singular (having full rank), which means that the determinant of \(\{{\lambda }_{ij}\}\) is non-zero and the matrix is invertible1. This implies that all errors have distinct effects on the code space and can be uniquely identified and corrected. In contrast, a degenerate QECC arises when the matrix \(\{{\lambda }_{ij}\}\) is singular (not of full rank), indicating that there are linear dependencies among the error operators when restricted to the code space4. Some errors or combinations of errors may have the same effect on the code space, making them indistinguishable. A completely degenerate code, or decoherence-free subspace (DFS), represents an extreme case where all \(\{{\lambda }_{ij}\}\) elements are equal, resulting in a matrix of rank 1, meaning λij = λ for all i, j. In this scenario, the code space remains invariant under certain noise processes11,17.

An ((n, K, d)) quantum error-correcting code is defined by three key parameters: n, the number of physical qubits used to encode the quantum information; K, the dimension of the code space, which corresponds to the number of logical qubits the code can protect (for example, if K = 2k, the code protects k logical qubits); and d, the distance of the code, which determines the minimum number of physical qubit errors required to cause a logical error. The distance d indicates the code’s ability to detect and correct errors. Specifically, an ((n, K, d)) code can detect up to d − 1 qubit errors and correct up to \(t=\left\lfloor \frac{d-1}{2}\right\rfloor\) qubit errors1,4. A well-known example is the Steane code, which is a ((7, 2, 3)) code. This code encodes one logical qubit into seven physical qubits and can correct up to one qubit error and detect up to two qubit errors4.

Furthermore, quantum error-correcting codes may either be non-additive or additive. Non-additive codes are a generalization of stabilizer (additive) codes and allow encoding of quantum information without adhering to the 2k constraint for the dimension K. The code distance d, which is the minimum weight of an undetectable error, remains critical in both types of codes, as it determines how many errors can be detected and corrected.

Two quantum error-correcting codes P1 and P2 are locally equivalent if one can be transformed into the other by local unitary operations or local Clifford operations applied to individual qubits. Formally, P1 and P2 are locally equivalent if there exists a unitary transformation U = U1 U2 Un, where each Ui acts on a single qubit, such that P2 = UP1U. This local equivalence ensures that the overall structure of the code and parameters n, K, d are preserved, even though individual states within the code space may change under the transformation3.

In practice, to test whether two ((n, K, d)) codes P1 and P2 are local unitary equivalent, we can use Quantum weight enumerators18, which were defined by

$$A(z)=\mathop{\sum }\limits_{j=0}^{n}{A}_{j}{z}^{j},\quad B(z)=\mathop{\sum }\limits_{j=0}^{n}{B}_{j}{z}^{j}$$
(4)

with coefficients

$${A}_{j}=\frac{1}{{K}^{2}}\sum _{\mathrm{wt}}\,({O}_{\alpha })=j{\mathrm{Tr}}\,({O}_{\alpha }{P}_{c}){\mathrm{Tr}}\,({O}_{\alpha }^{\dagger}{P}_{c}),$$
(5)
$${B}_{j}=\frac{1}{K}\sum _{\mathrm{wt}}\,({O}_{\alpha })=j{\mathrm{Tr}}\,({O}_{\alpha }{P}_{c}{O}_{\alpha }^{\dagger }{P}_{c}).$$
(6)

Here

$${O}_{\alpha }\in {\{X,Y,Z,I\}}^{\otimes n}$$
(7)

are n-fold tensor product. Denote the number of X factors, Y factors and Z factors in Oα as wtX(Oα), wtY(Oα), and wtZ(Oα). The weight of Oα is

$${\mathrm{wt}}\,({O}_{\alpha})={\mathrm{wt}}_{{\rm{X}}}({O}_{\alpha })+{\mathrm{wt}}_{{\rm{Y}}}({O}_{\alpha })+{\mathrm{wt}}_{{\rm{Z}}}({O}_{\alpha }).$$
(8)

Signature vector

We motivate the idea of a “signature vector” via the joint rank-Knumerical range for a set of operators \({\{{A}_{i}\}}_{i = 1}^{m}\), defined as19,20

$$\begin{array}{rcl}&&{W}^{(K)}({A}_{1},\ldots ,{A}_{m}):=\left\{{({\lambda }_{i})}_{i = 1}^{m}\,:\,\exists \,\,\text{rank-}\,K\,\,\text{projector}\,\,P\right.\\ &&\left.\,\text{with}\,\,P{A}_{i}P={\lambda }_{i}P\,\forall i\right\}.\end{array}$$
(9)

Thus, W(K) consists of all vectors \(\overrightarrow{\lambda }(P)=({\lambda }_{i})\) that arise from some K-dimensional projector P satisfying PAiP = λiP.

The joint rank-1 numerical range is connected, and for m = 2 Hermitian operators it is convex by the Toeplitz–Hausdorff theorem19,20; this convexity extends to higher ranks as well21,22. For m > 2, however, the geometry of joint higher-rank numerical ranges is much less understood23,24,25,26,27. In particular, for K≥2 the set is generally non-convex and may have disconnected components. As an example, consider two qubits with A1 = X I, A2 = X Z, A3 = Y I, A4 = Y Z, A5 = Z I. One can show that the joint rank-2 numerical range consists of exactly two points,

$${W}^{(2)}({A}_{1},\ldots ,{A}_{5})=\{(0,0,0,0,1),(0,0,0,0,-1)\},$$

and is therefore disconnected.

To adapt \(\overrightarrow{\lambda }(P)\) to an ((n, K, d)) code, let

$${{\mathcal{E}}}_{ < d}:=\{{O}_{\alpha }\,\,{\text{Pauli}}\,:0\le {\mathrm{wt}}\,({O}_{\alpha }) < d\,\}$$

denote the set of all Pauli operators of weight less than d including identity, and define

$${{\mathcal{W}}}_{{\rm{error}}}:={W}^{(K)}({{\mathcal{E}}}_{ < d}).$$
(10)

We call \(\overrightarrow{\lambda }(P)\in {{\mathcal{W}}}_{{\rm{error}}}\) a signature vector if

$$P{O}_{\alpha }P={\lambda }_{\alpha }P\quad \,\text{for all}\,\,{O}_{\alpha }\in {{\mathcal{E}}}_{ < d}.$$
(11)

In the Knill–Laflamme (KL) form,

$$P{E}_{i}^{\dagger }{E}_{j}P={\lambda }_{ij}P\quad \forall \,i,j,$$

we take \(\overrightarrow{\lambda }\) to be the collection of all distinct off-diagonal coefficients λij (ij), identifying pairs (i, j) and \(({i}^{{\prime} },{j}^{{\prime} })\) whenever \({E}_{i}^{\dagger }{E}_{j}\) and \({E}_{{i}^{{\prime} }}^{\dagger }{E}_{{j}^{{\prime} }}\) coincide with the same Pauli (up to an overall phase).

We are particularly interested in the length of the signature vector, denoted λ*(P), defined by

$${\lambda }^{* }(P)=\parallel \overrightarrow{\lambda }(P){\parallel }_{2}=\sqrt{\sum _{i}| {\lambda }_{i}{| }^{2}}.$$
(12)

This quantity provides a scalar measure of the aggregate strength of error couplings on the code subspace determined by P28. Trivially, λ*(P)≥0, with λ*(P) = 0 achievable when all off-diagonal KL coefficients vanish (e.g., in a non-degenerate stabilizer code). For a fixed noise model, a natural upper bound is approached when the code forms a decoherence-free subspace (DFS), where \({E}_{i}\left\vert \psi \right\rangle ={c}_{i}\left\vert \psi \right\rangle\) on the code so that \(P{E}_{i}^{\dagger }{E}_{j}P={c}_{i}^{* }{c}_{j}P\); under appropriate normalization this yields the maximal possible value of λ*.

To clarify the physical content of λ*, we first establish that it is invariant under local unitaries, and then relate it to the entropy of the code. These are specific features of the error model adopted for the analysis of ((n, K, d)) codes. We then propose a numerical procedure to estimate the attainable range of λ*, which also provides insight into the geometry of W(K) in general.

The physical meaning of λ * for ((n, K, d)) codes

We now show the local unitary invariance (LUI) of λ*. Given a quantum state \(\left\vert \psi \right\rangle\), the RDM for the i-th subsystem is defined as:

$${\rho }^{(i)}={{\rm{Tr}}}_{{(i)}^{c}}[\left\vert \psi \right\rangle \left\langle \psi \right\vert ],$$
(13)

where \({{\rm{Tr}}}_{{(i)}^{c}}\) denotes the partial trace over all subsystems except the i-th one. An n-RDM is defined as:

$${\rho }^{(\overbrace{i\ldots k}^{n})}={{\rm{Tr}}}_{{(\underbrace{i\ldots k}_{n})}^{c}}[\left\vert \psi \right\rangle \left\langle \psi \right\vert ],$$
(14)

The purity of this RDM is given by:

$${\mathcal{P}}\left({\rho }^{(\overbrace{i\ldots k}^{n})}\right)={\rm{Tr}}\left[{\left({\rho }^{(\overbrace{i\ldots k}^{n})}\right)}^{2}\,\right]$$
(15)

and since purity is invariant under local unitary transformations, the purity for 1-RDM, 2-RDM, ..., and up to (d-1)-RDM is also LUI. For an ((n, K, d)) code, the (d-1)-qubit RDM is the same for any state \(\left\vert \psi \right\rangle\) within the code subspace, hence all the lower order RDMs are also independent of the state \(\left\vert \psi \right\rangle\).

Next, consider the vector \({\lambda }^{(i)}=({\rm{Tr}}[{\rho }^{(i)}{X}_{i}],{\rm{Tr}}[{\rho }^{(i)}{Y}_{i}],{\rm{Tr}}[{\rho }^{(i)}{Z}_{i}])\), which captures how the i-th subsystem interacts with the Pauli operators. The length of this vector is LUI, and is expressed as:

$$\parallel {\lambda }^{(i)}{\parallel }_{2}=\sqrt{\mathop{\sum }\limits_{\alpha =1}^{3}| {\lambda }_{\alpha }^{(i)}{| }^{2}}.$$
(16)

This can be rewritten in terms of the purity as \(\parallel {\lambda }^{(i)}{\parallel }_{2}^{2}=2{\rm{Tr}}\left[{\left({\rho }^{(i)}\right)}^{2}\right]-1\), demonstrating that λ(i)2 is LUI.

Now, let λ(ij) be a vector with 9 components, corresponding to the two-qubit interactions:

$${\lambda }^{(ij)}=\left({\rm{Tr}}[{\rho }^{(ij)}{X}_{i}{X}_{j}],{\rm{Tr}}[{\rho }^{(ij)}{X}_{i}{Y}_{j}],\cdots \,,{\rm{Tr}}[{\rho }^{(ij)}{Z}_{i}{Z}_{j}]\right).$$
(17)

The length of this vector is also LUI, and is given by:

$$\parallel {\lambda }^{(ij)}{\parallel }_{2}=\sqrt{\mathop{\sum }\limits_{\alpha =1}^{9}| {\lambda }_{\alpha }^{(ij)}{| }^{2}}.$$
(18)

We can express this as:

$$\parallel {\lambda }^{(ij)}{\parallel }_{2}^{2}=4{\rm{Tr}}\left[{\left({\rho }^{(ij)}\right)}^{2}\right]-1-\parallel {\lambda }^{(i)}{\parallel }_{2}^{2}-\parallel {\lambda }^{(j)}{\parallel }_{2}^{2},$$
(19)

where each term on the right-hand side has already been shown to be LUI.

With invariance of weight-1 and weight-2 vectors, in a similar fashion, the length of weight-(d-1) vectors λ(ij )2 can be proven to be LUI. Consequently, the length of the signature vector is given by:

$$\begin{array}{rcl}{({\lambda }^{* })}^{2}&=&\mathop{\sum }\limits_{\alpha =1}^{3}\parallel {\lambda }_{\alpha }^{(i)}{\parallel }_{2}^{2}+\mathop{\sum }\limits_{\alpha =1}^{9}\parallel {\lambda }_{\alpha }^{(ij)}{\parallel }_{2}^{2}\\ &&+\cdots +(\,\text{weight}-(d-1)\text{term}\,),\end{array}$$
(20)

which is also LUI, as all terms involved are LUI. The LUI property can also be observed from the connection with quantum weight enumerators in Eq.(5). E.g., when d = 3, \({\lambda }^{* 2}={\sum }_{i}\parallel {\lambda }^{(i)}{\parallel }_{2}^{2}+{\sum }_{ij}\parallel {\lambda }^{(ij)}{\parallel }_{2}^{2}={A}_{1}+{A}_{2}\).

Since λ* is LUI, it follows that if two quantum codes P1 and P2 correspond to different values of λ*, i.e., λ*(P1) ≠ λ*(P2), then the two codes must be local unitary inequivalent. This means that the distinct values of λ* reflect different structures in the code subspaces that cannot be transformed into one another via local unitary operations. This shows that λ* serves as a useful tool for distinguishing some local unitary inequivalent codes. However, the converse does not hold: two local unitary inequivalent codes may correspond to the same value of λ*.

Beside the connection between λ* and the quantum weight enumerators and purity of RDMs, we also establish how the quantity λ* connects to the second-order Rényi entropy of the Knill-Laflamme (KL) matrix. The KL matrix Λ has elements

$${\lambda }_{ij}=\frac{{\mathrm{Tr}}\,(P\,{E}_{i}^{\dagger}{E}_{j}\,P)}{{\mathrm{Tr}}\,(P)},$$
(21)

where P is the projector onto the code space, and {Ei} are the error operators. By construction, Λ captures the pairwise overlaps of errors within the code space.

To interpret Λ as a density matrix, we normalize it as

$$\tilde{\Lambda }=\frac{\Lambda }{{\mathrm{Tr}}\,(\Lambda )}.$$
(22)

The second-order Rényi entropy of the normalized matrix is

$${S}_{2}(\tilde{\Lambda })=-\log {\mathrm{Tr}}\,(\tilde{\Lambda }^{2}).$$
(23)

Since \({\mathrm{Tr}}\,(\Lambda )={\sum }_{i}{\lambda }_{ii}={\sum }_{i}1=m\) (often taken to be the code-space dimension), we have

$${\mathrm{Tr}}\,({\Lambda }^{2})=\sum _{i,j}\,{\left\vert {\lambda }_{ij}\right\vert }^{2}=m+2\,\sum _{i < j}\,{\left\vert {\lambda }_{ij}\right\vert }^{2}.$$
(24)

By definition,

$$\,\sum _{i < j}\,{\left\vert {\lambda }_{ij}\right\vert }^{2}={\lambda }^{* 2}+3{A}_{1},$$
(25)

where A1 is the first-order quantum error enumerator introduced in Eq. (5). Since \(\{\mathrm{Tr}\,[P\,{O}_{i}]\}\) transforms as a vector under local unitary (LU) rotations, A1 remains invariant under LU transformations. Putting these observations together, we get

$${\mathrm{Tr}}\,({\tilde\Lambda}^{2})=\frac{m+2\,({\lambda }^{* 2}+3{A}_{1})}{{m}^{2}},$$
(26)

Consequently,

$${S}_{2}(\tilde{\Lambda })=-\log \left[m+2({\lambda }^{* 2}+3{A}_{1})\right]\,-\,2\log m.$$
(27)

This shows that the second-order Rényi entropy of the KL matrix (once normalized) depends directly on λ*, reinforcing the view that λ* serves as a measure of the off-diagonal correlation strength among the error operators.

The local-unitary invariance (LUI) of λ*, together with its connections to several physical quantities, indicates that λ* is a useful measure of codeword properties and physical quantities invariant to choice of basis or representation. The robustness, and the numerical efficiency working in the Stiefel manifold in Section IV A, make λ* a useful tool for finding the code with new error models. These properties, however, are specific to the error model adopted for our analysis of ((n, K, d)) codes. In particular, the LUI statement for λ* holds for any complete set of Hermitian error operators (P UPU, Ei UEiU), or arbitrary local changes of basis (Ei kVikEk, Λ VΛV); extensions to non-Hermitian errors lie beyond the present derivation. Nevertheless, the numerical procedure developed below is still valid with minimal modification and remains useful for finding the code with new error models.

((6, 2, 3)) codes

It is well known that ((5, 2, 3)) code is unique up to local unitary equivalence, with signature vector \(\overrightarrow{\lambda }=0\), hence the range of λ* is a single point 0. Much less is known about the range of λ* for the case of ((6, 2, 3)). For stabilizer codes, there are only degenerate ones, for example the stabilizer code given in13, with stabilizers given by

$$\begin{array}{llllllll}{g}_{1}&:&Y&I&Z&X&X&Y\\ {g}_{2}&:&Z&X&I&I&X&Z\\ {g}_{3}&:&I&Z&X&X&X&X\\ {g}_{4}&:&I&I&I&Z&I&Z\\ {g}_{5}&:&Z&Z&Z&I&Z&I\end{array}$$

For this code, all components of signature vector are zero except the term \(\left\langle {0}_{L}\right\vert {Z}_{4}{Z}_{6}\left\vert {0}_{L}\right\rangle =1\), hence λ* = 1. All the other ((6, 2, 3)) codes found in29 also have λ* = 1.

To find the range of λ*, we sample λ* [0.5, 1.1], then calculate the optimal value for \({\mathcal{L}}\left(\theta ;\mu ,{\lambda }^{* }\right)\) in eq. (67). The results are shown in Fig. 1. For all optimizations, the violations of error-correcting conditions are less than \({{\mathcal{L}}}_{{\rm{KL}}}\le 1{0}^{-14}\). From the figure, a sharp transition from almost zero to nonzero can be observed, which indicates \(\parallel \lambda {\parallel }_{2}^{2}\in [0.6,1.0]\). This two boundaries are also found via optimizing \({{\mathcal{L}}}_{\overline{\lambda }}\) and \({{\mathcal{L}}}_{\underline{\lambda }}\).

Fig. 1: λ*2 range for ((6, 2, 3)) code.
figure 1

Penalty factor is chosen as μ = 1. Clear boundaries can be found on the edges of region λ*2 [0.6, 1.0]. Inside the region, the loss function \({\mathcal{L}}\left(\theta ;\mu ,{\lambda }^{* }\right)\) is below 10−14.

To construct codes with \(\sqrt{0.6}\le {\lambda }^{* }\le 1\), denote the six qubits by q1q2q3q4q5q6, and choose the following five bases for qubits q2q3q4q5q6

$$\begin{array}{rcl}\left\vert {S}_{1}\right\rangle &=&\frac{1}{\sqrt{2}}\left(\left\vert 00001\right\rangle +\left\vert 11110\right\rangle \right),\\ \left\vert {S}_{2}\right\rangle &=&\frac{1}{\sqrt{2}}\left(\left\vert 00010\right\rangle +\left\vert 11101\right\rangle \right),\\ \left\vert {S}_{3}\right\rangle &=&\frac{1}{\sqrt{2}}\left(\left\vert 00100\right\rangle +\left\vert 11011\right\rangle \right),\\ \left\vert {S}_{4}\right\rangle &=&\frac{1}{\sqrt{2}}\left(\left\vert 01000\right\rangle +\left\vert 10111\right\rangle \right),\\ \left\vert {S}_{5}\right\rangle &=&\frac{1}{\sqrt{2}}\left(\left\vert 10000\right\rangle +\left\vert 01111\right\rangle \right).\end{array}$$

Now choose logical states as:

$$\left\vert {0}_{L}\right\rangle =\mathop{\sum }\limits_{i=1}^{5}\left\vert {x}_{i}\right\rangle \left\vert {S}_{i}\right\rangle ,\,\left\vert {1}_{L}\right\rangle =\mathop{\sum }\limits_{i=1}^{5}\left\vert {y}_{i}\right\rangle \left\vert {S}_{i}\right\rangle .$$
(28)

Here

$$\left\vert {x}_{i}\right\rangle ={\gamma }_{i}\left\vert 0\right\rangle +{\gamma }_{i+5}\left\vert 1\right\rangle ,\,i=1,2,3,4,5$$
$$\left\vert {y}_{i}\right\rangle ={\gamma }_{i+5}^{* }\left\vert 0\right\rangle -{\gamma }_{i}^{* }\left\vert 1\right\rangle ,\,i=1,2,3,4,5$$

The KL condition reduces to the following conditions on \(\left\vert {x}_{i}\right\rangle\) and \(\left\vert {y}_{i}\right\rangle\) (see Supplementary Information A for details):

$$\sum _{i}\left\vert {x}_{i}\right\rangle \left\langle {x}_{i}\right\vert =\sum _{i}\left\vert {y}_{i}\right\rangle \left\langle {y}_{i}\right\vert ,\,\sum _{i}\left\vert {y}_{i}\right\rangle \left\langle {x}_{i}\right\vert =0.$$

Notice that this is equivalent to require that the RDM of q1 is \(\frac{I}{2}\).

Our code are then designed in the following 10-dimensional subspace

$$\left\{\left\vert 0\right\rangle ,\left\vert 1\right\rangle \right\}\otimes \left\{\left\vert {S}_{1}\right\rangle ,\left\vert {S}_{2}\right\rangle ,\left\vert {S}_{3}\right\rangle ,\left\vert {S}_{4}\right\rangle ,\left\vert {S}_{5}\right\rangle \right\}$$

We choose this subspace because our numerical results indicate that all 2-RDM of pure states the code space take the form:

$${{\rm{RDM}}}_{ij}=\frac{1}{4}{I}_{4}+{\alpha }_{ij}\left(XX+YY\right)+{\beta }_{ij}ZZ.$$
(29)

In Supplementary Information A, we list the explicit form of 2-RDM for any pair of qubits i, j.

Now let

$${\gamma }_{j}={a}_{j}+i{b}_{j},{\gamma }_{5+j}={c}_{j}+i{d}_{j},$$

for j = 1, 2, 3, 4, 5. Where \({a}_{j},{b}_{j},{c}_{j},{d}_{j}\in {\mathbb{R}}\). Define the column vectors a, b, c, and d to be:

$$a=\left(\begin{array}{c}{a}_{1}\\ {a}_{2}\\ {a}_{3}\\ {a}_{4}\\ {a}_{5}\end{array}\right),\quad b=\left(\begin{array}{c}{b}_{1}\\ {b}_{2}\\ {b}_{3}\\ {b}_{4}\\ {b}_{5}\end{array}\right),\quad c=\left(\begin{array}{c}{c}_{1}\\ {c}_{2}\\ {c}_{3}\\ {c}_{4}\\ {c}_{5}\end{array}\right),\quad d=\left(\begin{array}{c}{d}_{1}\\ {d}_{2}\\ {d}_{3}\\ {d}_{4}\\ {d}_{5}\end{array}\right).$$

Then the KL condition will give the following conditions on a, b, c, d:

$$\begin{array}{lll}a\cdot a\,=\,b\cdot b=c\cdot c=d\cdot d=\frac{1}{4},\\ a\cdot b\,=\;a\cdot c=a\cdot d=b\cdot c=b\cdot d=c\cdot d=0.\end{array}$$
(30)

This means that a, b, c, d are orthogonal vectors in \({{\mathbb{R}}}^{5}\).

We then choose e being the vector orthogonal to a, b, c, d, that is, the unnormalized orthogonal matrix composed from (a, b, c, d, e) as A

$$A=\left[\begin{array}{ccccc}a&b&c&d&e\end{array}\right]=\left[\begin{array}{ccccc}{a}_{1}&{b}_{1}&{c}_{1}&{d}_{1}&{e}_{1}\\ {a}_{2}&{b}_{2}&{c}_{2}&{d}_{2}&{e}_{2}\\ {a}_{3}&{b}_{3}&{c}_{3}&{d}_{3}&{e}_{3}\\ {a}_{4}&{b}_{4}&{c}_{4}&{d}_{4}&{e}_{4}\\ {a}_{5}&{b}_{5}&{c}_{5}&{d}_{5}&{e}_{5}\end{array}\right]$$
$$\to A{A}^{T}={A}^{T}A=\frac{1}{4}I$$

which means each column (row) are orthogonal to each other. In other words, 2A is a 5 × 5 orthogonal matrix.

It turns out that the nonzero element of the signature vector, denoted as \(P{E}_{i}^{\dagger }{E}_{j}P={\lambda }_{ij}P\) of this code is given by the element of e (see Supplementary Information A for details):

$$\begin{array}{lll}{\lambda }_{{X}_{i}{X}_{j}}\,=\,{\lambda }_{{Y}_{i}{Y}_{j}}=-2{e}_{7-i}{e}_{7-j},\\ {\lambda }_{{Z}_{i}{Z}_{j}}\;=\,2{e}_{7-i}^{2}+2{e}_{7-j}^{2},\quad i,j\in \left\{2,3,4,5,6\right\}.\end{array}$$

And

$${\lambda }^{* 2}=\frac{1}{2}+8\sum _{i}{e}_{i}^{4}.$$

This means that λ* is invariant with the rotation within the subspace spanned by (a, b, c, d). To further understand this invariance, we can view \(\left\vert {0}_{L}\right\rangle\) and \(\left\vert {1}_{L}\right\rangle\) as bipartite states between q1 (Party I) and q2q3q4q5q6 (Party II). For Party I, an orthogonal transformation (i.e. 2A, change of basis in the subspace spanned by \(\left\vert {S}_{i}\right\rangle\)) will correspond to a unitary transformation on Party II, hence will not change the RDM of Party I. This unitary in general cannot be realized by LU transformations on q2q3q4q5q6, hence will lead to LU inequivalent codes.

It turns out (see Supplementary Information A for details), however, when e is chosen, the freedom in the choice of (a, b, c, d) will lead to locally equivalent codes. This is due to the fact that, all such choices, given by

$$\left[\begin{array}{cccc}a&b&c&d\end{array}\right]O,$$

where O is any 4 × 4 orthogonal matrix, can be generated by

  1. 1.

    local unitary transformations on party I (i.e. the first qubit) (leading to LU equivalent code), and

  2. 2.

    unitary transformations in the logical space spanned by \(\left\vert {0}_{L}\right\rangle\) and \(\left\vert {1}_{L}\right\rangle\) (leading to the same code).

In other words, the choice of e will in general lead to local inequivalent codes. Furthermore, combined with the fact there is a single parameter family of codes that connect \({\lambda }_{\min }^{* 2}=0.6\) to \({\lambda }_{\max }^{* 2}=1\) in Section II D, we found that the signature vector space is connected when choosing the logical states as in Eq. (28), which is the subspace of the whole signature vector space \({{\mathcal{W}}}_{{\rm{error}}}\).

Specifically, the vector e for \({\lambda }_{\min }^{* 2}=0.6\) is

$$e=\frac{1}{2\sqrt{5}}\left[\begin{array}{ccccc}1&1&1&1&1\end{array}\right],$$

and for \({\lambda }_{\max }^{* 2}=1\)

$$e=\frac{1}{2}\left[\begin{array}{ccccc}0&0&0&0&1\end{array}\right].$$

To have a single-parameter family of codes that connect \({\lambda }_{\min }^{* }\) to \({\lambda }_{\max }^{* 2}=1\), since λ* is only dependent on e, let us choose a single parameter family for e

$$e=\frac{1}{2}[\frac{1}{2}\sin \theta ,\frac{1}{2}\sin \theta ,\frac{1}{2}\sin \theta ,\frac{1}{2}\sin \theta ,\cos \theta ],$$

for \(\cos \theta \in [\frac{1}{\sqrt{5}},1]\).

Now we can choose the matrix A as

$${\bf{A}}=\frac{1}{2}\left[\begin{array}{ccccc}\frac{1}{2}&\frac{1}{2}&\frac{1}{2}&\frac{1}{2}\cos (\theta )&\frac{1}{2}\sin (\theta )\\ \frac{1}{2}&-\frac{1}{2}&-\frac{1}{2}&\frac{1}{2}\cos (\theta )&\frac{1}{2}\sin (\theta )\\ -\frac{1}{2}&\frac{1}{2}&-\frac{1}{2}&\frac{1}{2}\cos (\theta )&\frac{1}{2}\sin (\theta )\\ -\frac{1}{2}&-\frac{1}{2}&\frac{1}{2}&\frac{1}{2}\cos (\theta )&\frac{1}{2}\sin (\theta )\\ 0&0&0&-\sin (\theta )&\cos (\theta )\\ \end{array}\right]$$

This gives a single parameter family of codes with the corresponding

$${\lambda }^{* 2}=\frac{1}{2}+\frac{1}{2}\left(\frac{1}{4}{\sin }^{4}(\theta )+{\cos }^{4}(\theta )\right)$$

runs continuously from 0.6 to 1.

For this family of codes, the matrix \(\left\{{\lambda }_{ij}\right\}\) will be block diagonal, and each block corresponding to XiXj, YiYj, ZiZj correlations, with the form (we only need to consider \(i,j\in \left\{2,3,4,5,6\right\}\):

$$B=\left[\begin{array}{ccccc}1&r&r&r&r\\ r&1&s&s&s\\ r&s&1&s&s\\ r&s&s&1&s\\ r&s&s&s&1\end{array}\right].$$

The eigenvalues of the matrix are:

$${\lambda }_{B1}={\lambda }_{B2}={\lambda }_{B3}=1-s,$$
$${\lambda }_{B4}=\frac{2+3s+\sqrt{9{s}^{2}+16{r}^{2}}}{2},$$
$${\lambda }_{B5}=\frac{2+3s-\sqrt{9{s}^{2}+16{r}^{2}}}{2}.$$

Notice that

$$\begin{array}{lll}{\lambda }_{{X}_{2}{X}_{j}}\,=\,{\lambda }_{{Y}_{2}{Y}_{j}}=-2{e}_{5}{e}_{7-j}\\ \,\qquad\;\;=\,-2\left(\frac{1}{2}\cos \theta \frac{1}{4}\sin \theta \right),\quad j\in \left\{2,3,4,5,6\right\}\\ {\lambda }_{{X}_{i}{X}_{j}}\,=\,{\lambda }_{{Y}_{i}{Y}_{j}}=-2{e}_{7-i}{e}_{7-j}\\ \,\qquad\;\;=\;-2{\left(\frac{1}{4}\sin \theta \right)}^{2},\quad i,j\in \left\{3,4,5,6\right\}.\end{array}$$
(31)

So the XiXj, YiYj blocks are the same and correspond to

$$r=-\frac{1}{4}\sin \theta \cos \theta ,s=-2{\left(\frac{1}{4}\sin \theta \right)}^{2}.$$

And

$$\begin{array}{lll}{\lambda }_{{Z}_{2}{Z}_{j}}\,=\,2{e}_{5}^{2}+2{e}_{7-j}^{2}\\ \,\qquad\;\,=\,2{\left(\frac{1}{4}\sin \theta \right)}^{2}+2{\left(\frac{1}{2}\cos \theta \right)}^{2},\quad j\in \left\{2,3,4,5,6\right\}\\ {\lambda }_{{Z}_{i}{Z}_{j}}\,=\,2{e}_{7-i}^{2}+2{e}_{7-j}^{2}\\ \,\qquad\,\;=\,4{\left(\frac{1}{4}\sin \theta \right)}^{2},\quad i,j\in \left\{3,4,5,6\right\}.\end{array}$$
(32)

The ZiZj block corresponds to

$$r=2{\left(\frac{1}{4}\sin \theta \right)}^{2}+2{\left(\frac{1}{2}\cos \theta \right)}^{2},s=4{\left(\frac{1}{4}\sin \theta \right)}^{2}.$$

So the matrix \(\left\{{\lambda }_{ij}\right\}\) will be full rank for \(\cos \theta \in \left[\frac{1}{\sqrt{5}},1\right)\), i.e. \({\lambda }^{* }\in \left[\sqrt{0.6},1\right)\). For \(\cos \theta =1\), i.e. λ* = 1, we have λB5 = 0.

The enumerator is found to be:

$$\begin{array}{lll}{A}^{((6,2,3))}\,=\,1+(\frac{3}{16}\cos (2\theta )+\frac{5}{64}\cos (4\theta )+\frac{47}{64}){z}^{2}\\\qquad\qquad\,\,\,\,\,+(-\frac{3}{16}\cos (2\theta )-\frac{5}{64}\cos (4\theta )+\frac{17}{64}){z}^{3}\\\qquad\qquad\,\,\,\,\,+(-\frac{3}{16}\cos (2\theta )-\frac{5}{64}\cos (4\theta )+\frac{721}{64}){z}^{4}\\\qquad\qquad\,\,\,\,\,+(\frac{3}{16}\cos (2\theta )+\frac{5}{64}\cos (4\theta )+\frac{1007}{64}){z}^{5}+3{z}^{6}\end{array},$$
(33)
$$\begin{array}{lll}{B}^{((6,2,3))}\,=\,1+(\frac{3}{16}\cos (2\theta )+\frac{5}{64}\cos (4\theta )+\frac{47}{64}){z}^{2}\\\qquad\qquad\;\;\;+\,(\frac{3}{8}\cos (2\theta )+\frac{5}{32}\cos (4\theta )+\frac{751}{32}){z}^{3}\\\qquad\qquad\;\;\;+\,(-\frac{3}{4}\cos (2\theta )-\frac{5}{16}\cos (4\theta )+\frac{577}{16}){z}^{4}\\\qquad\qquad\;\;\;+\,(-\frac{3}{8}\cos (2\theta )-\frac{5}{32}\cos (4\theta )+\frac{1297}{32}){z}^{5}\\\qquad\qquad\;\;\;+\,(\frac{9}{16}\cos (2\theta )+\frac{15}{64}\cos (4\theta )+\frac{1677}{64}){z}^{6}\end{array}.$$
(34)

When \(\cos (\theta )=1\), we have \({\lambda }_{\max }^{* 2}=1\), and

$$e=\frac{1}{2}\left[\begin{array}{ccccc}0&0&0&0&1\end{array}\right].$$

The code subspace, spanned by \((\left\vert {0}_{L}\right\rangle ,\left\vert {1}_{L}\right\rangle )\), resides within the ground state space of the Hamiltonian

$$H=-2{Z}_{2}\sum _{i\in \{3,4,5,6\}}{Z}_{i}+\frac{1}{2}\sum _{i\,\in \{3,4,5,6\}}\sum _{\begin{array}{c}j\in \{3,4,5,6\}\\ j\ne i\end{array}}{Z}_{i}{Z}_{j},$$

which is 16-dimensional degenerate, and is spanned by

$$\left\vert 000001\right\rangle ,\left\vert 000010\right\rangle ,\left\vert 000100\right\rangle ,\left\vert 001000\right\rangle ,$$
$$\left\vert 011110\right\rangle ,\left\vert 011101\right\rangle ,\left\vert 011011\right\rangle ,\left\vert 010111\right\rangle ,$$
$$\left\vert 100001\right\rangle ,\left\vert 100010\right\rangle ,\left\vert 100100\right\rangle ,\left\vert 101000\right\rangle ,$$
$$\left\vert 111110\right\rangle ,\left\vert 111101\right\rangle ,\left\vert 111011\right\rangle ,\left\vert 110111\right\rangle .$$

This implies that the signature vector \(\overrightarrow{P}\) lies on the boundary of W(1)({Oα}), where wt(Oα) = 1, 2.

((7, 2, 3)) codes

For the ((7, 2, 3)) case, consider the Steane code with stabilizers

$$\begin{array}{ccccccccc}{g}_{1}&:&X&I&X&I&X&I&X\\ {g}_{2}&:&I&X&X&I&I&X&X\\ {g}_{3}&:&I&I&I&X&X&X&X\\ {g}_{4}&:&Z&I&Z&I&Z&I&Z\\ {g}_{5}&:&I&Z&Z&I&I&Z&Z\\ {g}_{6}&:&I&I&I&Z&Z&Z&Z\end{array}$$

This code has a signature vector \(\overrightarrow{\lambda }=0\), corresponding to λ* = 0. To find the maximum value of λ*, we run our algorithm and observe a sharp transition at \({\lambda }^{* }=\sqrt{7}\), as shown in Fig. 2.

Fig. 2: λ*2 range for ((7, 2, 3)) code.
figure 2

Penalty factor is chosen as μ = 1. The boundary λ*2 = 7 corresponds to permutation invariant code, while at λ*2 = 0 it is Steane code. Inside the region all loss functions are below 10−15.

It turns out that this maximum value \({\lambda }^{* }=\sqrt{7}\) corresponds to the permutation invariant code, which is constructed from the Dicke basis:

$${D}_{n,k}={\left(\begin{array}{c}n\\ k\end{array}\right)}^{-1/2}\sum _{\sigma \in {{\rm{Sym}}}_{n}}\sigma {\left\vert 0\right\rangle }^{\otimes n-k}\otimes {\left\vert 1\right\rangle }^{\otimes k}$$

Two permutation invariant codes are given in16 as:

$$\begin{array}{lll}8\left\vert {0}_{L}\right\rangle\,=\,\sqrt{15}{D}_{7,0}-\sqrt{7}{D}_{7,2}+\sqrt{21}{D}_{7,4}+\sqrt{21}{D}_{7,6}\\ \left\vert {1}_{L}\right\rangle\,\,\,\;=\,{X}^{\otimes 7}\left\vert {0}_{L}\right\rangle \end{array}$$
(35)

and

$$\begin{array}{rcl}8\left\vert {0}_{L}\right\rangle &=&\sqrt{15}{D}_{7,0}+\sqrt{7}{D}_{7,2}+\sqrt{21}{D}_{7,4}-\sqrt{21}{D}_{7,6}\\ \left\vert {1}_{L}\right\rangle &=&{X}^{\otimes 7}\left\vert {0}_{L}\right\rangle \end{array}$$
(36)

Notice that these two codes are local-unitary equivalent.

Now the key question is again, whether the set of all λ*s is connected, i.e., whether the range of λ* is indeed \([0,\sqrt{7}]\). Notice that by permuting the qubits, Steane code can have cyclic symmetry, with logical 0 and logical 1 given by

$$\begin{array}{lll}\left\vert {0}_{L}\right\rangle \,=\,\frac{1}{\sqrt{8}}\left(\left\vert 0000000\right\rangle +\left\vert 1100101\right\rangle +\left\vert 0101110\right\rangle +\left\vert 0010111\right\rangle \right.\\\quad\qquad\,\,\,\left.+\left\vert 1001011\right\rangle +\left\vert 1110010\right\rangle +\left\vert 0111001\right\rangle +\left\vert 1011100\right\rangle \right)\\\quad\;\;\;\,\,=\,\frac{1}{\sqrt{8}}\left\vert 0000000\right\rangle +\sqrt{\frac{7}{8}}\left(\left\vert 0010111\right\rangle +\,\text{cyc.}\,\right)\end{array}$$
(37)

and \(\left\vert {1}_{L}\right\rangle ={X}^{\otimes 7}\left\vert {0}_{L}\right\rangle .\) Here cyc. denotes all the other computational basis states with cyclic shift. Now we will explicitly construct families of cyclic codes with \({\lambda }^{* }\in [0,\sqrt{7}]\).

Let us choose the cyclic basis with even weights:

$$\left\vert \left\{0000000\right\}\right\rangle =\left\vert 0000000\right\rangle$$
$$\left\vert \left\{0000011\right\}\right\rangle =\frac{1}{\sqrt{7}}\left(\left\vert 0000011\right\rangle +\,\text{cyc.}\,\right)$$
$$\left\vert \left\{0000101\right\}\right\rangle =\frac{1}{\sqrt{7}}\left(\left\vert 0000101\right\rangle +\,\text{cyc.}\,\right)$$
$$\left\vert \left\{0001001\right\}\right\rangle =\frac{1}{\sqrt{7}}\left(\left\vert 0001001\right\rangle +\,\text{cyc.}\,\right)$$
$$\left\vert \left\{0001111\right\}\right\rangle =\frac{1}{\sqrt{7}}\left(\left\vert 0001111\right\rangle +\,\text{cyc.}\,\right)$$
$$\left\vert \left\{0011011\right\}\right\rangle =\frac{1}{\sqrt{7}}\left(\left\vert 0011011\right\rangle +\,\text{cyc.}\,\right)$$
$$\left\vert \left\{0011101\right\}\right\rangle =\frac{1}{\sqrt{7}}\left(\left\vert 0011101\right\rangle +\,\text{cyc.}\,\right)$$
$$\left\vert \left\{0101011\right\}\right\rangle =\frac{1}{\sqrt{7}}\left(\left\vert 0101011\right\rangle +\,\text{cyc.}\,\right)$$
$$\left\vert \left\{0010111\right\}\right\rangle =\frac{1}{\sqrt{7}}\left(\left\vert 0010111\right\rangle +\,\text{cyc.}\,\right)$$
$$\left\vert \left\{0111111\right\}\right\rangle =\frac{1}{\sqrt{7}}\left(\left\vert 0111111\right\rangle +\,\text{cyc.}\,\right)$$

Using this basis, we parametrize \(\left\vert {0}_{L}\right\rangle\) and \(\left\vert {1}_{L}\right\rangle\) as follows:

$$\begin{array}{lll}\left\vert {0}_{L}\right\rangle \,=\,{c}_{0}\left\vert \{0000000\}\right\rangle \\\qquad\quad+\,\frac{{c}_{1}}{\sqrt{3}}\left(\left\vert \{0000011\}\right\rangle +\left\vert \{0000101\}\right\rangle +\left\vert \{0001001\}\right\rangle \right)\\\qquad\quad+\,{c}_{2}\left\vert \{0010111\}\right\rangle +\frac{{c}_{3}}{2}\left(\left\vert \{0001111\}\right\rangle +\left\vert \{0011011\}\right\rangle \right.\\\qquad\quad+\,\left.\left\vert \{0011101\}\right\rangle +\left\vert \{0101011\}\right\rangle \right)+{c}_{4}\left\vert \{0111111\}\right\rangle,\\\qquad\quad\left\vert {1}_{L}\right\rangle ={X}^{\otimes 7}\left\vert {0}_{L}\right\rangle \end{array}$$
(38)

Within the five-dimensional subspace given in Eq. (38), KL conditions will lead to three independent equations. Combined with normalization condition, the coefficients (c0, c1, c2, c3, c4) should satisfy the following four equations:

$${c}_{0}^{2}+{c}_{1}^{2}+{c}_{2}^{2}+{c}_{3}^{2}+{c}_{4}^{2}=1$$
(39)
$$\begin{array}{rcl}&&\langle {0}_{L}| {Z}_{i}| {0}_{L}\rangle =0\,\to \,\\ &&7{c}_{0}^{2}+3{c}_{1}^{2}-{c}_{2}^{2}-{c}_{3}^{2}-5{c}_{4}^{2}=0\end{array}$$
(40)
$$\begin{array}{rcl}&&\langle {0}_{L}| {X}_{i}{X}^{\otimes 7}| {0}_{L}\rangle =0\,\to \,\\ &&2\sqrt{7}{c}_{0}{c}_{4}+2\sqrt{3}{c}_{1}{c}_{2}+4\sqrt{3}{c}_{1}{c}_{3}\\ &&+4\sqrt{3}{c}_{1}{c}_{4}+4{c}_{2}{c}_{3}+3{c}_{3}^{2}=0\end{array}$$
(41)
$$\begin{array}{rcl}&&\langle {0}_{L}| {Y}_{i}{X}^{\otimes 7}| {0}_{L}\rangle =0\,\to \,\\ &&2\sqrt{7}{c}_{0}{c}_{4}+2\sqrt{3}{c}_{1}{c}_{2}+4\sqrt{3}{c}_{1}{c}_{3}\\ &&-4\sqrt{3}{c}_{1}{c}_{4}-4{c}_{2}{c}_{3}-3{c}_{3}^{2}=0\end{array}$$
(42)

And for the signature vector, the following components are nonzero, satisfying (for ij):

$$\begin{array}{rcl}&&21\langle {0}_{L}| {X}_{i}{X}_{j}| {0}_{L}\rangle =2\sqrt{21}{c}_{0}{c}_{1}+10{c}_{1}^{2}+4\sqrt{3}{c}_{1}{c}_{2}\\ &&+8\sqrt{3}{c}_{1}{c}_{3}+12{c}_{2}{c}_{3}+6{c}_{2}{c}_{4}+9{c}_{3}^{2}+12{c}_{3}{c}_{4}+6{c}_{4}^{2}\end{array}$$
(43)
$$\begin{array}{rcl}&&21\langle {0}_{L}| {Y}_{i}{Y}_{j}| {0}_{L}\rangle =-2\sqrt{21}{c}_{0}{c}_{1}+10{c}_{1}^{2}-4\sqrt{3}{c}_{1}{c}_{2}\\ &&-8\sqrt{3}{c}_{1}{c}_{3}+12{c}_{2}{c}_{3}-6{c}_{2}{c}_{4}+9{c}_{3}^{2}-12{c}_{3}{c}_{4}+6{c}_{4}^{2}\end{array}$$
(44)
$$21\langle {0}_{L}| {Z}_{i}{Z}_{j}| {0}_{L}\rangle =21{c}_{0}^{2}+{c}_{1}^{2}-3{c}_{2}^{2}-3{c}_{3}^{2}+9{c}_{4}^{2}$$
(45)

From Eq. (41) and Eq. (42) we obtain:

$$\sqrt{7}{c}_{0}{c}_{4}+2\sqrt{3}{c}_{1}{c}_{2}+2\sqrt{3}{c}_{1}{c}_{3}=0$$
(46)
$$4\sqrt{3}{c}_{1}{c}_{4}+4{c}_{2}{c}_{3}+3{c}_{3}^{2}=0$$
(47)

To solve these equations, we first find one solution for c4 (see Supplementary Information B for details):

$${c}_{4}=-\sqrt{3}{c}_{1}$$
(48)

Then Eq. (48) and Eq. (46) derive another linear relation:

$${c}_{2}=-2{c}_{3}+\sqrt{7}{c}_{0}$$
(49)

Plug Eq. (48) and Eq. (49) into Eq. (39), (40), (43), (44), (45), (46) and (47), one finds f (for ij):

$$\,\text{Normalization}\,:\,\quad 8{c}_{0}^{2}-4\sqrt{7}{c}_{0}{c}_{3}+4{c}_{1}^{2}+5{c}_{3}^{2}=1$$
(50)
$$\left\langle {0}_{L}\left\vert {Z}_{i}\right\vert {0}_{L}\right\rangle =0\to \quad 4\sqrt{7}{c}_{0}{c}_{3}-12{c}_{1}^{2}-5{c}_{3}^{2}=0$$
(51)
$$\left\langle {0}_{L}\left\vert {X}_{i}{X}^{\otimes 7}\right\vert {0}_{L}\right\rangle =0\to \quad 4\sqrt{7}{c}_{0}{c}_{3}-12{c}_{1}^{2}-5{c}_{3}^{2}=0$$
(52)
$$\left\langle {0}_{L}\left\vert {Y}_{i}{X}^{\otimes 7}\right\vert {0}_{L}\right\rangle =0\to \quad -4\sqrt{7}{c}_{0}{c}_{3}+12{c}_{1}^{2}+5{c}_{3}^{2}=0$$
(53)
$$21\left\langle {0}_{L}\left\vert {X}_{i}{X}_{j}\right\vert {0}_{L}\right\rangle =\quad 12\sqrt{7}{c}_{0}{c}_{3}+28{c}_{1}^{2}-15{c}_{3}^{2}$$
(54)
$$21\left\langle {0}_{L}\left\vert {Y}_{i}{Y}_{j}\right\vert {0}_{L}\right\rangle =\quad 12\sqrt{7}{c}_{0}{c}_{3}+28{c}_{1}^{2}-15{c}_{3}^{2}$$
(55)
$$21\left\langle {0}_{L}\left\vert {Z}_{i}{Z}_{j}\right\vert {0}_{L}\right\rangle =\quad 12\sqrt{7}{c}_{0}{c}_{3}+28{c}_{1}^{2}-15{c}_{3}^{2}$$
(56)

Since the signature vector components ((54), (55) and (56)) are equal, it is convenient to introduce λ* as a parameter (for ij):

$$21\left\langle {0}_{L}\left\vert {X}_{i}{X}_{j}\right\vert {0}_{L}\right\rangle =\sqrt{7}{\lambda }^{* }$$
(57)
$$21\left\langle {0}_{L}\left\vert {Y}_{i}{Y}_{j}\right\vert {0}_{L}\right\rangle =\sqrt{7}{\lambda }^{* }$$
(58)
$$21\left\langle {0}_{L}\left\vert {Z}_{i}{Z}_{j}\right\vert {0}_{L}\right\rangle =\sqrt{7}{\lambda }^{* }$$
(59)

By eliminating c0 and c3 through Eq. (51) and Eq. (54), we find \({c}_{1}=\pm \frac{\sqrt{\sqrt{7}{\lambda }^{* }}}{8}\). With parameter \({\lambda }^{* }\in [0,\sqrt{7}]\), they become Steane code when λ* = 0, and parametric code at \({\lambda }^{* }=\sqrt{7}\). The following two QECCs are related to QECC in eq. (35):

$$\begin{array}{lll}{c}_{0}\,=\,\frac{\sqrt{\sqrt{7}{\lambda }^{* }+8}}{8},\\ {c}_{1}\,=\,-\frac{\sqrt{\sqrt{7}{\lambda }^{* }}}{8},\\ {c}_{4}\,=\,-\sqrt{3}{c}_{1},\\ {c}_{3}\,=\,\frac{2}{5}\left(\sqrt{7}{c}_{0}\pm \sqrt{7{c}_{0}^{2}-\frac{15\sqrt{7}{\lambda }^{* }}{64}}\right),\\ {c}_{2}\,=\,-2{c}_{3}+\sqrt{7}{c}_{0}\end{array}$$
(60)

The following two correspond to QECC in Eq. (36)

$$\begin{array}{lll}{c}_{0}\,=\,\frac{\sqrt{\sqrt{7}{\lambda }^{* }+8}}{8},\\ {c}_{1}\,=\,\frac{\sqrt{\sqrt{7}{\lambda }^{* }}}{8},\\ {c}_{4}\,=\,-\sqrt{3}{c}_{1},\\ {c}_{3}\,=\,\frac{2}{5}\left(\sqrt{7}{c}_{0}\pm \sqrt{7{c}_{0}^{2}-\frac{15\sqrt{7}{\lambda }^{* }}{64}}\right),\\ {c}_{2}\,=\,-2{c}_{3}+\sqrt{7}{c}_{0}\end{array}$$
(61)

For the quantity inside the square root non-negative, it requires \({\lambda }^{* }\le \sqrt{7}\). The signature vector for these four codes are the same with the following nonzero components (for ij:

$$\left\langle {0}_{L}\right\vert {X}_{i}{X}_{j}\left\vert {0}_{L}\right\rangle =\left\langle {0}_{L}\right\vert {Y}_{i}{Y}_{j}\left\vert {0}_{L}\right\rangle =\left\langle {0}_{L}\right\vert {Z}_{i}{Z}_{j}\left\vert {0}_{L}\right\rangle =\frac{{\lambda }^{* }}{3\sqrt{7}}$$

This means that all the 2-particle reduced density matrix of the code have the form

$${\rho }^{(ij)}=\frac{1}{4}I+\frac{{\lambda }^{* }}{3\sqrt{7}}({X}_{i}{X}_{j}+{Y}_{i}{Y}_{j}+{Z}_{i}{Z}_{j}).$$

Consequently, the matrix \(\left\{{\lambda }_{ij}\right\}\) will be block diagonal, and each block corresponding to XiXj, YiYj, ZiZj correlations, with the form

$$(1-s)I+sJ,s=\frac{{\lambda }^{* }}{3\sqrt{7}}\in [0,\frac{1}{3}].$$

where:

  • I is the 7 × 7 identity matrix.

  • J is the 7 × 7 matrix with all entries equal to 1.

This matrix (1 − s)I + sJ has full rank and with one eigenvalues 6x + 1 and six eigenvalues 1 − s.

For the family given in Eq. (60), weight enumerators is given by

$$\begin{array}{rcl}{A}^{((7,2,3))}&=&1+{\lambda }^{* 2}{z}^{2}+(21-2{\lambda }^{* 2}){z}^{4}+(42+{\lambda }^{* 2}){z}^{6}\\ {B}^{((7,2,3))}&=&1+{\lambda }^{* 2}{z}^{2}+3(7+{\lambda }^{* 2}){z}^{3}+(21-2{\lambda }^{* 2}){z}^{4}\\ &+6(21-{\lambda }^{* 2}){z}^{5}+(42+{\lambda }^{* 2}){z}^{6}+3(15+{\lambda }^{* 2}){z}^{7}.\end{array}$$
(62)

We have also explored all the local Clifford inequivalent ((7, 2, 3)) stabilizer codes, and found that the only possible values of λ* are \(\{0,\sqrt{1},\sqrt{2},\sqrt{3},\sqrt{5}\}\) (see30 for details). For instance, the Bare code31 corresponds to \({\lambda }^{* }=\sqrt{5}\).

When \({\lambda }^{* }={\lambda }_{\max }^{* }=\sqrt{7}\), the code subspace, spanned by \((\left\vert {0}_{L}\right\rangle ,\left\vert {1}_{L}\right\rangle )\), resides within the ground state space of the Hamiltonian

$$H=-\sum _{i\ne j}\left({X}_{i}{X}_{j}+{Y}_{i}{Y}_{j}+{Z}_{i}{Z}_{j}\right).$$

This ground state space is 8-dimensional and corresponds to the symmetric subspace spanned by the Dicke basis. This implies that the signature vector \(\overrightarrow{P}\) lies on the boundary of W(1)({Oα}), where wt(Oα) = 1, 2.

Discussion

We introduce a local-unitary invariant λ*(P), built from the off-diagonal Knill-Laflamme coefficients, and characterize its attainable range via optimization over the Stiefel manifold. For ((6, 2, 3)) and ((7, 2, 3)) codes, we identify continuous families of nonadditive codes that interpolate between extremal values of λ*. These numerical observations are corroborated by explicit analytic constructions of the same families, thereby certifying that λ* varies continuously in the exact KL regime.

Our analysis is set in the exact Knill-Laflamme (KL) regime, where both the optimal recovery and the Petz (transpose) recovery achieve entanglement fidelity Fe = 1 for the designed error set. In this regime, λ* is not a performance proxy; rather, it characterizes the internal pattern of error correlations within exact codes. For approximate error correction, Fe is governed instead by the size of the KL residuals PFαPλαP, not by λ* itself. Although a direct comparison therefore lies outside our present scope, the numerical framework extends naturally to the approximate setting (by incorporating a penalty term for KL residuals) and can report λ* alongside a residual norm that correlates with, and is expected to control, Fe (for both optimal and Petz recovery). A systematic study of this joint landscape is a promising direction for future work.

The continuity observed in λ* for distance-3 codes suggests an organizing principle for nonadditive constructions. Clarifying, in greater generality, when the λ* range is connected, and developing explicit fidelity bounds conditioned on small KL residuals while stratified by λ*, are natural next steps. Furthermore, the present framework served as the methodological foundation for our subsequent study on transversal gates32. By adapting the Stiefel-manifold optimization approach developed here, we were able to enforce both the Knill-Laflamme conditions and target transversal-group constraints, ultimately discovering new codes with non-Clifford transversal gates. This continuity highlights the broader applicability of the λ*-based approach to code discovery problems.

Finally, because λ* depends on the behavior of RDMs, exploring its connection to quantum entanglement measures, such as concentratable entanglement33, may yield new insights into the structure and effectiveness of quantum codes. A deeper grasp of how λ*, entropy, and entanglement measures interrelate could provide a stronger theoretical foundation for designing and improving quantum error-correcting codes.

Methods

Algorithm for calculating range of λ *

To parameterize the code space P, we use Stiefel manifold:

$${\rm{St}}\left(m,n\right)=\left\{x\in {{\mathbb{C}}}^{m\times n}:m\ge n,{x}^{\dagger }x={I}_{n}\right\}.$$

Parametrization for Stiefel manifold is given by:

$$\begin{array}{rcl}&&f:{{\mathbb{C}}}^{m\times n}\to {\rm{St}}(m,n)\\ &&:\theta \longmapsto \theta {({\theta }^{\dagger }\theta )}^{-1/2}\end{array}$$
(63)

Above is the polar decomposition which maps (full rank) complex matrix \(\theta \in {{\mathbb{C}}}^{m\times n}\) to a Stiefel matrix and all Stiefel matrices can be generated in such a way34. We embed the code subspace into Stiefel manifold:

$$\Psi =\left\{\left\vert {\psi }_{i}\right\rangle :i=1,\cdots \,,K\right\}\in {\rm{St}}\left({2}^{n},K\right)\subseteq {{\mathbb{C}}}^{{2}^{n}\times K}.$$

For the parametrized states Ψ (not a valid code yet), we can calculate the tensor \({\tilde{\lambda }}_{\alpha ,i,j}=\langle {\psi }_{i}| {O}_{\alpha }| {\psi }_{j}\rangle\). For the subspace to be a valid code, the following loss term \({{\mathcal{L}}}_{{\rm{KL}}}\) should be optimized to zero:

$${{\mathcal{L}}}_{{\rm{KL}}}\left(\theta \right)=\mathop{\sum}\limits_{\alpha ,i\ne j}{\left\vert {\tilde{\lambda }}_{\alpha ,i,j}\right\vert }^{2}+\mathop{\sum}\limits_{\alpha ,i}{\left({\tilde{\lambda }}_{\alpha ,i,i}-{\left\langle {\tilde{\lambda }}_{\alpha ,i,i}\right\rangle }_{i}\right)}^{2}$$
(64)
$${\text{where}}\,{\left\langle {\tilde{\lambda }}_{\alpha ,i,i}\right\rangle }_{i}=\frac{1}{K}\mathop{\sum}\limits_{i}{\tilde{\lambda }}_{\alpha ,i,i}$$

The two loss terms in \({{\mathcal{L}}}_{{\rm{KL}}}\) are introduced to ensure the validity of the code and penalize the deviation from the KL conditions. To find the minimum length of λ vector, we can optimize the following loss

$${{\mathcal{L}}}_{\underline{\lambda }}\left(\theta ;\mu \right)=\mu {{\mathcal{L}}}_{{\rm{KL}}}+{\left\Vert \tilde{\lambda }\right\Vert }_{2}^{2},{\left\Vert \tilde{\lambda }\right\Vert }_{2}=\sqrt{\sum _{\alpha }{\left\langle {\tilde{\lambda }}_{\alpha ,i,i}\right\rangle }_{i}^{2}}$$
(65)

with \({{\mathcal{L}}}_{{\rm{KL}}}\) added as penalty and the hyper-parameter μ control the penalty strength. For a large enough μ, the optimal value of \({{\mathcal{L}}}_{\underline{\lambda }}\) should correspond to λ with minimum length.

Similarly, to find the maximal length of λ, we optimize the following loss function:

$${{\mathcal{L}}}_{\overline{\lambda }}\left(\theta ;\mu \right)=\mu {{\mathcal{L}}}_{{\rm{KL}}}-{\left\Vert \tilde{\lambda }\right\Vert }_{2}^{2}.$$
(66)

To find whether a code exists with length of λ equal to λ*, we can define such a loss function:

$${\mathcal{L}}\left(\theta ;\mu ,{\lambda }^{* }\right)=\mu {{\mathcal{L}}}_{{\rm{KL}}}+{\left({\left\Vert \tilde{\lambda }\right\Vert }_{2}^{2}-{\lambda }^{* 2}\right)}^{2}.$$
(67)

Notice that similarly one can also find the code with a predefined vector \(\overrightarrow{\lambda }\), just choose the loss function as:

$${\mathcal{L}}\left(\theta ;\mu ,\overrightarrow{\lambda }\right)=\mu {{\mathcal{L}}}_{{\rm{KL}}}+{\left\Vert \tilde{\lambda }-\overrightarrow{\lambda }\right\Vert }_{2}^{2}.$$
(68)