“Message-passing” algorithms are used to efficiently evaluate quantities of interest in problems defined on graphs. They work by passing messages between nodes of the graph. For example, these algorithms have been successfully used for statistical inference, optimization, constraint-satisfaction problems, and the graph isomorphism problem among several other applications1,2,3,4,5,6,7,8. In particular, “belief-propagation” (BP) is a message-passing algorithm for efficiently marginalizing joint probability density functions in statistical inference problems. The algorithm derives its name from the fact that the messages used in BP are “local” probabilities or “beliefs” (e.g., of the value of the final quantity of interest). An important application of BP lies in the decoding of linear codes using the posterior bit-wise marginals given the outputs of a classical channel9. It is well-known that BP exactly performs the task of optimal bit-wise maximum-a-posteriori (bit-MAP) decoding when the code’s factor graph is a tree. However, since codes with tree factor graphs have poor minimum distance9, BP is also applied to codes whose factor graphs have cycles, e.g, low-density parity-check (LDPC) codes. Although BP does not compute the exact marginals in this case, it is computationally more efficient than MAP, and usually performs quite well. In fact, it has been proven that, for large blocks, BP achieves the optimal MAP performance for spatially-coupled LDPC codes over the binary erasure channel10 and binary memoryless symmetric channels11,12. From a more practical perspective, BP-based decoders are routinely deployed in modern communications and data storage.

Given the success of BP decoding for classical channels, it is natural to ask if it can be generalized to the quantum setting. For example, can one decode classical codes for communications over a classical-quantum (CQ) channel or, more generally, perform efficient inference on graphically-represented classical data encoded in qubits? Consider laser communications based on binary phase-shift keying (BPSK) modulation for sending classical data over a pure-loss bosonic channel of transmissivity η [0, 1]13. During each “use” of the quantum channel, the transmitter modulates each optical pulse, or mode, into one of the two coherent states \(\left|\alpha \right\rangle\) or \(\left|-\alpha \right\rangle\), where \(\alpha \in {\mathbb{R}}\) and the mean photon number per mode equals NS = α2. Each channel output symbol is an optical pulse that is in one of the two coherent states \(\left|\pm \beta \right\rangle\), where \(\beta =\sqrt{\eta }\alpha\) and mean photon number N = ηNS. These two states are non-orthogonal with an inner product 〈β − β〉 = e−2N ≡ σ. In this case, the coherent states \(\left|\pm \beta \right\rangle \,=\,\mathop{\sum }\nolimits_{n \,=\, 0}^{\infty }{e}^{-| \beta {| }^{2}/2}\frac{{(\pm \beta )}^{n}}{\sqrt{n!}}\left|n\right\rangle\) live in an infinite-dimensional Hilbert space spanned by the complete orthonormal number basis \(\left\{\left|n\right\rangle ,n\in {\mathbb{N}}\right\}\). However, since each channel output is always in one \(\left|\pm \beta \right\rangle\), for the purposes of designing a receiver, we can embed the subspace spanned by \(\left|\pm \beta \right\rangle\) in a two-dimensional (qubit) Hilbert space via the inner product-preserving map:

$$\left|\pm \beta \right\rangle\, \longmapsto \,\left|\pm \theta \right\rangle :\,=\,\cos \frac{\theta }{2}\left|0\right\rangle \,\pm\, \sin \frac{\theta }{2}\left|1\right\rangle ,$$

with \(\sigma =\cos \theta\). The resulting channel from a classical encoding variable x to a conditional quantum state, i.e., \([x\,=\,0]\,\mapsto \,\left|\theta \right\rangle ,[x\,=\,1]\,\mapsto \,\left|-\theta \right\rangle\), is often called a (pure-state) “CQ” channel in the quantum information theory literature.

When the channel output symbols are detected one at a time, the best possible detection error probability is given by the Helstrom bound14,15 on the minimum average error probability of discriminating the alphabet states \(\left|\pm \beta \right\rangle\), which is \(p:\,=\,\frac{1}{2}[1\,-\,\sqrt{1\,-\,{\sigma }^{2}}]\). A structured optical design of a receiver that achieves this performance was invented by Dolinar in 197316. This receiver induces a binary symmetric channel (BSC) between the quantum channel outputs \(\left|\pm \beta \right\rangle\) and the receiver’s guess “±β”, with crossover probability p, thereby enabling the communicating parties to achieve a reliable communication rate given by C1 = 1 − h2(p) bits per mode, the Shannon capacity of the BSC. To achieve communication at a rate close to this capacity, one would need to use a code that achieves the Shannon capacity of the BSC, e.g., Arikan’s polar code17, and a suitable decoder. If the receiver detects, i.e., converts from the quantum (optical) to the electrical domain, each quantum channel output one at a time, no amount of classical post-processing, including feedforward between channel uses, and soft-information processing, can achieve a rate higher than C1. Thus, a capacity-approaching LDPC code for the BSC and a BP decoder can approach but not surpass the rate C1.

However, if one employs a quantum joint-detection receiver that collectively measures the entire block of n channel outputs, then the rate may increase to the Holevo limit, \({C}_{\infty }\,=\,S(\frac{1}{2}\left|\beta \right\rangle \ \left\langle \beta \right|\,+\,\frac{1}{2}\left|-\beta \right\rangle \ \left\langle -\beta \right|)\,=\,{h}_{2}([1\,+\,\sigma ]/2)\) bits per mode, where S() denotes the von Neumann entropy. In the limit as N → 0 (or equivalently σ → 1), where the mean photon number per mode vanishes, one can show that C/C1 →  and collective measurement is preferable. This regime of operation is especially important for long-haul free-space terrestrial and deep-space laser communications. In order to fully exploit this large capacity gain, one can use a CQ polar code13 with a decoder based on collective measurement of the received quantum state. Alternatively, one can use a codebook comprising M = 2nR random length-n codewords with R < C, where each symbol of each codeword is chosen from an equal prior over the two BPSK symbols. If the receiver employs a joint measurement that discriminates between the codewords sufficiently well, then the probability of decoding error will converge to 0 as n → . Both the optimal measurement and the square root measurement (SRM) are known to faithfully discriminate between roughly \({2}^{n{C}_{\infty }}\) codewords18, as opposed to only \({2}^{n{C}_{1}}\) codewords if symbol-by-symbol detection is combined with classical decoding. Given the quantum states of the M codewords, the optimal measurement can be computed by applying the Yuen-Kennedy-Lax (YKL) conditions19 applied to the Gram matrix of the codebook—the M-by-M matrix of pairwise inner products of the codewords’ quantum states. This calculation is simpler for linear codes20, especially codes that have certain group symmetries21. Even when it is possible to compute the optimal measurement for the codebook, it may be hard to translate the mathematical description into a physical receiver design22, unless we have a general-purpose photonic quantum computer23. Therefore, an efficient and physically realizable receiver is of significant practical interest if it can outperform the optimal receiver based on optimal symbol-by-symbol measurement.

Renes24 recently proposed a quantum generalization of BP for a binary-output pure-state CQ channel. Renes’ algorithm is well-defined on a tree factor graph and works by passing quantum messages (encoded in qubits) and classical messages (bits) between nodes of the code’s factor graph. Unlike earlier algorithms termed “quantum belief-propagation”25,26, Renes’ algorithm does not measure the n channel outputs, followed by classical BP on the (classical) syndrome measurements, and hence is not limited to achieving a rate of C1. In order to avoid any confusion with previous quantum BP algorithms, we will refer to Renes’ algorithm as “belief-propagation with quantum messages” (BPQM).

In24, the first step in developing BPQM was to interpret the message-combining operations in classical BP as “channel combining” rules that execute a local inference procedure. This step has close connections with the channel combining operation defined by Arikan for polar codes17. The second step was a generalization of these channel combining rules to allow for quantum messages, as in CQ polar codes18, i.e., messages that are qubit density matrices which capture the node’s belief about a message bit. The above rules define a CQ channel that gets induced at each node when (quantum) messages arrive at it. Finally, the third step was to define appropriate unitary operations at the nodes, which process the outputs of the aforesaid induced CQ channels and produce messages to be passed on to subsequent nodes.

While24 is a breakthrough paper that provides a phenomenological description of BPQM, it does not assess its performance on an example code or make comparisons with optimal symbol-by-symbol measurements. Also, it does not present a proof of decoding optimality, even for CQ codes with a tree factor graph. Finally, it does not prescribe an explicit quantum circuit for BPQM. This paper addresses all of the above open questions and resolves many of them for the chosen example code.

Results and discussion

BPQM-based receiver design and block error rates

We construct an explicit quantum circuit for a BPQM-based joint-detection receiver (blueprint shown under “Methods” section, see Fig. 8), and prove that it achieves the Helstrom limit for discriminating between the eight codewords in our exemplary n = 5 linear BPSK code with a tree factor graph, as shown in Fig. 1. Hence, it outperforms the best achievable performance by the optimal symbol-by-symbol receiver measurement followed by a MAP decision. Based on our analysis of BPQM, we introduce a coherent rotation to be performed after decoding bit 1 as part of our receiver design, which is not part of Renes’ original BPQM scheme. This might be important for generalizing BPQM beyond the specific example considered here (see Remark 2). We explicitly compute the density matrices of quantum messages that are passed, and evaluate the performance of BPQM for this example code. For decoding bit 1, we also derive an analytical expression for the BPQM success probability. The ultimate benchmark for decoding a bit is the performance of the Helstrom measurement that optimally distinguishes the density matrices corresponding to the two values of the bit. We show that BPQM is optimal for deciding the value of each of the 5 bits. In Fig. 2, we plot performance curves that show the “global” performance of BPQM for the 5-bit code in terms of block (codeword) error rate for the following strategies:

Fig. 1: Factor graph and parity-check matrix for the 5-bit linear code in the running example.
figure 1

Each circle node denotes a variable xi, the square nodes c1 and c2 denote the two parity checks corresponding to the two rows of H, and the square nodes Wi denote the channel observation of the associated variables xi.

Fig. 2: The overall performance of BPQM compared with that of other related schemes.
figure 2

a The overall block error rate of BPQM along with those of optimal joint Helstrom, symbol-by-symbol Helstrom followed by classical optimal block MAP, and symbol-by-symbol Helstrom followed by classical BP. b The same plot as a except that the error rates are also displayed in log scale.

  1. (a)

    collective (optimal) Helstrom measurement on all n = 5 channel outputs of the received codeword,

  2. (b)

    BPQM on all channel outputs of the received codeword,

  3. (c)

    symbol-by-symbol (optimal) Helstrom measurement followed by classical (optimal) block-MAP decoding, and

  4. (d)

    symbol-by-symbol (optimal) Helstrom measurement followed by classical BP decoding.

For the last two schemes, classical decoding is performed for the BSC, with crossover probability \(p\,=\,\frac{1}{2}[1\,-\,\sqrt{1\,-\,{\sigma }^{2}}]\), that is induced by measuring each channel output with the Helstrom measurement to discriminate between \(\left|\pm \theta \right\rangle\).

As expected, the block error probabilities are in increasing order from (a) through (d). The plot shows that BPQM is strictly better than the quantum-optimal symbol-by-symbol detection followed by a block-MAP decision at all values of mean photon number per mode, and that it meets the optimal joint Helstrom measurement on the modulated codeword. We confirm this optimality analytically by using the fact that the SRM, also called the pretty good measurement, is optimal for transmitting binary linear codes on the pure-state channel20 (discussed under “Methods” section). More precisely, we calculate the closed-form expression for the SRM block error probability27, in terms of the classical code and associated cosets, and the density matrix-based expression for the BPQM block error probability for this example code. Then, for a range of channel parameters, we compute the values from these expressions and confirm that they agree up to even 15 decimal places. Therefore, while decomposing the SRM itself into an explicit circuit might be challenging, BPQM provides a circuit that still achieves the optimal block error probability for this code. This is an important result because, it demonstrates that, if we can construct a BPQM receiver, then it will outperform any known physically realizable receiver for this channel. We provide more detailed observations on Fig. 2 shortly.

Photon information efficiency

Besides the block error rates, we also compare the mutual information per photon per channel use, also referred to as the photon information efficiency (PIE)28,29, for BPQM, with the Holevo capacity of the pure-state channel and the capacity induced by symbol-by-symbol Helstrom measurements. In order to do this, we consider a composite channel whose input is k = 3 bits and output is also k = 3 bits, where the channel consists of encoding into the 5-bit code, transmitting over the pure-state channel, applying the BPQM receiver and identifying the transmitted codeword (equivalently the k-bit message). Determining the PIE for the BPQM analytically involves calculating closed-form expressions for the transition probabilities of the 2k-ary channel (where k = 3 for the considered 5-bit code), which involves cumbersome calculations of the relevant density matrices. Instead, we calculate the PIE numerically by performing a Monte Carlo simulation. Figure 3 shows a plot of the PIE of the BPQM receiver along with those corresponding to the Holevo capacity and the symbol-by-symbol Helstrom induced BSC capacity. We also compute the PIE for the SRM. The transition probability of decoding a transmitted message t {0, 1}k as g {0, 1}k using the SRM is given by27

Fig. 3: Mutual information per photon per channel use achieved by BPQM and the square root measurement (SRM) on the 5-bit code over the pure-state channel, along with the Holevo capacity of the channel and the BSC capacity induced by symbol-by-symbol Helstrom measurements at the channel output, all plotted against the mean photon number per mode (N).
figure 3

BPQM and SRM on this code produce identical results. The curves indicate that BPQM/SRM provides mutual information gains for certain regimes of N, thereby demonstrating superadditive capacity with an explicit code and decoder.

$${\mathbb{P}}\left[g\ | \ t\right]\,=\,\frac{\hat{\sigma }{(g\oplus t)}^{2}}{{2}^{k}},\quad \hat{\sigma }(g\oplus t)\,=\,\frac{1}{\sqrt{{2}^{k}}}\mathop{\sum}\limits_{h\in {{\mathbb{Z}}}_{2}^{k}}{(-1)}^{h{(g\oplus t)}^{T}}\sigma (h),\quad \sigma (h)\,=\,{2}^{k/4}\sqrt{\hat{s}(h)},$$

where \(\hat{s}(h)\) is as defined in (Eq. 77) (under “Methods” section, where the block success rate with the SRM given by (Eq. 76) is evaluated). Therefore, the transition probability only depends on the sum gt and hence the channel is symmetric. Using this closed form expression, we compute the mutual information for this k-bit channel, normalized by n = 5 (to obtain mutual information per channel use), then normalized by N to obtain the PIE, and also plot it in Fig. 3. We see that both BPQM and SRM produce identical curves, just as they do in block error rates. Finally, we observe that there exists a regime of N, where this explicit small code along with BPQM or SRM demonstrates superadditive capacity that beats the largest PIE obtained from symbol-by-symbol Helstrom measurements. The PIE with the BPQM (or SRM) receiver is found to be maximized at N = 6.2 × 10−3, the maximum PIE being 3.021, whereas the corresponding PIE attained by symbol-by-symbol Helstrom measurements is 2.862, the ratio of the two numbers being 1.056. (Interestingly, this is higher than the PIE ratio of 1.031 that has been reported for a different 5-bit code with 16 codewords and the corresponding SRM in ref. 30.) The superadditive PIE hence makes the case stronger for performing the optimal collective measurement at the channel output using the systematic scheme of BPQM.

In Fig. 2, we had plotted the block error probabilities as a function of the mean photon number per mode for the different measurement strategies. In Fig. 4, we plot both the bit and block error probabilities (and success probabilities, i.e., one minus error probability) for these measurement strategies. For strategy (a), the performance of the collective Helstrom measurement is plotted using the YKL conditions19 as discussed, for example, in21. For strategies (c) and (d), classical processing is performed essentially for the BSC induced by measuring each qubit output by the pure-state channel. The mean photon number per mode, N, relates to the pure-state channel parameter θ as \(\cos \theta ={e}^{-2N}\) (e.g., see13 for more information on this quantity). We make the following observations from these performance curves.

Fig. 4: The overall performance of BPQM for each bit and for the whole codeword.
figure 4

Each data point in all simulation curves was obtained by averaging over 105 uniformly random codeword transmissions. a The BPQM success probabilities for decoding each bit and its overall performance for the 5-bit code, the theoretical BPQM/Helstrom success rate for bit 1, the initial theoretical prediction of \(0.5(1\,+\,\sin {\theta }^{ \circledast })\) for BPQM for bits 2–5, the performance of BP and block ML when applied to the directly measured channel outputs, and the joint Helstrom limit (Eq. 76). b The same curves on the left plotted against the mean photon number per mode N (\(\cos \theta \,=\,{e}^{-2N}\)), where the codeword Helstrom limit was calculated from the YKL limit as in21. It can be seen that the YKL limit also matches the theoretical calculation from (Eq. 76).

  1. (1)

    The block error rates are in increasing order from strategy (a) to (d), as we might expect. Even though classical BP is performed on a tree FG here, it only implements bit-MAP decoding and not block-MAP decoding. This is why it performs worse than block ML (i.e., block MAP with uniform prior on codewords) in this case.

  2. (2)

    BPQM performs strictly better than symbol-by-symbol optimal detection followed by classical MAP decoding. This gives a clear demonstration that if one physically constructs a receiver for BPQM, then it will be the best known physically realizable receiver for the pure-state channel. For example, the Dolinar receiver13,16 realizes only strategy (c). One can use our circuits to make such a physical realization.

  3. (3)

    BPQM performs as well as the quantum optimal collective Helstrom measurement on the outputs of the channel. This lends evidence to the conclusion that by passing quantum messages, BPQM is able to behave like a collective measurement while still making only single-qubit Pauli measurements during the process. However, more careful analysis is required to characterize this in general for, say, the family of codes with tree FGs.

  4. (4)

    As a first self-consistency check, we observe that the block-ML curve asymptotes at roughly 0.875 for low mean photon numbers per mode. This is because, in this regime, the BSC induced by the symbol-by-symbol measurement essentially has a bit-flip rate of 0.5. Therefore, block ML computes a posterior that is almost uniform on all codewords, and thus the block success probability is \(1/| {\mathcal{C}}| \,=\,1/8\,=\,0.125\).

  5. (5)

    As another self-consistency check, we note that the BP curve asymptotes at roughly (1 − 1/32) = 0.9688 for low mean photon numbers per mode. Since BP performs bit-MAP on this FG, and the induced BSC in this regime flips bits at a rate of almost 0.5, BP essentially picks each bit uniformly at random, thereby returning a vector that is uniformly at random out of all the possible 25 = 32 vectors of length 5.

  6. (6)

    The bit error probability plots show that even though BPQM is optimal for bits x2 through x5, it still performs slightly poorly when compared to the performance for x1. This might be attributed to the fact that in the chosen parity-check matrix, bit x1 is involved in both checks whereas the other bits are involved in exactly one of the two checks.

CQ polar codes are known to achieve capacity on CQ channels when paired with a quantum successive cancellation decoder13,31. It remains to be seen if the same is also true for a BPQM-based decoder. Though this is mentioned in24, we think this requires more details in the form of an explicit proof. The quantum optimality of BPQM shown in this paper for the example 5-bit code bodes well for BPQM in this regard. It also remains open as to how BPQM can be generalized to FGs with cycles and also for decoding over general CQ channels. We have shown that the coherent rotation we introduced after measuring the first bit plays an important role in BPQM’s optimality (see Remark 2). Hence, one needs to refine Renes’ definition of the BPQM algorithm in more general settings. BPQM also has close connections with the recently introduced notion of channel duality32. The resulting entropic relations could help characterize the performance of a code over a channel using the performance of its dual code over the dual channel. Since the dual of the pure-state channel is the classical BSC, we believe it may be possible to extend classical techniques for analyzing BP (on BSC), such as density evolution, to analyze BPQM as well.

Leveraging optical realizations of “cat basis” quantum logic, i.e., single- and two-qubit quantum gates in the span of coherent states \(\left|\beta \right\rangle\) and \(\left|-\beta \right\rangle\)33,34, our BPQM quantum circuit can be translated into the first fully structured optical receiver that would attain the quantum limit of minimum-error discrimination of more than two coherent states. Since there is a proven CQ performance gap as discussed above, implementing our receiver on an optical quantum processor provides an alternative proposal for a quantum supremacy experiment that is distinct from the conventional proposals based on random circuits35.


In this section, we will analyze the BPQM algorithm on the example 5-bit code shown in Fig. 1. See Supplementary Note 1 for a review of decoding classical linear codes using the BP algorithm. It is very useful to interpret the node operations in BP as performing local statistical inference over certain induced channels, and this perspective is explained in Supplementary Note 2. This interpretation is also extended to CQ channels as first described by Renes in ref. 24. Then Supplementary Note 3 introduces the pure-state channel and describes the BPQM algorithm via its node operations. The relevant node convolution operations are performed in detail in Supplementary Note 6 for completeness.

Decoding bit 1

Let us begin by describing the procedure to decode bit 1 of the 5-bit code from Fig. 1. Observe that the codewords belonging to the code are


We assume that all the codewords are equally likely to be transmitted, just as in classical BP. Then the task of decoding the value of the first bit x1 involves distinguishing between the density matrices \({\rho }_{1}^{(0)}\) and \({\rho }_{1}^{(1)}\), which are uniform mixtures of the states corresponding to the codewords that have x1 = 0 and x1 = 1, respectively, i.e.,

$$\begin{array}{ll}{\rho }_{1}^{(0)}&\,=\,\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes \frac{1}{4}\left[\left|\theta \right\rangle {\left\langle \theta \right|}_{2}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{3}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{4}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{5}\,+\,\left|\theta \right\rangle {\left\langle \theta \right|}_{2}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{3}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{4}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{5}\right.\\ &\left.\,+\,\left|-\theta \right\rangle {\left\langle -\theta \right|}_{2}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{3}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{4}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{5}\,+\,\left|-\theta \right\rangle {\left\langle -\theta \right|}_{2}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{3}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{4}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{5}\right],\\ \end{array}$$
$$\begin{array}{ll}{\rho }_{1}^{(1)}&\,=\,\left|-\theta \right\rangle {\left\langle -\theta \right|}_{1}\otimes \frac{1}{4}\left[\left|\theta \right\rangle {\left\langle \theta \right|}_{2}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{3}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{4}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{5}\,+\,\left|\theta \right\rangle {\left\langle \theta \right|}_{2}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{3}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{4}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{5}\right.\\ &\left.\,+\,\left|-\theta \right\rangle {\left\langle -\theta \right|}_{2}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{3}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{4}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{5}\,+\,\left|-\theta \right\rangle {\left\langle -\theta \right|}_{2}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{3}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{4}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{5}\right].\end{array}$$

These density matrices can be written in terms of the FN channel convolution in (Eq. 19) of the Supplementary material as \({\rho }_{1}^{{x}_{1}}\,=\,{\rho }_{\pm }\,=\,\left|\pm \theta \right\rangle \ {\left\langle \pm \theta \right|}_{1}\otimes [W \,\boxed\ast\, W]{({x}_{1})}_{23}\otimes [W \,\boxed\ast\, W]{({x}_{1})}_{45}\), where we use the notation \(\pm \equiv {(-1)}^{{x}_{1}},\,{x}_{1}\in \{0,1\}\).

The BPQM circuit for decoding x1 is shown in Fig. 5 along with the density matrix in each stage of the circuit denoted by (a) through (e).

Fig. 5: The BPQM circuit to decode bit 1 of the 5-bit code in Fig. 1.
figure 5

All circuits are drawn using the “Quantikz” package36.

  1. (a)

    \({\rho }_{\pm ,a}\,=\,\left|\pm \theta \right\rangle \ {\left\langle \pm \theta \right|}_{1}\otimes [W \,\boxed\ast \,W]{({x}_{1})}_{23}\otimes [W\, \boxed\ast\, W]{({x}_{1})}_{45}\).

  2. (b)

    \({\rho }_{\pm ,b}\,=\,\left|\pm \theta \right\rangle \ {\left\langle \pm \theta \right|}_{1}\otimes {\sum }_{j\,\in\, \{0,1\}}{p}_{j}\left|\pm {\theta }_{j}^{ \boxed\ast }\right\rangle \ {\left\langle \pm {\theta }_{j}^{ \boxed\ast }\right|}_{2}\otimes \left|j\right\rangle \ {\left\langle j\right|}_{3}\otimes {\sum }_{k\,\in\, \{0,1\}}{p}_{k}\left|\pm {\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle \pm {\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\).

  3. (c)

    \({\rho }_{\pm ,c}\,=\,\left|\pm \theta \right\rangle \ {\left\langle \pm \theta \right|}_{1}\otimes {\sum }_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left|\pm {\theta }_{j}^{ \boxed\ast }\right\rangle \ {\left\langle \pm {\theta }_{j}^{ \boxed\ast }\right|}_{2}\otimes \left|\pm {\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle \pm {\theta }_{k}^{ \boxed\ast }\right|}_{3}\otimes \left|j\right\rangle \ {\left\langle j\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\).

  4. (d)

    \({\sigma }_{\pm }\,=\,{\sum }_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left|\pm \theta \right\rangle \ {\left\langle \pm \theta \right|}_{1}\otimes \left|\pm {\theta }_{jk}^{ \circledast }\right\rangle \ {\left\langle \pm {\theta }_{jk}^{ \circledast }\right|}_{2}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{3}\otimes \left|jk\right\rangle \ {\left\langle jk\right|}_{45}\), where the applied unitary operation is \(U:\,=\,{\sum }_{j,k\,\in\, {\{0,1\}}^{2}}{U}_{ \circledast }{({\theta }_{j}^{ \boxed\ast },{\theta }_{k}^{ \boxed\ast })}_{23}\otimes \left|jk\right\rangle \ {\left\langle jk\right|}_{45}\) and \(\cos {\theta }_{jk}^{ \circledast }:=\cos {\theta }_{j}^{ \boxed\ast }\cos {\theta }_{k}^{ \boxed\ast }\).

  5. (e)

    \({{{\Psi }}}_{\pm }\,=\,{\sum }_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left|\pm {\varphi }_{jk}^{ \circledast }\right\rangle \ {\left\langle \pm {\varphi }_{jk}^{ \circledast }\right|}_{1}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{2}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{3}\otimes \left|jk\right\rangle \ {\left\langle jk\right|}_{45}\), where the applied unitary operation is \(V:\,=\,{\sum }_{j,k\,\in\, {\{0,1\}}^{2}}{U}_{ \circledast }{(\theta ,{\theta }_{jk}^{ \circledast })}_{12}\otimes \left|jk\right\rangle \ {\left\langle jk\right|}_{45}\) and \(\cos {\varphi }_{jk}^{ \circledast }:\,=\,\cos \theta \cos {\theta }_{jk}^{ \circledast }\).

We emphasize that at each stage, the density matrix is the expectation over all pure states obtained there that correspond to transmitted codewords with the first bit taking value x1 {0, 1}. The operations U and V are effectively two-qubit unitary operations, albeit controlled ones, and this phenomenon extends to any factor graph. Evidently, BPQM compresses all the quantum information into system 1 and the problem reduces to distinguishing between \({{{\Psi }}}_{\pm }^{(1)}\,=\,{\sum }_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left|\pm {\varphi }_{jk}^{ \circledast }\right\rangle \ {\left\langle \pm {\varphi }_{jk}^{ \circledast }\right|}_{1}\), since the other systems are either trivial or completely classical and independent of x1. Finally, system 1 is measured by projecting onto the Pauli X basis, which we know from the discussion in Supplementary Note 3.2 after (31) to be the Helstrom measurement to optimally distinguish between the states \({{{\Psi }}}_{\pm }^{(1)}\).

It is pertinent that the optimal success probability of distinguishing between the density matrices \({\rho }_{1}^{(0)}\) and \({\rho }_{1}^{(1)}\) using a collective Helstrom measurement is given by

$${P}_{{\rm{succ}},1}^{\,\text{Hel}\,}\,=\,\frac{1}{2}\,+\,\frac{1}{4}{\left\Vert {\rho }_{1}^{(0)}\,-\,{\rho }_{1}^{(1)}\right\Vert }_{1},\,\,{\left\Vert M\right\Vert }_{1}:\,=\,\text{Tr}\,\left(\sqrt{{M}^{\dagger }M}\right).$$

The action of BPQM until the final measurement is unitary and the trace norm \({\left\Vert \cdot \right\Vert }_{1}\) is invariant under unitaries. Thus, BPQM does not lose optimality until the final measurement. Since the final measurement is also optimal for distinguishing the two possible states at that stage (e), BPQM is indeed optimal in decoding the value of x1. Thus, despite not performing a collective measurement, but rather only a single-qubit measurement at the end of a sequence of unitaries motivated by the FG structure and induced channels in classical BP, BPQM is still optimal to determine whether x1 = 0 or 1. The performance curves plotted in Fig. 6 demonstrate this optimality.

Fig. 6: The success probabilities for decoding the value of x1 in the 5-bit code.
figure 6

Here, “Helstrom on Density” represents \({P}_{{\rm{succ}},1}^{\,\text{Hel}\,}\) and “Direct” represents the success probability when directly implementing the Helstrom measurement at the channel output on system 1. The curve “Sim: BPQM” corresponds to a simulation that averaged each data point over 105 codewords.

Remark 1 Observe that in this quantum scenario, \({\rho }_{1}^{(x)}\) behave like a “posterior” for bit x1. However, these can be written down even before transmitting over the channel since they do not depend on the output of the channel. Hence, it is unclear if there is a better notion of a true posterior which we can then show to be “marginalized” by BPQM.

We now analyze the performance of the receiver in decoding bit 1. The probability to decode it as \({\hat{x}}_{1}=0\) is

$${\mathbb{P}}\left[{\hat{x}}_{1}\,=\,0\ | \ {{{\Psi }}}_{\pm }^{(1)}\right]\,=\,\,\text{Tr}\,\left[{{{\Psi }}}_{\pm }^{(1)}\left|+\right\rangle \ \left\langle +\right|\right]\,=\,\mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left(\frac{1\,\pm\, \sin {\varphi }_{jk}^{ \circledast }}{2}\right).$$

Therefore, since there are four codewords each that have x1 = 0 and x1 = 1, the prior for bit x1 is 1/2 and the probability of success for BPQM in decoding the bit x1 is

$${P}_{{\rm{succ}},1}^{{\rm{BPQM}}}\,=\,{\mathbb{P}}[{x}_{1}\,=\,0]\cdot {\mathbb{P}}[{\hat{x}}_{1}\,=\,0\ | \ {x}_{1}\,=\,0]\,+\,{\mathbb{P}}[{x}_{1}\,=\,1]\cdot {\mathbb{P}}[{\hat{x}}_{1}\,=\,1\ | \ {x}_{1}\,=\,1]$$
$$=\frac{1}{2}\left[\mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left(\frac{1\,+\,\sin {\varphi }_{jk}^{ \circledast }}{2}\right)\,+\,\mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left(\frac{1\,+\,\sin {\varphi }_{jk}^{ \circledast }}{2}\right)\right]$$
$$=\frac{{p}_{0}^{2}}{2}\left(1\,+\,\sin {\varphi }_{00}^{ \circledast }\right)\,+\,(1\,-\,{p}_{0}^{2})$$
$$=1\,-\,\frac{{p}_{0}^{2}}{2}(1\,-\,\sin {\varphi }_{00}^{ \circledast }),$$

where we have used the fact that since all channels are identically W, we have \(\cos {\theta }_{1}^{ \boxed\ast }=0\). We can calculate

$$\cos {\varphi }_{00}^{ \circledast }\,=\,\cos \theta \cos {\theta }_{00}^{ \circledast }\,=\,\cos \theta {\cos }^{2}{\theta }_{0}^{ \boxed\ast }\,=\,\cos \theta \frac{4{\cos }^{2}\theta }{{(1\,+\,{\cos }^{2}\theta )}^{2}}$$
$$\Rightarrow \sin {\varphi }_{00}^{ \circledast }\,=\,\sqrt{1\,-\,\frac{16{\cos }^{6}\theta }{{(1\,+\,{\cos }^{2}\theta )}^{4}}}\,=\,\sqrt{1\,-\,\frac{{(2{p}_{0}\,-\,1)}^{3}}{{p}_{0}^{4}}}\,=\,\frac{\sqrt{{p}_{0}^{4}\,-\,{(2{p}_{0}\,-\,1)}^{3}}}{{p}_{0}^{2}}.$$

Substituting back, we get the BPQM probability of success for bit x1 to be


which is the curve plotted as “Theory: BPQM \({P}_{{\rm{succ}},1}^{{\rm{BPQM}}}\)” in Fig. 6.

Before measuring system 1, the state of system 1 is essentially \({{{\Psi }}}_{\pm }^{(1)}\,=\,{p}_{0}^{2}\left|\pm {\varphi }_{00}^{ \circledast }\right\rangle \ \left\langle \pm {\varphi }_{00}^{ \circledast }\right|\,+\,(1\,-\,{p}_{0}^{2})\left|\pm \right\rangle \ \left\langle \pm \right|\), since \(\cos {\varphi }_{jk}^{ \circledast }=0\) whenever either j or k equals 1 (or both) and hence \(\left|\pm {\varphi }_{jk}^{ \circledast }\right\rangle \ \left\langle \pm {\varphi }_{jk}^{ \circledast }\right|\,=\,\left|\pm \right\rangle \ \left\langle \pm \right|\). So, \({p}_{0}^{2}\) is the probability that the system “confuses” the decoder, and projection onto the X basis essentially replaces the system with \(\left|{m}_{1}\right\rangle \ \left\langle {m}_{1}\right|\), where \({m}_{1}\,=\,{(-1)}^{{\hat{x}}_{1}}\,\in\, \{+,-\}\). The full postmeasurement state is given by quantum mechanics to be

$${{{\Phi }}}_{{m}_{1}}\,=\,\mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\frac{{\left|\left\langle {m}_{1}| \,\pm\, {\varphi }_{jk}^{ \circledast }\right\rangle \right|}^{2}}{\,\text{Tr}\,\left[{{{\Psi }}}_{\pm }^{(1)}\left|{m}_{1}\right\rangle \ \left\langle {m}_{1}\right|\right]}\left|{m}_{1}\right\rangle \ {\left\langle {m}_{1}\right|}_{1}\otimes \left|00\right\rangle \ {\left\langle 00\right|}_{23}\otimes \left|jk\right\rangle \ {\left\langle jk\right|}_{45}.$$

Note that in Fig. 5, we need to apply a Hadamard after the Z-basis measurement in order to ensure that the effective projector is \(H\left|{\hat{x}}_{1}\right\rangle \ \left\langle {\hat{x}}_{1}\right|\ H\,=\,\left|{m}_{1}\right\rangle \ \left\langle {m}_{1}\right|\).

Let us denote the overall unitary operation performed in Fig. 5 until stage (e) as \({B}_{1}^{{\rm{BPQM}}}\). As mentioned earlier, the Helstrom measurement to optimally distinguish between \({\rho }_{1}^{(0)}\) and \({\rho }_{1}^{(1)}\) is given by the POVM \(\{{{{\Pi }}}_{1}^{\,\text{Hel}\,},{\mathbb{I}}-{{{\Pi }}}_{1}^{\,\text{Hel}\,}\}\), where

$${{{\Pi }}}_{1}^{\,\text{Hel}\,}:\,=\,\mathop{\sum}\limits_{i:{\lambda }_{i}\,\ge\, 0}\left|i\right\rangle \ \left\langle i\right|,\,\,({\rho }_{1}^{(0)}\,-\,{\rho }_{1}^{(1)})\left|i\right\rangle \,=\,{\lambda }_{i}\left|i\right\rangle .$$

BPQM performs the final Helstrom measurement given by the POVM \(\{{\tilde{{{\Pi }}}}_{1}^{\,\text{Hel}\,},{\mathbb{I}}-{\tilde{{{\Pi }}}}_{1}^{\,\text{Hel}\,}\}\), where

$${\tilde{{{\Pi }}}}_{1}^{\,\text{Hel}\,}:\,=\,\mathop{\sum}\limits_{j:{\lambda }_{j}\,\ge\, 0}\left|j\right\rangle \ \left\langle j\right|\,=\,\left|+\right\rangle \ {\left\langle +\right|}_{1}\otimes {({I}_{16})}_{2345},\qquad \qquad ({{{\Psi }}}_{+}\,-\,{{{\Psi }}}_{-})\left|j\right\rangle \,=\,{\lambda }_{j}\left|j\right\rangle$$
$$\Rightarrow \left[{B}_{1}^{{\rm{BPQM}}}{\rho }_{1}^{(0)}{\left({B}_{1}^{{\rm{BPQM}}}\right)}^{\dagger }\,-\,{B}_{1}^{{\rm{BPQM}}}{\rho }_{1}^{(1)}{\left({B}_{1}^{{\rm{BPQM}}}\right)}^{\dagger }\right]\left|j\right\rangle \,=\,{\lambda }_{j}\left|j\right\rangle$$
$$\Rightarrow ({\rho }_{1}^{(0)}\,-\,{\rho }_{1}^{(1)}){\left({B}_{1}^{{\rm{BPQM}}}\right)}^{\dagger }\left|j\right\rangle \,=\,{\lambda }_{j}{\left({B}_{1}^{{\rm{BPQM}}}\right)}^{\dagger }\left|j\right\rangle .$$

Thus, we can express the eigenvectors for \(({\rho }_{1}^{(0)}\,-\,{\rho }_{1}^{(1)})\) as \(\left|i\right\rangle \,=\,{\left({B}_{1}^{{\rm{BPQM}}}\right)}^{\dagger }\left|j\right\rangle\). This further implies that

$${{{\Pi }}}_{1}^{\,\text{Hel}\,}\,=\,\mathop{\sum}\limits_{i:{\lambda }_{i}\,\ge\, 0}\left|i\right\rangle \ \left\langle i\right|\,=\,{\left({B}_{1}^{{\rm{BPQM}}}\right)}^{\dagger }\left[\mathop{\sum}\limits_{j:{\lambda }_{j}\,\ge\, 0}\left|j\right\rangle \ \left\langle j\right|\right]{B}_{1}^{{\rm{BPQM}}}\,=\,{\left({B}_{1}^{{\rm{BPQM}}}\right)}^{\dagger }\left[\left|+\right\rangle \ {\left\langle +\right|}_{1}\otimes {({I}_{16})}_{2345}\right]{B}_{1}^{{\rm{BPQM}}}.$$

Hence, in order to identically apply the Helstrom measurement \({{{\Pi }}}_{1}^{\,\text{Hel}\,}\), BPQM needs to first apply \({B}_{1}^{{\rm{BPQM}}}\), then measure the first qubit in the X-basis, and finally invert \({B}_{1}^{{\rm{BPQM}}}\) on the postmeasurement state \({{{\Phi }}}_{{m}_{1}}\) above. Although this is optimal for bit 1, next we will see that it is beneficial to coherently rotate \({{{\Phi }}}_{{m}_{1}}\) before inverting \({B}_{1}^{{\rm{BPQM}}}\), which sets up a better state discrimination problem for decoding bit 2.

Decoding bits 2 and 3 (or 4 and 5)

Next, in order to execute BPQM to decode bit x2, we would ideally hope to change the state \({{{\Phi }}}_{{m}_{1}}\) back to the channel outputs. However, this is impossible after having performed the measurement. In the original BPQM algorithm24, the procedure to be performed at this stage is ambiguous, so we describe a strategy that treads closely along the path of performing the Helstrom measurement for bit 2 as well, i.e., optimally distinguishing \({\rho }_{2}^{(0)}\) and \({\rho }_{2}^{(1)}\) evolved through \({\tilde{A}}_{1}^{{\rm{BPQM}}}:={\left({B}_{1}^{{\rm{BPQM}}}\right)}^{\dagger }\left[\left|{m}_{1}\right\rangle \ {\left\langle {m}_{1}\right|}_{1}\otimes {({I}_{16})}_{2345}\right]{B}_{1}^{{\rm{BPQM}}}\).

In order to be able to run BPQM for bit x1 in reverse to get “as close” to the channel outputs as possible, we need to make sure that the state \({{{\Phi }}}_{{m}_{1}}\) is modified to be compatible with the (angles used to define the) unitaries V and U in Fig. 5. Since we can keep track of the intermediate angles deterministically, we can conditionally rotate subsystem 1 to be \(\left|{m}_{1}{\varphi }_{00}^{ \circledast }\right\rangle \ {\left\langle {m}_{1}{\varphi }_{00}^{ \circledast }\right|}_{1}\) for \(\left|jk\right\rangle \ {\left\langle jk\right|}_{45}\,=\,\left|00\right\rangle \ {\left\langle 00\right|}_{45}\). Note again that in Ψ±, when either of j or k is 1 (or both), \({\varphi }_{jk}^{ \circledast }={\rm{\pi }}/2\) and hence \(\left|\pm {\varphi }_{jk}^{ \circledast }\right\rangle \ \left\langle \pm {\varphi }_{jk}^{ \circledast }\right|\,=\,\left|\pm \right\rangle \ \left\langle \pm \right|\). Therefore, if \({\hat{x}}_{1}\) is the wrong estimate for x1, then \(\left\langle {m}_{1}| \pm \right\rangle =0\) and the superposition in \({{{\Phi }}}_{{m}_{1}}\) collapses to a single term with j = k = 0.

More precisely, we can implement the unitary operation (see Supplementary Note 5 for a decomposition of \({K}_{{m}_{1}}\))

$${M}_{{m}_{1}}:\,=\,{({K}_{{m}_{1}})}_{1}\otimes \left|00\right\rangle \ {\left\langle 00\right|}_{45}\,+\,{({I}_{2})}_{1}\otimes \left(\left|01\right\rangle \ {\left\langle 01\right|}_{45}\,+\,\left|10\right\rangle \ {\left\langle 10\right|}_{45}\,+\,\left|11\right\rangle \ {\left\langle 11\right|}_{45}\right),$$

where K+ and K are unitaries chosen to satisfy \({K}_{+}\left|+\right\rangle \,=\,\left|{\varphi }_{00}^{ \circledast }\right\rangle\) and \({K}_{-}\left|-\right\rangle \,=\,\left|-{\varphi }_{00}^{ \circledast }\right\rangle\), respectively. We can easily complete these partially defined unitaries with the conditions \({K}_{+}\left|-\right\rangle \,=\,\sin \frac{{\varphi }_{00}^{ \circledast }}{2}\left|0\right\rangle \,-\,\cos \frac{{\varphi }_{00}^{ \circledast }}{2}\left|1\right\rangle\) and \({K}_{-}\left|+\right\rangle \,=\,\sin \frac{{\varphi }_{00}^{ \circledast }}{2}\left|0\right\rangle \,+\,\cos \frac{{\varphi }_{00}^{ \circledast }}{2}\left|1\right\rangle\). Applying \({M}_{{m}_{1}}\) to \({{{\Phi }}}_{{m}_{1}}\) we get the desired state (compare to state Ψ± in stage (e) of Fig. 5)

$${\tilde{{{\Psi }}}}_{{m}_{1}}\,=\,\mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\frac{{\left|\left\langle {m}_{1}| \pm {\varphi }_{jk}^{ \circledast }\right\rangle \right|}^{2}}{\,\text{Tr}\,\left[{{{\Psi }}}_{\,\pm\, }^{(1)}\left|{m}_{1}\right\rangle \ \left\langle {m}_{1}\right|\right]}\left|{m}_{1}{\varphi }_{jk}^{ \circledast }\right\rangle \ {\left\langle {m}_{1}{\varphi }_{jk}^{ \circledast }\right|}_{1}\otimes \left|00\right\rangle \ {\left\langle 00\right|}_{23}\otimes \left|jk\right\rangle \ {\left\langle jk\right|}_{45}.$$

Now the BPQM circuit for bit x1, shown in Fig. 5, can be run in reverse from before the final measurement, i.e., from stage (e) back to stage (a). Hence, the overall operation on the input state in Fig. 5 is

$${A}_{1}^{{\rm{BPQM}}}:={\left({B}_{1}^{{\rm{BPQM}}}\right)}^{\dagger }{M}_{{m}_{1}}\left[\left|{m}_{1}\right\rangle \ {\left\langle {m}_{1}\right|}_{1}\otimes {({I}_{16})}_{2345}\right]{B}_{1}^{{\rm{BPQM}}}.$$

Then we expect the state to be almost the same as the channel outputs, except that system 1 will deterministically be in state \(\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\). However, a simple calculation shows that this is not completely true since the additional factor \(\frac{{\left|\left\langle {m}_{1}| \,\pm\, {\varphi }_{jk}^{ \circledast }\right\rangle \right|}^{2}}{\,\text{Tr}\,\left[{{{\Psi }}}_{\pm }^{(1)}\left|{m}_{1}\right\rangle \ \left\langle {m}_{1}\right|\right]}\) prevents the density matrix to decompose into a tensor product of two 2-qubit density matrices at stage (b) of Fig. 5. Specifically, when we take \({\tilde{{{\Psi }}}}_{{m}_{1}}\) at stage (e) back to stage (b) by inverting the BPQM operations, we arrive at the state

$${\tilde{\rho }}_{\pm ,b}^{({m}_{1})}\,=\,\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes \mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\frac{{\left|\left\langle {m}_{1}| \,\pm\, {\varphi }_{jk}^{ \circledast }\right\rangle \right|}^{2}}{\,\text{Tr}\,\left[{{{\Psi }}}_{\pm }^{(1)}\left|{m}_{1}\right\rangle \ \left\langle {m}_{1}\right|\right]}\left(\left|{m}_{1}{\theta }_{j}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{j}^{ \boxed\ast }\right|}_{2}\otimes \left|j\right\rangle \ {\left\langle j\right|}_{3}\right)\otimes \left(\left|{m}_{1}{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right)$$
$$=\left\{\begin{array}{ll}\frac{1}{{P}_{{\rm{succ}},1}^{{\rm{BPQM}}}}\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes \mathop{\sum }\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}{\left|\left\langle {m}_{1}| \,\pm\, {\varphi }_{jk}^{ \circledast }\right\rangle \right|}^{2}\left(\left|{m}_{1}{\theta }_{j}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{j}^{ \boxed\ast }\right|}_{2}\otimes \left|j\right\rangle \ {\left\langle j\right|}_{3}\right)&\\ \otimes \left(\left|{m}_{1}{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right)&\,{\text{if}}\,\,{\hat{x}}_{1}\,=\,{x}_{1},\\ \left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes \left(\left|{m}_{1}{\theta }_{0}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{0}^{ \boxed\ast }\right|}_{2}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{3}\right)\otimes \left(\left|{m}_{1}{\theta }_{0}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{0}^{ \boxed\ast }\right|}_{4}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{5}\right)&\,\text{if}\,\,{\hat{x}}_{1}\,\ne\, {x}_{1}.\end{array}\right.$$

Lemma 1 Let \(C:={({I}_{2})}_{1}\otimes {\text{CNOT}}_{2\to 3}\otimes {\text{CNOT}}_{4\to 5}\) and \(\left|{{{\Gamma }}}_{{\hat{x}}_{1}}\right\rangle :=\cos \frac{{\theta }_{0}^{ \boxed\ast }}{2}\left|00\right\rangle \,+\,{(-1)}^{{\hat{x}}_{1}}\sin \frac{{\theta }_{0}^{ \boxed\ast }}{2}\left|11\right\rangle\). Then

$$C{\tilde{\rho }}_{\pm ,b}^{({m}_{1})}{C}^{\dagger }\,=\,\left\{\begin{array}{ll}\frac{1}{{P}_{{\rm{succ}},1}^{{\rm{BPQM}}}}\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes [W \boxed\ast W]{({\hat{x}}_{1})}_{23}\otimes [W \boxed\ast W]{({\hat{x}}_{1})}_{45}&\\ +\frac{{p}_{0}^{2}}{{P}_{{\rm{succ}},1}^{{\rm{BPQM}}}}\left[0.5(1\,+\,\sin {\varphi }_{00}^{ \circledast })\,-\,1\right]\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes \left|{{{\Gamma }}}_{{\hat{x}}_{1}}\right\rangle \ {\left\langle {{{\Gamma }}}_{{\hat{x}}_{1}}\right|}_{23}\otimes \left|{{{\Gamma }}}_{{\hat{x}}_{1}}\right\rangle \ {\left\langle {{{\Gamma }}}_{{\hat{x}}_{1}}\right|}_{45}&\,\text{if}\,\,{\hat{x}}_{1}\,=\,{x}_{1},\\ \left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes \left|{{{\Gamma }}}_{{\hat{x}}_{1}}\right\rangle \ {\left\langle {{{\Gamma }}}_{{\hat{x}}_{1}}\right|}_{23}\otimes \left|{{{\Gamma }}}_{{\hat{x}}_{1}}\right\rangle \ {\left\langle {{{\Gamma }}}_{{\hat{x}}_{1}}\right|}_{45}&\,\text{if}\,\,{\hat{x}}_{1}\,\ne\, {x}_{1}.\end{array}\right.$$

Proof We know from the definition of the factor node convolution operation of BPQM that

$$\begin{array}{ll}C&\left(\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes [W \boxed\ast W]{({\hat{x}}_{1})}_{23}\otimes [W \boxed\ast W]{({\hat{x}}_{1})}_{45}\right){C}^{\dagger }\\ &=\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes \left(\mathop{\sum}\limits_{j\,\in\, \{0,1\}}{p}_{j}\left|{m}_{1}{\theta }_{j}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{j}^{ \boxed\ast }\right|}_{2}\otimes \left|j\right\rangle \ {\left\langle j\right|}_{3}\right)\otimes \left(\mathop{\sum}\limits_{k\,\in\, \{0,1\}}{p}_{k}\left|{m}_{1}{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right)\end{array}$$
$$={\rho }_{{m}_{1},b}.$$

This in turn implies that \(C{\rho }_{{m}_{1},b}{C}^{\dagger }\,=\,\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes [W \boxed\ast W]{({\hat{x}}_{1})}_{23}\otimes [W \boxed\ast W]{({\hat{x}}_{1})}_{45}\). Ignoring the first qubit and the constant factor for simplicity, observe that

$${\tilde{\rho }}_{\pm ,b}^{({m}_{1})}{\left|\right.}_{{\hat{x}}_{1} \,=\, {x}_{1}}\,=\,\mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left({\left|\left\langle {m}_{1}| \,\pm\, {\varphi }_{jk}^{ \circledast }\right\rangle \right|}^{2}-1\,+\,1\right)\left(\left|{m}_{1}{\theta }_{j}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{j}^{ \boxed\ast }\right|}_{2}\otimes \left|j\right\rangle \ {\left\langle j\right|}_{3}\right)\otimes \left(\left|{m}_{1}{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right)$$
$$={\rho }_{{m}_{1},b}\,+\,{p}_{0}^{2}\left[0.5(1\,+\,\sin {\varphi }_{00}^{ \circledast })\,-\,1\right]\left(\left|{m}_{1}{\theta }_{0}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{0}^{ \boxed\ast }\right|}_{2}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{3}\right)\otimes \left(\left|{m}_{1}{\theta }_{0}^{ \boxed\ast }\right\rangle \ {\left\langle {m}_{1}{\theta }_{0}^{ \boxed\ast }\right|}_{4}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{5}\right).$$

We have used the fact that except when j = k = 0, assuming \({\hat{x}}_{1}={x}_{1}\), \(\langle {m}_{1}| \,\pm\, {\varphi }_{jk}^{ \circledast }\rangle =\langle {m}_{1}| {m}_{1}{\varphi }_{jk}^{ \circledast }\rangle \,=\,\langle {m}_{1}| {m}_{1}\rangle \,=\,1\). Finally, using \({\text{CNOT}}_{2\to 3}({|{m}_{1}{\theta }_{0}^{ \boxed\ast }\rangle }_{2}\otimes {|0\rangle }_{3})\,=\,|{{{\Gamma }}}_{{\hat{x}}_{1}}\rangle\), the result follows for both cases \({\hat{x}}_{1}\,=\,{x}_{1}\) and \({\hat{x}}_{1}\,\ne\, {x}_{1}\).

Therefore, after reversing the operations of BPQM for bit x1, the 5-qubit system is in the state

$$\begin{array}{lll}{\tilde{\rho }}_{{m}_{1},a}&\,=\,&{P}_{{\rm{succ}},1}^{{\rm{BPQM}}}\cdot C{\tilde{\rho }}_{\pm ,b}^{({m}_{1})}{\left|\right.}_{{\hat{x}}_{1} \,=\, {x}_{1}}{C}^{\dagger }+\left(1\,-\,{P}_{{\rm{succ}},1}^{{\rm{BPQM}}}\right)\cdot C{\tilde{\rho }}_{\pm ,b}^{({m}_{1})}{\left|\right.}_{{\hat{x}}_{1}\,\ne\, {x}_{1}}{C}^{\dagger }\\ &\,=\,&\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes [W \,\boxed\ast \,W]{({\hat{x}}_{1})}_{23}\otimes [W\, \boxed\ast\, W]{({\hat{x}}_{1})}_{45}\end{array}$$
$$\begin{array}{lll}&\,+\,&{p}_{0}^{2}\left[0.5(1\,+\,\sin {\varphi }_{00}^{ \circledast })\,-\,1\right]\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes \left|{{{\Gamma }}}_{{\hat{x}}_{1}}\right\rangle \ {\left\langle {{{\Gamma }}}_{{\hat{x}}_{1}}\right|}_{23}\otimes \left|{{{\Gamma }}}_{{\hat{x}}_{1}}\right\rangle \ {\left\langle {{{\Gamma }}}_{{\hat{x}}_{1}}\right|}_{45}\\ &\,+\,&\left(1\,-\,{P}_{{\rm{succ}},1}^{{\rm{BPQM}}}\right)\cdot \left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes \left|{{{\Gamma }}}_{{\hat{x}}_{1}}\right\rangle \ {\left\langle {{{\Gamma }}}_{{\hat{x}}_{1}}\right|}_{23}\otimes \left|{{{\Gamma }}}_{{\hat{x}}_{1}}\right\rangle \ {\left\langle {{{\Gamma }}}_{{\hat{x}}_{1}}\right|}_{45}\end{array}$$
$$=\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{1}\otimes [W \,\boxed\ast\, W]{({\hat{x}}_{1})}_{23}\otimes [W\, \boxed\ast\, W]{({\hat{x}}_{1})}_{45},$$

since \({P}_{{\rm{succ}},1}^{{\rm{BPQM}}}\,=\,{p}_{0}^{2}\cdot 0.5(1\,+\,\sin {\varphi }_{00}^{ \circledast })\,+\,(1\,-\,{p}_{0}^{2})\).

At this point, we have decoded \({\hat{x}}_{1}\,=\,0\) if m1 = + and \({\hat{x}}_{1}\,=\,1\) if m1 = −. We can absorb the value of \({\hat{x}}_{1}\) in the FG by updating the parity checks c1 and c2 to impose \({x}_{2}\oplus {x}_{3}={\hat{x}}_{1}\) and \({x}_{4}\oplus {x}_{5}={\hat{x}}_{1}\), respectively. Now we have two disjoint FGs as shown in Fig. 7. It suffices to decode x2 and x4 since \({\hat{x}}_{3}\,=\,{\hat{x}}_{2}\oplus {\hat{x}}_{1}\) and \({\hat{x}}_{5}\,=\,{\hat{x}}_{4}\oplus {\hat{x}}_{1}\). Also, due to symmetry, it suffices to analyze the success probability of decoding x2 (resp. x4) and x3 (resp. x5). For this reduced FG, we need to split \({\tilde{\rho }}_{{m}_{1},a}\) into two density matrices corresponding to the hypotheses x2 = 0 and x2 = 1. If we revisit the density matrices \({\rho }_{1}^{(0)}\) and \({\rho }_{1}^{(1)}\), we observe that the 5-qubit system at the channel output is exactly \(\frac{1}{2}{\rho }_{1}^{(0)}+\frac{1}{2}{\rho }_{1}^{(1)}\). Hence, for x2, we accordingly split \([W \,\boxed\ast\, W]{({\hat{x}}_{1})}_{23}\) in \({\tilde{\rho }}_{{m}_{1},a}\) and arrive at the two hypotheses states

Fig. 7: The reduced factor graph after estimating bit 1 to be \({\hat{x}}_{1}\).
figure 7

Conditioned on this estimate, the two checks c1 and c2 are updated respectively to \(\tilde{c}_1\) and \(\tilde{c}_2\), which represent the check equations shown above the two subgraphs.

$${\tilde{{{\Phi }}}}_{{x}_{2} \,=\, {\hat{x}}_{1}}({\hat{x}}_{1})\,=\,\left|{m}_{1}\theta \right\rangle \ {\left\langle {m}_{1}\theta \right|}_{2}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{3}\otimes [W\, \boxed\ast \,W]{({\hat{x}}_{1})}_{45},$$
$${\tilde{{{\Phi }}}}_{{x}_{2}\ne {\hat{x}}_{1}}({\hat{x}}_{1})\,=\,\left|-{m}_{1}\theta \right\rangle \ {\left\langle -{m}_{1}\theta \right|}_{2}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{3}\otimes [W \,\boxed\ast\, W]{({\hat{x}}_{1})}_{45}.$$

In Supplementary Note 4, we discuss how these hypotheses must be processed, which makes the next steps of BPQM intuitively clear (see Supplementary Fig. 3). However, the success probability derived from this analysis for bits 2–5 turns out to be significantly higher than the quantum optimal scheme for each bit at the channel output (see Supplementary Fig. 4). This indicates that the state discrimination problem for bit 2 discussed above is more ideal than the actual problem in hand. Hence, next we analyze the true state discrimination problem for bit 2 (or 4) and clarify the observed performance in Supplementary Fig. 4.

Analysis of BPQM optimality for decoding bit 2 (or 4)

At the channel output, it is clear that the optimal strategy to decode bit 2 is to perform the Helstrom measurement that distinguishes between \({\rho }_{2}^{(0)}\) and \({\rho }_{2}^{(1)}\). However, since we performed BPQM operations to decode bit 1 first, these two density matrices would have evolved through that process. Therefore, the correct analysis is to derive the resulting states and then subject them to the BPQM strategy for decoding bit 2 that was discussed above. For simplicity, we only track the density matrix \({\rho }_{2}^{(0)}\) through the different stages in Fig. 8. In Fig. 9, we provide the full expanded BPQM circuit for decoding all bits, and this can be turned into a circuit composed of standard quantum operations by using the decompositions in Figs. 10 and 11. The corresponding states for \({\rho }_{2}^{(1)}\) can easily be ascertained from these. It will be convenient to express

Fig. 8: The full BPQM circuit to decode all bits of the 5-bit code in Fig. 1.
figure 8

The decoded values are related to the measurement results as \({m}_{1}\,=\,{(-1)}^{{\hat{x}}_{1}},{m}_{2}\,=\,{(-1)}^{{\hat{x}}_{2}},{m}_{4}\,=\,{(-1)}^{{\hat{x}}_{4}}\), and \({\hat{x}}_{3}\,=\,{\hat{x}}_{1}\oplus {\hat{x}}_{2},{\hat{x}}_{5}\,=\,{\hat{x}}_{1}\oplus {\hat{x}}_{4}\). The open-circled controls indicate that \({K}_{{m}_{1}}\) is coherently controlled by the last two qubits being in the state \({\left|00\right\rangle }_{45}\). The solid line before \({K}_{{m}_{1}}\) indicates that the controlled unitary is applied to the postmeasurement state. See Fig. 9 for the full decomposition of this circuit.

Fig. 9: The circuit decomposition for \({U}_{ \circledast }(\theta ,\theta ^{\prime} )\), where we set A1: = Ry(γ1/2), B1: = Ry(−γ1/2)Rz(−π/2), C1: = Rz(π/2), A2: = Rz(π)Ry(γ2/2), B2: = Ry(−γ2/2)Rz(−π), and \(S\,=\,\sqrt{Z}\) is the phase gate.
figure 9

See Supplementary Note 5 for calculations and angles γ1, γ2. Note that, for example, B2 = Ry(−γ2/2)Rz(−π) implies that Rz(−π) must be applied first, then followed by Ry(−γ2/2).

Fig. 10: Decomposition of controlled gates using Toffoli (or CCZ) gates and an ancilla (Fig. 4.10 in37), where i, j {1, 2, 3} and D {A1, B1, C1, A2, B2, S} as appropriate.
figure 10

The top two identities can be used to implement each of the doubly controlled \({U}_{ \circledast }(\theta ,\theta ^{\prime} )\) appearing in Fig. 11, by applying doubly controlled versions of the components of \({U}_{ \circledast }(\theta ,\theta ^{\prime} )\) in Fig. 9. Note that \({m}_{1}={(-1)}^{{\hat{x}}_{1}}\) is the result of estimating x1 to be \({\hat{x}}_{1}\in \{0,1\}\). See Supplementary Note 5 for the relevant calculations and the angle γ.

Fig. 11: Full decomposition of the BPQM circuit in Fig. 8.
figure 11

The variable node unitaries \({U}_{ \circledast }(\theta ,\theta ^{\prime} )\) are decomposed in Fig. 9. The two-qubit-controlled coherent versions of these unitaries as well as the single-qubit rotation \({K}_{{m}_{1}}\), which is a function of the measurement result m1, are decomposed in Fig. 10.

$$\frac{1}{2}\left|\theta \right\rangle {\left\langle \theta \right|}_{2}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{3}\,=\,[W \,\boxed\ast\, W]{(0)}_{23}\,-\,\frac{1}{2}\left|-\theta \right\rangle {\left\langle -\theta \right|}_{2}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{3},$$
$$\frac{1}{2}\left|\theta \right\rangle {\left\langle \theta \right|}_{2}\otimes \left|\,-\,\theta \right\rangle {\left\langle -\theta \right|}_{3}\,=\,[W\, \boxed\ast\, W]{(1)}_{23}\,-\,\frac{1}{2}\left|-\theta \right\rangle {\left\langle -\theta \right|}_{2}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{3}.$$

For brevity, we will use the notation CXij := CNOTij and Swap34 := CX34 CX43 CX34. Then we can write

$${\rho }_{2,a}^{(0)}\,=\,\frac{1}{2}\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{2}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{3}\otimes [W \,\boxed\ast\, W]{(0)}_{45}\,+\,\frac{1}{2}\left|-\theta \right\rangle {\left\langle -\theta \right|}_{1}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{2}\otimes \left|-\theta \right\rangle {\left\langle -\theta \right|}_{3}\otimes [W \,\boxed\ast\, W]{(1)}_{45},$$
$$\begin{array}{l}{\rho }_{2,b}^{(0)}\,=\,\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes \left[\mathop{\sum}\limits_{j\,=\,0,1}{p}_{j}\left|{\theta }_{j}^{ \boxed\ast }\right\rangle \ {\left\langle {\theta }_{j}^{ \boxed\ast }\right|}_{2}\otimes \left|j\right\rangle \ {\left\langle j\right|}_{3}\,-\,\frac{1}{2}{\text{CX}}_{23}\ \left|-\theta ,-\theta \right\rangle \ {\left\langle -\theta ,-\theta \right|}_{23}\ {\text{CX}}_{23}\right]\\ \qquad\quad\otimes \left[\mathop{\sum}\limits_{k\,=\,0,1}{p}_{k}\left|{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right] \,+\,\left|-\theta \right\rangle {\left\langle -\theta \right|}_{1}\\ \qquad\quad\otimes \left[\mathop{\sum}\limits_{j\,=\,0,1}{p}_{j}\left|-{\theta }_{j}^{ \boxed\ast }\right\rangle \ {\left\langle -{\theta }_{j}^{ \boxed\ast }\right|}_{2}\otimes \left|j\right\rangle \ {\left\langle j\right|}_{3}\,-\,\frac{1}{2}{\text{CX}}_{23}\ \left|-\theta ,\theta \right\rangle \ {\left\langle -\theta ,\theta \right|}_{23}\ {\text{CX}}_{23}\right]\\ \qquad\quad\otimes \left[\mathop{\sum}\limits_{k\,=\,0,1}{p}_{k}\left|-{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle -{\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right],\end{array}$$
$$\begin{array}{ll}{\rho }_{2,c}^{(0)}\,\,=&\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes \mathop{\sum}\limits_{j,k\in {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left|{\theta }_{j}^{ \boxed\ast }\right\rangle \ {\left\langle {\theta }_{j}^{ \boxed\ast }\right|}_{2}\otimes \left|{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {\theta }_{k}^{ \boxed\ast }\right|}_{3}\otimes \left|j\right\rangle \ {\left\langle j\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\\&-\frac{1}{2}\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes {\text{Swap}}_{34}\ \left[{\text{CX}}_{23}\left|-\theta ,-\theta \right\rangle \ {\left\langle -\theta ,-\theta \right|}_{23}{\text{CX}}_{23}\otimes \mathop{\sum}\limits_{k=0,1}{p}_{k}\left|{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right]{\text{Swap}}_{34}\\& +\,\left|-\theta \right\rangle {\left\langle -\theta \right|}_{1}\otimes \mathop{\sum}\limits_{j,k\in {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left|-{\theta }_{j}^{ \boxed\ast }\right\rangle \ {\left\langle -{\theta }_{j}^{ \boxed\ast }\right|}_{2}\otimes \left|-{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle -{\theta }_{k}^{ \boxed\ast }\right|}_{3}\otimes \left|j\right\rangle \ {\left\langle j\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\\& -\frac{1}{2}\left|-\theta \right\rangle {\left\langle -\theta \right|}_{1}\otimes {\text{Swap}}_{34}\ \left[{\text{CX}}_{23}\left|-\theta ,\theta \right\rangle \ {\left\langle -\theta ,\theta \right|}_{23}{\text{CX}}_{23}\otimes \mathop{\sum}\limits_{k=0,1}{p}_{k}\left|-{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle -{\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right]{\text{Swap}}_{34},\end{array}$$
$$\begin{array}{lll}{\rho }_{2,e}^{(0)}&=&\mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left|{\varphi }_{jk}^{ \circledast }\right\rangle \ {\left\langle {\varphi }_{jk}^{ \circledast }\right|}_{1}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{2}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{3}\otimes \left|jk\right\rangle \ {\left\langle jk\right|}_{45}\\ &&+\,\mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}\left|-{\varphi }_{jk}^{ \circledast }\right\rangle \ {\left\langle -{\varphi }_{jk}^{ \circledast }\right|}_{1}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{2}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{3}\otimes \left|jk\right\rangle \ {\left\langle jk\right|}_{45}\\ &&-\,\frac{1}{2}VU\left\{\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes {\text{Swap}}_{34}\ \left[{\text{CX}}_{23}\left|-\theta ,-\theta \right\rangle \ {\left\langle -\theta ,-\theta \right|}_{23}{\text{CX}}_{23}\otimes \mathop{\sum}\limits_{k\,=\,0,1}{p}_{k}\left|{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right]{\text{Swap}}_{34}\right.\\ &&+\,\left.\left|-\theta \right\rangle {\left\langle -\theta \right|}_{1}\otimes {\text{Swap}}_{34}\ \left[{\text{CX}}_{23}\left|-\theta ,\theta \right\rangle \ {\left\langle -\theta ,\theta \right|}_{23}{\text{CX}}_{23}\otimes \mathop{\sum}\limits_{k=0,1}{p}_{k}\left|-{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle -{\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right]{\text{Swap}}_{34}\right\}{U}^{\dagger }{V}^{\dagger }.\end{array}$$

Next, we make an X-basis measurement on the first qubit, and for convenience we assume that the measurement result is m1 = +. The analysis for m1 = − is very similar and follows by symmetry. We verified numerically that \(\,\text{Tr}\,\left[\left|+\right\rangle \ {\left\langle +\right|}_{1}\cdot {\rho }_{2,e}^{(0)}\right]\,=\,0.5\), which we might intuitively expect since \({\rho }_{2,e}^{(0)}\) is the density matrix for x2 = 0 and x2 is independent from x1. Since m1 = +, we follow the measurement with the conditional rotation M+ in (Eq. 21) to obtain

$$\begin{array}{l}{{{\Phi }}}_{2,{m}_{1} \,=\, +}^{(0)}\,=\,\frac{1}{0.5}\left[\mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}| \left\langle +| {\varphi }_{jk}^{ \circledast }\right\rangle {| }^{2}\left|{\varphi }_{jk}^{ \circledast }\right\rangle \ {\left\langle {\varphi }_{jk}^{ \circledast }\right|}_{1}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{2}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{3}\otimes \left|jk\right\rangle \ {\left\langle jk\right|}_{45}\right.\\ \qquad\quad+\,\frac{{p}_{0}^{2}(1\,-\,\sin {\varphi }_{00}^{ \circledast })}{2}\left|{\varphi }_{00}^{ \circledast }\right\rangle \ \left\langle {\varphi }_{00}^{ \circledast }\right|\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{2}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{3}\otimes \left|00\right\rangle \ {\left\langle 00\right|}_{45}\\ \left.\qquad\quad-\,\frac{1}{2}{M}_{+}\left|+\right\rangle \ {\left\langle +\right|}_{1}VU{{{\Lambda }}}_{2}^{(0)}{U}^{\dagger }{V}^{\dagger }\left|+\right\rangle \ {\left\langle +\right|}_{1}{M}_{+}^{\dagger }\right],\end{array}$$
$$\begin{array}{ll}{{{\Lambda }}}_{2}^{(0)}&:\,=\,\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes {\text{Swap}}_{34}\ \left[{\text{CX}}_{23}\left|-\theta ,-\theta \right\rangle \ {\left\langle -\theta ,-\theta \right|}_{23}{\text{CX}}_{23}\otimes \mathop{\sum}\limits_{k\,=\,0,1}{p}_{k}\left|{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right]{\text{Swap}}_{34}\\ &\quad\,+\,\left|-\theta \right\rangle {\left\langle -\theta \right|}_{1}\otimes {\text{Swap}}_{34}\ \left[{\text{CX}}_{23}\left|-\theta ,\theta \right\rangle \ {\left\langle -\theta ,\theta \right|}_{23}{\text{CX}}_{23}\otimes \mathop{\sum}\limits_{k\,=\,0,1}{p}_{k}\left|-{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle -{\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right]{\text{Swap}}_{34}.\end{array}$$

This is the state at stage (f) in Fig. 8. Hence, for x2 = 0, the density matrix we have when \({\hat{x}}_{1}=0\) and we reverse the BPQM operations on \({{{\Phi }}}_{2,{m}_{1} = +}^{(0)}\) is

$$\begin{array}{ll}{\tilde{\rho }}_{2,{m}_{1} \,=\, +}^{(0)}&\,=\,\frac{1}{0.5}\left[\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes [W \boxed\ast W]{(0)}_{23}\otimes [W \boxed\ast W]{(0)}_{45}\right.\\ &\quad \left.-\frac{1}{2}{\text{CX}}_{23}\ {\text{CX}}_{45}\ {\text{Swap}}_{34}{U}^{\dagger }{V}^{\dagger }{M}_{+}\left|+\right\rangle \ {\left\langle +\right|}_{1}VU{{{\Lambda }}}_{2}^{(0)}{U}^{\dagger }{V}^{\dagger }\left|+\right\rangle \ {\left\langle +\right|}_{1}{M}_{+}^{\dagger }VU{\text{Swap}}_{34}\ {\text{CX}}_{45}\ {\text{CX}}_{23}\right].\end{array}$$

This is the state at stage (g) in Fig. 8. So, this is the actual density matrix that BPQM encounters for x2 = 0 after having estimated \({\hat{x}}_{1}=0\). When compared with the earlier analysis, we observe numerically that this is close to \({\tilde{{{\Phi }}}}_{{x}_{2} = {\hat{x}}_{1}}({\hat{x}}_{1})\) but is not exactly the same. For example, when θ = 0.1π, we find that \({\Vert {\tilde{\rho }}_{2,{m}_{1} \,=\, +}^{(0)}-{\tilde{{{\Phi }}}}_{{x}_{2} \,=\, 0}(0)\Vert }_{\text{Fro}}=0.0542\), where “Fro” denotes the Frobenius norm, and only two of the distinct entries differ (slightly). Similarly,

$$\begin{array}{l}{\tilde{\rho }}_{2,{m}_{1} \,=\, +}^{(1)}\,=\,\frac{1}{0.5}\left[\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes [W \,\boxed\ast\, W]{(0)}_{23}\otimes [W \,\boxed\ast\, W]{(0)}_{45}\right.\\ \qquad\qquad\quad-\,\left.\frac{1}{2}{\text{CX}}_{23}\ {\text{CX}}_{45}\ {\text{Swap}}_{34}{U}^{\dagger }{V}^{\dagger }{M}_{+}\left|+\right\rangle \ {\left\langle +\right|}_{1}VU{{{\Lambda }}}_{2}^{(1)}{U}^{\dagger }{V}^{\dagger }\left|+\right\rangle \ {\left\langle +\right|}_{1}{M}_{+}^{\dagger }VU{\text{Swap}}_{34}\ {\text{CX}}_{45}\ {\text{CX}}_{23}\right],\end{array}$$
$$\begin{array}{ll}{{{\Lambda }}}_{2}^{(1)}&:\,=\,\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes {\text{Swap}}_{34}\ \left[{\text{CX}}_{23}\left|\theta ,\theta \right\rangle \ {\left\langle \theta ,\theta \right|}_{23}{\text{CX}}_{23}\otimes \mathop{\sum}\limits_{k\,=\,0,1}{p}_{k}\left|{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right]{\text{Swap}}_{34}\\ &\qquad+\left|-\theta \right\rangle {\left\langle -\theta \right|}_{1}\otimes {\text{Swap}}_{34}\ \left[{\text{CX}}_{23}\left|\theta ,-\theta \right\rangle \ {\left\langle \theta ,-\theta \right|}_{23}{\text{CX}}_{23}\otimes \mathop{\sum}\limits_{k\,=\,0,1}{p}_{k}\left|-{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle -{\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right]{\text{Swap}}_{34}.\end{array}$$

However, most importantly, we observe that \(\frac{1}{2}{\tilde{\rho }}_{2,{m}_{1} \,=\, +}^{(0)}\,+\frac{1}{2}{\tilde{\rho }}_{2,{m}_{1} \,=\, +}^{(1)}\,=\,\frac{1}{2}{\tilde{{{\Phi }}}}_{{x}_{2} \,=\, 0}(0)\,+\,\frac{1}{2}{\tilde{{{\Phi }}}}_{{x}_{2} \,=\, 1}(0)\). This explains that while the full density matrix \({\tilde{\rho }}_{{m}_{1},a}\) was correct, we had split it incorrectly to arrive at the two hypotheses \({\tilde{{{\Phi }}}}_{{x}_{2} \,=\, {\hat{x}}_{1}}({\hat{x}}_{1})\) and \({\tilde{{{\Phi }}}}_{{x}_{2}\,\ne\, {\hat{x}}_{1}}({\hat{x}}_{1})\). Now, the Helstrom measurement that optimally distinguishes between \({\tilde{\rho }}_{2,{m}_{1} \,=\, +}^{(0)}\) and \({\tilde{\rho }}_{2,{m}_{1} = +}^{(1)}\) only depends on

$${\tilde{\rho }}_{2,{m}_{1} \,=\, +}^{(0)}-{\tilde{\rho }}_{2,{m}_{1} \,=\, +}^{(1)}\,=\,A\left[{{{\Lambda }}}_{2}^{(1)}-{{{\Lambda }}}_{2}^{(0)}\right]{A}^{\dagger },\ A:\,=\,{\text{CX}}_{23}\ {\text{CX}}_{45}\ {\text{Swap}}_{34}{U}^{\dagger }{V}^{\dagger }{M}_{+}\left|+\right\rangle \ {\left\langle +\right|}_{1}VU.$$

By symmetry of m1 = + and m1 = −, the optimal success probability to decide bit 2 is given by

$${P}_{{\rm{succ}},2}^{\,\text{Hel}\,}\,=\,\frac{1}{2}\,+\,\frac{1}{4}{\left\Vert {\tilde{\rho }}_{2,{m}_{1} \,=\, +}^{(0)}\,-\,{\tilde{\rho }}_{2,{m}_{1} \,=\, +}^{(1)}\right\Vert }_{1}=\frac{1}{2}\,+\,\frac{1}{4}{\left\Vert A\left[{{{\Lambda }}}_{2}^{(1)}\,-\,{{{\Lambda }}}_{2}^{(0)}\right]{A}^{\dagger }\right\Vert }_{1}=\frac{1}{2}\,+\,\frac{1}{4}{\left\Vert L\left({\rho }_{2}^{(0)}\,-\,{\rho }_{2}^{(1)}\right){L}^{\dagger }\right\Vert }_{1},$$
$$L:\,=\,{\text{CX}}_{23}\ {\text{CX}}_{45}\ {\text{Swap}}_{34}{U}^{\dagger }{V}^{\dagger }{M}_{+}\frac{\left|+\right\rangle \ {\left\langle +\right|}_{1}}{\sqrt{0.5}}VU{\text{Swap}}_{34}\ {\text{CX}}_{45}\ {\text{CX}}_{23}.$$

Since L is not unitary, we cannot directly apply the unitary invariance of the trace norm to conclude that there is no degradation in performance when compared to optimally distinguishing \({\rho }_{2}^{(0)}\) and \({\rho }_{2}^{(1)}\) at the channel output. However, we observe numerically (even up to 12 significant digits) that the operations in L indeed ensure that \({\left\Vert L\left({\rho }_{2}^{(0)}\,-\,{\rho }_{2}^{(1)}\right){L}^{\dagger }\right\Vert }_{1}\,=\,{\left\Vert {\rho }_{2}^{(0)}\,-\,{\rho }_{2}^{(1)}\right\Vert }_{1}\). Moreover, we also observe that the BPQM operations for bit 2 given in Supplementary Fig. 3 achieve the same success probability, i.e., using the notation \(\pm \equiv {(-1)}^{{x}_{2}}\) we have

$${P}_{{\rm{succ}},2}^{{\rm{BPQM}}}\,=\,\,\text{Tr}\,\left[{U}_{ \circledast }({m}_{1}\theta ,\theta ){\tilde{\rho }}_{2,{m}_{1}}^{({x}_{2})}{U}_{ \circledast }{({m}_{1}\theta ,\theta )}^{\dagger }\cdot \left|\pm \right\rangle \ {\left\langle \pm \right|}_{2}\right]$$
$$=\frac{1}{2}\,+\,\frac{1}{4}{\left\Vert L\left({\rho }_{2}^{(0)}\,-\,{\rho }_{2}^{(1)}\right){L}^{\dagger }\right\Vert }_{1}$$
$$=\frac{1}{2}\,+\,\frac{1}{4}{\left\Vert {\rho }_{2}^{(0)}\,-\,{\rho }_{2}^{(1)}\right\Vert }_{1}$$

Finally, the simulation results in Fig. 4 clearly show that the overall block error rate of BPQM coincides with that of the quantum optimal joint Helstrom limit. It remains open to rigorously prove all of these observations.

Overall performance of BPQM

We can calculate the probability that the full codeword \(\underline{x}\) is decoded correctly as

$${P}_{{\rm{succ}}}^{{\rm{BPQM}}}\,=\,{\mathbb{P}}[\underline{\hat{x}}\,=\,\underline{x}]\,=\,{\mathbb{P}}[{\hat{x}}_{1}\,=\,{x}_{1}]\cdot {\mathbb{P}}[{\hat{x}}_{2}\,=\,{x}_{2}\ | \ {\hat{x}}_{1}\,=\,{x}_{1}]\cdot {\mathbb{P}}[{\hat{x}}_{4}\,=\,{x}_{4}\ | \ {\hat{x}}_{1}\,=\,{x}_{1},{\hat{x}}_{2}\,=\,{x}_{2}]$$
$$={P}_{{\rm{succ}},1}^{{\rm{BPQM}}}\cdot {P}_{{\rm{succ}},2}^{{\rm{BPQM}}}{| }_{{\hat{x}}_{1} \,=\, {x}_{1} \,=\, 0}\cdot {P}_{{\rm{succ}},4}^{{\rm{BPQM}}}{| }_{\begin{array}{c}{\hat{x}}_{1} \,=\, {x}_{1} \,=\, 0\\ {\hat{x}}_{2} \,=\, {x}_{2} \,=\, 0\end{array}}.$$

The first term in (Eq. 55) is clearly \({P}_{{\rm{succ}},1}^{{\rm{BPQM}}}\,=\,{P}_{{\rm{succ}},1}^{\,\text{Hel}\,}\). The second term, however, is different from \({P}_{{\rm{succ}},2}^{{\rm{BPQM}}}\,=\,{P}_{{\rm{succ}},2}^{\,\text{Hel}\,}\) because of the conditioning on x1 being estimated correctly, whereas in the above analysis we had implicitly averaged over \({\hat{x}}_{1}\,=\,{x}_{1}\) and \({\hat{x}}_{1}\,\ne\, {x}_{1}\). Nevertheless, we can use a similar strategy as above to derive an expression for the second term. Here, we want to condition on x1 being estimated correctly, i.e., \({\hat{x}}_{1}\,=\,{x}_{1}\), and derive the hypothesis states for x2 under this scenario. Similarly, for the third term, the additional conditioning on \({\hat{x}}_{2}\,=\,{x}_{2}\) makes it not equal to the second term, although x2 and x4 are placed symmetrically in the factor graph of the code. But it still holds that \({P}_{{\rm{succ}},2}^{{\rm{BPQM}}}{| }_{{\hat{x}}_{1} = {x}_{1} = 0}\,=\,{P}_{{\rm{succ}},4}^{{\rm{BPQM}}}{| }_{{\hat{x}}_{1} = {x}_{1} = 0}\). We perform these two analyses next and then combine them to calculate the full block success probability of BPQM.

We will first analyze the decoding of bit 2 conditioned on bit 1. Let \(({\rho }_{2}^{(00)},{\rho }_{2}^{(01)}),({\rho }_{2}^{(10)},{\rho }_{2}^{(11)})\) be two pairs of hypothesis states for x2, at the channel output, where the first pair is conditioned on x1 = 0 and the second on x1 = 1, and this information is known to the receiver. It is clear, for example, that \({\rho }_{2}^{(0{x}_{2})}\,=\,\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes \left|{(-1)}^{{x}_{2}}\theta \right\rangle \ {\left\langle {(-1)}^{{x}_{2}}\theta \right|}_{2}\otimes \left|{(-1)}^{{x}_{2}}\theta \right\rangle \ {\left\langle {(-1)}^{{x}_{2}}\theta \right|}_{3}\otimes [W \,\boxed\ast\, W]{(0)}_{45}\). After similar calculations as before, we finally obtain

$$\begin{array}{l}{\tilde{\sigma }}_{2,{m}_{1} \,=\, +}^{(00)}\,=\,\frac{1}{{P}_{{\rm{succ}},1}^{\,\text{Hel}}}{\text{CX}}_{23}\ {\text{CX}}_{45}\ {\text{Swap}}_{34}{U}^{\dagger }{V}^{\dagger }\left[2\mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}| \left\langle +| {\varphi }_{jk}^{ \circledast }\right\rangle {| }^{2}\left|{\varphi }_{jk}^{ \circledast }\right\rangle \ {\left\langle {\varphi }_{jk}^{ \circledast }\right|}_{1}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{2}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{3}\otimes \left|jk\right\rangle \ {\left\langle jk\right|}_{45}\right.\\ \left.\,-\,{M}_{+}\left|+\right\rangle \ {\left\langle +\right|}_{1}VU{\tilde{{{\Lambda }}}}_{2}^{(0)}{U}^{\dagger }{V}^{\dagger }\left|+\right\rangle \ {\left\langle +\right|}_{1}{M}_{+}^{\dagger }\right]VU{\text{Swap}}_{34}\ {\text{CX}}_{45}\ {\text{CX}}_{23},\\ \end{array}$$
$${\tilde{{{\Lambda }}}}_{2}^{(0)}:\,=\,\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes {\text{Swap}}_{34}\ \left[{\text{CX}}_{23}\left|-\theta ,-\theta \right\rangle \ {\left\langle -\theta ,-\theta \right|}_{23}{\text{CX}}_{23}\otimes \mathop{\sum}\limits_{k\,=\,0,1}{p}_{k}\left|{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right]{\text{Swap}}_{34}.$$

This is the state at stage (g) in Fig. 8. So, this is the actual density matrix that BPQM encounters for x2 = 0 after having estimated correctly that \({\hat{x}}_{1}\,=\,{x}_{1}=0\) (and reversed the first set of operations). Similarly,

$$\begin{array}{l}{\tilde{\sigma }}_{2,{m}_{1} \,=\, +}^{(01)}\,=\,\frac{1}{{P}_{{\rm{succ}},1}^{\,\text{Hel}}}{\text{CX}}_{23}\ {\text{CX}}_{45}\ {\text{Swap}}_{34}{U}^{\dagger }{V}^{\dagger }\left[2\mathop{\sum}\limits_{j,k\,\in\, {\{0,1\}}^{2}}{p}_{j}{p}_{k}| \left\langle +| {\varphi }_{jk}^{ \circledast }\right\rangle {| }^{2}\left|{\varphi }_{jk}^{ \circledast }\right\rangle \ {\left\langle {\varphi }_{jk}^{ \circledast }\right|}_{1}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{2}\otimes \left|0\right\rangle \ {\left\langle 0\right|}_{3}\otimes \left|jk\right\rangle \ {\left\langle jk\right|}_{45}\right.\\ \left.\,-\,{M}_{+}\left|+\right\rangle \ {\left\langle +\right|}_{1}VU{\tilde{{{\Lambda }}}}_{2}^{(1)}{U}^{\dagger }{V}^{\dagger }\left|+\right\rangle \ {\left\langle +\right|}_{1}{M}_{+}^{\dagger }\right]VU{\text{Swap}}_{34}\ {\text{CX}}_{45}\ {\text{CX}}_{23},\end{array}$$
$${\tilde{{{\Lambda }}}}_{2}^{(1)}:\,=\,\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes {\text{Swap}}_{34}\ \left[{\text{CX}}_{23}\left|\theta ,\theta \right\rangle \ {\left\langle \theta ,\theta \right|}_{23}{\text{CX}}_{23}\otimes \mathop{\sum}\limits_{k\,=\,0,1}{p}_{k}\left|{\theta }_{k}^{ \boxed\ast }\right\rangle \ {\left\langle {\theta }_{k}^{ \boxed\ast }\right|}_{4}\otimes \left|k\right\rangle \ {\left\langle k\right|}_{5}\right]{\text{Swap}}_{34}.$$

The Helstrom measurement that optimally distinguishes between \({\tilde{\sigma }}_{2,{m}_{1} \,=\, +}^{(00)}\) and \({\tilde{\sigma }}_{2,{m}_{1} \,=\, +}^{(01)}\) achieves the success probability

$${P}_{{\rm{succ}},2}^{\,\text{Hel}\,}{\left|\right.}_{{\hat{x}}_{1} \,=\, {x}_{1} \,=\, 0}\,=\,\frac{1}{2}\,+\,\frac{1}{4}{\left\Vert {\tilde{\sigma }}_{2,{m}_{1} \,=\, +}^{(00)}-{\tilde{\sigma }}_{2,{m}_{1} \,=\, +}^{(01)}\right\Vert }_{1}$$
$$=\frac{1}{2}\,+\,\frac{1}{4{P}_{{\rm{succ}},1}^{\,\text{Hel}\,}}{\left\Vert A\left[{\tilde{{{\Lambda }}}}_{2}^{(1)}\,-\,{\tilde{{{\Lambda }}}}_{2}^{(0)}\right]{A}^{\dagger }\right\Vert }_{1}.$$

We verified numerically that the final processing of BPQM, after (g) in Fig. 8, also achieves the same success probability, i.e.,

$${P}_{{\rm{succ}},2}^{{\rm{BPQM}}}{\left|\right.}_{{\hat{x}}_{1} \,=\, {x}_{1} \,=\, 0}\,=\,\,\text{Tr}\,\left[{U}_{ \circledast }(\theta ,\theta ){\tilde{\sigma }}_{2,{m}_{1} \,=\, +}^{(0{x}_{2})}{U}_{ \circledast }{(\theta ,\theta )}^{\dagger }\cdot \left|{(-1)}^{{x}_{2}}\right\rangle \ {\left\langle {(-1)}^{{x}_{2}}\right|}_{2}\right]$$
$$=\frac{1}{2}\,+\,\frac{1}{4{P}_{{\rm{succ}},1}^{\,\text{Hel}\,}}{\left\Vert A\left[{\tilde{{{\Lambda }}}}_{2}^{(1)}\,-\,{\tilde{{{\Lambda }}}}_{2}^{(0)}\right]{A}^{\dagger }\right\Vert }_{1}$$
$$={P}_{{\rm{succ}},2}^{\,\text{Hel}\,}{\left|\right.}_{{\hat{x}}_{1} \,=\, {x}_{1} \,=\, 0}.$$

Using a similar procedure as above, we can verify the analogous result for x2 conditioned on x1 = 1 and \({\hat{x}}_{1}\,=\,{x}_{1}\,=\,1\).

Next, we will analyze the decoding of bit 4 conditioned on bits 1 and 2. For convenience, let us assume that x1 = x2 = 0 in the transmitted codeword. Note that, due to symmetry, this choice will not affect the analysis and the final probability of success for x4 conditioned on correct estimation of x1 and x2 will be independent of this fixed choice. Then, at the channel output, the candidate states for x4 are given by

$${\rho }_{4}^{(00{x}_{4})}\,=\,\left|\theta \right\rangle {\left\langle \theta \right|}_{1}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{2}\otimes \left|\theta \right\rangle {\left\langle \theta \right|}_{3}\otimes \left|{(-1)}^{{x}_{4}}\theta \right\rangle \ {\left\langle {(-1)}^{{x}_{4}}\theta \right|}_{4}\otimes \left|{(-1)}^{{x}_{4}}\theta \right\rangle \ {\left\langle {(-1)}^{{x}_{4}}\theta \right|}_{5}.$$

Let U1 = VUSwap34 CX45 CX23 and \({\rho }_{4,1}^{(00{x}_{4})}\,=\,{U}_{1}{\rho }_{4}^{(00{x}_{4})}{U}_{1}^{\dagger }\). If \({p}_{1,4}^{(00{x}_{4})}\,=\,\,\text{Tr}\,\left[\left|+\right\rangle \ {\left\langle +\right|}_{1}\cdot {\rho }_{4,1}^{(00{x}_{4})}\right]\) is the probability of measuring x1 = 0, then conditioned on this correct measurement, we arrive at the following candidate states after the next set of BPQM operations:

$${\rho }_{4,2}^{(00{x}_{4})}\,=\,\frac{{U}_{2}\cdot {\rho }_{4,1}^{(00{x}_{4})}{U}_{2}^{\dagger }}{{p}_{1,4}^{(00{x}_{4})}},\,\,{U}_{2}:\,=\,{U}_{ \circledast }{(\theta ,\theta )}_{45}\ {U}_{ \circledast }{(\theta ,\theta )}_{23}\ {\text{CX}}_{23}\ {\text{CX}}_{45}\ {\text{Swap}}_{34}{U}^{\dagger }{V}^{\dagger }{M}_{+}\left|+\right\rangle \ {\left\langle +\right|}_{1}.$$

If \({p}_{2,4}^{(00{x}_{4})}\,=\,\,\text{Tr}\,\left[\left|+\right\rangle \ {\left\langle +\right|}_{2}\cdot {\rho }_{4,2}^{(00{x}_{4})}\right]\) is the probability of measuring x2 = 0, conditioned on \({\hat{x}}_{1}={x}_{1}\), then conditioned on this correct measurement, we arrive at the following candidate states after the x2 measurement:

$${\rho }_{4,3}^{(00{x}_{4})}\,=\,\frac{\left|+\right\rangle \ {\left\langle +\right|}_{2}\cdot {\rho }_{4,1}^{(00{x}_{4})}\left|+\right\rangle \ {\left\langle +\right|}_{2}}{{p}_{2,4}^{(00{x}_{4})}}.$$

Therefore, any measurement that optimally distinguishes between x4 = 0 and x4 = 1 conditioned on \({\hat{x}}_{1}\,=\,{x}_{1}\) and \({\hat{x}}_{2}\,=\,{x}_{2}\) must satisfy the same probability of success as the Helstrom measurement on \(({\rho }_{4,3}^{(000)},{\rho }_{4,3}^{(001)})\). We verified that measuring the 4th qubit in the X basis on \({\rho }_{4,3}^{(00{x}_{4})}\) indeed satisfies this and hence BPQM is optimal in estimating x4 conditioned on estimating x1 and x2 correctly, i.e.,

$${P}_{{\rm{succ}},4}^{{\rm{BPQM}}}{\left|\right.}_{\begin{array}{c}{{\hat{x}}_{1} = {x}_{1} = 0}\\ {{\hat{x}}_{2} = {x}_{2} = 0}\end{array}}\,=\,\text{Tr}\,\left[{\rho }_{4,3}^{(00{x}_{4})}\cdot \left|{(-1)}^{{x}_{4}}\right\rangle \ {\left\langle {(-1)}^{{x}_{4}}\right|}_{4}\right]$$
$$=\frac{1}{2}+\frac{1}{4}{\left\Vert {\rho }_{4,3}^{(000)}-{\rho }_{4,3}^{(001)}\right\Vert }_{1}$$
$$={P}_{{\rm{succ}},4}^{\,\text{Hel}\,}{\left|\right.}_{\begin{array}{c}{{\hat{x}}_{1} = {x}_{1} = 0}\\ {{\hat{x}}_{2} = {x}_{2} = 0}\end{array}}.$$

However, we also observe that

$${P}_{{\rm{succ}},4}^{{\rm{BPQM}}}{\left|\right.}_{\begin{array}{c}{{\hat{x}}_{1} = {x}_{1} = 0}\\ {{\hat{x}}_{2} = {x}_{2} = 0}\end{array}}\,=\,{P}_{{\rm{succ}},4}^{\text{Hel}}{\left|\right.}_{\begin{array}{c}{{\hat{x}}_{1} = {x}_{1} = 0}\\ {{\hat{x}}_{2} = {x}_{2} = 0}\end{array}}\ne {P}_{{\rm{succ}},2}^{\text{Hel}}{\left|\right.}_{{\hat{x}}_{1} = {x}_{1} = 0}\,=\,{P}_{{\rm{succ}},2}^{{\rm{BPQM}}}{\left|\right.}_{{\hat{x}}_{1} = {x}_{1} = 0}\,=\,{P}_{{\rm{succ}},4}^{{\rm{BPQM}}}{\left|\right.}_{{{\hat{x}}_{1} = {x}_{1} = 0}}\,=\,{P}_{{\rm{succ}},4}^{\text{Hel}}{\left|\right.}_{{\hat{x}}_{1} = {x}_{1} = 0}.$$

Therefore, the overall BPQM success probability is given by

$${P}_{{\rm{succ}}}^{{\rm{BPQM}}}\,=\,{\mathbb{P}}[\hat{\underline{x}}\,=\,\underline{x}]\,=\,{\mathbb{P}}[{\hat{x}}_{1}\,=\,{x}_{1}]\cdot {\mathbb{P}}[{\hat{x}}_{2}\,=\,{x}_{2}\ | \ {\hat{x}}_{1}\,=\,{x}_{1}]\cdot {\mathbb{P}}[{\hat{x}}_{4}\,=\,{x}_{4}\ | \ {\hat{x}}_{1}\,=\,{x}_{1},{\hat{x}}_{2}\,=\,{x}_{2}]$$
$$={P}_{{\rm{succ}},1}^{{\rm{BPQM}}}\cdot {P}_{{\rm{succ}},2}^{{\rm{BPQM}}}{\left|\right.}_{{{\hat{x}}_{1} = {x}_{1} = 0}}\cdot {P}_{{\rm{succ}},4}^{{\rm{BPQM}}}{\left|\right.}_{\begin{array}{c}{{\hat{x}}_{1} = {x}_{1} = 0}\\ {{\hat{x}}_{2} = {x}_{2} = 0}\end{array}}$$
$$={P}_{{\rm{succ}},1}^{\,\text{Hel}\,}\left(\frac{1}{2}\,+\,\frac{1}{4{P}_{{\rm{succ}},1}^{\,\text{Hel}\,}}{\left\Vert A\left[{\tilde{{{\Lambda }}}}_{2}^{(1)}\,-\,{\tilde{{{\Lambda }}}}_{2}^{(0)}\right]{A}^{\dagger }\right\Vert }_{1}\right)\left(\frac{1}{2}\,+\,\frac{1}{4}{\left\Vert {\rho }_{4,3}^{(000)}\,-\,{\rho }_{4,3}^{(001)}\right\Vert }_{1}\right)$$
$$\ne \,{P}_{{\rm{succ}},1}^{\text{Hel}}{\left(\frac{1}{2}\,+\,\frac{1}{4{P}_{{\rm{succ}},1}^{\text{Hel}}}{\left\Vert A\left[{\tilde{{{\Lambda }}}}_{2}^{(1)}\,-\,{\tilde{{{\Lambda }}}}_{2}^{(0)}\right]{A}^{\dagger }\right\Vert }_{1}\right)}^{2}.$$

This success probability exactly equals the value from the closed-form expression one obtains using the fact that the SRM is optimal for channel coding over the pure-state channel20,27:

$${P}_{{\rm{succ}}}^{\,\text{SRM}\,}\,=\,{\left(\mathop{\sum}\limits_{h\in {{\mathbb{Z}}}_{2}^{k}}\sqrt{\frac{\hat{s}(h)}{{2}^{k/2}}}\sqrt{\frac{1}{{2}^{k}}}\right)}^{2},$$
$$\frac{1}{{2}^{k/2}}\hat{s}(h):\,=\,\mathop{\sum}\limits_{z\in {y}_{h} \oplus {{\mathcal{C}}}^{\perp }}{p}^{{w}_{H}(z)}{(1\,-\,p)}^{{w}_{H}(z)}\,;\,\,\mathop{\sum}\limits_{h\,\in\, {{\mathbb{Z}}}_{2}^{k}}\frac{\hat{s}(h)}{{2}^{k/2}}\,=\,1,$$

where yh is any vector in the coset of \({{\mathcal{C}}}^{\perp }\) corresponding to \(h\in {{\mathbb{Z}}}_{2}^{k}\). Alternatively, one can also use the YKL conditions19,21 to derive the optimal error rates.

For example, let us pick θ = 0.05π which corresponds to the mean photon number per mode N ≈ 0.00619. Then the optimal error probability from the SRM-based closed-form expression is 0.758171401618323 up to numerical precision. Similarly, the density matrix-based expression (Eq. 73) produces the number 0.758171401618325 whose small difference can be attributed to numerical error. Furthermore, we have

$${P}_{{\rm{succ}},1}^{{\rm{BPQM}}}\approx 0.5889,\quad {P}_{{\rm{succ}},2}^{{\rm{BPQM}}}{\left|\right.}_{{\hat{x}}_{1} = {x}_{1} = 0}\approx 0.6425,\quad {P}_{{\rm{succ}},4}^{{\rm{BPQM}}}{\left|\right.}_{\begin{array}{c}{\hat{x}}_{1} = {x}_{1} = 0\\ {\hat{x}}_{2} = {x}_{2} = 0\end{array}}\approx 0.6390.$$

Note that \({P}_{{\rm{succ}},2}^{{\rm{BPQM}}}{\left|\right.}_{{\hat{x}}_{1} = {x}_{1} = 0}={P}_{{\rm{succ}},4}^{{\rm{BPQM}}}{\left|\right.}_{{\hat{x}}_{1} = {x}_{1} = 0}\) but the additional conditioning on \({\hat{x}}_{2}\,=\,{x}_{2}\) makes a difference for x4. The overall bit error probabilities for the 5 bits are given by

$${P}_{\,\text{err}\,,1}^{{\rm{BPQM}}}\,=\,1\,-\,{P}_{{\rm{succ}},1}^{{\rm{BPQM}}}\approx 0.4111,\quad {P}_{\,\text{err}\,,i}^{{\rm{BPQM}}}\approx 0.4160,i\,\in\, \{2,3,4,5\}.$$

To check simulation results averaged over B = 106 codeword transmissions, we set the confidence level to be 1 − α = 0.98 and calculate the accuracy β of the error estimate. These quantities are related as

$$B\,=\,\frac{1}{p}{\left(\frac{{Q}^{-1}(\alpha /2)}{\beta }\right)}^{2},$$

where Q() is the “Q function” of the Gaussian distribution and p is the true error probability we are trying to estimate (numerically).

  1. (1)

    For the block error rate, p ≈ 0.7582, we obtain β ≈ 0.2671% which means the answer is in the window [0.7561, 0.7602]. The simulation produced the value 0.7573 which is well within this window. When we used only B = 105 codeword transmissions we obtained the value 0.7558. For this setting, again with 98% confidence, the window for β ≈ 0.8448% is [0.7518, 0.7646], so the simulation result is well within this window.

  2. (2)

    For x1, the result is well within β ≈ 0.3629% from the actual number p ≈ 0.4111 since the window is [0.4096, 0.4126] and the simulation gives 0.4111.

  3. (3)

    For x2 through x5 (which all have the same overall error probability), the results are well within β ≈ 0.3606% from the actual number p = 0.4160 since the window is [0.4145, 0.4175] and the simulation yields 0.4163 for x2, 0.4168 for x3, 0.4150 for x4, and 0.4163 for x5.

Remark 2 We also observe that if we ignore the coherent rotation after measuring x1, then the success probabilities of the remaining bits decrease significantly to

$$\begin{array}{r}{P}_{{\rm{succ}},2}^{{\rm{BPQM}}}{\left|\right.}_{{{\hat{x}}_{1} = {x}_{1} = 0}}\approx 0.6090,{P}_{{\rm{succ}},4}^{{\rm{BPQM}}}{\left|\right.}_{\begin{array}{c}{{\hat{x}}_{1} = {x}_{1} = 0}\\ {{\hat{x}}_{2} = {x}_{2} = 0}\end{array}}\approx 0.6161.\end{array}$$

Due to this, the overall block error rate increases to roughly 0.7790. Therefore, it is clear that the coherent rotation plays an important and non-trivial role in the optimality of BPQM (for this code).

Remark 3 The above analyses demonstrate that even though the measurement for each bit is irreversible, BPQM still decides each bit optimally in this 5-bit example code. In particular, the order in which the bits are decoded does not seem to affect the performance. This needs to be studied further and we need to analyze if BPQM always achieves the codeword Helstrom limit for all codes with tree factor graphs. We emphasize that, while in classical BP there is no question of ordering and one makes hard decisions on all the bits simultaneously after several BP iterations, it appears that quantum BP always has a sequential nature due to the unitarity of operations and the no-cloning theorem. This resembles “successive-cancellation” type decoders more than BP. Due to these facts, we expect that extending classical ideas for analyzing BP, such as density evolution9, will require some caveats in the quantum setting.

In connection to this, Renes has recently developed a precise notion of duality between channels, and shown that classical channels need to be embedded in CQ channels in order to define their duals32. An interesting fact that follows from this framework is that the dual of the pure-state channel is the classical BSC. Since we know that density evolution is a well-defined analysis technique for BP on BSCs, albeit sophisticated, it will be interesting to see if duality allows one to borrow from this literature and analyze BPQM on pure-state channels.