# Optimal encoding of two dissipative interacting qubits

G. Di Bello1 G. De Filippis2,3∗ A. Hamma1,3∗ C. A. Perroni2,3∗ 1Dip. di Fisica
E. Pancini - Università di Napoli Federico II - I-80126 Napoli, Italy  2SPIN-
CNR and Dip. di Fisica E. Pancini - Università di Napoli Federico II - I-80126
Napoli, Italy  3INFN, Sezione di Napoli - Complesso Universitario di Monte S.
Angelo - I-80126 Napoli, Italy

###### Abstract

We investigate a system of two coupled qubits interacting with an Ohmic bath
as a physical model for the implementation of one logical qubit. In this
model, the interaction with the other qubit represents unitary noise while the
Ohmic bath is responsible for finite temperature. In the presence of a one-
dimensional decoherence-free subspace (DFS), we show that, while this is not
sufficient to protect a qubit from decoherence, it can be exploited to encode
one logical qubit with greater performance than the physical one. We show
different possible strategies for the optimal encoding of a logical qubit
through a numerical analysis based on matrix product states. This method
reproduces faithfully the results of perturbative calculations, but it can be
extended to cases of crucial interest for physical implementations, e.g., in
the case of strong coupling with the bath. As a result, a logical qubit
encoded in the subspace which is the direct sum of the antiferromagnetic
states in Bell basis, the DFS and the one in the triplet, is the optimally
robust one, as it takes advantage of both the anchoring to the DFS and the
protection from the antiferromagnetic interaction.

∗These authors contributed equally to this work, and their names are listed in
alphabetical order.

##  I Introduction

Optimal control of a qubit is of fundamental importance for the implementation
of quantum technologies, the construction of reliable quantum devices, and
quantum information processing [1, 2, 3].

In the past two decades, there has been a significant increase of interest in
the encoding of information in quantum computing, both from experimental and
theoretical perspectives [4, 5]. This surge of interest can be attributed to
the ongoing need for improved techniques for optimal control in quantum
systems. Researchers have developed and widely employed active and passive
methods to protect quantum systems from decoherence and environmental effects.
Active approaches involve the use of quantum error correction codes (QECCs)
[6], while passive approaches are focused on noiseless quantum codes such as
DFS or topological codes [7].

Extensive studies have focused on DFS implementation, including investigations
of quantum registers [8] and the pairing of qubits with ancillas [9].
Experimental demonstrations conducted during this time have showcased the
ability of quantum computers to execute algorithms such as Shor’s
factorization [10] and Grover’s search [11] by encoding information in DFS.
Moreover, in [12] universal control was demonstrated in a DFS-encoded qubit in
a system of two nuclear spins using liquid state nuclear magnetic resonance
techniques.

However, several limitations have been identified regarding the use of DFS in
real experimental implementations [13]. In practice, they depend on the fact
that DFS are based on fine tuned symmetries that are hardly realistic. More
realistically, though, the noise model may break most symmetries and shrink
them to a point where they are useless.

In recent years, attempts have been made to generalize the idea of DFS and
combine it with other methods, such as dynamical decoupling, to achieve better
performance in quantum computation with spin chains [14]. Furthermore,
researchers have explored the application of DFS in various systems, ranging
from solid-state qubits implementations to wave-guide quantum electrodynamics
[15, 16, 17].

In this work, we study a model where a single qubit is interacting unitarily
with another qubit, and both qubits are placed in a Ohmic bath. As a result,
there is no two-dimensional DFS and therefore no protected qubit. However, a
one-dimensional DFS survives. One may think of making a qubit with two such
DFSs, but then one should take into account the coupling between these two
degrees of freedom. Similarly, one can make one qubit by taking the DFS and
another one-dimensional subspace in the space of two qubits. Both cases model
the presence of additional unitary noise. In this work, we focus on the
latter, more fundamental case, which includes the fact that once one couples a
DFS to another subspace that is subject to dissipation, then the whole qubit
is spoiled.

And yet, one is tempted to think that anchoring part of the qubit to the DFS
might increase its protection, as some of the decaying rates are cancelled, as
it was shown in the perturbative case in [18]. In this work, we thoroughly
study the optimal encoding of a logical qubit by exploiting the DFS, and using
the MPS ansatz of tensor networks [19, 20, 21, 22] numerical technique that
allows us to go beyond the weak-coupling limit and consider system-bath
interactions [23, 24, 25, 26] that are more realistic and amenable to
experimentation.

We find that all the logical encodings that exploit the DFS perform better
than the physical qubits. Moreover, we find that the optimal encoding results
in the qubit made of the DFS and the other antiferromagnetic state in the
triplet. In this way, both symmetry of the interaction with the bath and of
the spin-spin interaction conspire to achieve the best performance.

We begin by summarizing the main results of this work in Sect. II, where we
examine the logical subspace of the encoded qubit for three different
strategies and compare it with the physical one. We demonstrate that the
antiferromagnetic strategy is the optimal choice. In Sect. III, we present the
dissipative model comprising two interacting qubits in an Ohmic bath, along
with the spectrum of the closed system Hamiltonian. Additionally, we analyze
the effects of the bath on the free evolution of the open system for the
physical qubits through the fidelity in Subsect. III.1. Next, in Sect. IV, we
introduce three encoding strategies (Subsubsects. IV.1.1, IV.1.2, and IV.1.3)
that encode information from the two physical qubits into one logical qubit.
We proceed to optimize these strategies and compare their performance in
Subsect. IV.2, using fidelity and leakage (defined in the main text) as
measures of the effect of the bath on the chosen encoding strategy. Then, we
analyze what happens in the new logical subspace to the purity of the best
strategies (Subsect. IV.3). Finally, in the concluding section, Sect. V, we
summarize and further discuss our findings. In Appendix A, we compare the
Lindblad master equation solutions and the MPS numerical simulations.
Furthermore, in Appendix B we observe that also the fidelity in the logical
subspace of the best encoded qubit remains very high during the evolution.
Finally, in Appendix C we examine the impact of increasing system-bath
coupling on the best encoding strategy we have identified.

##  II Overview of the key findings

In this work, we present strategies (AF, SYMM, NSYMM, see Sect. IV) for
encoding information in a qubit subjected to both unitary and non-unitary
noises. We demonstrate that by optimizing with respect to the fidelity of free
evolution compared to evolution in the presence of the environment, these
strategies outperform simply encoding information in a physical qubit. This is
evident in Figure 1, where we operate within the new logical subspaces chosen
to implement these encoding strategies and average over the pure states
located on the surface of the new logical Bloch sphere. The figure illustrates
fidelity (Figure 1.a), which measures the effect of the bath on the encoded
qubit’s dynamics, and purity (Figure 1.b), which remains near 1, ensuring us
that the new qubit remains in a quantum state.
Furthermore, from the plots, we can discern that the best strategy is the AF
(Antiferromagnetic) strategy, with more details provided in Sect. IV.1.1. In
fact, the fidelity consistently oscillates around a value of 0.98 (see the
inset in Figure 1.a) throughout our simulation time, while the purity exhibits
a similar trend for extended time intervals around an asymptotic value of
0.97. This exceptional performance of the AF strategy stems from our
utilization of the two antiferromagnetic states in the Bell basis for the up
and down states, harnessing the power of the DFS and the antiferromagnetic
interaction ($\nu=-5\Delta$). Consequently, we establish a quasi-one-
dimensional DFS that exhibits remarkable resilience to bath effects over
extended durations and in the presence of a significantly strong coupling to
the environment.

Figure 1: Fidelity $F(t)$ of the free evolution with the open system evolution
($a$) and purity $P(t)$ ($b$) for encoded qubits AF (red circle), SYMM (blue
square), NSYMM (green triangle) (more details on the definition in the main
text) and one physical qubit (orange pentagon) as functions of dimensionless
time $\Delta t$ for $\nu=-5\Delta$, $\alpha=0.01$, and the initial state
$\ket{\psi_{L}(0)}=\cos{\theta}\ket{\uparrow_{L}}+e^{i\phi}\sin{\theta}\ket{\downarrow_{L}}$
where $\theta$ and $\phi$ sample all the logical qubit Hilbert space. We
average the fidelity and the purity over $18$ realizations of these angles.
The dots in the plots correspond to the average value of the fidelity and the
purity, while the shaded regions around them show the range of values covered
by the standard deviation of the fidelity and the purity.

##  III Dissipative two interacting qubits model

We are considering a system of two interacting qubits immersed in an Ohmic
common bath, which is composed of a set of $N$ harmonic oscillators. The model
we are considering assumes a zero temperature thermal bath and we set
$\hbar=1$. The Hamiltonian that describes the system is given by:

$H=H_{qub}+H_{bath}+H_{qub-bath}.$ (1)

Here, the qubits energy $H_{qub}$ is

$H_{qub}=-\frac{\Delta}{2}(\sigma_{x}^{1}+\sigma_{x}^{2})-\frac{\nu}{2}\sigma_{z}^{1}\sigma_{z}^{2},$
(2)

with $\Delta$ the frequency of the two qubits, labelled with the superscripts
1 or 2, $\nu$ the strength of the interaction between them and
$\sigma_{i}^{j}$, with $i=x,y,z$ and $j=1,2$, the Pauli matrices. The bath
Hamiltonian $H_{bath}$ is

$H_{bath}=\sum_{i=1}^{N}\omega_{i}a^{\dagger}_{i}a_{i},$ (3)

with $\omega_{i}$ the frequencies of the bath modes and $a_{i}$
($a^{\dagger}_{i}$) the annihilation (creation) operators for the $N$ harmonic
oscillators. The qubits-bath interaction Hamiltonian $H_{qub-bath}$ is given
by:

$H_{qub-
bath}=(\sigma_{z}^{1}+\sigma_{z}^{2})\sum_{i=1}^{N}\lambda_{i}(a_{i}+a^{\dagger}_{i}),$
(4)

with $\lambda_{i}$ the couplings between each qubit and each bath mode. We set
the coupling in this way because the long-wavelength limit applies to the case
of two qubits [27]. The coupling to the bath $\alpha$ is defined in such a way
that the bath spectral density $J(\omega)$ can be written as follows:

$J(\omega)=\sum_{i=1}^{N}\mid\lambda_{i}\mid^{2}\delta(\omega-\omega_{i})=\frac{\alpha}{2}\omega
f\left(\frac{\omega}{\omega_{c}}\right),$ (5)

where $f\left(\frac{\omega}{\omega_{c}}\right)$ is a function depending on the
cutoff frequency for the bath modes $\omega_{c}$, ruling the behavior of the
spectral density at high frequencies. This function can be
$f\left(\frac{\omega}{\omega_{c}}\right)=\Theta\left(\frac{\omega_{c}}{\omega}-1\right)$,
where $\Theta(x)$ is the Heaviside step function or an exponential decay
$f\left(\frac{\omega}{\omega_{c}}\right)=e^{-\frac{\omega}{\omega_{c}}}$. This
cutoff frequency is typically chosen to be of the order of the largest energy
scale in the system.
To gain a deeper understanding of how states affect the dynamic behavior of
the system, we begin by diagonalizing the closed Hamiltonian $H_{0}=H_{qub}$.
The resulting spectrum is shown in Figure 2:

$\frac{E\left(\frac{\nu}{\Delta}\right)}{\Delta}=\left\\{-\sqrt{1+\left(\frac{\nu}{2\Delta}\right)^{2}};\,-\frac{\nu}{2\Delta};\,\frac{\nu}{2\Delta};\,\sqrt{1+\left(\frac{\nu}{2\Delta}\right)^{2}}\right\\}.$
(6)

Figure 2: Energy spectrum (in units of $\Delta$) of the closed system
consisting of two interacting qubits, as described by the Hamiltonian
$H_{qub}$, as a function of the ratio $\nu/\Delta$.

The corresponding four eigenstates of the closed system can be written in the
Bell basis [28]
$\left\\{\ket{S}\equiv\ket{\Psi^{-}},\,\,\ket{T,AF}\equiv\ket{\Psi^{+}},\,\,\ket{T,F+}\equiv\ket{\Phi^{+}},\right.$
$\left.\ket{T,F-}\equiv\ket{\Phi^{-}}\right\\}$, where the subscript $S$
stands for “singlet”, while $T$ for “triplet”, and the specifications $AF$ and
$F$, respectively, for “antiferromagnetic” and “ferromagnetic”. Hence, the
Hamiltonian eigenstates read:

$\displaystyle\ket{0}=$ $\displaystyle
a\left(\frac{\nu}{\Delta}\right)\ket{T,AF}-b\left(\frac{\nu}{\Delta}\right)\ket{T,F+}$
(7) $\displaystyle\ket{1}=$ $\displaystyle\ket{T,F-}$ (8)
$\displaystyle\ket{2}=$ $\displaystyle\ket{S}$ (9) $\displaystyle\ket{3}=$
$\displaystyle
a\left(\frac{\nu}{\Delta}\right)\ket{T,F+}+b\left(\frac{\nu}{\Delta}\right)\ket{T,AF},$
(10)

where $0,1,2,3$ go from the ground state ($0$) to the most excited one ($3$).
The two coefficients $a$ and $b$ depend only on the parameters of the
Hamiltonian and are defined as:

$\displaystyle a\left(\frac{\nu}{\Delta}\right)$
$\displaystyle=\frac{2}{\sqrt{4+\left(\frac{\nu}{\Delta}+\sqrt{4+\left(\frac{\nu}{\Delta}\right)^{2}}\right)^{2}}}$
(11) $\displaystyle b\left(\frac{\nu}{\Delta}\right)$
$\displaystyle=-\frac{\sqrt{4+\left(\frac{\nu}{\Delta}\right)^{2}}+\frac{\nu}{\Delta}}{\sqrt{4+\left(\frac{\nu}{\Delta}+\sqrt{4+\left(\frac{\nu}{\Delta}\right)^{2}}\right)^{2}}}.$
(12)

To thoroughly explore the entire Hilbert space and identify the optimal
encoding strategy that remains independent of the initial state, we opt to
sample from a uniform distribution. Specifically, we set the initial state as
a linear combination of the singlet $\ket{S}$ and the triplet in the Bell
basis $\left\\{\ket{T,AF},\ket{T,F+},\ket{T,F-}\right\\}$ as follows:

$\displaystyle\ket{\psi(0)}$ $\displaystyle=d_{S}\ket{S}+d_{T,AF}\ket{T,AF}$
$\displaystyle+d_{T,F+}\ket{T,F+}+d_{T,F-}\ket{T,F-}.$ (13)

Here, the coefficients $d_{T,AF},d_{T,F+},$ and $d_{T,F-}$ are complex
numbers, but their squared magnitudes can take on one of the values
$\\{0.0,0.25,0.5,0.75,1.0\\}$, and their phases can be one of the values
$\left\\{0,\frac{\pi}{2},\pi,\frac{3}{2}\pi\right\\}$. To satisfy the
normalization condition, we take the last coefficient, $d_{S}$, to be real and
set it to $\sqrt{1-|d_{T,AF}|^{2}-|d_{T,F+}|^{2}-|d_{T,F-}|^{2}}$. By removing
the double counting of states, we obtain $332$ different realizations of the
initial state, over which we compute the average fidelity over time.
In order to verify if our sampling of the entire Hilbert space is sufficiently
faithful, we compute the quantity:

$\left|\left|\frac{1}{M}\sum_{i=1}^{M}\rho_{i}(0)-\frac{\mathrm{I}}{4}\right|\right|_{F},$
(14)

where $M$ is the number of realizations, in our case $332$, $\rho_{i}(0)$ is
the initial state of the i-th realization, $\mathrm{I}$ is the identity
matrix, and the used matrix norm is the Frobenius one. We expect this norm to
be zero if the sampling is correct, and indeed it is zero within our numerical
precision ($\leq 10^{-15}$).

###  III.1 Bath effects on the qubits

Our goal is to investigate the influence of the bath on the physical qubits
and the encoded qubit. To achieve this, we compute the Uhlmann fidelity $F$ of
the density matrix of the open system, $\rho^{o}(t)$, with respect to that of
the closed system (without bath interaction) $\rho^{c}(t)$ [28] by using MPS
numerical simulations (Appendix A):

$F\left[\rho^{o}(t),\rho^{c}(t)\right]=Tr\left\\{\sqrt{\sqrt{\rho^{o}(t)}\rho^{c}(t)\sqrt{\rho^{o}(t)}}\right\\}.$
(15)

We use $\Delta$ as the energy unit and set the value of the coupling to the
bath, $\alpha$, in the range of $[0.005,0.02]$ (Appendix C). This range allows
us to analyze the typical coupling regime where the effect of the bath can be
detrimental [24, 29]. We also analyze the system for different values of
$\nu$, specifically $\nu=\\{-5,0,5\\}\Delta$.

Figure 3: Fidelity $F(t)$ of the free evolution of one physical qubit with the
open system evolution as a function of dimensionless time $\Delta t$ for
$\alpha=0.01$ and $\nu=-5\Delta$ (red circle), $\nu=0\Delta$ (blue square),
$\nu=5\Delta$ (green triangle) in $(a)$ and for $\nu=-5\Delta$ and
$\alpha=0.005$ (red circle), $\alpha=0.01$ (blue square), $\alpha=0.02$ (green
triangle) in $(b)$. The initial state is
$\ket{\psi(0)}=d_{S}\ket{S}+d_{T,AF}\ket{T,AF}+d_{T,F+}\ket{T,F+}+d_{T,F-}\ket{T,F-}$,
where $d_{S}$, $d_{T,AF}$, $d_{T,F+}$ and $d_{T,F-}$ sample all the two-qubits
Hilbert space. We average the fidelity over $332$ realizations of these
coefficients. The dots in the plots correspond to the average value of the
fidelity, while the shaded regions around them in light colors show the range
of values covered by the standard deviation of the fidelity.

When examining the fidelity of a single physical qubit over time, averaged
over all possible initial states (see Figure 3), we observe a minimum value at
short times of about $0.8$ for the mean value and $0.6$, considering the
standard deviation, for all values of $\alpha$ and $\nu$. In particular, when
varying the interaction strength $\nu$ (see Figure 3.a), we observe that the
worst-case scenario occurs for $\nu=0\Delta$, both for the mean value of the
oscillations and the standard deviation. The behavior is similar for the other
two values of $\nu$. However, in the ferromagnetic case, there is a decreasing
mean value of the oscillations, while in the antiferromagnetic case, the mean
value is almost constant and higher than the others. Figure 3.b shows that
decreasing $\alpha$ results in the same fidelity behavior, but with lower
oscillation frequencies. This finding is consistent with the limit of $\alpha$
approaching zero, where the fidelity must remain constantly one, and
therefore, the oscillation frequency is zero.
Given this worst-case behavior for a single physical qubit, we need to
determine the optimal way to encode information into a logical qubit.
For the remainder of the paper, we focus on the results obtained for
$\alpha=0.01$ and $\nu=-5\Delta$, as they are the most interesting and
promising. This coupling strength value takes advantage of the
antiferromagnetic interaction, which can help mitigate the effects of the bath
(the exact elimination of the bosonic degrees of freedom induces an effective
ferromagnetic time retarded interaction between the two spins). In Appendix C,
we demonstrate how increasing the coupling to the bath affects the optimal
encoding strategy.

##  IV Optimal encodings in one logical qubit

The general idea is to encode the logical up and down states in other states.
In particular, we choose these states to be the Bell states or a linear
combination of them. We define the logical up $\ket{\psi_{\uparrow_{L}}}$ and
logical down $\ket{\psi_{\downarrow_{L}}}$ as follows:

$\displaystyle\ket{\psi_{\uparrow_{L}}}$
$\displaystyle=\sum_{i=1}^{N_{\uparrow}}l_{i}\ket{\psi_{i}}$ (16)
$\displaystyle\ket{\psi_{\downarrow_{L}}}$
$\displaystyle=\sum_{i=1}^{N_{\downarrow}}k_{i}\ket{\phi_{i}},$ (17)

where $N_{\uparrow}$ and $N_{\downarrow}$ are the dimensions of the subspaces
chosen for the encoding, and $\psi_{i}$ and $\phi_{i}$ are the states that
span the subspaces, respectively[4]. The normalization conditions are
satisfied such that $\sum_{i=1}^{N_{\uparrow}}|l_{i}|^{2}=1$ and
$\sum_{i=1}^{N_{\downarrow}}|k_{i}|^{2}=1$.
With this choice, the generic state of the encoded qubit is given by:
$\ket{\psi^{E}}=\alpha\ket{\psi_{\uparrow_{L}}}+\beta\ket{\psi_{\downarrow_{L}}}$,
where $\alpha$ and $\beta$ are complex coefficients satisfying the
normalization condition $|\alpha|^{2}+|\beta|^{2}=1$. To represent the encoded
qubit, we need to find the new Pauli operators $\sigma_{i}^{E}$, where
$i=x,y,z$. These operators are given by:

$\displaystyle\sigma_{x}^{E}$
$\displaystyle=\ket{\psi_{\uparrow_{L}}}\bra{\psi_{\downarrow_{L}}}+\ket{\psi_{\downarrow_{L}}}\bra{\psi_{\uparrow_{L}}}$
(18) $\displaystyle\sigma_{y}^{E}$
$\displaystyle=-i\ket{\psi_{\uparrow_{L}}}\bra{\psi_{\downarrow_{L}}}+i\ket{\psi_{\downarrow_{L}}}\bra{\psi_{\uparrow_{L}}}$
(19) $\displaystyle\sigma_{z}^{E}$
$\displaystyle=\ket{\psi_{\uparrow_{L}}}\bra{\psi_{\uparrow_{L}}}-\ket{\psi_{\downarrow_{L}}}\bra{\psi_{\downarrow_{L}}}.$
(20)

These operators allow us to define the encoded qubit state:

$\rho^{E}(t)=\frac{1}{2}\begin{pmatrix}1+\langle\sigma_{z}^{E}(t)\rangle&\langle\sigma_{x}^{E}(t)\rangle-i\langle\sigma_{y}^{E}(t)\rangle\\\
\langle\sigma_{x}^{E}(t)\rangle+i\langle\sigma_{y}^{E}(t)\rangle&1-\langle\sigma_{z}^{E}(t)\rangle\end{pmatrix}.$
(21)

###  IV.1 Encoding strategies and optimization

Our approach involves utilizing the singlet and triplet subspaces to encode
one logical qubit in the two physical qubits. In the following sections, we
present our three proposed encoding strategies and their respective
optimizations.

####  IV.1.1 Antiferromagnetic single-level encoding

Due to the presence of an antiferromagnetic interaction ($\nu=-5\Delta$), here
we utilize a single-level encoding (SLE) strategy to encode information in the
two physical qubits. Specifically, we select the singlet state $\ket{S}$ as
the logical up state, which is also an eigenstate of the closed Hamiltonian
$\left(\ket{2}\right)$, and the antiferromagnetic state of the triplet in the
Bell basis $\ket{T,AF}$ as the logical down state. This encoding strategy,
which we refer to as “antiferromagnetic” encoding, works by exploiting the
properties of the singlet state and the antiferromagnetic bath interaction to
create a sort of semi-DF-subspace encoding. The singlet state, indeed, is
decoherence-free, while the antiferromagnetic state of the triplet in the Bell
basis is the state that is most protected by the antiferromagnetic
interaction. By encoding information in these two states, we can mitigate
errors and noise caused by the bath, which makes our system more robust and
reliable.

####  IV.1.2 Symmetric multilevel encoding

Here we consider as a possible implementation of the multilevel encoding (MLE)
strategy the “symmetric” case in which use an equal number of states to span
the two logical subspaces.
In particular, we select two antiferromagnetic states from the Bell basis,
$\ket{S}$ and $\ket{T,AF}$, to span the logical up subspace. Similarly, we
choose two ferromagnetic states, $\ket{\psi_{F,+}}$ and $\ket{\psi_{F,-}}$, to
span the logical down subspace. The logical up and down can be expressed as:

$\displaystyle\ket{\psi_{\uparrow_{L}}^{SM}}$
$\displaystyle=l_{S}^{SM}\ket{S}+l_{T,AF}^{SM}\ket{T,AF}$ (22)
$\displaystyle\ket{\psi_{\downarrow_{L}}^{SM}}$
$\displaystyle=k_{T,F+}^{SM}\ket{T,F+}+k_{T,F-}^{SM}\ket{T,F-}$ (23)

where $l_{S}^{SM}$ and $l_{T,AF}^{SM}$ are coefficients representing the
contributions of the logical up states, and $k_{T,F+}^{SM}$ and
$k_{T,F-}^{SM}$ are coefficients representing the contributions of the logical
down states. It’s important to note that these states are normalized, so
$|l_{S}^{SM}|^{2}+|l_{T,AF}^{SM}|^{2}=|k_{T,F+}^{SM}|^{2}+|k_{T,F-}^{SM}|^{2}=1$.
We also vary these coefficients to find the best encoding strategy.
We first check that the phases of the coefficients have only a slight effect
on the oscillations of the standard deviation of the fidelity. Therefore, we
set the coefficients to be real. We vary the squared modulus of $l_{S}^{SM}$
and $k_{T,F+}^{SM}$ in the interval $\left\\{0.25,0.50,0.75\right\\}$, and the
other coefficients are determined by normalization, resulting in an “optimal
symmetric” encoding (OPTSYMM). We then observe the effect of this encoding on
the fidelity of the qubit over time. Figure 4 shows that increasing
$l_{s}^{SM}$ (or decreasing $l_{T,AF}^{SM}$) leads to a higher asymptotic
value of the fidelity. When $l_{S}^{SM}$ and $l_{T,AF}^{SM}$ are fixed,
varying $k_{T,F+}^{SM}$ and $k_{T,F-}^{SM}$ only affects the frequency of the
oscillations, with a slight improvement in fidelity for the lower value of
$k_{T,F+}^{SM}$, which corresponds to the main contribution to the most
excited eigenstate of the closed Hamiltonian.

Figure 4: Fidelity $F(t)$ of the free evolution of the encoded qubits OPTSYMM
with the open system evolution for different values of $l_{S}^{SM}$ and
$k_{T,F+}^{SM}\in\left\\{0.25,0.50,0.75\right\\}$ (rainbow colours from violet
to red) as a function of dimensionless time $\Delta t$ for $\nu=-5\Delta$,
$\alpha=0.01$, and the initial state
$\ket{\psi(0)}=d_{S}\ket{S}+d_{T,AF}\ket{T,AF}+d_{T,F+}\ket{T,F+}+d_{T,F-}\ket{T,F-}$,
where $d_{S}$, $d_{T,AF}$, $d_{T,F+}$ and $d_{T,F-}$ sample all the two-qubits
Hilbert space. We average the fidelity over $332$ realizations of these
coefficients.

To optimize the encoding strategy, we fit the curve in our range of time with
four parameters $c_{i}$, where $i=1,\dots,4$, using the following function:

$F_{FIT}\left[\rho^{o}(t),\rho^{c}(t)\right]=c_{1}+c_{2}t+(1-c_{1})\cos(c_{3}t)e^{-c_{4}t}.$
(24)

This function takes into account the linear behavior of the average ($c_{2}$)
and the damped oscillations, where $c_{3}$ determines the frequency of the
oscillations and $c_{4}$ determines the rate of decay. The parameter $c_{1}$
ensures that the fitted curve starts at the value of $1$, which is defined as
the absence of any bath effect.
To determine the best encoding parameters and coefficients, we analyze how the
fitting parameters depend on $l_{S}^{SM}$ and $k_{T,F+}^{SM}$ and how they
relate to the fidelity over time. To examine the asymptotic behavior of the
fidelity, we take its value from the numerical data at time $\Delta t=100$ and
extrapolate it from the fit at time $\Delta t=200$ (respectively Figure 5.b
and 5.c).
We can stop our analysis at $\Delta t=200$ because the large $\tau=1/c_{4}$
value from the fit, which quantifies the decay, is approximately $75$, as
shown in Figure 5.d. Therefore, we have already observed the complete behavior
of the system over the time interval of $\Delta t=200$.
We observe that the higher the value of $l_{S}^{SM}$, the higher the fidelity
of the encoding strategy becomes. If we further increase its contribution, the
$c_{2}$ coefficient passes through zero and becomes slightly positive,
although it remains on the order of $10^{-4}$. Therefore, we choose
$l_{S}^{SM}=\sqrt{3}/2$ and $k_{T,F+}^{SM}=1/2$ as the best encoding in the
symmetric case.

Figure 5: Fidelity$F(t)$ of the free evolution of the encoded qubits OPTSYMM
with the open system evolution for different values of $l_{S}^{SM}$ and
$k_{T,F+}^{SM}\in\left\\{0.25,0.50,0.75\right\\}$ (rainbow colours from violet
to red) as a function of dimensionless time $\Delta t$ for $\nu=-5\Delta$,
$\alpha=0.01$, and the initial state
$\ket{\psi(0)}=d_{S}\ket{S}+d_{T,AF}\ket{T,AF}+d_{T,F+}\ket{T,F+}+d_{T,F-}\ket{T,F-}$,
where $d_{S}$, $d_{T,AF}$, $d_{T,F+}$ and $d_{T,F-}$ sample all the two-qubits
Hilbert space. We average the fidelity over $332$ realizations of these
coefficients. In the plot $(a)$ there is the parameter $c_{2}$ responsible of
the linear behavior, while in $(d)$ we observe the decay rate $\tau=1/c_{4}$.
Plots $(b)$ and $(c)$ show the fidelity from MPS data at $\Delta\,t=100$ and
from fitting data at $\Delta\,t=200$ respectively.

####  IV.1.3 Nonsymmetric multilevel encoding

The second implementation of the MLE strategy that we introduce here is the
“nonsymmetric” encoding, in which we use a different number of states to span
each subspace. In particular, we encode the logical up in the singlet state
$\ket{\psi_{\uparrow_{L}}^{NSM}}=\ket{S}$ ($l_{S}^{NSM}=1$), while varying the
logical down in the triplet. Specifically, the logical down can be written as
an arbitrary combination of the three states of the triplet in the Bell basis
as follows:

$\ket{\psi_{\downarrow_{L}}^{NSM}}=k_{T,AF}^{NSM}\ket{T,AF}+k_{T,F+}^{NSM}\ket{T,F+}+k_{T,F-}^{NSM}\ket{T,F-},$
(25)

and it is normalized:
$|k_{T,AF}^{NSM}|^{2}+|k_{T,F+}^{NSM}|^{2}+|k_{T,F-}^{NSM}|^{2}=1$.

Figure 6: Fidelity $F(t)$ of the free evolution of the encoded qubits OPTNSYMM
with the open system evolution for increasing values of
$k_{T,F+}^{NSM}\in\left]0,1/\sqrt{2}\right[$ (rainbow colours from violet to
red) as a function of dimensionless time $\Delta t$ for $\nu=-5\Delta$,
$\alpha=0.01$, and the initial state
$\ket{\psi(0)}=d_{S}\ket{S}+d_{T,AF}\ket{T,AF}+d_{T,F+}\ket{T,F+}+d_{T,F-}\ket{T,F-}$,
where $d_{S}$, $d_{T,AF}$, $d_{T,F+}$ and $d_{T,F-}$ sample all the two-qubits
Hilbert space. We average the fidelity over $332$ realizations of these
coefficients.

We optimize the coefficients of $\ket{\psi_{\downarrow_{L}}^{NSM}}$ to improve
the fidelity of the encoded qubit. As before, we set the coefficients to be
real. We also find that the coefficient $k_{T,AF}^{NSM}$ has the most
significant contribution to the fidelity, while the other two coefficients
($k_{T,F+}^{NSM}$ and $k_{T,F-}^{NSM}$) related to the higher system
eigenenergies are less important. Hence, we set them to be equal and the other
coefficient is determined by normalization, making an “optimal nonsymmetric”
encoding (OPTNSYMM). This allows us to vary a single parameter
$k_{T,F+}^{NSM}\in\left]0,1/\sqrt{2}\right[$ and observe the effect on the
fidelity over time of the encoded qubit. In this way, we explore the cases in
between the AF strategy (i.e., $k_{T,AF}^{NSM}=1$ and
$k_{T,F+}^{NSM}=k_{T,F-}^{NSM}=0$), and the case in which
$k_{T,F+}^{NSM}=k_{T,F-}^{NSM}=1/\sqrt{2}$, completely canceling the
contribution of the antiferromagnetic triplet state. Figure 6 shows that
increasing $k_{T,F+}^{NSM}$ (decreasing $k_{T,AF}^{NSM}$) leads to a lower
minimum value of the fidelity at short times, but a higher asymptotic value.
Using the same fitting function (Eq. 24), we find the best compromise between
these two behaviors.
As previously done for the symmetric encoding, we observe how the fitting
parameters depend on $k_{T,F+}^{NSM}$. We concentrate on the range of
coefficients that offer the optimal trade-off between the minimum short-term
value and the highest asymptotic value, specifically centered around $c_{2}$
passing through zero, indicating a constant average value (see Figure 7.a).
Again, we take the fidelity from the numerical data at time $\Delta t=100$ and
extrapolate it from the fit at time $\Delta t=200$ (respectively Figure 7.b
and 7.c) to analyze its asymptotic behavior.
The best encoding with the corresponding fit is obtained for
$k_{T,F+}^{NSM}\approx 1/\sqrt{3}$.

Figure 7: Fidelity $F(t)$ of the free evolution of the encoded qubits OPTNSYMM
with the open system evolution for increasing values of
$k_{T,F+}^{NSM}\in\left]0,1/\sqrt{2}\right[$ (rainbow colours from violet to
red) as a function of dimensionless time $\Delta t$ for $\nu=-5\Delta$,
$\alpha=0.01$, and the initial state
$\ket{\psi(0)}=d_{S}\ket{S}+d_{T,AF}\ket{T,AF}+d_{T,F+}\ket{T,F+}+d_{T,F-}\ket{T,F-}$,
where $d_{S}$, $d_{T,AF}$, $d_{T,F+}$ and $d_{T,F-}$ sample all the two-qubits
Hilbert space. We average the fidelity over $332$ realizations of these
coefficients. In the plot $(a)$ there is the parameter $c_{2}$ responsible of
the linear behavior, while in $(d)$ we observe the decay rate $\tau=1/c_{4}$.
Plots $(b)$ and $(c)$ show the fidelity from MPS data at $\Delta\,t=100$ and
from fitting data at $\Delta\,t=200$ respectively.

###  IV.2 Comparison of optimal encodings: fidelity and leakage

After optimizing the two MLE strategies, we aim to compare them with AF and
determine the best approach.
We begin by computing the fidelity of the three encoded qubits and the
physical one. For the encoded ones we fix the coefficients of
$\ket{\psi_{\uparrow_{L}}}$ and $\ket{\psi_{\downarrow_{L}}}$ such that they
can be:

  * •

“antiferromagnetic” encoding (AF), SLE in Bell basis
$\left(\ket{\psi_{\uparrow_{L}}}=\ket{S}\right.$ and
$\left.\ket{\psi_{\downarrow_{L}}}=\ket{T,AF}\right)$ (see Subsubsect.
IV.1.1);

  * •

“symmetric” encoding (SYMM), MLE in Bell basis
$\left(\ket{\psi_{\uparrow_{L}}}=\frac{\sqrt{3}}{2}\ket{S}+\frac{1}{2}\ket{T,AF}\right.$
and
$\left.\ket{\psi_{\downarrow_{L}}}=\frac{1}{2}\ket{T,F+}+\frac{\sqrt{3}}{2}\ket{T,F-}\right)$
(see Subsubsect. IV.1.2);

  * •

“nonsymmetric” encoding (NSYMM), MLE in Bell basis
$\bigg{(}\ket{\psi_{\uparrow_{L}}}=\ket{S}$ and
$\left.\ket{\psi_{\downarrow_{L}}}=\frac{\ket{T,AF}+\ket{T,F+}+\ket{T,F-}}{\sqrt{3}}\right)$
(see Subsubsect. IV.1.3).

We assess the fidelity of the three encoding strategies, and the results are
presented in Figure 8.a. Our findings show that all encoding strategies
outperform the physical qubit. Specifically, the AF strategy exhibits higher
fidelity at short times, but its fidelity linearly decreases over time with
small damped oscillations. On the other hand, allowing for a non-zero
probability for other states in the two logical states initially worsens
fidelity, but ultimately reaches a better asymptotic value. The two MLE
strategies demonstrate a higher asymptotic value for fidelity. The symmetric
strategy has a short-time minimum and an asymptotic value lower than the
nonsymmetric case. This behavior can be explained by the system dynamics,
which involves a timescale during which higher-order processes with the bath
become dynamically allowed, and low-energy states can be excited, overcoming
the energy gap. As the effect of the bath increases, higher-energy levels
decay, leading to a stationary state that ultimately increases the fidelity.
Therefore, including all triplet states in one of the encoded logical states
allows for better accounting of the various processes arising during the
dynamics.
Also, we introduce a quantity called “leakage” that measures the effect of the
bath (i.e., the environment) on the encoding strategy. We can define the
leakage as follows:

$L(t)=\frac{\left|Tr_{L}\left\\{\Pi_{Q}\rho(0)\right\\}\right|-\left|Tr_{L}\left\\{\Pi_{Q}^{U}(t)\rho(0)\right\\}\right|}{2\sqrt{2}}.$
(26)

In this definition, $\Pi_{Q}$ is the projector in the encoded space, which is
spanned by the new logical up and down. $\Pi_{Q}$ is defined as the outer
product of the two basis states $\ket{\psi_{\uparrow_{L}}}$ and
$\ket{\psi_{\downarrow_{L}}}$. The superscript $U$ denotes the evolution under
the complete Hamiltonian, and hence $\Pi_{Q}^{U}$ is the evolved projector.
The trace is performed in the encoded logical space, which is indicated by the
subscript $L$. The factor $2\sqrt{2}$ in the denominator is a normalization
factor such that the leakage assumes only values in the range $[-1;1]$. This
quantity is a measure of how dissipation makes the system deviate from or
return to the logical subspace during the evolution.
Figure 8.b indicates that the NSYMM and the AF strategies are the best
options, being negative, which means that the dynamics increases the
populations in the logical subspace. However, the leakage for AF strategy
reaches a lower asymptotic value.
Based on our analysis, we can conclude that the AF SLE encoding strategy in
the Bell basis allows for better information extraction from two physical
qubits to one logical qubit, while remaining robust to the detrimental effects
of the bath over time (Appendix C).

Figure 8: Fidelity $F(t)$ of the free evolution with the open system evolution
($a$) and leakage $L(t)$ ($b$) of encoded qubits AF (red circle), SYMM (blue
square) and NSYMM (green triangle) (more details on the definition in the main
text) and one physical qubit (orange pentagon) as functions of dimensionless
time $\Delta t$ for $\nu=-5\Delta$, $\alpha=0.01$, and the initial state
$\ket{\psi(0)}=d_{S}\ket{S}+d_{T,AF}\ket{T,AF}+d_{T,F+}\ket{T,F+}+d_{T,F-}\ket{T,F-}$,
where $d_{S}$, $d_{T,AF}$, $d_{T,F+}$ and $d_{T,F-}$ sample all the two-qubits
Hilbert space. We average the fidelity and the leakage over $332$ realizations
of these coefficients. The dots in the plots correspond to the average value
of the fidelity and the leakage, while the shaded regions around them show the
range of values covered by the standard deviation of the fidelity and the
leakage.

###  IV.3 Encoded qubit: analysis of the purity

We are now prepared to examine the newly encoded logical subspace to determine
whether the encoded qubit retains its quantum properties, as indicated by the
purity of its state. To do this, we will perform an average over 18
realizations of the initial state, which is extracted from a uniform
distribution within the new logical encoded space. This initial state is
defined as a linear combination of the two new logical states, up and down, as
follows:

$\ket{\psi_{L}(0)}=\cos{\theta}\ket{\uparrow_{L}}+e^{i\phi}\sin{\theta}\ket{\downarrow_{L}}.$
(27)

Similar to our approach for averaging initial states in the two-qubit case, we
will verify that the sampling of the logical Hilbert space provides an
adequate representation of the problem. Our analysis indicates that the norm
in (14) is indeed approximately $10^{-8}$.
Since in Sect. II in Figure 1, we describe all three encoding strategies
compared with the physical one and find that the best two approaches are NSYMM
and AF, as identified in the previous section, in what follows we will focus
on these two.

Figure 9: Purity $P(t)$ of encoded qubits for $\alpha=0$ ($a$) and
$\alpha=0.01$ ($b$) as a function of dimensionless time $\Delta t$ for
$\nu=-5\Delta$, for the AF strategy (red circle), and NSYMM strategy (green
triangle), and the initial state
$\ket{\psi_{L}(0)}=\cos{\theta}\ket{\uparrow_{L}}+e^{i\phi}\sin{\theta}\ket{\downarrow_{L}}$
where $\theta$ and $\phi$ sample all the logical qubit Hilbert space. We
average the purity over $18$ realizations of these angles. The dots in the
plots correspond to the average value of the purity, while the shaded regions
around them show the range of values covered by the standard deviation of the
purity.

In Figure 9.a, we depict the qubits in isolation from the bath. It is evident
that the purity exhibits periodic oscillations, periodically returning to a
value of 1, signifying the preservation of quantum characteristics in our
qubit. Notably, the AF strategy exhibits smaller amplitude oscillations,
closer to a purity value of 1.
Conversely, Figure 9.b presents the scenario where there is a non-zero
coupling to the bath. In the case of NSYMM, all peaks are shorter, and the
purity no longer reaches a value of 1 over time; instead, it converges towards
a stationary value of approximately 0.7. In contrast, for AF, although the
amplitude of oscillations is reduced, the purity consistently remains high,
stabilizing at around 0.97.
Based on our analysis, we can confidently conclude that the AF encoding
strategy is an excellent choice for encoding information that is highly
resilient to the effects of the bath over time.

##  V Discussion and conclusions

In the earlier section, we established that the most effective encoding
strategy, following our analysis, is the antiferromagnetic SLE (Subsubsect.
IV.1.1). This strategy involves the antiferromagnetic state of the triplet in
the logical down state and the singlet state as the logical up state. This
superior performance might be attributed to the use of the states closer to
the lowest levels of the system thanks to the antiferromagnetic interaction
between the qubits. It outperforms the nonsymmetric MLE strategy (Subsubsect.
IV.1.3) that is also a good choice, in particular in terms of fidelity. In
this case we can observe the excitation of low-energy states and the decay of
higher-energy levels, owing to higher-order processes, which lead to a
stationary state that enhances fidelity. In other words, as suggested in [4]
mixing and decoherence in the encoding subspace do not affect the coherence
between the logical states and therefore do not reduce the computational
fidelity. Specifically, the nonsymmetric case outperforms the symmetric one
(Subsubsect. IV.1.2) because it do not couple the two subspaces (singlet and
triplet) and also leverages the DFS (singlet).
In the previous sections, we focused on the strength of the antiferromagnetic
interaction $\nu=-5\Delta$ and the system-bath coupling $\alpha=0.01$.
However, we have conducted a comprehensive analysis. Regarding the physical
qubits shown in Figure 3.a, the best performance is achieved with the
antiferromagnetic interaction, which is true for all encoding strategies. In
fact, the qubits, when influenced by the bath, tend to establish a
ferromagnetic order. Therefore, an antiferromagnetic interaction can mitigate
the detrimental effects of the bath. Additionally, as $\alpha$ increases, we
observe that the fidelity remains very high, as supported in the Appendix C,
where we show fidelity and leakage for various $\alpha$ couplings.
One of the limitations of our work is the inevitable “loss” of information
that occurs when encoding one qubit in two physical ones, as it requires the
use of two qubits to store the information of a single qubit. Another
limitation lies in determining how to model the interaction with the bath, a
common critique for encoding strategies proposed in the existing literature.
However, the potential “gain” achieved through a non-detrimental bath effect
on the system dynamics could counterbalance the aforementioned “loss” of
information. It is worth noting that the long-wavelength limit [27] holds when
dealing with two qubits, justifying the use of the same coupling method,
global bath, and coupling constant. Yet, this assumption may become
problematic when dealing with a chain of more than two qubits.
Since the encoding can be done a posteriori, utilizing the mean values of the
observables of the two physical qubits, the experimental implementation only
requires an antiferromagnetic interaction between the qubits. One possible
approach for this implementation is the use of a coupler [30, 31] (qubit or
electromagnetic mode) that achieves an effective interaction between the two
qubits without directly coupling them.
Our work helps to understand and analyze the potential of the interaction
between qubits in the presence of the bath. As a future study, we could
investigate the behavior when more qubits are involved, since the DFSs become
more intriguing. Additionally, we can conduct a detailed analysis of the model
by introducing a coupler through MPS numerical simulations, accurately
reproducing the system dynamics.

###### Acknowledgements.

G.D.F. and A.H. acknowledge financial support from 376 PNRR MUR Project No.
PE0000023-NQSTI; A.H. was also supported by the PNRR MUR Project CN
$00000013$-ICSC. The authors acknowledge interesting discussions with A. de
Candia.

##  Appendix A Lindblad vs MPS and decay rates estimation

Figure 10: Coherence modulus $|\rho_{13}(t)|$ and populations
$\rho_{11}(t)=P_{1}$, and $\rho_{33}(t)=P_{3}$ of the energy eigenstates
$\ket{1}$, and $\ket{3}$ of $H_{0}$. These are the only non-zero terms of the
reduced density matrix $\rho(0)$, given the initial state (Eq. 38), displayed
as functions of dimensionless time $\Delta t$. Also, the population
$\rho_{00}(t)=P_{0}$ is fixed by normalization. The bath coupling strength is
$\alpha=0.02$, and the qubit-qubit interaction strength takes the values
$\nu=0\Delta$ in the first line, $\nu=5\Delta$ in the second line, and
$\nu=-5\Delta$ in the third line. In the plot, the red solid lines correspond
to the MPS numerical results, while the orange dashed lines are the Lindblad
master equation solutions and the blue dotted lines are the fits obtained by
using the same functional forms as the Lindblad solutions.

In this appendix we wish to clarify that MPS numerical simulations are
necessary instead of relying on the more commonly used Lindblad master
equation solution. We focus on the relaxation and decoherence due to the
presence of the bath [32, 33, 34, 35, 36]. It’s worth noting that the singlet
state $\ket{\psi_{S}}$ is DFS due to the nature of its interaction with the
bath, which means that it is not affected by decoherence.
We follow the notation used in [37] for the Lindblad master equation in
presence of the interaction Hamiltonian $H_{qub-bath}=A\otimes B$, where
$A=\sigma_{z}^{1}+\sigma_{z}^{2}$ is the system operator coupled to the bath
one $B=\sum_{i=1}^{N}\lambda_{i}\left(a_{i}+a_{i}^{\dagger}\right)$. The
singlet state does not participate in the dynamics and can be effectively
decoupled from the other equations. Hence, in the interaction picture using
the system energy eigenbasis $H_{qub}\ket{i}=E_{i}\ket{i}$, with $i=0,\dots,3$
and neglecting the Lamb-shift Hamiltonian, the Lindblad equation reads:

$\displaystyle\frac{d\rho}{dt}$
$\displaystyle=\gamma_{01,01}\left[\ket{0}\bra{1}\rho(t)\ket{1}\bra{0}-\frac{1}{2}\left\\{\ket{1}\bra{1},\rho(t)\right\\}\right]$
$\displaystyle\,+\gamma_{13,13}\left[\ket{1}\bra{3}\rho(t)\ket{3}\bra{1}-\frac{1}{2}\left\\{\ket{3}\bra{3},\rho(t)\right\\}\right],$
(28)

where the decay rates are:

$\displaystyle\gamma_{01,01}$
$\displaystyle=\gamma(E_{1}-E_{0})\bra{0}(\sigma_{z}^{1}+\sigma_{z}^{2})\ket{1}\bra{1}(\sigma_{z}^{1}+\sigma_{z}^{2})\ket{0}$
$\displaystyle=4\left(b\left(\frac{\nu}{\Delta}\right)\right)^{2}2\pi
J(E_{1}-E_{0}),$ (29) $\displaystyle\gamma_{13,13}$
$\displaystyle=\gamma(E_{3}-E_{1})\bra{1}(\sigma_{z}^{1}+\sigma_{z}^{2})\ket{3}\bra{3}(\sigma_{z}^{1}+\sigma_{z}^{2})\ket{1}$
$\displaystyle=4\left(a\left(\frac{\nu}{\Delta}\right)\right)^{2}2\pi
J(E_{3}-E_{1}).$ (30)

Here $J(E_{b}-E_{a})$ is the spectral density of the bath at the energy
difference $E_{b}-E_{a}$, and $a(\nu/\Delta)$ (Eq. 11) and $b(\nu/\Delta)$
(Eq. 12) are the coefficients in the definitions of the system eigenstates. We
can use these equations to calculate the time-evolution of the populations and
coherences of the system reduced density matrix. If we look at the populations
$\rho_{00}(t)$ and $\rho_{11}(t)$ we see that there is the difference between
the two decay rates. Furthermore, if we use an Ohmic spectral density
$J(\omega)$ (Eq. 5) with a cutoff made by the Heaviside function, we obtain a
$0/0$ indeterminate form. Hence, we choose to model the system decay using an
exponential function with the cutoff frequency and then take the limit as the
cutoff frequency goes to infinity. We only need to compute one limit, for
example, for $\rho_{11}(t)$ and $\rho_{00}(t)$ will be fixed by the
normalization ($\sum_{i=0}^{3}\rho_{ii}(t)=1$). By defining a single decay
rate $\gamma=2\pi\alpha c$, where the constant
$c=(a(\nu/\Delta))^{2}(\sqrt{4\Delta^{2}+\nu^{2}}+\nu)=(b(\nu/\Delta))^{2}(\sqrt{4\Delta^{2}+\nu^{2}}-\nu)$,
the populations and coherences can be rewritten in a very compact way as
follows:

$\displaystyle\rho_{00}(t)$ $\displaystyle=1-\rho_{11}(0)e^{-\gamma
t}-\rho_{22}(0)-\rho_{33}(0)e^{-\gamma t}(1+\gamma t)$ (31)
$\displaystyle\rho_{11}(t)$ $\displaystyle=\rho_{11}(0)e^{-\gamma
t}+\rho_{33}(0)e^{-\gamma t}\gamma t$ (32) $\displaystyle\rho_{22}(t)$
$\displaystyle=\rho_{22}(0)$ (33) $\displaystyle\rho_{33}(t)$
$\displaystyle=\rho_{33}(0)e^{-\gamma t}$ (34) $\displaystyle\rho_{01}(t)$
$\displaystyle=\rho_{01}(0)e^{-\frac{\gamma}{2}t}$ (35)
$\displaystyle\rho_{03}(t)$ $\displaystyle=\rho_{03}(0)e^{-\frac{\gamma}{2}t}$
(36) $\displaystyle\rho_{13}(t)$ $\displaystyle=\rho_{13}(0)e^{-\gamma t}.$
(37)

It’s worth noting that the coherence $\rho_{13}$ exhibits a decay rate equal
to $\gamma$, which is the same as that of the population $\rho_{33}$.
Meanwhile, the decay rate of the other two coherences is half of $\gamma$,
similar to what occurs in the case of a single qubit. Now, we can use these
time functions to compare them with our MPS numerical results and estimate the
accuracy of the Lindblad solution in predicting the decay rates, as well as
the errors that may arise in the dynamics when using it, starting from the
quasi-ferromagnetic (F) state:

$\ket{\psi(0)^{F}}=\frac{\ket{1}+e^{i\pi/4}\ket{3}}{\sqrt{2}}\otimes\ket{0,\dots,0}_{B}.$
(38)

This means that the two-qubit system is initially in a combination of the most
excited ferromagnetic eigenstates of the closed Hamiltonian ($\ket{1}$ and
$\ket{3}$), and the bath is empty at zero temperature.
We investigate three values of the interaction strength between the qubits,
$\nu=\\{-5,0,5\\}\Delta$, to study the interplay between the energy scale of
the system and the bath effects. Additionally, we observe the dynamical
behavior of the system for two different values of the coupling to the bath,
$\alpha=\\{0.01,0.02\\}$.
Figure 10 displays the time evolution of the modulus of the coherence
$|\rho_{13}(t)|$ and the populations $\rho_{11}(t)=P_{1}$, and
$\rho_{33}(t)=P_{3}$. These populations are computed for a typical bath
coupling strength of $\alpha=0.02$, which is of the same order of magnitude as
the coupling strength used in the main text. The density matrix elements are
shown for the three different values of the qubit-qubit interaction strength:
$\nu=0\Delta$ in the first line, $\nu=5\Delta$ in the second line, and
$\nu=-5\Delta$ in the third line.
It is evident that the Lindblad equation, which is a perturbative approach in
the coupling to the bath and does not consider higher-order processes, only
accurately predicts the exponential decay of the $P_{3}$ population.
Nevertheless, it fails to correctly forecast the population $P_{1}$ and
$P_{0}$ (not displayed in the figure, but fixed by normalization) as higher-
order processes become significant and are not taken into account.
For the coherence modulus, we observe that the Lindblad solution cannot
reproduce the oscillations of the MPS numerical simulations. Additionally, for
$\nu\neq 0\Delta$, it also predicts an incorrect initial transient. Looking at
the real and imaginary parts of the coherence separately (not shown in the
figure for clarity), we observe more discrepancies in frequencies and
amplitudes of the oscillations, which are somewhat balanced when considering
the modulus. To estimate the decay rates of the MPS results $\gamma_{FIT}$, we
also plot the results obtained by fitting the MPS data with the same
functional forms as the Lindblad equation solutions (Eqs. from 31 to 37).
It’s worth noting that the ferromagnetic qubit-qubit interaction (the second
line in Figure 10), especially for $P_{1}$, enhances the effect of the bath,
which always induces the ferromagnetic order of the qubits. As a result, the
Lindblad equation fails to reproduce the expected stationary state. On the
other hand, the antiferromagnetic qubit-qubit interaction (the third line in
Figure 10) offers some protection against the bath and yields the correct
stationary state, even for this intermediate value of $\alpha$. This suggests
that the particular type of qubit-qubit interaction can significantly impact
the behavior of the system in the presence of a bath.

##  Appendix B Fidelity in the logical subspace of best encoding strategies

Figure 11: Fidelity $F(t)$ of the free evolution with the open system
evolution of encoded qubits AF (red circle), and NSYMM (green triangle) as a
function of dimensionless time $\Delta t$ for $\nu=-5\Delta$, $\alpha=0.01$,
and the initial state
$\ket{\psi_{L}(0)}=\cos{\theta}\ket{\uparrow_{L}}+e^{i\phi}\sin{\theta}\ket{\downarrow_{L}}$
where $\theta$ and $\phi$ sample all the logical qubit Hilbert space. We
average the fidelity over $18$ realizations of these angles. The dots in the
plot correspond to the average value of the fidelity, while the shaded regions
around them shows the range of values covered by the standard deviation of the
fidelity.

In this appendix, we aim to emphasize that the AF strategy remains the
superior choice when considering the new logical subspace of the qubit. This
observation is underscored by the data presented in Figure 11. Specifically,
the NSYMM strategy exhibits a fidelity that oscillates with increasing
amplitudes over time, reaching a value of approximately 0.85 within the
duration of our simulation. Conversely, the AF strategy displays smaller
oscillation amplitudes and approaches a fidelity value of around 0.97. This
further supports the conclusion that the AF strategy is the preferred option
for maintaining qubit integrity within the new logical subspace.

##  Appendix C Effects on the encoding of increasing the system-bath coupling
strength

In this appendix, we investigate how increasing the coupling strength of the
system to the bath affects the optimal encoding strategy. Specifically, we
explore how the variation of $\alpha$ impacts the fidelity and leakage of the
encoded information, and determine whether the encoding strategy becomes
ineffective under stronger coupling regimes. Our results provide valuable
information on the robustness of the encoding scheme under different coupling
conditions.
Figure 12 provides insight into the robustness of the encoding paradigm
concerning the coupling strength parameter $\alpha$. In Figure 12.a, we
observe the efficacy of our chosen encoding strategy, which consistently
approaches high asymptotic values, even as $\alpha$ increases. Furthermore,
Figure 12.b illustrates that as $\alpha$ increases, the degree of leakage
becomes more negative. This behavior is attributed to the increased influence
of the bath on the system, particularly as the system approaches its ground
state. Thus, our chosen encoding strategy exhibits strong resilience to the
detrimental effects of the bath, in contrast to that of physical qubits.
Moreover, the fidelity values are even higher, indicating that we are
effectively leveraging the interaction between the two qubits to counteract
the bath’s negative effects.

Figure 12: Fidelity $F(t)$ of the free evolution with the open system
evolution ($a$) and leakage $L(t)$ ($b$) of the encoded qubit AF as functions
of dimensionless time $\Delta t$ for $\nu=-5\Delta$, $\alpha=0.005$ (red
circle), $\alpha=0.01$ (blue square), $\alpha=0.02$ (green triangle) and the
initial state
$\ket{\psi(0)}=d_{S}\ket{S}+d_{T,AF}\ket{T,AF}+d_{T,F+}\ket{T,F+}+d_{T,F-}\ket{T,F-}$,
where $d_{S}$, $d_{T,AF}$, $d_{T,F+}$ and $d_{T,F-}$ sample all the two-qubits
Hilbert space. We average the fidelity and the leakage over $332$ realizations
of these coefficients. The dots in the plots correspond to the average value
of the fidelity and the leakage, while the shaded regions around them show the
range of values covered by the standard deviation of the fidelity and the
leakage.

## References

  * Kurizki and Kofman [2022] G. Kurizki and A. G. Kofman,  _Thermodynamics and Control of Open Quantum Systems_ (Cambridge University Press, 2022).
  * Koch  _et al._ [2022] C. P. Koch, U. Boscain, T. Calarco, G. Dirr, S. Filipp, S. J. Glaser, R. Kosloff, S. Montangero, T. Schulte-Herbrüggen, D. Sugny, _et al._ , Quantum optimal control in quantum technologies. strategic report on current status, visions and goals for research in europe, EPJ Quantum Technology 9, 19 (2022).
  * Poggiali  _et al._ [2018] F. Poggiali, P. Cappellaro, and N. Fabbri, Optimal control for one-qubit quantum sensing, Physical Review X 8, 021059 (2018).
  * Grace  _et al._ [2006] M. Grace, C. Brif, H. Rabitz, I. Walmsley, R. Kosut, and D. Lidar, Encoding a qubit into multilevel subspaces, New J. Phys. 8, 35 (2006).
  * Hodges  _et al._ [2007] J. Hodges, P. Cappellaro, T. Havel, R. Martinez, and D. Cory, Experimental implementation of a logical Bell state encoding, Phys. Rev. A 75, 042320 (2007).
  * Shor [1995] P. W. Shor, Scheme for reducing decoherence in quantum computer memory, Phys. Rev. A 52, R2493 (1995).
  * Kitaev [2003] A. Y. Kitaev, Fault-tolerant quantum computation by anyons, Annals of physics 303, 2 (2003).
  * Zanardi and Rasetti [1997] P. Zanardi and M. Rasetti, Noiseless quantum codes, Phys. Rev. Lett. 79, 3306 (1997).
  * Duan and Guo [1997] L.-M. Duan and G.-C. Guo, Preserving coherence in quantum computation by pairing quantum bits, Phys. Rev. Lett. 79, 1953 (1997).
  * Mohseni  _et al._ [2003] M. Mohseni, J. S. Lundeen, K. J. Resch, and A. M. Steinberg, Experimental application of decoherence-free subspaces in an optical quantum-computing algorithm, Phys. Rev. Lett. 91, 187903 (2003).
  * Ollerenshaw  _et al._ [2003] J. E. Ollerenshaw, D. A. Lidar, and L. E. Kay, Magnetic resonance realization of decoherence-free quantum computation, Phys. Rev. Lett. 91, 217904 (2003).
  * Fortunato  _et al._ [2002] E. M. Fortunato, L. Viola, J. Hodges, G. Teklemariam, and D. G. Cory, Implementation of universal control on a decoherence-free qubit, New Journal of Physics 4, 5 (2002).
  * Cappellaro  _et al._ [2007] P. Cappellaro, J. Hodges, T. Havel, and D. Cory, Control of qubits encoded in decoherence-free subspaces, Laser Phys. 17, 545 (2007).
  * Qin  _et al._ [2015] W. Qin, C. Wang, and X. Zhang, Protected quantum-state transfer in decoherence-free subspaces, Phys. Rev. A 91, 042303 (2015).
  * Lidar [2014] D. A. Lidar, Review of Decoherence-Free Subspaces, Noiseless Subsystems, and Dynamical Decoupling, Quantum information and computation for chemistry , 295 (2014).
  * Friesen  _et al._ [2017] M. Friesen, J. Ghosh, M. Eriksson, and S. Coppersmith, A decoherence-free subspace in a charge quadrupole qubit, Nat. Commun. 8, 15923 (2017).
  * Kockum  _et al._ [2018] A. F. Kockum, G. Johansson, and F. Nori, Decoherence-free interaction between giant atoms in waveguide quantum electrodynamics, Phys. Rev. Lett. 120, 140404 (2018).
  * Campagnano  _et al._ [2010] G. Campagnano, A. Hamma, and U. Weiss, Entanglement dynamics of coupled qubits and a semi-decoherence free subspace, Phys. Lett. A 374, 416 (2010).
  * Paeckel  _et al._ [2019] S. Paeckel, T. Köhler, A. Swoboda, S. R. Manmana, U. Schollwöck, and C. Hubig, Time-evolution methods for matrix-product states, Ann. Phys. 411, 167998 (2019).
  * Fishman  _et al._ [2022] M. Fishman, S. R. White, and E. M. Stoudenmire, The ITensor Software Library for Tensor Network Calculations, SciPost Phys. Codebases , 4 (2022).
  * Haegeman  _et al._ [2016] J. Haegeman, C. Lubich, I. Oseledets, B. Vandereycken, and F. Verstraete, Unifying time evolution and optimization with matrix product states, Phys. Rev. B 94, 165116 (2016).
  * Haegeman  _et al._ [2011] J. Haegeman, J. I. Cirac, T. J. Osborne, I. Pižorn, H. Verschelde, and F. Verstraete, Time-Dependent Variational Principle for Quantum Lattices, Phys. Rev. Lett. 107, 070601 (2011).
  * Moroder  _et al._ [2023] M. Moroder, M. Grundner, F. Damanet, U. Schollwöck, S. Mardazad, S. Flannigan, T. Köhler, and S. Paeckel, Stable bipolarons in open quantum systems, Phys. Rev. B 107, 214310 (2023).
  * De Filippis  _et al._ [2023] G. De Filippis, A. de Candia, G. Di Bello, C. A. Perroni, L. Cangemi, A. Nocera, M. Sassetti, R. Fazio, and V. Cataudella, Signatures of dissipation driven quantum phase transition in Rabi model, Phys. Rev. Lett. 130, 210404 (2023).
  * Flannigan  _et al._ [2022] S. Flannigan, F. Damanet, and A. J. Daley, Many-body quantum state diffusion for non-Markovian dynamics in strongly interacting systems, Phys. Rev. Lett. 128, 063601 (2022).
  * Strathearn  _et al._ [2018] A. Strathearn, P. Kirton, D. Kilda, J. Keeling, and B. W. Lovett, Efficient non-Markovian quantum dynamics using time-evolving matrix product operators, Nat. Commun. 9, 3322 (2018).
  * Fradkin [2013] E. Fradkin,  _Field theories of condensed matter physics_ (Cambridge University Press, 2013).
  * Nielsen and Chuang [2002] M. A. Nielsen and I. Chuang,  _Quantum computation and quantum information_ (American Association of Physics Teachers, 2002).
  * Di Bello  _et al._ [2023] G. Di Bello, L. Cangemi, V. Cataudella, G. De Filippis, A. Nocera, and C. A. Perroni, Qubit-oscillator relationships in the open quantum Rabi model: the role of dissipation, Eur. Phys. J. Plus 138, 135 (2023).
  * Blais  _et al._ [2021] A. Blais, A. L. Grimsmo, S. M. Girvin, and A. Wallraff, Circuit quantum electrodynamics, Rev. Mod. Phys. 93, 025005 (2021).
  * Yan  _et al._ [2018] F. Yan, P. Krantz, Y. Sung, M. Kjaergaard, D. L. Campbell, T. P. Orlando, S. Gustavsson, and W. D. Oliver, Tunable coupling scheme for implementing high-fidelity two-qubit gates, Phys. Rev. App. 10, 054062 (2018).
  * Gargiulo  _et al._ [2011] F. Gargiulo, C. A. Perroni, V. M. Ramaglia, and V. Cataudella, Electronic transport within a quasi-two-dimensional model for rubrene single-crystal field effect transistors, Phys. Rev. B 84, 245204 (2011).
  * Perroni  _et al._ [2011] C. A. Perroni, A. Nocera, V. M. Ramaglia, and V. Cataudella, Spectral, optical, and transport properties of the adiabatic anisotropic Holstein model: Application to slightly doped organic semiconductors, Phys. Rev. B 83, 245107 (2011).
  * Perroni  _et al._ [2013] C. A. Perroni, A. Nocera, and V. Cataudella, Single-parameter charge pumping in carbon nanotube resonators at low frequency, Europhys. Lett. 103, 58001 (2013).
  * Perroni  _et al._ [2014] C. A. Perroni, F. Romeo, A. Nocera, V. M. Ramaglia, R. Citro, and V. Cataudella, Noise-assisted charge pump in elastically deformable molecular junctions, J. Phys. Condens. Matter 26, 365301 (2014).
  * Perroni  _et al._ [2015] C. A. Perroni, D. Ninno, and V. Cataudella, Interplay between electron–electron and electron–vibration interactions on the thermoelectric properties of molecular junctions, New J. Phys. 17, 083050 (2015).
  * Schaller [2014] G. Schaller,  _Open quantum systems far from equilibrium_ , Vol. 881 (Springer, 2014).