# Purpose of using Fidelity in Randomised Benchmarking

Often, when comparing two density matrices, $\rho$ and $\sigma$ (such as when $\rho$ is an experimental implementation of an ideal $\sigma$), the closeness of these two states is given by the quantum state fidelity $$F = tr\left(\sqrt{\sqrt{\rho}\sigma\sqrt{\rho}}\right),$$ with infidelity defined as $1-F$.

Similarly, when comparing how close an implementation of a gate is with an ideal version, the fidelity becomes $$F\left( U, \tilde U\right) = \int\left[tr\left(\sqrt{\sqrt{U\left|\psi\rangle\langle\psi\right|U^\dagger}\tilde U\left|\psi\rangle\langle\psi\right|\tilde U^\dagger\sqrt{U\left|\psi\rangle\langle\psi\right|U^\dagger}}\right)\right]^2\,d\psi,$$ where $d\psi$ is the Haar measure over pure states. Unsurprisingly, this can get relatively unpleasant to work with.

Now, let's define a matrix $M = \rho - \sigma$ in the case of density matrices, or $M = U - \tilde U$ when working with gates. Then, the Schatten norms1, such as $\| M\|_1 = tr\left(\sqrt{M^\dagger M}\right)$, $\| M\|_2^2 = tr\left(M^\dagger M\right)$, or other norms, such as the diamond norm can be computed.

These norms are often easier to compute2 than the above Fidelity. What makes matters worse is that in randomised benchmarking calculations, infidelity doesn't even appear to be a great measure, yet is the number that's used every time that I've seen when looking at benchmarking values for quantum processors.3

So, Why is (in)fidelity the go-to value for calculating gate errors in quantum processors (using randomised benchmarking), when it doesn't seem to have a helpful meaning and other methods, such as Schatten norms, are easier to calculate on a classical computer?

1 The Schatten p-norm of $M$ is $\| M\|_p^p = tr\left(\sqrt{M^\dagger M}^p\right)$

2 i.e. plug in a noise model on a (classical) computer and simulate

3 Such as IBM's QMX5

Nielsen and Chuang in their book "Quantum Computation and Quantum Information" have section (Chapter 9) on distance measures for quantum information.

Surprisingly they say in Section 9.3 " How well does a quantum channel preserve information?" that when comparing fidelity to the trace norm:

Using the properties of the trace distance established in the last section it is not difficult, for the most part, to give a parallel development based upon the trace distance. However, it turns out that the fidelity is an easier tool to calculate with, and for that reason we restrict ourselves to considerations based upon the fidelity.

I imagine this is in part why fidelity is used. It seems it's fairly useful as a static measure of distance.

There also seems to be relatively straightforward extensions of fidelity to ensembles of states

$$F =\sum_j p_jF(\rho_j,\mathcal{E}(\rho_j))^2,$$

$p_j$ the probability of preparing the system in states $\rho_j$, and $\mathcal{E}$ the particular noisy channel of interest, $0\leq F\leq 1$.

There's also an extension to entanglement fidelity, to measure how well a channel preserves entanglement. Given a state $Q$ assumed to be entangled to the external world in some way, and a purification of the state (fictitious system $R$), such that $RQ$ is pure. The state is subjected to dynamics in the channel $\mathcal{E}$. The primes indicate the state after the application of quantum operation. $\mathcal{I}_R$ is the identity map on system $R$.

$$F(\rho,\mathcal{E}) ≡ F(RQ,R′Q′)^2= ⟨RQ| \left(\mathcal{I}_R \otimes \mathcal{E}\right)\left(|RQ⟩⟨RQ|\right) |RQ⟩$$

There's some formulas derived to simplify computations of fidelity and entanglement fidelity also given in the chapter.

One of the attractive properties of the entanglement fidelity is that there is a very simple formula which enables it to be calculated exactly.

$$F(\rho,\mathcal{E})=\sum_i\operatorname{tr}|(\rho E_i)|^2$$

where the 'operation elements' $E_i$ satisfy a completeness relation. Maybe someone else can comment on more practical implementations, but this is what I've gathered from reading.

Update 1: Re M.Stern

It's the same reference Nielsen and Chuang. They comment on that by saying "You may wonder why the fidelity appearing on the right hand side of the definition is squared. There are two answers to this question, one simple, and one complex. The simple answer is that including this square term makes the ensemble fidelity more naturally related to the entanglement fidelity, as defined below. The more complex answer is that quantum information is, at present, in a state of infancy and it is not entirely clear what the ‘correct’ definitions for notions such as information preservation are! Nevertheless, as we shall see in Chapter 12, the ensemble average fidelity and the entanglement fidelity give rise to a rich theory of quantum information, which leads us to believe that these measures are on the right track, even though a complete theory of quantum information has not yet been developed."

To answer your second question as to why not look at the fidelity of $\bar{\rho}$, there's a nice point mentioned in "Distinguishability measures between ensembles of quantum states" which I think is in PhysRevA but there's an arXiv version here.

The point they mention on pg 4, is suppose you have two ensembles $rho$ and $\sigma$ which happen to have the same ensemble average density matrix, $\bar{\rho}=\bar{\sigma}$, then the fidelity $F(\bar{\rho},\bar{\sigma})$ can't distinguish between them.

Update 2: Re Mithrandir24601 So one definition for gate fidelity is motivated by thinking what's the worst-case behaviour of a channel $\mathcal{E}$, for a given input state.

$$F_{min}=\min_{|\psi\rangle}F(|\psi\rangle\langle\psi|,\mathcal{E}(|\psi\rangle\langle\psi|))\equiv\min_{|\psi\rangle}F(|\psi\rangle,\mathcal{E}(|\psi\rangle\langle\psi|))$$

Due to concavity in both arguments you can restrict to pure states in this minimising, the equivalence in the second part is just notation.

In defining how well a gate is implemented one can look as well at a worst case implementation of a unitary gate $U$ by a channel $\mathcal{E}$ by defining

$$F(U,\mathcal{E})=\min_{|\psi\rangle}F(U|\psi\rangle,\mathcal{E}(|\psi\rangle\langle\psi|))$$

In the formula you've given and the paper you've linked, they integrate over $\psi$, with an appropriate measure$^*$. This makes me think this should be regarded instead as an average fidelity $\bar{F}(U,\tilde{U})$, which you can imagine might be more useful in practical experiments, especially if you're repeating the experiment. It's probably unlikely to achieve the exact minimum.

There's an arXiv version of a paper here by Michael Nielsen where he talks about average gate fidelity.

The only extra difference between fidelity for a gate and average fidelity of a gate mentioned vs the formula you initially provided, is the square of the trace: $[\operatorname{trace}]^2$ you have. As in Update 1 some people prefer to use $F^2$ as the fidelity rather than $F$, as it can supposedly be connected more readily to entanglement fidelity. I do need to read a bit more about that to comment properly.

($\,^*$) Aside: I think calling it a 'Haar measure' might be misleading, I've seen in it in papers as well. As far as I know, the space of pure states is usually topologically $\Bbb{CP}^n$, for an $n$-dimensional hilbert space. Apparently the measure they use is inherited from the haar measure on $U(n)$ by a quotient or so I've read here: https://physics.stackexchange.com/a/98869/41998.

• That gives a reasonable explanation of why it could be useful for states and the bit about entanglement fidelity is definitely interesting, sure. However, the issue I've got is (as per this paper) that doing the same thing for gates just doesn't work in the same way. (unless I'm missing something else) Mar 17, 2018 at 16:26
• Could you give a reference for the fidelity of ensembles that you mention? Why is it different from the fidelity of the mixed state $\sum_j p_j \rho_j$? Mar 18, 2018 at 18:17
• @M.Stern I've moved my comments to an update. Mar 21, 2018 at 18:03
• @Mithrandir24601 Apologies for being slow to reply, I've been trying to find time to read the paper you linked and time to write a response! See Update 2. Mar 26, 2018 at 11:35
• As for your aside, you're correct - I'm just being a lazy physicist. It is (to my knowledge) a Haar measure, but calling it a 'Haar measure over states' is, yes, not exactly the most technically accurate statement ever... What's slightly more worrying is that arXiv currently seems to be down :( Mar 26, 2018 at 23:15