††thanks: Contributed Equally††thanks: Contributed Equally††thanks:
Contributed Equally

# Context Aware Fidelity Estimation

Dripto M. Debroy<EMAIL_ADDRESS>Google Quantum AI, Venice, CA 90291  Élie
Genois<EMAIL_ADDRESS>Google Quantum AI, Venice, CA 90291
Institut quantique & Département de Physique, Université de Sherbrooke, Québec
J1K 2R1, Canada  Jonathan A. Gross<EMAIL_ADDRESS>Google Quantum AI,
Venice, CA 90291  Wojciech Mruczkiewicz  Google Quantum AI, Venice, CA 90291
Kenny Lee  Google Quantum AI, Venice, CA 90291  Sabrina Hong  Google Quantum
AI, Venice, CA 90291  Zijun Chen  Google Quantum AI, Venice, CA 90291  Vadim
Smelyanskiy  Google Quantum AI, Venice, CA 90291  Zhang Jiang  Google Quantum
AI, Venice, CA 90291

###### Abstract

We present Context Aware Fidelity Estimation (CAFE), a framework for
benchmarking quantum operations that offers several practical advantages over
existing methods such as Randomized Benchmarking (RB) and Cross-Entropy
Benchmarking (XEB). In CAFE, a gate or a subcircuit from some target
experiment is repeated $n$ times before being measured. By using a subcircuit,
we account for effects from spatial and temporal circuit context. Since
coherent errors accumulate quadratically while incoherent errors grow
linearly, we can separate them by fitting the measured fidelity as a function
of $n$. One can additionally interleave the subcircuit with dynamical
decoupling sequences to remove certain coherent error sources from the
characterization when desired. We have used CAFE to experimentally validate
our single- and two-qubit unitary characterizations by measuring fidelity
against estimated unitaries. In numerical simulations, we find CAFE produces
fidelity estimates at least as accurate as Interleaved RB while using
significantly fewer resources. We also introduce a compact formulation for
preparing an arbitrary two-qubit state with a single entangling operation, and
use it to present a concrete example using CAFE to study $\mathrm{CZ}$ gates
in parallel on a Sycamore processor.

##  I Introduction

Reliably understanding the structure of noise in quantum processors is vital
for advancing quantum computation. There are a variety of characterization
methods available to quantify and validate the performance of individual
quantum operations like state preparation, single- and two-qubit gates,
measurement, and reset Eisert  _et al._ (2020). Amongst these techniques, some
use randomness to estimate gate fidelities efficiently, such as randomized
benchmarking (RB) Knill  _et al._ (2008); Magesan  _et al._ (2011); Wallman
and Flammia (2014); Sheldon  _et al._ (2016); Proctor  _et al._ (2022);
Polloreno  _et al._ (2023), cross-entropy benchmarking (XEB) Boixo  _et al._
(2018); Arute  _et al._ (2019), channel spectrum benchmarking (CSB) Gu  _et
al._ (2023), and direct fidelity estimation (DFE) da Silva  _et al._ (2011);
Flammia and Liu (2011); Elben  _et al._ (2022), while others use complete sets
of input states, such as unitary tomography (UT) Nielsen and Chuang (2002);
Baldwin  _et al._ (2014), quantum process tomography (QPT) D’Ariano  _et al._
(2003); Merkel  _et al._ (2013), and gate set tomography (GST) Greenbaum
(2015); Nielsen  _et al._ (2021). These methods all have upsides and downsides
in terms of speed, scalability, and the amount of information provided.

An important problem that many existing techniques face is that as quantum
computers scale, complex inter-component interactions arise, such as control
crosstalk or temporal correlations caused by residual pulse tails. For
example, experiments may use amplifiers with temperature dependent gain
profiles, which could be linked to pulse duty cycle and cause circuit-
dependent errors. These effects can make the performance of a quantum
operation highly context dependent Kelly  _et al._ (2018); Arute  _et al._
(2019); Rudinger  _et al._ (2019); Wu  _et al._ (2021), and there is a growing
need for characterization methods which account for them.

In this paper, we describe a characterization method called _Context Aware
Fidelity Estimation_ (CAFE) which measures the fidelity between an
experimentally implemented quantum operation and a reference unitary. In CAFE,
we repeat a gate or a subcircuit from a target experiment $n$ times and
measure the average gate fidelity against the reference unitary raised to the
$n^{\text{th}}$ power. For example, the subcircuit can be a stabilizer
extraction circuit in a quantum error correction experiment, as shown in App.
D. This procedure allows us to capture context-related errors which isolated
characterizations do not capture Murali  _et al._ (2020); Sarovar  _et al._
(2020). Since coherent errors accumulate quadratically as a function of $n$
while incoherent errors grow linearly, we can separate their contributions to
the infidelity. This is in contrast with RB and XEB, where random compiling is
used to twirl coherent errors into incoherent ones.

Figure 1: A schematic of the circuits used to measure the fidelity of $n$
repetitions of the cycle circuit, which is selected to be a subcircuit from
some target experiment. First, a state pulled from a $m$ qubit 2-design,
$\\{\psi_{i}\\}$, is prepared (blue). Second, the cycle circuit being
characterized is applied the desired number of times $n$ (pink). Third, we
apply the inverse of the combined preparation circuit and reference unitary
$U_{\mathrm{ref}}$ to the $n^{\text{th}}$ power. Finally, we measure the
resulting state in the computational basis (green). The fidelity between $n$
repetitions of the applied operation and the $n^{\text{th}}$ power of the
reference unitary can be found by averaging the probability of getting
$|0\rangle^{\otimes m}$ over all $4^{m}$ initial states. The faded operations
represent the spatial context of the cycle circuit being characterized.

Throughout the main text of this paper, we focus on using CAFE to study the
performance of $\mathrm{CZ}$ gates implemented in parallel, as two-qubit
operations have been shown to be a dominant error source across recent large-
scale experiments on a number of experimental platforms, especially in the
presence of stray interactions Krinner  _et al._ (2022); AI (2022); Ryan-
Anderson  _et al._ (2021). In the Appendices, we present results from CAFE
experiments characterizing parallel single-qubit operations as well as a
circuit layer of a surface code stabilizer extraction experiment.

##  II Context Aware Fidelity Estimation

A typical CAFE experiment is performed in three steps, schematically shown in
Fig. 1. First, a state $|\psi\rangle$ is prepared from an $m$-qubit 2-design
$\\{\psi_{i}\\}$ Dankert  _et al._ (2009); Harrow and Low (2009); Zhu  _et
al._ (2010); Lu  _et al._ (2015). These ensembles match the Haar-random
distribution up to second moments, allowing us to measure fidelity. In App. A
we present a method to construct shallow circuits that prepare arbitrary two-
qubit entangled states for this purpose. Next, the $m$-qubit circuit of
interest, referred to as the cycle circuit, is repeated $n$ times, along with
operations on neighboring uninvolved qubits. The cycle circuit can include
multiple operations, allowing close matching to the circuit context found in
the target experiment. As an example, an experiment which includes dynamical
decoupling (DD) would be robust to certain coherent errors, and including
these DD gates in the cycle circuit allows CAFE to neglect contributions from
these coherent errors, focusing on the errors which impact performance.
Inserting DD gates is one of several ways for CAFE to separate coherent and
incoherent contributions to gate errors, which we discuss further in Sec. IV.
Finally, using the “reference unitary”, we apply a circuit which ideally maps
the state back to $|0\rangle^{\otimes m}$, before measuring the qubits in the
computational basis. This final step allows us to validate the performance of
different unitary characterization methods, as discussed further in Sec. V.
The average gate fidelity of the operation, which we refer to as _fidelity_ in
the following, can be found by averaging over the experiments for all 2-design
states $\\{\psi_{i}\\}$ Nielsen and Chuang (2002):

$\mathcal{F}=\langle\mathbb{P}_{0...0}\rangle_{\\{\psi_{i}\\}}.$ (1)

We note that in the $m=2$ case, the preparation and measurement stages only
use a single entangling gate, so their contribution to the total error rate is
far smaller than the circuit being characterized for most values of $n$. In
general, since the information we extract from CAFE comes from fitting
fidelity over different values of $n$, reasonable SPAM errors do not
significantly impact the characterization results, as they only cause a
constant offset in the fidelity curve. While the number of 2-design states
scales exponentially with qubit count, random circuits can approximate the
states in polynomial depth Harrow and Low (2009), which could be used for
performing CAFE on $m>2$ qubits.

##  III Comparing CAFE with Randomized Benchmarking

Figure 2: Simulations comparing the CAFE and Interleaved Randomized
Benchmarking (IRB) techniques for characterizing the average gate infidelity
of noisy $\mathrm{CZ}$ gates with amplitude and phase damping noise in
addition to coherent errors. For CAFE (blue), we use depths $n\in[0,2,4,6,8]$,
whereas for IRB (gray) we use depths $n\in[5,10,15,20,25,30,35]$ for obtaining
both the reference RB curve and the acquisition with interleaved $\mathrm{CZ}$
gates. Both approaches use $2000$ shots per circuit. Labels presents the
median absolute errors (MAE) of IRB and CAFE over $N=1000$ different noisy
$\mathrm{CZ}$ gates.
$\mathrm{MAE}=\operatorname{median}(|\tilde{\mathcal{F}}_{1}-\mathcal{F}_{1}|,\ldots,|\tilde{\mathcal{F}}_{N}-\mathcal{F}_{N}|)$.
We note that MAE scales with the true error of the gates being considered.

In this section, we compare our CAFE approach to the widely used Interleaved
Randomized Benchmarking (IRB) protocol for estimating the fidelity of noisy
$\mathrm{CZ}$ gates. The error model for these gates, which is fully described
in App. E, contains coherent errors together with amplitude and phase damping
as incoherent noise. In Fig. 2, we show that for this model, and using
realistic error rates, CAFE yields a more accurate average gate fidelity
estimation than IRB, while requiring significantly less experimental
resources. The randomized benchmarking protocol uses 20 different circuits for
7 depths $5\leq n\leq 35$ of random two-qubit Cliffords (which often require 2
$\mathrm{CZ}$s together with single-qubit gates once compiled), in addition to
repeating these same circuits interleaved with a $\mathrm{CZ}$ at every depth
in order to obtain the $\mathrm{CZ}$ gate fidelity estimate. In contrast, CAFE
uses only 16 different circuits and 5 depths $0\leq n\leq 8$ of $\mathrm{CZ}$s
(with at most two additional $\mathrm{CZ}$ layers for state preparation and
measurement). Moreover, the single qubit gates used by IRB to create the
random Clifford gates introduce unwanted error sources from decoherence and
systematic errors, a problem that CAFE alleviates altogether by only repeating
the cycle circuit of interest. Note that, unlike CAFE, RB additionally
provides an estimate of the average gate fidelity of all two-qubit Cliffords,
which can be of independent interest. We also want to point out that using
additional depths $n$ and sampling shots can improve both approaches, and that
considering a different range of noise parameters can change the resulting
median absolute errors significantly. However, we have found that the
conclusion remains that CAFE allows one to do a gate characterization at least
as good as IRB, while requiring significantly less run time in experiment.

##  IV Budgeting coherent and incoherent errors

Figure 3: Experimental characterization of $\mathrm{CZ}$ gates performed in
parallel using CAFE. Data represents the cycle circuit fidelity compared to
the ideal $\mathrm{CZ}$ unitary for different cycle repetitions, along with
fits using the model presented in Eq. 6 and resulting gate budgets in the
inset table. We plot the data for three specific gates – at the 10th, 50th and
90th percentile on a Sycamore device in terms of average gate infidelity – to
illustrate the accuracy of the modeling over a wide range of data. Error bars
represent the standard deviation of binomial distributions scaled by a factor
of 5 to be visible.

Using CAFE, one can accurately estimate the fidelity of any unitary operation
and report this single number as a performance metric, which is useful for
validation and for estimating the performance of different quantum algorithms
Eisert  _et al._ (2020). However, such a metric alone provides very little
information as to how to improve the gate fidelity in practice. A central
feature of CAFE is that one can extract actionable information about the
origins of gate error by budgeting the coherent and incoherent contributions.
To do so, one can fit the fidelity decay curve to a physical model, or modify
the cycle circuit to echo out different parts of the gate errors, for example
by leveraging Dynamical Decoupling (DD) pulses.

We note that such budgeting is helpful for directing research focus, as
interventions for coherent and incoherent errors tend to be different.

###  IV.1 Separating coherent and incoherent errors through fitting to a model

The CAFE experiment and resulting error budget is valid for any $m$-qubit
unitary, but we will again focus on the two-qubit $\mathrm{CZ}$ case to
simplify the discussion in the main text. We present a more general derivation
in App. B. We assume that the cycle unitary is an excitation-preserving two-
qubit gate close to a $\mathrm{CZ}$

$\displaystyle\tilde{U}(\Delta\theta,\Delta\gamma,\Delta\phi)=$
$\displaystyle\scalebox{0.97}{$\begin{pmatrix}1&0&0&0\\\\[3.0pt]
0&e^{-i\Delta\gamma}\cos(\Delta\theta)&-ie^{-i\Delta\gamma}\sin(\Delta\theta)&0\\\\[3.0pt]
0&-ie^{-i\Delta\gamma}\sin(\Delta\theta)&e^{-i\Delta\gamma}\cos(\Delta\theta)&0\\\\[3.0pt]
0&0&0&-e^{-i(\Delta\phi+2\Delta\gamma)}\end{pmatrix}$}\,,$ (2)

where $\tilde{U}(0,0,0)=\mbox{\small$\mathrm{CZ}$}$, and the swap, single-
qubit phase, and controlled-phased miscalibration angles are assumed to be
small, such that $\Delta\theta,\,\Delta\gamma,\,\Delta\phi\ll 1$. To simplify
further the expressions here, we also assume that the noisy quantum channel
implementing the cycle circuit can be described by a two-qubit depolarizing
channel

$\displaystyle\mathcal{E}(\rho)=$
$\displaystyle(1-{p_{\mathrm{depol}}})\,\tilde{U}\rho\,\tilde{U}^{\dagger}\,+\,{p_{\mathrm{depol}}}\,I_{d}/{d}\,,$
(3)

which outputs a totally mixed state with probability ${p_{\mathrm{depol}}}$
and otherwise applies the cycle unitary $\tilde{U}$. With such a channel, the
average gate fidelity for $n$ repetitions of the cycle circuit is given by

$\displaystyle\begin{multlined}\mathcal{F}_{n}=\frac{1}{4}-{\epsilon_{\mathrm{spam}}}-\frac{1}{20}(1-{p_{\mathrm{depol}}})^{n}\,\cdot\\\
\Big{(}1-\left|1+2e^{-in\Delta\gamma}\cos(n\Delta\theta)+e^{-in(2\Delta\gamma+\Delta\phi)}\right|^{2}\Big{)},\end{multlined}\mathcal{F}_{n}=\frac{1}{4}-{\epsilon_{\mathrm{spam}}}-\frac{1}{20}(1-{p_{\mathrm{depol}}})^{n}\,\cdot\\\
\Big{(}1-\left|1+2e^{-in\Delta\gamma}\cos(n\Delta\theta)+e^{-in(2\Delta\gamma+\Delta\phi)}\right|^{2}\Big{)},$
(6)

where we have explicitly included the SPAM errors
${\epsilon_{\mathrm{spam}}}$, which are assumed to vary slowly over the
timescale of an experiment. We note that in this model we made a steady-state
assumption about the gates in our system, but modeling transient behavior
could be achieved with a more advanced fit. Using the expression in Eq. 6, we
can model the experimental data to obtain the gate fidelity $\mathcal{F}$, in
addition to the incoherent errors ${\epsilon_{\mathrm{incoh}}}$ and coherent
errors ${\epsilon_{\mathrm{coh}}}$ of the quantum operation. To get these
parameters in a way that is robust to SPAM errors, we use

$\displaystyle 1-\mathcal{F}$
$\displaystyle=1-\frac{\mathcal{F}_{1}}{(1-{\epsilon_{\mathrm{spam}}})},$ (7)
$\displaystyle{\epsilon_{\mathrm{incoh}}}$
$\displaystyle=1-\frac{\mathcal{F}_{1}({p_{\mathrm{depol}}}=0)}{(1-{\epsilon_{\mathrm{spam}}})},$
(8) $\displaystyle{\epsilon_{\mathrm{coh}}}$
$\displaystyle=1-\frac{\mathcal{F}_{1}({\Delta\theta}={\Delta\gamma}={\Delta\phi}=0)}{(1-{\epsilon_{\mathrm{spam}}})}.$
(9)

In numerical simulations, which are presented in App. E, this analysis
procedure was shown to be valid and robust to different unitary errors, as
well as amplitude and phase damping channels. We use this method to budget
errors in Figs. 2, 3, 4 and 5. A similar budgeting approach for single-qubit
$\mbox{\small$\mathrm{X}$}(\pi)$ gates, together with experimental results
acquired on a Sycamore chip, are presented in App. C.

As shown in Fig. 3, the simple model of Eq. 6 allows us to accurately fit the
CAFE curves spanning a wide range of $\mathrm{CZ}$ gate fidelities executed in
parallel on a Sycamore chip. Additional data showing the consistency of the
resulting error budget with XEB is presented in App. H.

A useful and intuitive picture to analyze the CAFE data is to consider the
incoherent and coherent errors as linear and quadratic contributions to the
gate infidelity, respectively. This can be seen directly by expanding Eq. 6 up
to terms
$\mathcal{O}((\Delta\theta)^{4},(\Delta\gamma)^{4},(\Delta\phi)^{4},{p_{\mathrm{depol}}}^{2})$

$\displaystyle\mathcal{F}_{n}$ $\displaystyle\approx
1-\epsilon_{\mathrm{spam}}-\epsilon_{\mathrm{lin}}\,n-\epsilon_{\mathrm{quad}}\,n^{2}$
(10) $\displaystyle\epsilon_{\mathrm{lin}}$
$\displaystyle=\frac{3{p_{\mathrm{depol}}}}{4}\;n$ (11)
$\displaystyle\epsilon_{\mathrm{quad}}$
$\displaystyle=\frac{8[(\Delta\theta)^{2}+(\Delta\gamma)^{2}+\Delta\gamma\Delta\phi]+3(\Delta\phi)^{2}}{20}\;n^{2}$
(12)

This approximate quadratic form can be found for different cycle unitaries
under similar noise channels, and could be used directly in the budgeting
procedure given low gate infidelities and shallow cycle repetitions $n$, or in
cases lacking an accurate analytical model for the quantum channel, however we
will stick to the model in Eqs. 7, 8 and 9 in the rest of this paper.

The quantity ${\epsilon_{\mathrm{incoh}}}$ estimates the average gate
infidelity when no coherent control errors are present. This useful
characterization metric is defined as $R(\mathcal{E})$ in Ref. Wallman  _et
al._ (2015), where the authors show that it bounds the unitarity of the
channel $u(\mathcal{E})$:

$\frac{d-1}{d}(1-\sqrt{u(\mathcal{E})})\leq R(\mathcal{E}).$ (13)

As such, we can also relate our incoherent error estimate to unitarity. For
instance, in the case of depolarizing noise, the unitarity is

$u(\mathcal{E}_{\mathrm{depol}})=(1-{p_{\mathrm{depol}}})^{2},$ (14)

and the incoherent error obtained from CAFE is, as derived in App. B,

$\displaystyle 1-{\epsilon_{\mathrm{incoh}}}$
$\displaystyle=\frac{1}{d}+\frac{d-1}{d}(1-{p_{\mathrm{depol}}})$ (15)
$\displaystyle=\frac{1}{d}+\frac{d-1}{d}\sqrt{u(\mathcal{E}_{\mathrm{depol}})}.$
(16)

###  IV.2 Isolating Coherent Channels using Dynamical Decoupling

Figure 4:  Experimental results on characterizing $\mathrm{CZ}$ gates in
parallel when dynamical decoupling gates are part of the cycle circuit
(orange), alongside the standard CAFE data presented in Fig. 3 (blue).
Interleaving the $\mathrm{CZ}$ gates with $\mathrm{X}$ gates on both qubits
echoes out low-frequency $Z$ noise, which contributes to
${\epsilon_{\mathrm{incoh}}}$, and removes the sensitivity to single-qubit
phase unitary errors, which contribute to ${\epsilon_{\mathrm{coh}}}$.
Performing the simple DECAF experiment thus provides valuable information
about the error mechanisms in $\mathrm{CZ}$ gates. Error bars are scaled by a
factor 5 to be visible.

Exploiting the versatility of CAFE, we can modify the cycle circuit we are
characterizing in order to isolate specific error channels. In particular,
this is viable when the impact of the modifications is insignificant relative
to the error channels being isolated. As a relevant example, we can leverage
the fact that the cycle circuit is repeated $n$ times by inserting dynamical
decoupling gates in between repetitions. This approach of combining DD and
CAFE, which we refer to as _DECAF_ , is particularly useful to characterize
the amount of certain coherent error present in the cycle circuit without
necessitating full unitary tomography. We note that this is somewhat similar
to the work in Ref. Sheldon  _et al._ (2016), with a single repetition of the
cycle circuit, and the randomized unitaries replaced with specific DD pulses.

In the case of a $\mathrm{CZ}$ gate, adding an $\mathrm{X}$ gate to both
qubits in the CAFE cycle circuit echos out the single-qubit phase errors, in
addition to mitigating low-frequency noise, as demonstrated in App. F Viola
and Lloyd (1998); Viola and Knill (2003). As shown in Fig. 4, the DECAF data
has higher fidelities and decreases more linearly in practice. Looking at the
resulting fits over all characterized $\mathrm{CZ}$ gates, we see a
significant decrease in the median coherent error from $5.5\times 10^{-4}$ to
$9.4\times 10^{-5}$, which highlights single-qubit phase miscalibrations,
alongside a decrease of the median incoherent error from $7.2\times 10^{-3}$
to $6.7\times 10^{-3}$, which indicates the level of low-frequency noise in
the device.

##  V Validating unitary characterizations

Figure 5: Using CAFE to validate different unitary characterizations of a
$\mathrm{CZ}$ gate with 50th percentile infidelity. The different curves
represent the fidelity between the experimental gate and an ideal
$\mathrm{CZ}$ unitary (blue), a unitary extracted from an XEB experiment
(green), and a unitary characterized with a newly introduced method called
MEADD Genois  _et al._ . In these three different CAFE experiments, only the
final pre-measurement circuit layer changes (see the green box in Fig. 1). The
improvement in fidelity can thus entirely be attributed to considering a gate
unitary that is closer to the experimental $\mathrm{CZ}$ implementation. Error
bars are scaled by a factor 5 to be visible.

One key difference between CAFE and other methods for extracting error rates
is the final unentangling step before measurement. By doing all of the
inversion in a single step, similar to RB, but using the reference unitary for
the inversion, we can validate different unitary characterizations, while
respecting the non-Clifford nature of most coherent error models. As such, we
can use CAFE to benchmark unitary characterizations, simply by changing the
final measurement step and seeing which predictions most accurately map the
final state back to $|0\rangle^{\otimes m}$, in conjunction with the methods
presented in Sec. IV.1.

In Fig. 5, we compare the CZ unitary extracted by XEB to the one extracted
using a unitary characterization method called Matrix-Element Amplification by
Dynamical Decoupling (MEADD) Genois  _et al._ , which is a characterization
technique that we have developed based on Floquet characterization Arute  _et
al._ (2020); Neill  _et al._ (2021). MEADD allows us to isolate and precisely
measure the different unitary parameters in any phased fSim gate (a general
excitation number preserving two-qubit gate). We can see very clearly that the
unitary predicted by MEADD is significantly better at predicting the coherent
error than the unitary extracted by XEB. By increasing the amount of context
around the gate, for example including some microwave operations or
measurements on the surrounding qubits to include crosstalk or measurement-
induced dephasing effects, we can see which characterizations break down in
other contexts (see App. D), and build trust that the structures seen in our
characterizations are the dominant effects on the processor impacting
algorithm performance.

##  VI Conclusion

CAFE separates itself from other gate characterization methods due to its
simplicity and flexibility, most notably as a complementary tool to other gate
characterizations that provide more granular output. We have found its ability
to split coherent and incoherent errors more reliable than other methods, and
the ability to experimentally test unitary characterizations has allowed us to
design and evaluate novel characterization methods more effectively.

Its flexibility allows for many other as-of-yet unexplored variations, from
creating fits which include the impact of leakage, to changing the cycle
circuit round-by-round to echo out components in different ways, to analyzing
the different input bases separately to extract details about the error
structure. Our hope is that other researchers will be able to create their own
modifications of the CAFE framework to study the errors facing their own
systems.

##  VII Acknowledgements

We are grateful to the Google Quantum AI team for building, operating, and
maintaining software and hardware infrastructure used in this work. The
authors would like to thank Will Livingston, Sergio Boixo, Ben Chiaro,
Vinicius S. Ferreira, Abraham Asfaw, and Paul V. Klimov for discussions and
feedback on the draft, and Catherine Erickson and Andreas Bengtsson for
software support.

## References

  * Eisert  _et al._ (2020) J. Eisert, D. Hangleiter, N. Walk, I. Roth, D. Markham, R. Parekh, U. Chabaud, and E. Kashefi, “Quantum certification and benchmarking,” Nature Reviews Physics 2, 382 (2020).
  * Knill  _et al._ (2008) E. Knill, D. Leibfried, R. Reichle, J. Britton, R. B. Blakestad, J. D. Jost, C. Langer, R. Ozeri, S. Seidelin, and D. J. Wineland, “Randomized benchmarking of quantum gates,” Physical Review A 77, 012307 (2008).
  * Magesan  _et al._ (2011) E. Magesan, J. M. Gambetta, and J. Emerson, “Scalable and robust randomized benchmarking of quantum processes,” Physical review letters 106, 180504 (2011).
  * Wallman and Flammia (2014) J. J. Wallman and S. T. Flammia, “Randomized benchmarking with confidence,” New Journal of Physics 16, 103032 (2014).
  * Sheldon  _et al._ (2016) S. Sheldon, L. S. Bishop, E. Magesan, S. Filipp, J. M. Chow, and J. M. Gambetta, “Characterizing errors on qubit operations via iterative randomized benchmarking,” Physical Review A 93, 012301 (2016).
  * Proctor  _et al._ (2022) T. Proctor, S. Seritan, K. Rudinger, E. Nielsen, R. Blume-Kohout, and K. Young, “Scalable randomized benchmarking of quantum computers using mirror circuits,” Physical Review Letters 129, 150502 (2022).
  * Polloreno  _et al._ (2023) A. M. Polloreno, A. Carignan-Dugas, J. Hines, R. Blume-Kohout, K. Young, and T. Proctor, “A theory of direct randomized benchmarking,”  (2023), arXiv:2302.13853 [quant-ph].
  * Boixo  _et al._ (2018) S. Boixo, S. V. Isakov, V. N. Smelyanskiy, R. Babbush, N. Ding, Z. Jiang, M. J. Bremner, J. M. Martinis, and H. Neven, “Characterizing quantum supremacy in near-term devices,” Nature Physics 14, 595 (2018).
  * Arute  _et al._ (2019) F. Arute, K. Arya, R. Babbush, D. Bacon, J. C. Bardin, R. Barends, R. Biswas, S. Boixo, F. G. Brandao, D. A. Buell, _et al._ , “Quantum supremacy using a programmable superconducting processor,” Nature 574, 505 (2019).
  * Gu  _et al._ (2023) Y. Gu, W.-F. Zhuang, X. Chai, and D. E. Liu, “Benchmarking universal quantum gates via channel spectrum,” arXiv preprint arXiv:2301.02056 (2023).
  * da Silva  _et al._ (2011) M. P. da Silva, O. Landon-Cardinal, and D. Poulin, “Practical Characterization of Quantum Devices without Tomography,” Physical Review Letters 107, 210404 (2011), publisher: American Physical Society.
  * Flammia and Liu (2011) S. T. Flammia and Y.-K. Liu, “Direct Fidelity Estimation from Few Pauli Measurements,” Physical Review Letters 106, 230501 (2011), publisher: American Physical Society.
  * Elben  _et al._ (2022) A. Elben, S. T. Flammia, H.-Y. Huang, R. Kueng, J. Preskill, B. Vermersch, and P. Zoller, “The randomized measurement toolbox,” Nature Reviews Physics , 1 (2022), publisher: Nature Publishing Group.
  * Nielsen and Chuang (2002) M. A. Nielsen and I. Chuang, “Quantum computation and quantum information,” (2002).
  * Baldwin  _et al._ (2014) C. H. Baldwin, A. Kalev, and I. H. Deutsch, “Quantum process tomography of unitary and near-unitary maps,” Physical Review A 90, 012110 (2014).
  * D’Ariano  _et al._ (2003) G. M. D’Ariano, M. G. Paris, and M. F. Sacchi, “Quantum tomography,” Advances in Imaging and Electron Physics 128, 206 (2003).
  * Merkel  _et al._ (2013) S. T. Merkel, J. M. Gambetta, J. A. Smolin, S. Poletto, A. D. Córcoles, B. R. Johnson, C. A. Ryan, and M. Steffen, “Self-consistent quantum process tomography,” Physical Review A 87, 062119 (2013).
  * Greenbaum (2015) D. Greenbaum, “Introduction to quantum gate set tomography,” arXiv preprint arXiv:1509.02921 (2015).
  * Nielsen  _et al._ (2021) E. Nielsen, J. K. Gamble, K. Rudinger, T. Scholten, K. Young, and R. Blume-Kohout, “Gate set tomography,” Quantum 5, 557 (2021).
  * Kelly  _et al._ (2018) J. Kelly, P. O’Malley, M. Neeley, H. Neven, and J. M. Martinis, “Physical qubit calibration on a directed acyclic graph,” arXiv:1803.03226 [quant-ph] (2018), arXiv: 1803.03226.
  * Rudinger  _et al._ (2019) K. Rudinger, T. Proctor, D. Langharst, M. Sarovar, K. Young, and R. Blume-Kohout, “Probing Context-Dependent Errors in Quantum Processors,” Physical Review X 9, 021045 (2019), publisher: American Physical Society.
  * Wu  _et al._ (2021) Y. Wu, W.-S. Bao, S. Cao, F. Chen, M.-C. Chen, X. Chen, T.-H. Chung, H. Deng, Y. Du, D. Fan, _et al._ , “Strong quantum computational advantage using a superconducting quantum processor,” Physical review letters 127, 180501 (2021).
  * Murali  _et al._ (2020) P. Murali, D. C. Mckay, M. Martonosi, and A. Javadi-Abhari, “Software Mitigation of Crosstalk on Noisy Intermediate-Scale Quantum Computers,” in  _Proceedings of the Twenty-Fifth International Conference on Architectural Support for Programming Languages and Operating Systems_, ASPLOS ’20 (Association for Computing Machinery, New York, NY, USA, 2020) pp. 1001–1016.
  * Sarovar  _et al._ (2020) M. Sarovar, T. Proctor, K. Rudinger, K. Young, E. Nielsen, and R. Blume-Kohout, “Detecting crosstalk errors in quantum information processors,” Quantum 4, 321 (2020).
  * Krinner  _et al._ (2022) S. Krinner, N. Lacroix, A. Remm, A. Di Paolo, E. Genois, C. Leroux, C. Hellings, S. Lazar, F. Swiadek, J. Herrmann, _et al._ , “Realizing repeated quantum error correction in a distance-three surface code,” Nature 605, 669 (2022).
  * AI (2022) G. Q. AI, “Suppressing quantum errors by scaling a surface code logical qubit,”  (2022).
  * Ryan-Anderson  _et al._ (2021) C. Ryan-Anderson, J. G. Bohnet, K. Lee, D. Gresh, A. Hankin, J. P. Gaebler, D. Francois, A. Chernoguzov, D. Lucchetti, N. C. Brown, T. M. Gatterman, S. K. Halit, K. Gilmore, J. A. Gerber, B. Neyenhuis, D. Hayes, and R. P. Stutz, “Realization of real-time fault-tolerant quantum error correction,” Phys. Rev. X 11, 041058 (2021).
  * Dankert  _et al._ (2009) C. Dankert, R. Cleve, J. Emerson, and E. Livine, “Exact and approximate unitary 2-designs and their application to fidelity estimation,” Physical Review A 80, 012304 (2009).
  * Harrow and Low (2009) A. W. Harrow and R. A. Low, “Random quantum circuits are approximate 2-designs,” Communications in Mathematical Physics 291, 257 (2009).
  * Zhu  _et al._ (2010) H. Zhu, Y. S. Teo, and B.-G. Englert, “Two-qubit symmetric informationally complete positive-operator-valued measures,” Physical Review A 82, 042308 (2010).
  * Lu  _et al._ (2015) D. Lu, H. Li, D.-A. Trottier, J. Li, A. Brodutch, A. P. Krismanich, A. Ghavami, G. I. Dmitrienko, G. Long, J. Baugh, and R. Laflamme, “Experimental Estimation of Average Fidelity of a Clifford Gate on a 7-Qubit Quantum Processor,” Physical Review Letters 114, 140505 (2015), publisher: American Physical Society.
  * Wallman  _et al._ (2015) J. Wallman, C. Granade, R. Harper, and S. T. Flammia, “Estimating the coherence of noise,” New Journal of Physics 17, 113020 (2015).
  * Viola and Lloyd (1998) L. Viola and S. Lloyd, “Dynamical suppression of decoherence in two-state quantum systems,” Physical Review A 58, 2733 (1998).
  * Viola and Knill (2003) L. Viola and E. Knill, “Robust dynamical decoupling of quantum systems with bounded controls,” Physical Review Letters 90, 037901 (2003).
  * (35) E. Genois, J. A. Gross, Z.-P. Cian, D. M. Debroy, and Z. Jiang, “Matrix element amplification using dynamical decoupling,” in preparation .
  * Arute  _et al._ (2020) F. Arute, K. Arya, R. Babbush, D. Bacon, J. C. Bardin, R. Barends, A. Bengtsson, S. Boixo, M. Broughton, B. B. Buckley, D. A. Buell, B. Burkett, N. Bushnell, Y. Chen, Z. Chen, Y.-A. Chen, B. Chiaro, R. Collins, S. J. Cotton, W. Courtney, S. Demura, A. Derk, A. Dunsworth, D. Eppens, T. Eckl, C. Erickson, E. Farhi, A. Fowler, B. Foxen, C. Gidney, M. Giustina, R. Graff, J. A. Gross, S. Habegger, M. P. Harrigan, A. Ho, S. Hong, T. Huang, W. Huggins, L. B. Ioffe, S. V. Isakov, E. Jeffrey, Z. Jiang, C. Jones, D. Kafri, K. Kechedzhi, J. Kelly, S. Kim, P. V. Klimov, A. N. Korotkov, F. Kostritsa, D. Landhuis, P. Laptev, M. Lindmark, E. Lucero, M. Marthaler, O. Martin, J. M. Martinis, A. Marusczyk, S. McArdle, J. R. McClean, T. McCourt, M. McEwen, A. Megrant, C. Mejuto-Zaera, X. Mi, M. Mohseni, W. Mruczkiewicz, J. Mutus, O. Naaman, M. Neeley, C. Neill, H. Neven, M. Newman, M. Y. Niu, T. E. O’Brien, E. Ostby, B. Pató, A. Petukhov, H. Putterman, C. Quintana, J.-M. Reiner, P. Roushan, N. C. Rubin, D. Sank, K. J. Satzinger, V. Smelyanskiy, D. Strain, K. J. Sung, P. Schmitteckert, M. Szalay, N. M. Tubman, A. Vainsencher, T. White, N. Vogt, Z. J. Yao, P. Yeh, A. Zalcman, and S. Zanker, “Observation of separated dynamics of charge and spin in the Fermi-Hubbard model,” arXiv:2010.07965 (2020).
  * Neill  _et al._ (2021) C. Neill, T. McCourt, X. Mi, Z. Jiang, M. Y. Niu, W. Mruczkiewicz, I. Aleiner, F. Arute, K. Arya, J. Atalaya, R. Babbush, J. C. Bardin, R. Barends, A. Bengtsson, A. Bourassa, M. Broughton, B. B. Buckley, D. A. Buell, B. Burkett, N. Bushnell, J. Campero, Z. Chen, B. Chiaro, R. Collins, W. Courtney, S. Demura, A. R. Derk, A. Dunsworth, D. Eppens, C. Erickson, E. Farhi, A. G. Fowler, B. Foxen, C. Gidney, M. Giustina, J. A. Gross, M. P. Harrigan, S. D. Harrington, J. Hilton, A. Ho, S. Hong, T. Huang, W. J. Huggins, S. V. Isakov, M. Jacob-Mitos, E. Jeffrey, C. Jones, D. Kafri, K. Kechedzhi, J. Kelly, S. Kim, P. V. Klimov, A. N. Korotkov, F. Kostritsa, D. Landhuis, P. Laptev, E. Lucero, O. Martin, J. R. McClean, M. McEwen, A. Megrant, K. C. Miao, M. Mohseni, J. Mutus, O. Naaman, M. Neeley, M. Newman, T. E. O’Brien, A. Opremcak, E. Ostby, B. Pató, A. Petukhov, C. Quintana, N. Redd, N. C. Rubin, D. Sank, K. J. Satzinger, V. Shvarts, D. Strain, M. Szalay, M. D. Trevithick, B. Villalonga, T. C. White, Z. Yao, P. Yeh, A. Zalcman, H. Neven, S. Boixo, L. B. Ioffe, P. Roushan, Y. Chen, and V. Smelyanskiy, “Accurately computing the electronic properties of a quantum ring,” Nature 594, 508 (2021).
  * Developers (2022) C. Developers, “Cirq,”  (2022), See full list of authors on Github: https://github .com/quantumlib/Cirq/graphs/contributors.

##  Appendix A Preparing and measuring two-qubit states

As an aside, we describe a method to prepare or measure an arbitrary two-qubit
state with a single maximally entangling operation. We start by considering a
general two-qubit target state

$\begin{split}|\psi\rangle=&A|00\rangle+B|01\rangle+C|10\rangle+D|11\rangle,\\\
&|A|^{2}+|B|^{2}+|C|^{2}+|D|^{2}=1.\end{split}$ (17)

We can then write a matrix with the amplitudes of this state

$M_{\psi}=\begin{bmatrix}A&B\\\ C&D\end{bmatrix},$ (18)

and perform the singular value decomposition (SVD)
$M_{\psi}=U_{\psi}S_{\psi}V^{\dagger}_{\psi}$. Considering the initial
singular value, $S_{\psi}^{00}$, we can quantify the level of entanglement in
the targeted state. The first step to generate this state is to prepare a
state with a matching entanglement signature.

In the case where we intend to use a $\mathrm{CZ}$ gate, this can be done by
putting one qubit in $|+\rangle$, and applying a $Y$ rotation to the other
qubit with an angle of $\alpha=2\arccos\left(S_{\psi}^{00}\right)$. This
state, labeled as $|\mbox{\small$\mathrm{CZ}$}\rangle$ in Fig. 6, is
equivalent to the final state up to single qubit rotations. To find these
rotations, we take the SVD of the $2\times 2$ matrix corresponding to this
intermediate state, $U_{CZ}S_{CZ}V^{\dagger}_{CZ}$. The single qubit unitary
required for the first qubit is given by $U_{1}=U_{\psi}U_{CZ}^{-1}$, and the
unitary for the second qubit is $U_{2}=V_{\psi}V_{CZ}^{-1}$. The resulting
circuit is shown in Fig. 6. Constructions for $\mathrm{CZ}$ and
$\sqrt{\mbox{\small$\mathrm{iSWAP}$}}$ are implemented as the methods
prepare_two_qubit_state_with_cz and prepare_two_qubit_state_with_iswap in the
open-source software Cirq Developers (2022).

Figure 6: A simple circuit that maps $|00\rangle$ to an arbitrary two-qubit
state $|\psi\rangle$ using only one $\mathrm{CZ}$ operation. The overlap of
any two-qubit state with the state $|\psi\rangle$ can be obtained by executing
the inverse of this circuit and reporting the probability of measuring
$|00\rangle$ afterwards.

##  Appendix B Derivation of Eq. 6

In this section, we derive Eq. 6 as an example of how one could do the same
for other unitaries and error models of interest. Given a general quantum
channel described by a set of Kraus operators $K_{\alpha}$,

$\displaystyle\mathcal{E}(\rho)=\sum_{\alpha}K_{\alpha}\rho
K_{\alpha}^{\dagger}\,,$ (19)

the average fidelity of the quantum operation $\mathcal{E}$ with respect to a
unitary operation $U$ is

$\displaystyle\mathcal{F}(\mathcal{E},U)$
$\displaystyle=\int\bra{\psi(\bm{{x}})}U^{\dagger}\mathcal{E}\bigl{(}\,\ket{\psi(\bm{{x}})}\bra{\psi(\bm{{x}})}\,\bigr{)}U\ket{\psi(\bm{{x}})}\,d\mu(\bm{{x}})$
(20)
$\displaystyle=\sum_{\alpha}\int\big{\lvert}\bra{\psi(\bm{{x}})}U^{\dagger}K_{\alpha}\ket{\psi(\bm{{x}})}\big{\rvert}^{2}\,d\mu(\bm{{x}})\,,$
(21)

where $\bm{{x}}$ is a parametrization of pure quantum states and
$\mu(\bm{{x}})$ is the Haar measure. To evaluate $\mathcal{F}$, we introduce
the projector on the symmetric subspace of the system and its replica, which
is expressed as

$\displaystyle P_{S}$
$\displaystyle=\frac{{d}({d}+1)}{2}\\!\int\ket{\psi(\bm{{x}})}\bra{\psi(\bm{{x}})}\otimes\ket{\psi(\bm{{x}})}\bra{\psi(\bm{{x}})}\,d\mu(\bm{{x}})\,,$
(22)

where ${d}=2^{m}$ is the dimension of the $m$-qubit Hilbert space. Using this
projector, the fidelity takes the form

$\displaystyle\mathcal{F}(\mathcal{E},U)$
$\displaystyle=\frac{2}{{d}({d}+1)}\operatorname{tr}\Bigl{(}P_{S}\sum_{\alpha}K^{\dagger}_{\alpha}U\otimes
U^{\dagger}K_{\alpha}\,\Bigr{)}$ (23) $\displaystyle=\frac{1}{{d}\hskip
0.4pt({d}+1)}\sum_{\alpha}\operatorname{tr}K_{\alpha}^{\dagger}K_{\alpha}+\big{\lvert}\operatorname{tr}(U^{\dagger}K_{\alpha})\big{\rvert}^{2}$
(24) $\displaystyle=\frac{1}{{d}+1}+\frac{1}{{d}\hskip
0.4pt({d}+1)}\sum_{\alpha}\big{\lvert}\operatorname{tr}(U^{\dagger}K_{\alpha})\big{\rvert}^{2}\,.$
(25)

In order to compute the fidelity expression in Eq. 25, one computes the
eigenvalues of $U^{\dagger}K_{\alpha}$ and sum them up directly to get
$\operatorname{tr}(U^{\dagger}K_{\alpha})$. For example, we consider the case
where the operation of interest can be described by a quantum channel that
either applies the unitary $\tilde{U}$, or totally depolarizes the qubits with
probability ${p_{\mathrm{depol}}}$

$\displaystyle\mathcal{E}(\rho)=(1-{p_{\mathrm{depol}}})\,\tilde{U}\rho\,\tilde{U}^{\dagger}+{p_{\mathrm{depol}}}\,I_{d}/{d}\,,$
(26)

where $I_{d}$ is the ${d}$-dimensional identity operator. The fidelity of this
channel after $n$ consecutive applications is given by

$\displaystyle\mathcal{F}_{n}$
$\displaystyle=(1-{p_{\mathrm{depol}}})^{n}\,\frac{{d}+\big{\lvert}\operatorname{tr}[(U^{\dagger})^{n}\tilde{U}^{n}]\big{\rvert}^{2}}{{d}({d}+1)}+\bigl{[}1-(1-{p_{\mathrm{depol}}})^{n}\bigr{]}\,\frac{1}{{d}}\,.$
(27)

After subtracting $\epsilon_{\mathrm{spam}}$ from the RHS to account for
experimental SPAM errors, the expression in Eq. 27 can be used to fit the CAFE
data of any $m$-qubit unitary $\tilde{U}$, subject to symmetric depolarizing
noise, with respect to a reference unitary $U$. Note that in the case where
the quantum operation under characterization, $\tilde{U}$, corresponds exactly
with the reference unitary $U$, the CAFE data should obey the following
single-exponential decay

$\displaystyle\mathcal{F}_{n}$
$\displaystyle=\frac{1}{d}+\frac{d-1}{d}(1-{p_{\mathrm{depol}}})^{n}.$ (28)

Otherwise, when $\tilde{U}\neq U$, coherent errors are present and the first
term of 27 will introduce errors that scale quadratically with $n$ to first
order.

In the case we are interested in, we want to use CAFE to characterize a two-
qubit gate, where $d=4$, $U=\mbox{\small$\mathrm{CZ}$}$ and $\tilde{U}$ is a
number-preserving $\mathrm{fSim}$ gate close to a $\mathrm{CZ}$ gate:

$\displaystyle\tilde{U}(\Delta\theta,\Delta\gamma,\Delta\phi)=\begin{pmatrix}1&0&0&0\\\\[3.0pt]
0&e^{-i\Delta\gamma}\cos(\Delta\theta)&-ie^{-i\Delta\gamma}\sin(\Delta\theta)&0\\\\[3.0pt]
0&-ie^{-i\Delta\gamma}\sin(\Delta\theta)&e^{-i\Delta\gamma}\cos(\Delta\theta)&0\\\\[3.0pt]
0&0&0&-e^{-i(2\Delta\gamma+\Delta\phi)}\end{pmatrix}\,,$ (29)

with some residual $\mathrm{SWAP}$-like error captured by the angle
$\Delta\theta$, single-qubit phase error captured by $\Delta\gamma$, and
$\mathrm{CPhase}$-like error captured by $\Delta\phi$, with
$\Delta\theta,\,\Delta\gamma,\,\Delta\phi\ll 1$. Since $\mathrm{CZ}$ is
diagonal, we can show that the eigenvalues of $(U^{\dagger})^{n}\tilde{U}^{n}$
are

$\displaystyle\bm{\lambda}=\begin{pmatrix}1&e^{-in(\Delta\gamma-\Delta\theta)}&e^{-in(\Delta\gamma+\Delta\theta)}&e^{-in(2\Delta\gamma+\Delta\phi)}\end{pmatrix},$
(30)

for $n\in\mathbb{N}$. As such,
$\operatorname{tr}[(U^{\dagger})^{n}\tilde{U}^{n}]=\operatorname{sum}(\bm{\lambda})$
and substituting into Eq. 27 gives

$\displaystyle\mathcal{F}_{n}$
$\displaystyle=\frac{1}{4}-(1-{p_{\mathrm{depol}}})^{n}\left(\frac{1-\left|1+2e^{-in\Delta\gamma}\cos(n\Delta\theta)+e^{-in(2\Delta\gamma+\Delta\phi)}\right|^{2}}{20}\right)$
(31)
$\displaystyle=1-\frac{3{p_{\mathrm{depol}}}}{4}n-\frac{8(\Delta\theta)^{2}+8(\Delta\gamma)^{2}+8(\Delta\gamma\Delta\phi)+3(\Delta\phi)^{2}}{20}n^{2}$
(32)
$\displaystyle\hphantom{{}\mathrel{=}}+\mathcal{O}((\Delta\theta)^{4},(\Delta\gamma)^{4},(\Delta\phi)^{4},{p_{\mathrm{depol}}}^{2}),$
(33)

which is the expression in Eq. 6 of the main text, after subtracting the SPAM
errors $\epsilon_{\mathrm{spam}}$ from the RHS to account for experimental
imperfections.

##  Appendix C Single-qubit CAFE

Figure 7: Single-qubit parallel CAFE results for three $\mathrm{X}$ gates
close to the 10th (left), 50th (center), and 90th (right) percentiles of
infidelity, from a total of 68 parallel $\mathrm{X}$ gates on a Sycamore
device. The data in blue computes the fidelity with an ideal
$U=\mbox{\small$\mathrm{X}$}$ unitary, whereas the CAFE data in red uses a
characterized unitary. Note that in this data, the characterized single-qubit
unitaries were not used to optimize the gate parameters, thus the imperfect
calibration.

In order to give an additional example on how to deploy the CAFE
characterization framework, we present an experiment characterizing 68 single-
qubit $\mathrm{X}$ gates in parallel on a Sycamore processor. The results are
presented in Fig. 7, showing the fidelity of the experimental gate with both
an ideal unitary (in blue) and a characterized one (in red), in addition to
fits using an analytical model derived below, for three example gates. In the
single qubit case, the minimal 2-design contains only 4 states which can all
be prepared with a single gate, which significantly speeds up the
characterization. We have used cycle repetitions $n$ up to $32$ here, showing
how one can modify the experiment when studying especially high-fidelity
operations to maintain good fit robustness.

Assuming that the incoherent noise of the experimental gate can be described
by a totally depolarizing channel, our model to fit the single-qubit CAFE data
can again be derived from Eq. 27. For this case where $U=R_{x}(\pi)$ and
${d}=2$, we can parametrize a single-qubit unitary

$\displaystyle\tilde{U}(\Delta\mu)$
$\displaystyle=\begin{pmatrix}-\sin(\Delta\mu/2)&-i\cos(\Delta\mu/2)\\\\[3.0pt]
-i\cos(\Delta\mu/2)&-\sin((\Delta\mu/2)\end{pmatrix}\,,$ (34)

where $\tilde{U}(0)=R_{x}(\pi)$. One can easily show that the eigenvalues of
$(U^{\dagger})^{n}\tilde{U}^{n}$ are

$\displaystyle\bm{\lambda}_{n}=\begin{cases}(i^{n}e^{in\Delta\mu/2}&i^{n}e^{-in\Delta\mu/2}),\;\mathrm{for}\;n\;\mathrm{even}\\\
(e^{in\Delta\mu/2}&e^{-in\Delta\mu/2}),\;\mathrm{for}\;n\;\mathrm{odd}\end{cases}$
(35)

where $n\in\mathbb{N}$. As such,

$\displaystyle\left|\operatorname{tr}[(U^{\dagger})^{n}\tilde{U}^{n}]\right|^{2}$
$\displaystyle=\left|\operatorname{sum}(\bm{\lambda}_{n})\right|^{2}=4\cos^{2}(n\Delta\mu/2)$
(36)

and Eq. 27 becomes

$\displaystyle\mathcal{F}_{n}$
$\displaystyle=\frac{1}{2}-{\epsilon_{\mathrm{spam}}}+(1-{p_{\mathrm{depol}}})^{n}\left(\frac{2}{3}\cos^{2}(n\Delta\mu/2)-\frac{1}{6}\right).$
(37)

where, as before, we have explicitly included the SPAM errors
${\epsilon_{\mathrm{spam}}}$ to account for experimental imperfections. The
error budget in terms of the fidelity $\mathcal{F}$, incoherent error
contribution ${\epsilon_{\mathrm{incoh}}}$, and coherent error contribution
${\epsilon_{\mathrm{coh}}}$ is obtained the same way as in Eqs. 7, 8 and 9 of
the main text, i.e. by fitting the data with this expression, evaluating it at
$n=1$ with different noise parameters set to zero, and normalizing by the SPAM
errors. Figure 7 shows that such a model allows us to accurately reproduce the
CAFE data obtained in the experiment.

##  Appendix D Characterizing multi-layer circuits using CAFE

Here, we provide an example of a CAFE experiment that includes both spatial
and temporal context by characterizing a cycle circuit containing multiple
layers. As illustrated in Fig. 8a, we consider a portion of the stabilizer
extraction circuit for a distance-3 surface code experiment used in Ref. AI
(2022). In Fig. 8b, we show how this section of the circuit can be considered
on its own and broken down into qubit groups. We can then run a parallel CAFE
experiment on these qubit groups which uses the highlighted section as the
cycle circuit. The resulting experimental data is shown in Fig. 8c. We can see
that one of the $m=1$ qubit groups experiences significant error, despite its
individual single-qubit gates $\mathrm{X}$ and $\mathrm{H}$ showing good
fidelities. This highlights the importance of context-aware characterization,
as the error mode being experienced was only visible when the gates were run
in conjunction. This experiment also highlights the flexibility of CAFE in
being able to characterize multi-operation circuits simultaneously on qubit
groups of varying size.

Figure 8: a. The stabilizer extraction circuit for a distance-3 surface code,
with the section to be characterized boxed in orange. b. A layout for the CAFE
experiment along with the qubit groups characterized. c. CAFE data for
repetitions of the cycle circuit from a. on the qubit groups in b., with the
$m=2$ groups in green and the $m=1$ groups in red. CAFE allows us to see that
$q_{11}$ (red, dotted) is experiencing a significant context-dependent error.

##  Appendix E Numerical CAFE simulations

In this section, we present numerical simulations where we characterize a
$\mathrm{CZ}$ gate using the CAFE approach presented in the main text. We
simulate the same $2^{4}=16$ circuits executed on the Sycamore device with
noisy two-qubit unitaries, together with either depolarizing noise in App. E.1
or amplitude and phase damping noise in App. E.2. We also used the same low
cycle repetitions $n\in[0,2,4,6,8]$ which make the CAFE experiment have
especially low execution time relative to other two-qubit benchmarking
techniques. In Sec. III we showed that using CAFE to characterize a
$\mathrm{CZ}$ gate can allow for a more accurate fidelity estimation than the
widely used Randomized Benchmarking (RB) protocol while using significantly
less experimental resources. Note that we also simulate the sampling of $2000$
shots used experimentally, which places an upper bound on the standard
deviation of all the CAFE data points presented in Figs. 3, 4, and 5 of

$\displaystyle\sigma_{\mathcal{F}}\leq\frac{1}{8\sqrt{N_{\mathrm{shots}}}}\approx
0.0028,$ (38)

which is smaller than all the markers used in the plots of the main text.

Importantly, these simulations allow us to confirm the validity of the CAFE
experiment and following fitting procedure to obtain accurate estimates of the
following: the average gate fidelity of the quantum operation with regards to
any reference unitary, the incoherent error contribution to the infidelity and
the coherent error contribution.

The simulations were performed using the open-source software Cirq Developers
(2022).

###  E.1 Depolarizing noise

Figure 9: Simulating the CAFE experiment for characterizing 1000 different
$\mathrm{CZ}$ gates with realistically small coherent errors and depolarizing
incoherent noise. Two error budgeting techniques obtained by fitting this CAFE
data are presented. In blue, using a quadratic fit for the fidelity at depths
$n\in[0,2,4]$, and in orange using the analytical expression of Eq. 6 for
depths $n\in[0,2,4,6,8]$. Inset shows the median absolute errors (MAE) of the
two error budgeting techniques from the true values inserted into the
simulation. We note that MAE scales with the true error of the gates being
considered. The true incoherent (coherent) errors are obtained from the
channel’s average gate infidelity when only depolarizing errors (unitary
errors) are present in the simulation.

In a first case, we consider that the noisy $\mathrm{CZ}$ gate we are trying
to characterize is described by the quantum channel

$\displaystyle\mathcal{E}(\rho)=$
$\displaystyle(1-{p_{\mathrm{depol}}})\,\tilde{V}\rho\,\tilde{V}^{\dagger}\,+\,{p_{\mathrm{depol}}}\,I_{d}/{d}\,,$
(39)

which outputs a totally depolarized state with probability
${p_{\mathrm{depol}}}$, and otherwise applies the excitation-preserving
unitary

$\displaystyle\tilde{V}(\theta,\zeta,\chi,\gamma,\phi)=\begin{pmatrix}1&0&0&0\\\\[3.0pt]
0&e^{-i(\gamma+\zeta)}\cos\theta&-i\,e^{-i(\gamma-\chi)}\sin\theta&0\\\\[3.0pt]
0&-i\,e^{-i(\gamma+\chi)}\sin\theta&e^{-i(\gamma-\zeta)}\cos\theta&0\\\\[3.0pt]
0&0&0&-e^{-i(2\gamma+\phi)}\end{pmatrix}\,,$ (40)

where we allow for miscalibrations in all of the five angles that parametrize
this gate, where $\tilde{V}(0,0,0,0,0)=\mbox{\small$\mathrm{CZ}$}$. For the
simulation, we then sample the depolarizing probability uniformly in the range
from 0 to 0.05, and sample the miscalibrated angles from a normal distribution
with zero mean and standard deviation of 0.05 rad such that

$\displaystyle{p_{\mathrm{depol}}}$ $\displaystyle\propto\mathcal{U}(0,0.05)$
(41) $\displaystyle\\{\theta,\zeta,\chi,\gamma,\phi\\}$
$\displaystyle\propto\mathcal{N}(0,0.05^{2}).$ (42)

Using this model, we can simulate the noisy CAFE experiment for different
cycle repetitions $n$, and then fit these data points to obtain an error
budgeting of the noisy $\mathrm{CZ}$ gate, which we can compare directly with
the true parameter values that were drawn for the simulation.

In Fig. 9, we present the average gate infidelity $(1-\mathcal{F})$,
incoherent error contribution ${\epsilon_{\mathrm{incoh}}}$, and coherent
error contribution ${\epsilon_{\mathrm{coh}}}$ to this infidelity for $1000$
independently sampled unitaries and depolarizing probabilities. We present two
valid gate error budgeting approaches, one which fits the CAFE data with the
analytical expression in Eq. 6 (orange points), and one which uses the simple
quadratic form of Eq. 10 (blue points). These scatter demonstrate the validity
of CAFE to characterize the fidelity of a quantum operation and budget its
coherent and incoherent contributions with an imprecision smaller or equal to
0.001 on median for realistic gate fidelities. Note that the reported median
absolute errors depend on the specific range of gate fidelities considered.
For example, the MAE values decrease significantly when considering only gate
infidelities $<1\%$ in the ensemble.

The quadratic fit results shown in blue in Fig. 9 are an indication of how the
CAFE framework can be deployed in order to estimate the fidelity of an
operation in context. However, this simplest approach gives slightly biased
results for ${\epsilon_{\mathrm{incoh}}}$ and ${\epsilon_{\mathrm{coh}}}$,
which is understood from the breakdown of the $n{p_{\mathrm{depol}}}\ll 1$
approximation and/or the $n\alpha\ll 1$ approximation, where $\alpha$ here
stands for any of the five miscalibrated $\mathrm{CZ}$ angles. Consequently,
using a quadratic fit should be used carefully, for operations with high
fidelity ($>99$ %) and using shallow cycle repetitions $n$. In fact, for these
simulations, we have found that using larger depths than $n=4$ for the
quadratic fit decreased the accuracy of the resulting error budgets. However,
if the fidelity of the operation of interest is very high, for example with
single-qubit gates, using a quadratic fit becomes an attractive strategy when
lacking a proper analytical model of the error origins.

On the other hand, the analytical fit performs well for larger depths $n$
since it does not rely on any approximation. Here, we have only used the
depths $n\in[0,2,4,6,8]$ to be consistent with the experiment results of the
main text. These results are an important validation for CAFE, but not
necessarily surprising since we are using the same error model to simulate the
experiment and to fit the resulting data. In the next sub-section, we show
that this model also holds very well for different noise models such as
amplitude and phase damping, provided they cause realistic gate infidelities
of a few percent or less.

###  E.2 Amplitude and phase damping noise

Figure 10: Similar simulations as presented in Fig. 9, now implementing
realistic amplitude and phase damping incoherent noise instead of a
depolarizing channel. The analytical fit, which still uses Eq. 6 that
effectively lumps the incoherent noise into a ${p_{\mathrm{depol}}}$
probability, works remarkably well even under this different noise channel.

To verify the robustness of the CAFE framework to different incoherent noise
processes, we have also simulated a two-qubit CAFE experiment where the
quantum channel is described by the same unitary $\tilde{V}$ with randomly
sampled angles as before, but now followed by a single-qubit amplitude and
phase damping channel on both qubits. The total decay and phase-flip
probabilities for both qubits were sampled from a normal distribution with a
standard deviation of 0.03, before taking the absolute value

$\displaystyle\\{p_{\mathrm{decay,total}},p_{\mathrm{phaseflip,total}}\\}$
$\displaystyle\propto\left|\mathcal{N}(0,0.03^{2})\right|,$ (43)

and the individual decay and phase-flip probabilities of the two qubits were
splitting these total probabilities with a ratio drawn from a normal
distribution with mean of 0.5 and standard deviation of 0.1, such that the
qubits have similar but distinct coherence properties.

In Fig. 10, we show that the CAFE framework we developed again gives very
accurate $\mathrm{CZ}$ characterizations and error budgets. In particular,
using the analytical expression of Eq. 6 to fit this CAFE data works
remarkably well given that the noise present in the gate cannot be fully
described by the assumed depolarizing channel. Since the incoherent noise is
small, but in the realistic range of creating about 0.1 % to 4 % gate
infidelity, the fit is able to approximate well the incoherent error
contribution into the single exponential of the model. This gives us
confidence that we can leverage this model in realistic gate characterization
scenarios. Moreover, the simulations show that the accuracy of using this
model increases with increasing gate fidelities, which is a great indication
for the continued usefulness of this method as gates and qubit coherences keep
improving.

###  E.3 Fitting CAFE data

Figure 11: Example of fitting the CAFE curve obtained in simulations with the
depolarizing noise channel used in Sec. E.1 (left) and the amplitude and phase
damping noise channel used in Sec. E.2 (right). In blue, we show simulations
including both incoherent errors of strength
${\epsilon_{\mathrm{incoh}}}=0.005$ and coherent errors of
${\epsilon_{\mathrm{coh}}}=0.002$, and the dotted line shows the fit of this
data using Eq. 6. As in the main text, only the even depths are used in the
fit, the odd depths points are presented with x symbols simply to show their
consistency with the model. Note: the green data is the same in both panels as
we fix the incoherent errors to be zero.

In Fig. 11, we present examples of the CAFE data together with fits to the
model of Eq. 6 realized on the simulation data to obtain the $\mathrm{CZ}$
error budgets presented in Figs. 9 and 10. We see that the model of Eq. 6 fits
the CAFE data very well for realistic noise of strength
${\epsilon_{\mathrm{incoh}}}=0.005$ and ${\epsilon_{\mathrm{coh}}}=0.002$,
even when the incoherent noise comes from an amplitude and phase damping
channel. In Fig. 11, we also show simulation data using the same noise channel
but an ideal unitary (${\epsilon_{\mathrm{coh}}}=0$) in red, and using the
same unitary without any incoherent noise (${\epsilon_{\mathrm{incoh}}}=0$) in
green. The linear and purely quadratic behaviors of these curves,
respectively, can be easily understood from the quadratic form of Eq. 10 where
the incoherent errors build up linearly with $n$, whereas the coherent errors
build up quadratically.

Since we simulate the actual 16 circuits used to obtain the average gate
fidelity at different depths, we capture some depth-dependent behaviors that
are due to coherent effects in the single- and two-qubit unitaries (see for
example the green ‘x’ at $n=1$ in Fig. 11, which is actually higher than the
point at $n=0$). This is not an artifact of the finite sampling, but is due to
the fact that the preparation and measurement circuits both require an
imperfect $\mathrm{CZ}$ gate, which can coherently map the state closer or
further away from the desired state $|00\rangle$, depending on the specific
imperfect unitaries. Similarly, part of the incoherent noise channel can anti-
commute with the $\mathrm{CZ}$ unitary and produce back-and-forth behaviors
between the odd and even depths $n$. We have found in simulation that using
only the even depths avoids this issue, while performing similarly or better
in terms of accuracy in error budgeting, compared to using all the even and
odd depths.

##  Appendix F Dynamical Decoupling in CAFE

In this Appendix, we show how applying an $\mathrm{X}$ gate to both qubits
after the $\mathrm{CZ}$ in the cycle circuit decouples the $\mathrm{fSim}$
unitary from both of its single-qubit phases. First, we can show that
interleaving a pair of $\mathrm{fSim}$ gates with parallel $\mathrm{X}$ gates
gives a cycle unitary that also corresponds to an $\mathrm{fSim}$ gate. To see
this, consider what happens when conjugating an $\mathrm{fSim}$ unitary by
parallel $\mathrm{X}$s:

$\displaystyle(X\otimes X)\mbox{\small$\mathrm{fSim}$}(X\otimes X)$
$\displaystyle=\begin{pmatrix}0&0&0&1\\\ 0&0&1&0\\\ 0&1&0&0\\\
1&0&0&0\end{pmatrix}\begin{pmatrix}1&0&0&0\\\
0&e^{-i\gamma}u_{11}&e^{-i\gamma}u_{12}&0\\\
0&e^{-i\gamma}u_{21}&e^{-i\gamma}u_{22}&0\\\
0&0&0&e^{-i(2\gamma+\phi)}\end{pmatrix}\begin{pmatrix}0&0&0&1\\\ 0&0&1&0\\\
0&1&0&0\\\ 1&0&0&0\end{pmatrix}$ (44)
$\displaystyle=\begin{pmatrix}e^{-i(2\gamma+\phi)}&0&0&0\\\
0&e^{-i\gamma}u_{22}&e^{-i\gamma}u_{21}&0\\\
0&e^{-i\gamma}u_{12}&e^{-i\gamma}u_{11}&0\\\ 0&0&0&1\end{pmatrix},$ (45)

where we’ve factored the $\mathrm{fSim}$ unitary into phases between the
particle-number subspaces and a special unitary $U$ in the single-excitation
subspace

$\displaystyle U$ $\displaystyle=\begin{pmatrix}u_{11}&u_{12}\\\
u_{21}&u_{22}\end{pmatrix}=\begin{pmatrix}e^{-i\zeta}\cos\theta&-ie^{i\chi}\sin\theta\\\
-ie^{-i\chi}\sin\theta&e^{i\zeta}\cos\theta\end{pmatrix}.$ (46)

Following this with a second $\mathrm{fSim}$ gate gives

$\displaystyle\mbox{\small$\mathrm{fSim}$}(X\otimes
X)\mbox{\small$\mathrm{fSim}$}(X\otimes X)$
$\displaystyle=e^{-i2\gamma}\begin{pmatrix}e^{-i\phi}&0&0&0\\\
0&\tilde{u}_{11}&\tilde{u}_{12}&0\\\ 0&\tilde{u}_{21}&\tilde{u}_{22}&0\\\
0&0&0&e^{-i\phi}\end{pmatrix}$ (47) $\displaystyle UXUX$
$\displaystyle=\tilde{U}=\begin{pmatrix}\tilde{u}_{11}&\tilde{u}_{12}\\\
\tilde{u}_{21}&\tilde{u}_{22}\end{pmatrix}=\begin{pmatrix}u_{11}u_{22}+u_{12}^{2}&u_{11}(u_{21}+u_{12})\\\
u_{22}(u_{21}+u_{12})&u_{11}u_{22}+u_{21}^{2}\end{pmatrix}.$ (48)

Here the common phase $\gamma$ has been eliminated (only appearing as a global
phase), and the controlled phase $\phi$ is a relative phase between the even-
and odd-parity subspaces. For the case of something close to a CZ gate (small
swap angle $\theta$ and small differential phase $\zeta$), the single-
excitation unitary simplifies to

$\displaystyle U$ $\displaystyle=I-i(\theta\cos\chi X-\theta\sin\chi Y+\zeta
Z)+\mathcal{O}(\zeta^{2})+\mathcal{O}(\theta^{2})$ (49) $\displaystyle XUX$
$\displaystyle=I-i(\theta\cos\chi X+\theta\sin\chi Y-\zeta
Z)+\mathcal{O}(\zeta^{2})+\mathcal{O}(\theta^{2})$ (50) $\displaystyle UXUX$
$\displaystyle=I-i2\theta\cos\chi
X+\mathcal{O}(\zeta^{2})+\mathcal{O}(\theta^{2})+\mathcal{O}(\zeta\theta)\,.$
(51)

As such, the effects of the differential phase $\zeta$, to first order, are
also removed by this echoing.

##  Appendix G Swap errors without phase matching

When running CAFE with characterized unitaries in the experiments performed in
this work, we do not attempt to correct the swap errors. This is for two
reasons. First, the swap errors are the smallest errors in the system, and
tend to be overshadowed by the other sources of error. Second, in our system,
the relative phases accumulated between qubits sitting at different idle
frequencies are accounted for by changing the microwave phases. This is
possible because the two-qubit gate we are using, the CZ gate, ideally
commutes with such differential phases. The effect of not “phase matching”
(that is, removing this differential phase by shifting qubit frequencies) on
swap errors is that the swap phase $\chi$ is shifted from cycle to cycle,
preventing the swaps from coherently adding and further diminishing their
effect relative to the other error sources. Should one be concerned with
relatively large swap angles $\theta$, one could incorporate the application-
dependent value of $\chi$ in the determination of the circuit to map the
predicted state back to $|00\rangle$.

##  Appendix H Additional $\mathrm{CZ}$ Data

For completeness, we present in Fig. 12 the entire error budget results from
the parallel $\mathrm{CZ}$ CAFE dataset acquired on a Sycamore processor. This
data illustrates that CAFE can be straightforwardly deployed on large-scale
quantum processors to characterize the fidelity of quantum operations in
parallel, while budgeting the incoherent and coherent error contributions. For
reference, we also present an error budgeting of the same $\mathrm{CZ}$ gates
obtained from XEB. Note that in this latter case, the coherent error
contribution is obtained by subtracting the incoherent speckle purity error
from the total XEB error, which gives an unphysical negative
${\epsilon_{\mathrm{incoh}}}$ value for 33 out of the 103 gates. In our tests,
this problem did not arise for CAFE.

Figure 12:  Error budgets of parallel $\mathrm{CZ}$ gates on a Sycamore
processor. Data in blue is obtained from the CAFE experiment using the
procedure detailed in the main text, where 3 samples of this data are shown in
Fig. 3. For reference, we present similar gate error budget information as
obtained from standard XEB in gray, where the incoherent error is extracted
from the speckle purity and the coherent error is obtained from the difference
with the total gate error. Data shows 103 different two-qubit gates.