# How is Pauli twirling applied to a noisy gate in practice?

My understanding of Pauli Twirling mainly comes from this paper. Please, correct me if I am wrong in any part of my explanation.

## General idea of Pauli twirling

The idea of Pauli Twirling is the following. We have a noisy channel (over $$n$$-qubits) $$\mathcal{N}(\rho)=\sum_{j} N_j \rho N_j^{\dagger}$$, where the $$N_j$$ are the Kraus operators.

If we apply a random $$n$$-Pauli $$\sigma_{\mathbf{i}}$$ before and after the noise map, it is possible to show that:

$$\widetilde{\mathcal{N}}(\rho)=\frac{1}{2^n} \sum_{\mathbf{i}}\sum_j \left(\sigma_{\mathbf{i}} N_j \sigma_{\mathbf{i}}\right) \rho \left( \sigma_{\mathbf{i}} N_j^{\dagger} \sigma_{\mathbf{i}} \right)=\sum_{\mathbf{k}} p_{\mathbf{k}} \sigma_{\mathbf{k}} \rho \sigma_{\mathbf{k}}^{\dagger},$$

where the $$p_k$$ are some probabilities that one can determine. Basically, we transformed the arbitrary noisy channel into a Pauli Channel (we kill any coherent noise effect in the Pauli basis).

What I said could be generalized (as explained in the paper we can take another set than the full Pauli group to perform the average on). What matters is that the set we take has to kill the off-diagonal terms (and the full Pauli group does the job).

## Applying Pauli twirling "in practice"

Now, in practice, the map describing a noisy gate can be rewritten (under reasonable assumptions like Markovian noise for instance) as:

$$\mathcal{E}=\mathcal{N} \circ \mathcal{U}$$

Where $$\mathcal{U}$$ is the "ideal" unitary we wish to implement, $$\mathcal{E}$$ is the noisy map we implement "in practice" in the lab, and $$\mathcal{N}$$ is a CPTP map describing the noise introduced by the gate on the system (the equation I just wrote is a way to define the noise map $$\mathcal{N}$$).

While this equality is always true, by definition, in the lab the noise does not really comes "after" the gate, but it occurs during the implementation. Hence, we cannot really perform the Pauli Twirling on $$\mathcal{N}$$ "alone". What we can do is a twirling around the full map $$\mathcal{E}$$.

And here is my issue/question: a naive implementation of Pauli twirling around the full map $$\mathcal{E}$$ will completely corrupt the "unitary part" of the evolution. An easy way to see it is to assume that there is no noise at all: $$\mathcal{N}=\mathbb{I}$$. In such a case we would completely ruin the unitary map.

How is twirling applied in practice then? Do we choose a twirl set that somehow "commutes" with $$\mathcal{U}$$?

Ideally, an answer explaining how to solve my issue with a few refs would be great!

• If I'm not mistaken, you're asking how randomized compiling works arxiv.org/abs/1512.01098 Commented Nov 6, 2022 at 7:38
• @MarkusHeinrich it could be a method that fits for my question indeed. Thanks! I believe that it might not be the only approach possible. Commented Nov 7, 2022 at 11:05
• This might help as well: quantum-enablement.org/posts/2023/… Commented Jul 12, 2023 at 14:50