# Experimental Bayesian estimation of quantum state preparation, measurement,
and gate errors in multi-qubit devices

Haggai Landa<EMAIL_ADDRESS>Dekel Meirom  IBM Quantum, IBM Research –
Haifa, Haifa University Campus, Mount Carmel, Haifa 31905, Israel  Naoki
Kanazawa  IBM Quantum, IBM Research – Tokyo, 19-21 Nihonbashi Hakozaki-cho,
Chuo-ku, Tokyo, 103-8510, Japan  Mattias Fitzpatrick  Christopher J. Wood  IBM
Quantum, T.J. Watson Research Center, Yorktown Heights, NY 10598, USA

###### Abstract

We introduce a Bayesian method for the estimation of single qubit errors in
quantum devices, and use it to characterize these errors on three
superconducting 27-qubit devices. We self-consistently estimate up to seven
parameters of each qubit’s state preparation, readout, and gate errors,
analyze the stability of these errors as a function of time, and demonstrate
easily implemented approaches for mitigating different errors before a quantum
computation experiment. On the investigated devices we find non-negligible
qubit reset errors that cannot be parametrized as a diagonal mixed state, but
manifest as a coherent phase in a superposition with a small contribution from
the qubit’s excited state. We are able to mitigate such errors by applying
pre-rotations on the initialized qubits, which we demonstrate with multi-qubit
entangled states. Our results show that Bayesian estimation can resolve small
parameters – including those pertaining to quantum gate errors – with a high
relative accuracy, at a lower measurement cost as compared with standard
characterization approaches.

##  I Introduction

Quantum computers experience a variety of errors that limit the ability of
near-term quantum devices to perform arbitrary computations in the absence of
fault-tolerant quantum error correction. Characterizing the performance of
these devices is a challenge of significant importance for their use with
near-term applications corcoles2020challanges . Recently a variety of error
mitigation techniques have been proposed to reduce the effects of errors in
current devices, with the goal of achieving useful quantum computation on
noisy near-term quantum computers kandala2019error ; sun2021mitigating . Many
of these techniques focus on mitigating measurement errors through classical
post-processing of measurement data based on an accurately characterized model
of errors in measurement chen2019detector ; bravyi2021mitigating ;
Maciejewski2020mitigation ; barron2020measurement ; Geller_2021 . However,
characterization of measurement (readout) errors in isolation of preparation
or gate errors in particular can be challenging. Other approaches aim to
mitigate specific kinds of gate errors by applying post-processing of data
from additional modified experiments to average or extrapolate away the effect
of errors temme2017error ; endo2018practical ; giurgica2020digital ;
berg2020model , where typically errors must be characterized to confirm they
are a good match to the model.

Different errors require a variety of techniques to characterize and mitigate
and it is often useful to classify them into distinct types of preparation,
measurement, and gate errors. In the circuit model a typical quantum
experiment consists of (i) Preparation (reset) to initialize specific qubits
in a fixed fiducial state,(ii) applying unitary gates to evolve the state, and
(iii) measurement of qubits in a fixed basis to extract state probabilities.
Errors in steps (i) and (iii) – so called state preparation and measurement
(SPAM) errors – are typically treated separately from the gate errors
(although the distinction could depend on the context).

For gate errors one widely used technique is quantum process tomography (QPT),
which aims to estimate the process matrix of a noisy gate from accessible
measurements of a set of known input states chuang1997prescription ;
fiuravsek2001maximum ; shabani2011efficient ; flammia2012quantum . This
technique is however susceptible to SPAM errors which are difficult to
distinguish from the gate errors it aims to characterize. Gateset tomography
(GST) is a generalization that simultaneously and self-consistently
characterizes the performance of preparation, measurement, and gates of a
small generating gateset merkel2013self ; blume2013robust ;
blume2017demonstration . Other commonly used methods for estimating average
gate errors in gatesets are randomized benchmarking (RB) and many related
randomized protocols kimmel2014robust ; johnson2015demonstration ;
proctor2019direct ; erhard2019characterizing ; harper2020efficient . These
decouple the effect of SPAM errors by fitting decay parameters to an
exponential noise model as a function of sequence lengths and are used
extensively in current experiments mccormick2017experimental ; keith2018joint
; ferrie2014self ; chapman2016experimental ; granade2017practical ;
knee2018quantum . Another approach is based on constructing experiment
protocols that amplify and isolate certain parameters in the results, while
making the signal independent of the values of other (unknown) parameters, in
particular SPAM errors. Such sequences are often referred to as error
amplification sheldon2016characterizing , and are in common use.

Works that employ Bayesian estimation techniques in the context of quantum
parameter estimation have been proposed for quantum state tomography (QST)
blume2010optimal , Hamiltonian learning wang2017experimental ;
evans2019scalable ; Bairey_2019 , and randomized benchmarking
granade2015accelerated . Alternative QST methods include self-guided
tomography PhysRevLett.113.190404 ; PhysRevLett.117.040402 ;
PhysRevLett.126.100402 . Experimental estimates of Hamiltonian parameters in a
system of nitrogen vacancy in a diamond have been obtained
hincks2018hamiltonian  using Monte Carlo simulations and also involved what is
known as online Bayesian experiment design, where experiment steps are
modified online as data is processed.

In this work, we present a characterization of gate and SPAM errors using an
analytic Bayesian approach. We consider preparation errors as resulting from a
noisy process that prepares an initial density matrix different from the
intended pure state, and measurement errors as a positive operator-valued
measure (POVM) that differs from an ideal projective measurement of the
diagonal elements of a density matrix. We distinguish between four type of
SPAM errors; classical vs. quantum (coherent) preparation errors, and
classical vs. quantum measurement (readout) errors. We analyze both the
general case and special cases of classical preparation errors, quantum
preparation errors, and classical readout errors. Methods for the
characterization and mitigation of classical SPAM errors are extensively
researched and are relatively straightforward. In contrast, the estimation and
mitigation of quantum preparation errors is less developed, and constitutes
one of the main contributions of the current work.

We develop the theory in detail for single-qubit errors, focusing on errors
that have been observed in our experiments, while emphasizing that the
generalization of the approach to parametrize multi-qubit errors is formally
straightforward. Our method estimates the probability distribution of the
parameters of interest, given a prior distribution (that we take as uniform in
a relevant domain of the parameter space) and an assumed model. We take
advantage of closed-form relations between the probability of experimental
measurements and the parameters of the model to cope with the main downside of
Bayesian estimation: the computational burden. The advantage of the Bayesian
approach is that the full information in the experiment data is utilized to
self-consistently characterize all parameters simultaneously. The error
estimates then immediately follow and the covariances of the parameters are
accounted for. In addition, physical constraints are enforced _ab inito_ (into
the parameter priors), avoiding typical complications of fitting methods that
may give unphysical results. This allows for a reliable characterization of
even small parameters and fully exploits the information about all parameters
contained in the experiments – significantly reducing the required
experimental resources.

These techniques were applied to characterize single-qubit SPAM errors in the
27-qubit IBM Quantum devices _ibmq_paris_ , _ibmq_sydney_ , and _ibmq_toronto_
, accessible via the cloud using Qiskit Qiskit . An open-source code
repository quantum-bayesian-estimation-repo  implements our Bayesian
estimation approach and can be used to run similar estimation and research
experiments. We observe that SPAM errors are mostly uncorrelated between
qubits in the devices studied. Hence, the characterization can be done
independently (and in parallel) for all qubits of a device, or in two
disconnected groups of qubits, a common practice. Quantum (coherent)
preparation errors are found to be stable in time, suggesting that these
coherent errors can be corrected a-priori.

There are two possible ways for such a correction – either the state
preparation can be recalibrated to account for and reduce such errors, or the
characterization data from one experiment can be used to perform a pre-
rotation of each qubit at the beginning of a subsequent experiment. The
calibration of the state preparation is beyond the scope of the current work
and is beyond the capabilities of most cloud-based users so we focus on the
second possibility of rotating the qubits before an experiment, demonstrating
its usefulness by mitigating expectation values after creating (noisy) multi-
qubit Greenberger–Horne–Zeilinger (GHZ) entangled states of up to 7 qubits. In
addition, we estimate small gate errors and study the precision with which the
Bayesian approach can be used to estimate and correct those, consistently
finding a significant reduction in the required experiment measurements for
the same level of precision as compared with standard characterization and
error amplification techniques.

##  II Bayesian Estimation

###  II.1 POVM measurement errors

For a single qubit it is convenient to write the qubit’s density matrix $\rho$
using the Bloch representation,

$\rho=\frac{1}{2}\left(\mathds{1}+\vec{r}\cdot\vec{\sigma}\right)\equiv\frac{1}{2}\sum_{\mu}r_{\mu}\sigma^{\mu},\quad\mu\in\\{x,y,z,0\\},$
(1)

where we have defined

$r_{0}\equiv 1,\qquad\sigma^{0}\equiv\mathds{1},$ (2)

where $\mathds{1}$ is the identity matrix and $\sigma^{a}$ with
$a\in\\{x,y,z\\}$ are the Pauli matrices. The vector of coefficients $\vec{r}$
is the Bloch vector representing the qubit’s state within the Bloch sphere
($|\vec{r}|\leq 1$), since

$\langle\sigma^{a}\rangle={\rm tr}\\{\rho\sigma^{a}\\}=r_{a}.$ (3)

We consider a measurement process in the computational basis (the basis of
eigenstates of $\sigma^{z}$). A general two-outcome measurement can be modeled
using a positive operator valued measure (POVM) $\mathcal{E}$,

$\mathcal{E}=\\{\Pi,\mathds{1}-\Pi\\},\text{where}\qquad\Pi\geq
0,\qquad\mathds{1}-\Pi\geq 0.$ (4)

The POVM element corresponding to the result 0 is expanded using four
parameters $\pi_{\mu}$ as

$\Pi=\sum_{\mu}\pi_{\mu}\sigma^{\mu},\qquad\mu\in\\{x,y,z,0\\}$ (5)

with some constraints on the parameters that are discussed below. For the
ideal measurement, $\Pi=|0\rangle\langle
0|=\frac{1}{2}\left(\mathds{1}+\sigma^{z}\right)$ is a projector on the state
$|0\rangle$, with $\pi_{0}=\pi_{z}=1/2$, and $\mathds{1}-\Pi$ is the projector
on $|1\rangle$. The probability of measuring the result 0 (that corresponds to
the POVM element $\Pi$), given the state $\rho$ is found using Eq. (5) and Eq.
(1) where,

$p\equiv p(0|\rho)={\rm
tr}\left\\{\rho\Pi\right\\}=\sum_{\mu}r_{\mu}\pi_{\mu}.$ (6)

The single-qubit POVM parameters $\pi_{\mu}$ defined in Eq. (5) generalize the
classical measurement error parameters that can be defined as the conditional
probabilities

$\epsilon_{0}=p\left(1\,|\,\rho=|0\rangle\langle
0|\,\right)=1-\left(\pi_{0}+\pi_{z}\right),$ (7)
$\epsilon_{1}=p\left(0\,|\,\rho=|1\rangle\langle
1|\rangle\,\right)=\pi_{0}-\pi_{z}.$ (8)

Here $\epsilon_{0}$ is the probability of measuring 1 when the qubit is in the
state $|0\rangle$, and $\epsilon_{1}$ is the probability of measuring 0 when
the qubit is in the state $|1\rangle$. We refer to these readout errors as the
classical ones, since they correspond to classical bit flip errors.

The nonclassical measurement errors are given by the coefficients $\pi_{x}$
and $\pi_{y}$, which can be understood by considering the following
conditional probabilities in the qubit’s $x-y$ plane:

$p\left(0\,|\,\rho=|+\rangle\langle+|\,\right)=\pi_{0}+\pi_{x},$ (9)
$p\left(0\,|\,\rho=\left|i\right\rangle\langle i|\,\right)=\pi_{0}+\pi_{y},$
(10)

with $|+\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$ and
$|i\rangle=(|0\rangle+i|1\rangle)/\sqrt{2}$. The probabilities in Eqs.
(9)-(10) correspond to measuring 0 when the qubit is aligned with the positive
$x$ and $y$ axes, respectively. If the measurement process can be described
using only the errors of Eqs. (7)-(8), a qubit in the state $|+\rangle$ would
collapse to either $|0\rangle$ or $|1\rangle$ with equal probability during
the measurement, and the measurement error would be the arithmetic mean of the
two errors, i.e., $\pi_{0}$. Thus, nonzero values for $\pi_{x}$ and $\pi_{y}$
represent nonclassical errors, sensitive to the qubit state being a
superposition with a coherent phase, rather than a mixed state.

In App. A we write the constraints on the POVM elements that stem from the
positivity conditions in Eq. (4) in terms of the parameters, and we further
discuss characterization of POVM errors in the case when both the
initialization and the gate errors can be neglected, a scenario that lends
itself to a straightforward analytic estimation. However, when there are
initialization errors or gate errors in addition to measurement errors, the
relations used in App. A cannot be used.

###  II.2 SPAM errors

Equation (6) contains seven independent parameters that describe the qubit
state and the measurement POVM. When $\vec{r}$ is the initial state, these are
the SPAM error parameters within this framework, and we introduce the notation

$\vec{r}(t=0)\equiv\\{x_{0},y_{0},z_{0}\\},$ (11)

parametrizing the initial Bloch vector. The ideal initial state is
$|0\rangle$, for which $z_{0}=1$. In many cases, the only initialization error
that is considered corresponds to a classical probability of the qubit being
in the $|1\rangle$ state. Then $\rho$ takes the form of a mixed diagonal
state, with only $z_{0}$ being nonzero, and smaller than 1. With the $x_{0}$
and $y_{0}$ components, also a coherent (quantum) initialization error
expressing an initial superposition of the qubit basis states (i.e., a rotated
Bloch vector) can be modeled. As discussed further in Sec. II.3, gate errors
can also be accounted for within the Bayesian approach [with Eq. (6)
generalized accordingly]. However, since in the current experiments these are
found to be mostly relatively small (on the order of the estimation error
bars, as argued in more detail and shown in Sec. III), we neglect gate errors
at first, focusing in the current subsection on SPAM errors using an
experiment consisting of six different gates followed by measurement,
specifically

$\left\\{\mathds{1},X,X_{-90},X_{90},Y_{90},Y_{-90}\right\\},$ (12)

where $X=\sigma^{x}$, and $X_{\theta}$ ($Y_{\theta}$) correspond to a rotation
of angle $\theta$ about the $x$ ($y$) axis.

The probabilities for measuring 0 in each of the six experiments using the
gates in Eq. (12) are given, respectively, by

$f_{\pm z}=\pi_{0}+\pi_{x}x_{0}\pm\pi_{y}y_{0}\pm\pi_{z}z_{0},$ (13) $f_{\pm
y}=\pi_{0}\pm\pi_{y}z_{0}+\pi_{x}x_{0}\mp\pi_{z}y_{0},$ (14) $f_{\pm
x}=\pi_{0}\pm\pi_{x}z_{0}\mp\pi_{z}x_{0}+\pi_{y}y_{0}.$ (15)

There are six independent relations in Eqs. (13)-(15), and hence up to six
parameters can be uniquely estimated. This is a known problem of SPAM error
characterization (the parameters are sometimes said to be “confounded”). We
are not aware of a solution that the Bayesian method can offer specifically to
this issue, and if all seven parameters have to be estimated together, further
information beyond the gates considered above must be considered.

Considering the physics of the qubit initialization and readout, the main
question is whether there are quantum readout errors (whence $\pi_{x}$ and
$\pi_{y}$ cannot be neglected), and whether there are quantum initialization
errors ($x_{0}$ and $y_{0}$ cannot be neglected). One can consider the current
study as starting with an ansatz that retains the parameters $x_{0}$ and
$y_{0}$ in the analysis, while $\pi_{x}$ and $\pi_{y}$ are neglected (set to
0). The results of Sec. III.2 then constitute a justification of this
assumption a posteriori, since the active mitigation of $x_{0}$ and $y_{0}$ by
a pre-rotation of each qubit works systematically. An analysis of the
unconditional reset scheme implemented on IBM Quantum devices strengthens this
conclusion and motivates the physical mechanism behind it. The essence of the
unconditional reset pulse PhysRevApplied.10.044030  is a pumping of the qubit
amplitude from the state $|1\rangle$ to a higher state (call it $|2\rangle$),
followed by a resonant pulse inducing a transition from the state $|2\rangle$
to $|0\rangle$ accompanied by a creation of a photon in the coupled readout
resonator, which then rapidly decays. This coupling is the leading order
effective interaction induced by the reset driving, and is derived by
adiabatically eliminating the off-resonant level $|1\rangle$. When the ramping
up and down of the reset pulse is not adiabatic enough, a residual (coherent)
population transfer into the $|1\rangle$ state is possible.

###  II.3 Parametrization of gate errors

In addition to SPAM errors, the Bayesian framework described here can
naturally incorporate gate errors, especially those which can be modeled
analytically in closed form. As a simplified model for gate errors, we
consider one incoherent error parameter, and one coherent gate error. Typical
qubit coherent errors include an amplitude error (of the driving pulse), a
frequency error (in the estimated qubit frequency that determines the drive
frequency), and angle error between $X$ and $Y$ rotations for the single qubit
gate model. On the IBM Quantum devices, the angle offset of the $X$ rotation
axis from the $Y$ axis is considered to be negligibly smaller as compared with
other errors since those devices provide single-qubit basis gates consisting
of $Z$ rotation and $X_{90}$ gates. Namely, the $Y$ rotation gate can be
composed of virtual-$Z$ gate mckay2017efficient  with exactly $\pi/2$ phase
offset. Frequency errors are also typically well suppressed with the single-
junction transmon qubits utilized in the IBM Quantum devices
burnett2019decoherence .

Therefore, to account for coherent rotation errors, we assume that the $X_{\pm
90},Y_{\pm 90}$ gates perform a rotation of the Bloch vector with one angle
parametrizing deviations from an ideal gate. The rotation error angle $\theta$
is identical for all gates with just the axis of rotation and direction
redefined for each gate. An extension of the model to arbitrary rotation
errors is considered briefly in App. B.

Repeated application of gates is necessary to amplify small gate errors (as is
typically the situation). The result of repeated application of one of these
gates $j$ times is calculated by taking the corresponding power of the
rotation matrix and applying it to the initial state, meaning that

$(X_{\pm 90})^{j}=\left(\begin{array}[]{ccc}1&0&0\\\ 0&\cos
j(\frac{\pi}{2}+\theta)&\mp\sin j(\frac{\pi}{2}+\theta)\\\ 0&\pm\sin
j(\frac{\pi}{2}+\theta)&\cos j(\frac{\pi}{2}+\theta)\end{array}\right),$ (16)

and

$(Y_{\pm 90})^{j}=\left(\begin{array}[]{ccc}\cos
j(\frac{\pi}{2}+\theta)&0&\pm\sin j(\frac{\pi}{2}+\theta)\\\ 0&1&0\\\ \mp\sin
j(\frac{\pi}{2}+\theta)&0&\cos j(\frac{\pi}{2}+\theta)\end{array}\right).$
(17)

We note that the matrix power has to be computed analytically in order to
allow the analytic calculation of the probabilities [App. B lists a few
explicit calculations based on Eqs. (16)-(17)].

A uniform depolarizing error parameter $\varepsilon$ that acts on the density
matrix during the operation of a gate repeated $j$ times can be modeled by the
replacement

$\rho\to(1-\varepsilon)^{j}\rho+[1-(1-\varepsilon)^{j}]\mathds{1},$ (18)

or, equivalently, $\vec{r}\to(1-\varepsilon)^{j}\vec{r}$. This single error
parameter constitutes an approximate averaging of energy relaxation and
dephasing errors (quantified using the characteristic times $T_{1}$ and
$T_{2}$ krantz2019quantum ), that act on different qubit components within the
Bloch sphere during the operation of the gate. With gate errors, the
probabilities in Eqs. (13)-(15) should not be used directly (as the gate
errors were neglected there), but rather the computation proceeds by applying
the gates to the initial state, and plugging the resulting Bloch vector into
Eq. (6) to obtain the final probabilities.

###  II.4 Bayesian estimation

In the experiment, we prepare a fixed state $\rho$ and measure it for a total
of $n$ shots. This process constitutes a sampling of a random variable, with
the number of shots $s_{0}$ where the result $0$ is drawn from a binomial
distribution with the parameter $p\equiv p(0|\rho)$ of Eq. (6) is given by

$s_{0}\sim\mathcal{B}(n,p),\quad p(s_{0}=k)=\left(\begin{subarray}{c}n\\\
k\end{subarray}\right)p^{k}(1-p)^{n-k}.$ (19)

We can estimate $p$ using the maximum likelihood estimator,

$\hat{p}=s_{0}/n.$ (20)

From the experimental estimates of the six probabilities ($f_{\pm\mu}$), we
cannot directly derive the distribution of the nonlinearly-dependent
parameters of interest and therefore resort to a Bayesian approach. In the
following we denote the set of the unknown parameters by

$\lambda=\\{\lambda^{0},...,\lambda^{\alpha},...\\}.$ (21)

In this notation, $\lambda$ is a vector, $\lambda^{\alpha}$ is the $\alpha$’th
component of this vector, while $\lambda_{i}$ and $\lambda_{j}$ will be used
to denote two different vectors.

We define $p_{e}(\lambda)$ as the distribution of interest for the vector of
parameters $\lambda$ given the set of observed measurements $\\{m\\}_{e}$

$p_{e}(\lambda)\equiv
p(\lambda|\\{m\\}_{e})=\frac{\tilde{p}_{e}(\lambda)}{\int\tilde{p}_{e}(\lambda)d\lambda},$
(22)

where $p_{e}$ is normalized by integration of $\tilde{p}_{e}(\lambda)$ – the
unnormalized posterior density which is given by the Bayes theorem:

$\tilde{p}_{e}(\lambda)=p(\\{m\\}_{e}|\lambda)p_{0}(\lambda).$ (23)

Here, $p(\\{m\\}_{e}|\lambda)$ is the likelihood of the observed experiment
(the probability of observing $\\{m\\}_{e}$ given $\lambda$), and
$p_{0}(\lambda)$ is the prior distribution for the parameters, which we take
as a uniform distribution over a bounded domain,

$p_{0}(\lambda)=V^{-1},$ (24)

where $V=\int_{\Lambda}d\lambda$ is the volume of the domain.

We now show how to calculate $p_{e}(\lambda)$, which is the output of the
Bayesian estimation. This can be achieved by calculating
$\tilde{p}_{e}(\lambda)$ and integrating it (numerically), and then
substituting in Eq. (22). The likelihood of an experiment consisting of
$n_{s}$ sequences, each repeated $n$ times (shots), is given by the binomial
distribution

$p(\\{m\\}_{e}|\lambda)\propto\prod_{k}^{n_{s}}(p_{k})^{s_{k}}(1-p_{k})^{n-s_{k}},$
(25)

where $p_{k}$ is the model-predicted probability (given the parameters) and
$s_{k}$ the count of successes, and the binomial coefficients (which do not
depend on the parameters), have been omitted. The likelihood
$p(\\{m\\}_{e}|\lambda)$ can be calculated from the log-likelihood defined by

$L\equiv\ln p(\\{m\\}_{e}|\lambda),$ (26)

which reads explicitly

$L=\sum_{k}\left[s_{k}\ln p_{k}+({n-s_{k}})\ln(1-p_{k})\right]+C,$ (27)

where $C$ is an unimportant additive term that can be dropped. Exponentiating
$L$ to get $p(\\{m\\}_{e}|\lambda)$ and plugging it in Eq. (23) allows one to
get the unnormalized posterior distribution $\tilde{p}_{e}(\lambda)$.

A Monte Carlo estimate of the integral of an arbitrary function $f(\lambda)$
over the domain $\Lambda$,

$F=\int_{\Lambda}f(\lambda)d\lambda,$ (28)

can be approximated using $n$ sample points $\lambda_{i}$ drawn according to a
uniform distribution over $\Lambda$, by

$\hat{F}=\frac{1}{n}\sum_{i}\frac{f(\lambda_{i})}{V^{-1}}.$ (29)

With this formula we can integrate $\tilde{p}_{e}(\lambda)$ numerically and
get $p_{e}(\lambda)$, the posterior distribution on a sample of points in the
parameter space. The numerical challenge of the Bayesian method lies here – it
is necessary to sample the parameter space with enough resolution to resolve
the features of the posterior density, which could be concentrated in a small
parameter region, or in some cases can even be multi-modal. We discuss this
point again in the following sections.

Integrating over $\lambda$ using the distribution in Eq. (22) gives a mean
estimator,

$\hat{\lambda}=\int\lambda p_{e}(\lambda)d\lambda,$ (30)

which is by construction the expected value of the model parameters given the
experiment results. A similar integration over bilinear combination in
$\lambda$ gives the covariance matrix indicating error estimates, given by its
entries,

${\rm
Cov}(\hat{\lambda})=\int(\lambda^{\alpha}-\hat{\lambda}^{\alpha})(\lambda^{\beta}-\hat{\lambda}^{\beta})p_{e}(\lambda)d\lambda.$
(31)

The diagonal elements of the covariance matrix are the variances of each
parameter, and the off-diagonal matrix elements express the correlations. In
the current work we find it sufficient to study the variances, which already
manifest the dependence of each parameter’s uncertainty on the other
parameters. The covariances and higher moments can be studied in a similar
way.

##  III Results from experimental Bayesian estimation

###  III.1 SPAM error results

In this subsection we present results from the self-consistent estimation of
the five SPAM parameters

$\\{x_{0},y_{0},z_{0},\pi_{0},\pi_{z}\\}.$ (32)

Hence, as already discussed above, the following results are based on
neglecting gate errors of different types. With this assumption, the
probabilities of measuring 0 in each of the six measurements corresponding to
the gates in Eq. (12), are respectively given by

$f_{\pm z}=\pi_{0}\pm\pi_{z}z_{0},\,\,\,f_{\pm
y}=\pi_{0}\mp\pi_{z}y_{0},\,\,\,f_{\pm x}=\pi_{0}\mp\pi_{z}x_{0},$ (33)

which are obtained from Eqs. (13)-(15) by setting $\pi_{x}=\pi_{y}=0$.
Choosing any five of the values in Eqs. (33) is sufficient for an estimation
of the five SPAM parameters but we use all six probabilities for the
estimations presented in Figs. 1-6 of the current and next subsection. Each of
the six experiments was measured for 16384 shots. Between $5\times 10^{6}$ and
$80\times 10^{6}$ points in the parameter space have been sampled for the
Bayesian estimation (as described in Sec. II.4), which results in a very
precise sampling in the current experiments, and is highly efficient with the
analytic expressions being used.

Figure 1: Two components of the quantum state preparation (initialization)
errors; (a) $x_{0}$ and (b) $y_{0}$, as measured using three parallelization
modes in one single job on the IBM Quantum device _ibmq_paris_ , accessed via
the cloud. The estimation method was Bayesian as described in the text (and in
Sec. II.4 in detail), with five state preparation and measurement parameters
[Eq. (32)] estimated self-consistently. As indicated in the legend, the
parameters are estimated either for all qubits in parallel, in two parallel
experiments of physically disconnected qubits, or completely sequentially
(where only one qubit is being operated on during a given experiment). The
data is consistent with no clear correlations in the measurement results
between the qubits. The error bars are calculated within the Bayesian approach
as in Eq. (31). Qubit 5 was removed from the analysis because of excessive
errors (possibly due to interaction with a transient two-level system in the
environment). Figure 2: (a) The initial state component $z_{0}$ and (b) one
POVM parameter corresponding to classical measurement errors, $\pi_{z}$, as
estimated in the same experiment of Fig. 1. For an ideal readout without
errors, $\pi_{z}=0.5$. Here $\pi_{z}<0.5$ for all qubits, which indicates that
measuring 0 when the qubit is in $|1\rangle$ is slightly more probable than
the reverse error, consistent with $T_{1}$ decay events during measurement.
See the text for a discussion of the correlation in the error bars seen for
some of the qubits, between the classical state preparation and readout error
parameters.

Starting with an experiment quantifying the correlations between different
qubits, we present the results of one job (a large experiment run contiguously
on the device) composed of three different sub-experiments on the IBM Quantum
device _ibmq_paris_ 111The experiment was run on the device _ibmq_paris_ on
05/07/2021, with backend version 1.7.16. Backends are listed in
https://quantum-computing.ibm.com/. Figures 1-2 present $x_{0},y_{0}$ and
$z_{0},\pi_{z}$, where the three characterization modes were: (i) all qubits
in parallel, (ii) the qubits divided into two groups of disconnected qubits,
with the qubits in each group measured in parallel (but sequentially with the
other group), and (iii) all qubits measured sequentially. The near-coincidence
(within error bars) of the three types of experiments for almost all
parameters and qubits indicates that to a large extent these parameters are
uncorrelated. It is beyond the scope of the current work to quantitatively
study small residual correlations that may nevertheless be present.

Figure 3: (a) The transverse [$\rho_{0}$ of Eq. (34)] and (b) the initial
longitudinal ($z_{0}$) components of each qubit in the 27-qubit IBM Quantum
device _ibmq_paris_ , accessed via the cloud. Seven identical experiments were
run at different times within a window of 8 hours. The plot depicts with
horizontal bars the minimal, mean and maximal values estimated for each qubit,
while the “violin” shape indicates the averaged probability shape (being
narrow near less frequently observed values). Typical quantum initialization
errors ($\rho_{0}\sim 0.05$) are larger than the classical errors (given by
$1-z_{0}\sim 0.01$), and the initialization errors are mostly relatively
stable for time scales of hours. Qubit 5 was removed from the analysis because
of excessive measurement errors.

We emphasize an important useful characteristic of Bayesian estimation that
manifests itself in the presented figures, where the error bars already
account for both the statistical uncertainty and the effect of the self-
consistently estimated readout errors. Indeed in Fig. 2 the correlation
between $z_{0}$ and $\pi_{z}$ can be clearly seen for a few qubits, where
larger deviations of $z_{0}$ from the ideal value of $1$, lead to larger
estimation errors of both of these initialization and readout parameters, and
such correlations between various parameters can be systematically analyzed
with the current approach. The constraint $\pi_{0}+\pi_{z}\leq 1$ (expressing
that the probability of measuring any result is bounded by 1) is enforced on
the domain of the parameter distribution, and correspondingly $\pi_{0}$ (not
shown) takes values slightly larger than 0.5 for all qubits. It should be
noted that qubit 5 had noticeably worse measurement parameters
($\pi_{z},\pi_{0}$) possibly due to an interaction with two-level systems
(TLSs) and we have therefore avoided plotting the corresponding estimated
parameters.

As can be seen in Fig. 1, the quantum state preparation error appears to take
different orientations in $x-y$ plane for each qubit. A natural question that
arises is whether this coherent initialization error fluctuates or drifts
between experiments, and on what timescales it can be considered stable.
Figure 3 presents a characterization of the qubits of the IBM Quantum device
_ibmq_paris_ 222The experiments were run on the device _ibmq_paris_ on
04/28/2021, with backend version 1.7.15., as measured in seven identical
experiments conducted over the course of eight hours (the duration of each
experiment was approximately 1 minute). The figure presents estimates of the
initial longitudinal ($z_{0}$) and transverse ($\rho_{0}$) components of each
qubit, where the polar Bloch vector parametrization takes the obvious
definition using the $xy$-plane angle $\varphi_{0}$,

$x_{0}\equiv\rho_{0}\cos\varphi_{0},\qquad
y_{0}\equiv\rho_{0}\sin\varphi_{0}.$ (34)

The data in Fig. 3 clearly shows that the typical quantum initialization
errors ($\rho_{0}\sim 0.05$) are larger than the classical errors (given by
$1-z_{0}\sim 0.01$). Moreover – with a few exceptions, the initialization
errors are relatively stable on the time scale of hours, which can be seen
also for the qubits’ plane polar angles ($\varphi_{0}$) in the curved of Fig.
4. We study the consequences of this observation in the following subsection.
In Sec. III.3 we also study gate error parameters, finding that their
contribution is typically (in the studied devices) of the order of the error
bars in the estimation of the SPAM parameters (or less), which justifies _a-
posteriori_ their neglect in the above treatment.

###  III.2 SPAM mitigation results

The observed stability of the quantum initialization data suggests that the
characterization of these coherent errors can be corrected a-priori. There are
two possible ways for such a correction – either the state preparation can be
calibrated to account for and reduce such errors, or the characterization data
can be used to perform a pre-rotation of each qubit at the beginning of a
subsequent experiment. The calibration of the state preparation is beyond the
scope of the current work because not all users of a quantum device have the
capability of doing calibrations when using a device via cloud access. We
therefore focus here on the second possibility of rotating the qubits. In Sec.
IV we briefly discuss mitigation when the error parameters fluctuate on a
timescale that does not allow to separately characterize and then rotate the
qubits. In such a scenario, when the errors are still coherent over the
duration of one experiment, they can be characterized in parallel with the
execution of each particular experiment, and then mitigated a-posteriori by
post-processing the experiment results together with the characterization
data. We will not follow this approach in the current work.

Figure 4: (a) The plane polar angle ($\varphi_{0}$), and (b) the initial
transverse component ($\rho_{0}$), both defined in Eq. (34), of the first four
qubits (chosen arbitrarily), plotted vs. time for the same experiments as in
Fig. 3. Seven identical experiments were run at different times within a
window of 8 hours. The initialization errors can be seen to be relatively
stable for time scales of hours. Figure 5: Two components of the quantum state
preparation errors, (a) $x_{0}$ and (b) $y_{0}$, for each qubit in the
27-qubit IBM Quantum device _ibmq_toronto_ , in an experiment of estimation
and mitigation run in two steps. The first estimation starting (arbitrarily)
at $t=0$, was used to calculate the parameters needed for mitigation of the
state preparation errors. The second experiment included two estimations of
$x_{0}$ and $y_{0}$ parameters, with and without their mitigation by rotation
gates. As can be seen, the mitigation reduced the initialization error in the
device. Here, qubit 18 was removed from the analysis because of excessive
errors. See the text for a detailed description of the protocol employed.
Figure 6: Comparison of expectation values obtained using different possible
steps of mitigation, in an experiment performed on the 27-qubit IBM Quantum
device _ibmq_sydney_ , accessed via the cloud. In each experiment the
$N$-qubit cat state of Eq. (36) was prepared (with some inevitable noise), and
then the expectation value of the $N$-qubit operator $\otimes X^{N}$ was
measured, while $N$ was increased from step to step. Each expectation value
was calculated four times; without any mitigation, with pre-rotation of the
participating qubits in order to mitigate the estimated state preparation
errors, with mitigation of the readout errors using the estimated readout
error probabilities, and with both state preparation and readout mitigation.
The ideal expectation value is shown with a dashed line. These results show
that the estimated SPAM parameters of the device were accurate enough to
enable non-negligible improvements of the results via error mitigation.

Figure 5 shows the estimation of the quantum state preparation errors, $x_{0}$
and $y_{0}$, both before and following its mitigation, in an experiment run in
two steps 333The experiment was run on the device _ibmq_toronto_ on 01/31/2022
with backend version 1.6.9.. First, an estimation of the device parameters
given in Eq. (32) was performed. Using these parameters, the spherical
coordinates of the initial Bloch state vector of each qubit were calculated by
considering

$\theta_{0}=\tan^{-1}\left(\rho_{0},z_{0}\right),$ (35)

in addition to $\rho_{0}$ and $\varphi_{0}$ defined in Eq. (34). In the second
step of the experiment, the mitigation of the initial $xy$-plane component was
done using two consecutive rotation gates; An $R_{z}$ gate (a single-qubit
rotation about the z axis) with a rotation angle of $-\varphi_{0}$ was first
applied in order to align the initial state vector with the $x$ axis, and an
$R_{y}$ gate (a single-qubit rotation about the y axis) with a rotation angle
of $-\theta_{0}$ was applied in order to align the initial state vector with
the $z$ axis.

Together with the mitigation gates in the second step, we estimated the state
preparation errors of the device again, both with the additional rotation
gates and without them, in order to test the mitigation process. As can be
seen in Fig. 5, for almost all qubits the state preparation errors were
reduced significantly with the mitigation. By comparing the parameters of the
pre-estimation and the estimation without mitigation, drifts of these
parameters can be observed for few qubits. These drifts caused the mitigation
on those qubits to be less effective. One can also notice that the mitigation
of the $y_{0}$ parameter tends to be better. That is plausibly due to the
$R_{z}$ gate used to mitigate the $y_{0}$ error being a virtual gate without
any error, as opposed to the $R_{y}$ gate which mitigates the $x_{0}$ error
and entails an $X_{90}$ rotation basis gate. To avoid the introduction of
spurious noise, we avoid mitigating the $x_{0}$ error with qubits for which
$|x_{0}|<0.015$, which is the reason for some mitigation points missing in the
top panel of Fig. 5.

As a further independent demonstration of the utility of the mitigation of
SPAM errors,, Fig. 6 shows the results of a simple quantum computing
experiment 444The experiment was run on the device _ibmq_sydney_ on 08/05/2021
with backend version 1.0.68., wherein a circuit for generating a multi-qubit
entangled GHZ (cat) state with $N=1-7$ qubits was first executed. The circuit
produces the state

$|\psi\rangle\propto\left(|0\rangle^{N}+e^{i{\pi}/{4}}|1\rangle^{N}\right),$
(36)

(which in practice was created with some inevitable noise), and then the
expectation value of the global operator $X^{N}$ was measured 555The phase
factor was chosen to avoid the expectation value being 0 or 1, which are
nongeneric since they are at the boundary.. The parameters obtained in a
preceding estimation experiment were used in order to perform a pre-rotation
of the qubits as described above. In order to mitigate the readout errors, the
readout parameters presented in Eq. (32) were used to calculate $\epsilon_{0}$
and $\epsilon_{1}$ using Eqs. (7)-(8). A matrix of transition probabilities
was calculated for each qubit based on these results (while assuming that the
readout noise of each qubit is independent of the other qubits). With these
matrices, the mitigated readout results were estimated using least-squares
fitting. For simplicity, in the estimation of SPAM parameters we used here we
neglected the gate errors both in the estimation circuits and in the state
initialization mitigation (the rotation gates). These gate errors are smaller
than the SPAM errors for most qubits, but might cause over mitigation,
especially with a low number of qubits. Nevertheless, the experiment shows
that both state preparation and readout errors of a device can be estimated
and mitigated using the proposed methods.

###  III.3 Gate error results

Figure 7: (a) The gate depolarization error parameter [$\varepsilon$ of Eq.
(18)], and (b) gate rotation error parameter [$\theta$ of Eq. (16)], of each
qubit in the 27-qubit IBM Quantum device _ibmq_sydney_. As indicated in the
legend, two experiments are shown, with the first experiment starting
(arbitrarily) at $t=0$. For the second experiment, a small heuristic
correction to the gate pulse amplitude was applied based on the first
experiment’s estimated rotation error (see the text for more details). As can
be seen, this _ad hoc_ correction has significantly reduced the overrotation
error for most qubits. Here, the Bayesian estimation method described in the
text, with seven state preparation, measurement and gate error parameters were
self-consistently estimated using eight gate sequences [Eq. (37)]. Here,
qubits 3 and 18 were removed from the analysis because of excessive
measurement errors.

In order to estimate the two single-qubit gate error parameters together with
the SPAM errors, we repeatedly apply the $X_{90}$ gate. We use eight gate
measurements in order to self-consistently estimate the seven parameters in
Eqs.(32)-(16) and (18), with the gates in Eq. (12) extended to read

$\left\\{\mathds{1},X,X_{-90},X_{90},Y_{90},Y_{-90},(X_{90})^{32},(X_{90})^{33}\right\\}.$
(37)

As in Sec. III.1, each gate sequence was measured for 16384 shots in the
experiments described below, and $80\times 10^{6}$ points in the parameter
space have been sampled for the Bayesian estimation.

Figure 7 shows the results of such an estimation on the 27 qubits of the IBM
Quantum device _ibmq_sydney_ 666The experiment was run on the device
_ibmq_sydney_ on 05/20/2021 with backend version 1.0.47., as measured with two
experiments separated by approximately 14 minutes. The figure presents
estimates of $\varepsilon$ and $\theta$ for each qubit. Following the first
estimation (at the arbitrary time $t=0$), the estimated rotation errors are
then corrected by adjusting the gate pulse amplitude using the Qiskit Pulse
interface alexander2020qiskit , which allows us to control parameters of the
microwave pulses sent to the qubits. When the gate error is small, the
correction is expected to be linear, and the relation that has been used for
Fig. 7 reads

$A\to(1-\eta\frac{\theta}{\pi})A,\qquad\eta=1.33$ (38)

where $A$ is the amplitude of the $X_{90}$ microwave pulse envelope (which is
a square pulse with a Gaussian-shaped rise and fall on both sides), and we
have heuristically set the value of the proportionality coefficient $\eta$ to
1.33. As Fig. 7 shows, in this example, this heuristic correction has
significantly reduced the rotation error for most qubits, even though it was
applied almost a quarter of an hour after the estimation experiment.

In Fig. 8 we present data 777The experiment was run on the device
_ibmq_sydney_ on 05/24/2021 with backend version 1.0.47. comparing the
estimation of the two gate error parameters $\varepsilon$ and $\theta$ as
function of the number of repetitions of the $X_{90}$ gate in the set of gates
parametrized using the integer $n$ as

$\left\\{\mathds{1},X,X_{-90},X_{90},Y_{90},Y_{-90},(X_{90})^{4n},(X_{90})^{4n+1}\right\\}.$
(39)

The convergence and accuracy of the estimation depends on $n$ and the values
of the parameters themselves, and here $\theta$ values noticeably converge for
$n\gtrsim 6$, while there appears to be more variability in $\varepsilon$.
Comparing the $\theta$ data in Fig. 7 to Fig. 8, it can be seen that in the
former experiment $\theta\geq 0$ for all qubits, while in the latter, the
estimated $\theta$ values (for $n=8,10$, which are reliably converged) are
smaller in absolute values, and also can be seen to take both positive and
negative value. This could indicate a correlated fluctuation in the parameters
affecting the device during in the experiment of Fig. 7.

Figure 8: The two single-qubit gate error parameters of each qubit in the
27-qubit IBM Quantum device _ibmq_sydney_ , as a function of the powers that
the $X_{90}$ gate is taken to, with $n$ being the exponent in $(X_{90})^{4n}$
and $(X_{90})^{4n+1}$. It can be seen that for these parameters, the estimated
$\theta$ values typically converge for $n\gtrsim 6$, and the same holds for
$\varepsilon$, with a few exceptions.

As a further corroboration of the accuracy and relevance of the gate error
parameters that we estimate, we compare the Bayesian estimation results and
the well-established method for calibration and estimation of gate rotation
errors, commonly known as the ping-pong calibration sheldon2016characterizing
. In App. C we give more details of the experiment and fitting procedure that
we applied, and present an example of the resulting data and plots. Figure 9
shows (bottom panel) a comparison of the ping-pong estimates against the
Bayesian method for all qubits of the device 888The data was taken on the
device _ibmq_sydney_ on 06/28/2021, with backend version 1.0.53.. With just a
few exceptions, the estimated $\theta$ values for most qubits are equivalent
within the expected statistical fluctuations as described by the error bars.
In the top panel of the same figure, the values of $\varepsilon$ derived in
the Bayesian estimation are given for completeness. Beyond being an
independent validation of the gate error estimations using the Bayesian
approach, the above experiment provides a starting point for a comparison of
the use of quantum resources (experiment durations and number of shots)
between different approaches. While a more extensive such analysis is beyond
the scope of the current work, in Sec. IV we discuss in more detail some
initial conclusions that the above data suggests.

Finally, we comment on the question of the reliability of the $\varepsilon$
parameter estimations. The duration of the single qubit gates in those
experiments is approximately $35\,$ns. The $T_{1}$ (energy decay timescale)
and $T_{2}$ (decoherence timescale) values reported by the device for the
qubits (e.g., in the experiment of Fig. 7), are in the range of
$30-180\,\mu$s, with most being around $70-100\,\mu$s. Hence the shortening of
the Bloch vector corresponding to one gate execution, as parametrized by
$\varepsilon$, can be estimated to be of order 0.0005, with some qubits being
worse or better – matching well our experiment results. The averaging of the
action of $T_{1}$ and $T_{2}$ dynamics to an effective depolarizing error
during the gate could be considered as a zeroth order approximation, and
improving it would require a significant complication of the model. We note
that if the model is too different from the actual system, it can be expected
that the data just represents noise when being fit to the model, or the
parameters take values on the boundaries of the priors, and this would be
evident in the results. We did not observe such red flags (except for some
qubits that were badly performing), and in contrast, at least in some cases as
our results show, this approximation of a depolarizing error is still enough
in order to facilitate the method capturing the coherent overrotation error to
a useful degree.

Figure 9: Bottom: The ping-pong comparison experiment for all qubits of the
27-qubit IBM Quantum device _ibmq_sydney_. Top: The depolarization parameter
estimated using the Bayesian method in the same experiment, shown for
reference. For most qubits, despite a few notable exceptions, the estimation
of $\theta$ using the Bayesian approach is close (within statistical
fluctuations) to the estimation using an extended ping-pong method with
variation of the gate amplitude. This serves as an independent validation of
the Bayesian estimation parametrization and experiments.

##  IV Summary and outlook

Using a Bayesian parameter estimation approach with a single-qubit error model
we were able to identify key characteristics of different device preparation,
measurement and gate errors. The primary advantage of the approach is that it
allows one to simultaneously and self-consistently estimate many error
parameters, utilizing the full information available in a set of experimental
data. This advantage comes along with physical constraints being respected
a-priori, and together with accessible estimation errors and covariances.
Although we have not pursued this line of research, the available information
about the parameter correlations and interdependency can be valuable for
specific purposes.

Applying our approach to study qubit errors in the 27-qubit _ibmq_sydney_ ,
_ibmq_toronto_ , and _ibmq_paris_ devices we were able to identify non-
negligible state preparation errors of a quantum nature. These preparation
errors correspond to a small coherent rotation of the ideal initial state
following the initialization. As mentioned above, the physical origin of the
quantum state preparation errors is rooted in the unconditional reset method,
however, for our estimation procedure this fact is irrelevant and the
parametrization is agnostic of the underlying mechanism. With the observed
stability of this error and the high precision of its estimation, we have
demonstrated its mitigation in by adding a pre-rotation of each qubit,
compensating for its coherent reset error. Expectation values of a multi-qubit
operator were corrected by a significant fraction in the example that we
studied, showing the relevance of the characterized errors.

Augmenting the self-consistent SPAM error experiments with two more gate
sequences, we demonstrated a high precision estimation of single qubit gate
errors, parametrizing one incoherent error (a depolarizing channel), and one
coherent rotation error. Similar to the coherent quantum state preparation
errors, the gate rotation error lends itself to immediate mitigation (in an
experiment following its estimation), using the cloud based interface for
pulse control of qubit devices. These two approaches (qubit pre-rotation and
gate amplitude scaling) to correct the coherent quantum errors can be
considered as “online” mitigation which is a simplified (and straightforward)
form of calibration based on using the error estimates obtained in one
experiment in order to reduce the errors in the next experiment.

In addition, one can consider “offline” mitigation which is performed via
post-processing of measurement results. This approach is suitable when the
error parameters fluctuate on a timescale that does not allow separate
characterization and correction of errors before running a computation (or
when this is infeasible for other reasons). In such a scenario, when the
errors are still coherent over the duration of one experiment, they can be
characterized in parallel with the execution of each particular experiment,
and then mitigated a-posteriori by post-processing the results together with
the characterization data. Readout errors are the primary (and widely used)
example of this approach. Also, mitigation and state and process tomography
codes (e.g., those included in Qiskit Qiskit ), can be initialized with error
parameters such as the quantum errors observed in the current work. The source
code facilitating estimation experiments such as we have analyzed in this work
quantum-bayesian-estimation-repo  can be used together with Qiskit to extract
these parameters.

We conclude by commenting on the important aspect of the scalability and
resources utilized by the experiment. The Bayesian estimation experiments
presented in Sec. III.3 consisted of an application of the 8 gate sequences
(of different lengths, from single-gates and up to 33 gates) listed in Eq.
(37), from which 7 parameters that were estimated. In a characterization of
the gate rotation error parameter $\theta$ performed to compare to an extended
ping-pong method (as shown in Fig. 9, and in more detail in App. C), 80 gate
sequences (of varying lengths as well) were necessary for the estimation of
just this one parameter with approximately the same accuracy.

While a more complete exploration of gate calibrations and the required
resources using the Bayesian approach are beyond the scope of the current
work, this demonstrates the potential power of the Bayesian method in
estimating small parameters with a high precision, while significantly
reducing the number of measurements required on the quantum hardware. When
considering interacting qubits (such as for calibration of two-qubit gates),
and the number of parameters and the complexity of the model grow, the space
to be explored in Bayesian estimation increases in dimension, making it hard
to estimate all parameters together. However, it is not necessary in general
to estimate all model parameters together; Well chosen parametrizations of the
errors and the experiments can be beneficial in coping with this issue by
splitting the estimation into nearly-independent groups of parameters. Pushing
calibrations to a high accuracy while maintaining a low exploitation of
quantum resources is an important goal in the field, which may prove important
for reaching the low error thresholds required for fault-tolerant quantum
computing.

###### Acknowledgements.

We thank Gadi Aleksandrowicz, Shelly Garion, Eli Arbel, and Sam Ackerman for
very helpful feedback. We thank Nick Bronn, Isaac Lauer, Doug McClure,
Matthias Steffen and Oliver Dial for fruitful discussions about the
unconditional reset mechanism and the qubit preparation errors observed in the
experiments.

##  Appendix A Characterization using maximum-likelihood estimators of POVM
errors

First, let us write the positivity conditions on the POVM parameters of Sec.
II.1. Assuming that

$0\leq\epsilon_{0}<1,\qquad 0\leq\epsilon_{1}<1,$ (40)

the positive semi-definiteness of both $\Pi$ and $\mathds{1}-\Pi$ gives us the
conditions (using the determinant),

$(\pi_{0})^{2},\,(1-\pi_{0})^{2}\geq\sum_{a\in\\{x,y,z\\}}(\pi_{a})^{2},$ (41)

or, equivalently,

$\epsilon_{1}(1-\epsilon_{0}),\,\epsilon_{0}(1-\epsilon_{1})\geq(\pi_{x}^{2}+\pi_{y}^{2}).$
(42)

If the initialization and single-qubit gate errors can be neglected, the
estimation of the distribution of the four POVM parameters $\pi_{\mu}$ of Eq.
(5) can be done directly. The characterization in this case is straightforward
due to the linear dependence of the measurement probabilities on the
parameters, and the Bayesian numerical procedure is not required. The
experiment is composed of four independent measurements, each preceded by one
of the gates in the set (other choices could suitable as well),

$\left\\{\mathds{1},X,X_{-90},Y_{90}\right\\}.$ (43)

Under the assumption that the initial state is $|0\rangle$, the probabilities
of measuring 0 in each of the four calibration experiments using the gates in
Eq. (43) are given, respectively, by

$f_{z}=\pi_{0}+\pi_{z},\qquad f_{-z}=\pi_{0}-\pi_{z},$ (44)
$f_{y}=\pi_{0}+\pi_{y},\qquad f_{x}=\pi_{0}+\pi_{x}.$ (45)

The maximum likelihood estimators $\hat{\pi}_{\mu}$ follow directly from the
estimators $\hat{f}_{\mu}$ from the count of 0 shots in each experiment [as in
Eq. (20)], using the inverse relations

$\displaystyle\hat{\pi}_{0}$
$\displaystyle=\frac{1}{2}(\hat{f}_{z}+\hat{f}_{-z}),$
$\displaystyle\qquad\hat{\pi}_{z}$
$\displaystyle=\frac{1}{2}(\hat{f}_{z}-\hat{f}_{-z}),$ (46)
$\displaystyle\hat{\pi}_{x}$ $\displaystyle=\hat{f}_{x}-\hat{\pi}_{0},$
$\displaystyle\qquad\hat{\pi}_{y}$ $\displaystyle=\hat{f}_{y}-\hat{\pi}_{0}.$
(47)

Using these expressions, we can derive the distribution of the estimators
$\pi_{\mu}$. The analytic derivation of their distribution gives at once the
variances of the estimators, indicating the error bars on the POVM parameters.
In the limit of a large number of shots $n$, the binomial distributions from
which the experiment samples in each measurement, can be approximated using a
Gaussian (normal) distribution. As a rule of thumb, this approximation is
taken to be sufficient when the parameters of the distribution of Eq. (19)
obey

$np>q,\qquad n(1-p)>q,$ (48)

with $q$ some threshold guaranteeing that both $p$ and $1-p$ are not too small
probabilities to skew the Gaussian approximation, and $q=9$ is often chosen,
which corresponds to three standard deviations in the normal distribution.
Under this assumption, we can write instead of Eq. (19),

$s_{0}\sim\mathcal{N}\left(\mu=np,\sigma^{2}=np(1-p)\right),$ (49)

i.e., a normal distribution with mean $\mu=np$ and variance
$\sigma^{2}=np(1-p)$. Hence the estimator $\hat{p}$ is distributed as

$\hat{p}\sim\mathcal{N}\left(p,\frac{1}{n}p(1-p)\right).$ (50)

Using the arithmetic of independent normal random variables,

$\left(af_{1}+bf_{2}\right)\sim\mathcal{N}\left(a\mu_{1}+b\mu_{2},|a|^{2}\sigma_{1}^{2}+|b|^{2}\sigma_{2}^{2}\right),$
(51)

the distribution of the estimators can be obtained explicitly, e.g.,

$\hat{\pi}_{0,z}\sim\mathcal{N}\left(\frac{1}{2}({f}_{0}\pm{f}_{z}),\frac{1}{4n}[{f}_{0}(1-{f}_{0})+{f}_{z}(1-{f}_{z})]\right),$
(52)

and similarly for $\hat{\pi}_{x}$ and $\hat{\pi}_{y}$, the distribution is
normal with the mean and variance being

$\mu_{x,y}={f}_{x,y}-\frac{1}{2}({f}_{z}+{f}_{-z}),$ (53)
$\sigma_{x,y}^{2}=\frac{1}{4n}[4{f}_{x,y}(1-{f}_{x,y})+{f}_{z}(1-{f}_{z})+{f}_{-z}(1-{f}_{-z})],$
(54)

For the values of $f_{\mu}$ in these formulae, we substitute their estimators
obtained in the experiment, $\hat{f}_{\mu}$. We therefore have analytic
estimates for the variances in the estimation of the unknown parameters
$\pi_{\mu}$ used in the mitigation matrix.

However, it is important to note that the above approximation using normal
distributions, we have neglected the constraints on the POVM elements. The
Gaussian distributions above are therefore justified when the conditions in
Eq. (48) hold, and in addition when the constraints of Eq. (41) hold, within a
few (say, at least three) standard deviations of the normal distributions of
the parameters. The Bayesian estimation discussed in Sec. II resolves the
issue of constraints in a straightforward manner, and allows the consistent
estimation of more parameters.

##  Appendix B Explicit overrotations

Using Eqs. (16)-(17) for the case of overrotation parametrized with just one
angle $\theta$, we get explicit formulae for a few useful rotation powers,

$X_{\pm 90}\vec{r}=(x,-\sin\theta y\mp\cos\theta z,\pm\cos\theta y-\sin\theta
z),$ (55) $Y_{\pm 90}\vec{r}=(-\sin\theta x\pm\cos\theta z,y,\mp\cos\theta
x-\sin\theta z),$ (56) $(X_{\pm 90})^{2}\vec{r}=\\\ (x,-\cos 2\theta y\pm\sin
2\theta z,\mp\sin 2\theta y-\cos 2\theta z),$ (57) $(X_{\pm
90})^{4n}\vec{r}=\\\ (x,\cos 4n\theta y\mp\sin 4n\theta z,\pm\sin 4n\theta
y+\cos 4n\theta z),$ (58) $(X_{\pm 90})^{4n+1}\vec{r}=(x,-\sin(4n+1)\theta
y\mp\cos(4n+1)\theta z,\\\ \pm\cos(4n+1)\theta y-\sin(4n+1)\theta z).$ (59)

The more general case of an imperfect rotation (deviating from an ideal
rotation about the $x$ axis), can be accounted for using a tilted rotation
axis parametrized using two parameters $\hat{y},\hat{z}$ that define the
orientation of the axis

$\hat{u}=\left(\hat{x},\hat{y},\hat{z}\right),\qquad\hat{x}\equiv\sqrt{1-\hat{y}^{2}-\hat{z}^{2}}$
(60)

(where the positive root is chosen uniquely when rotations about the $x$ axis
are considered), and an angle of rotation $\theta$, giving the rotation matrix

$X_{\theta}=1+(\sin\theta)U+(1-\cos\theta)U^{2},$ (61)

with the generator matrix

$U=\left(\begin{array}[]{ccc}0&-\hat{z}&\hat{y}\\\ \hat{z}&0&-\hat{x}\\\
-\hat{y}&\hat{x}&0\end{array}\right).$ (62)

##  Appendix C The ping-pong estimation experiment

Figure 10: The extended ping-pong experiment with a variation of the pulse
amplitude, shown corresponding to a single qubit (number 8), for the same
experimental run as Fig. 10. (a) The experiment points and fit curve of Eq.
(64) for $A=1.0157$, and (b) the experiment points and fit curve of Eq. (65).

Precise estimation of a small error on a control parameter requires a
technique that can selectively amplify the error of interest. A ping-pong
technique is one of such experimental techniques that repeats unit sequence to
accumulate the error in the form of trigonometric function. Here we employ the
following sequence to estimate the rotation angle error $\theta$;
$X_{+90}-\left[(X_{+90})^{2}\right]^{j}$ where $j$ is the number of
repetitions of the basic sequence. The standard ping-pong fitting ansatz is

$z_{j}=a+(-1)^{j}\cos\left(\frac{\pi}{2}+2j\theta\right).$ (63)

This form of amplification can be robust to SPAM errors, since such errors are
absorbed into offset terms, whereas the rotation angle error appears in the
sinusoidal term. Considering the state preparation error, we extended the
ansatz to

$z_{j}=a+(-1)^{j}\left[b+\cos\left(\frac{\pi}{2}+2j\theta\right)\right].$ (64)

When the error $\theta$ is small enough, we can approximate
$\left|z_{j}\right|\sim j\theta$ by ignoring offset terms, namely the error
amplification is linear to $j$. Investigation of calibrated gates when the
error is close to zero requires a large number of repetitions, however long
experiments usually suffer from the effect of incoherent errors. Instead, we
combine multiple ping-pong experiments varying the amplitude
$\Omega=A\Omega_{0}$ (here $A$ is a scale factor), which allows us to
interpolate the value of $\theta$ at $\Omega_{0}$ (with $A=1$), of the
calibrated pulse amplitude. We fit the resulting curve with a polynomial
expansion of the form

$\theta=\alpha+\beta A+\gamma A^{2}+\delta A^{3}.$ (65)

An example of the analysis from such an experiment (with the data used to
construct Fig. 9), is shown in Fig. 10 for a single qubit. The top panel shows
$z_{j}$ for a single gate pulse amplitude $A=1.0157$, and the value of
$\theta$ extracted from fitting the shown curve, constitutes a single point on
the curve in the bottom panel, which is then fitted according to Eq. (65),
from which the value of $\theta$ at $A=1$ is extracted, with its error bars
(that stem from the spread of points of the latter curve).

## References

  * (1) Antonio D. Córcoles, Abhinav Kandala, Ali Javadi-Abhari, Douglas T. McClure, Andrew W. Cross, Kristan Temme, Paul D. Nation, Matthias Steffen, and Jay M. Gambetta.  Challenges and opportunities of near-term quantum computing systems.  Proceedings of the IEEE, 108(8):1338–1352, 2020.
  * (2) Abhinav Kandala, Kristan Temme, Antonio D Córcoles, Antonio Mezzacapo, Jerry M Chow, and Jay M Gambetta.  Error mitigation extends the computational reach of a noisy quantum processor.  Nature, 567(7749):491–495, 2019.
  * (3) Jinzhao Sun, Xiao Yuan, Takahiro Tsunoda, Vlatko Vedral, Simon C Benjamin, and Suguru Endo.  Mitigating realistic noise in practical noisy intermediate-scale quantum devices.  Physical Review Applied, 15(3):034026, 2021.
  * (4) Yanzhu Chen, Maziar Farahzad, Shinjae Yoo, and Tzu-Chieh Wei.  Detector tomography on ibm 5-qubit quantum computers and mitigation of imperfect measurement.  arXiv preprint arXiv:1904.11935, 2019.
  * (5) Sergey Bravyi, Sarah Sheldon, Abhinav Kandala, David C Mckay, and Jay M Gambetta.  Mitigating measurement errors in multiqubit experiments.  Physical Review A, 103(4):042605, 2021.
  * (6) Filip B. Maciejewski, Zoltán Zimborás, and Michał Oszmaniec.  Mitigation of readout noise in near-term quantum devices by classical post-processing based on detector tomography.  Quantum, 4:257, April 2020.
  * (7) George S Barron and Christopher J Wood.  Measurement error mitigation for variational quantum algorithms.  arXiv preprint arXiv:2010.08520, 2020.
  * (8) Michael R Geller and Mingyu Sun.  Toward efficient correction of multiqubit measurement errors: pair correlation method.  Quantum Science and Technology, 6(2):025009, feb 2021.
  * (9) Kristan Temme, Sergey Bravyi, and Jay M Gambetta.  Error mitigation for short-depth quantum circuits.  Physical review letters, 119(18):180509, 2017.
  * (10) Suguru Endo, Simon C Benjamin, and Ying Li.  Practical quantum error mitigation for near-future applications.  Physical Review X, 8(3):031027, 2018.
  * (11) Tudor Giurgica-Tiron, Yousef Hindy, Ryan LaRose, Andrea Mari, and William J Zeng.  Digital zero noise extrapolation for quantum error mitigation.  In 2020 IEEE International Conference on Quantum Computing and Engineering (QCE), pages 306–316. IEEE, 2020.
  * (12) Ewout van den Berg, Zlatko K Minev, and Kristan Temme.  Model-free readout-error mitigation for quantum expectation values.  arXiv preprint arXiv:2012.09738, 2020.
  * (13) Isaac L Chuang and Michael A Nielsen.  Prescription for experimental determination of the dynamics of a quantum black box.  Journal of Modern Optics, 44(11-12):2455–2467, 1997.
  * (14) Jaromír Fiurášek.  Maximum-likelihood estimation of quantum measurement.  Physical Review A, 64(2):024102, 2001.
  * (15) A Shabani, RL Kosut, M Mohseni, H Rabitz, MA Broome, MP Almeida, A Fedrizzi, and AG White.  Efficient measurement of quantum dynamics via compressive sensing.  Physical review letters, 106(10):100401, 2011.
  * (16) Steven T Flammia, David Gross, Yi-Kai Liu, and Jens Eisert.  Quantum tomography via compressed sensing: error bounds, sample complexity and efficient estimators.  New Journal of Physics, 14(9):095022, 2012.
  * (17) Seth T Merkel, Jay M Gambetta, John A Smolin, Stefano Poletto, Antonio D Córcoles, Blake R Johnson, Colm A Ryan, and Matthias Steffen.  Self-consistent quantum process tomography.  Physical Review A, 87(6):062119, 2013.
  * (18) Robin Blume-Kohout, John King Gamble, Erik Nielsen, Jonathan Mizrahi, Jonathan D Sterk, and Peter Maunz.  Robust, self-consistent, closed-form tomography of quantum logic gates on a trapped ion qubit.  arXiv preprint arXiv:1310.4492, 2013.
  * (19) Robin Blume-Kohout, John King Gamble, Erik Nielsen, Kenneth Rudinger, Jonathan Mizrahi, Kevin Fortier, and Peter Maunz.  Demonstration of qubit operations below a rigorous fault tolerance threshold with gate set tomography.  Nature communications, 8(1):1–13, 2017.
  * (20) Shelby Kimmel, Marcus P da Silva, Colm A Ryan, Blake R Johnson, and Thomas Ohki.  Robust extraction of tomographic information via randomized benchmarking.  Physical Review X, 4(1):011050, 2014.
  * (21) Blake R Johnson, Marcus P da Silva, Colm A Ryan, Shelby Kimmel, Jerry M Chow, and Thomas A Ohki.  Demonstration of robust quantum gate tomography via randomized benchmarking.  New Journal of Physics, 17(11):113019, 2015.
  * (22) Timothy J Proctor, Arnaud Carignan-Dugas, Kenneth Rudinger, Erik Nielsen, Robin Blume-Kohout, and Kevin Young.  Direct randomized benchmarking for multiqubit devices.  Physical review letters, 123(3):030503, 2019.
  * (23) Alexander Erhard, Joel J Wallman, Lukas Postler, Michael Meth, Roman Stricker, Esteban A Martinez, Philipp Schindler, Thomas Monz, Joseph Emerson, and Rainer Blatt.  Characterizing large-scale quantum computers via cycle benchmarking.  Nature communications, 10(1):1–7, 2019.
  * (24) Robin Harper, Steven T Flammia, and Joel J Wallman.  Efficient learning of quantum noise.  Nature Physics, 16(12):1184–1188, 2020.
  * (25) AF McCormick, SJ van Enk, and M Beck.  Experimental demonstration of loop state-preparation-and-measurement tomography.  Physical Review A, 95(4):042329, 2017.
  * (26) Adam C Keith, Charles H Baldwin, Scott Glancy, and E Knill.  Joint quantum-state and measurement tomography with incomplete measurements.  Physical Review A, 98(4):042318, 2018.
  * (27) Christopher Ferrie.  Self-guided quantum tomography.  Physical review letters, 113(19):190404, 2014.
  * (28) Robert J Chapman, Christopher Ferrie, and Alberto Peruzzo.  Experimental demonstration of self-guided quantum tomography.  Physical review letters, 117(4):040402, 2016.
  * (29) Christopher Granade, Christopher Ferrie, and Steven T Flammia.  Practical adaptive quantum tomography.  New Journal of Physics, 19(11):113017, 2017.
  * (30) George C Knee, Eliot Bolduc, Jonathan Leach, and Erik M Gauger.  Quantum process tomography via completely positive and trace-preserving projection.  Physical Review A, 98(6):062336, 2018.
  * (31) Sarah Sheldon, Lev S Bishop, Easwar Magesan, Stefan Filipp, Jerry M Chow, and Jay M Gambetta.  Characterizing errors on qubit operations via iterative randomized benchmarking.  Physical Review A, 93(1):012301, 2016.
  * (32) Robin Blume-Kohout.  Optimal, reliable estimation of quantum states.  New Journal of Physics, 12(4):043034, 2010.
  * (33) Jianwei Wang, Stefano Paesani, Raffaele Santagati, Sebastian Knauer, Antonio A Gentile, Nathan Wiebe, Maurangelo Petruzzella, Jeremy L O’Brien, John G Rarity, Anthony Laing, et al.  Experimental quantum hamiltonian learning.  Nature Physics, 13(6):551–555, 2017.
  * (34) Tim J Evans, Robin Harper, and Steven T Flammia.  Scalable bayesian hamiltonian learning.  arXiv preprint arXiv:1912.07636, 2019.
  * (35) Eyal Bairey, Itai Arad, and Netanel H. Lindner.  Learning a local hamiltonian from local measurements.  Physical Review Letters, 122(2), Jan 2019.
  * (36) Christopher Granade, Christopher Ferrie, and David G Cory.  Accelerated randomized benchmarking.  New Journal of Physics, 17(1):013042, 2015.
  * (37) Christopher Ferrie.  Self-guided quantum tomography.  Phys. Rev. Lett., 113:190404, Nov 2014.
  * (38) Robert J. Chapman, Christopher Ferrie, and Alberto Peruzzo.  Experimental demonstration of self-guided quantum tomography.  Phys. Rev. Lett., 117:040402, Jul 2016.
  * (39) Markus Rambach, Mahdi Qaryan, Michael Kewming, Christopher Ferrie, Andrew G. White, and Jacquiline Romero.  Robust and efficient high-dimensional quantum state tomography.  Phys. Rev. Lett., 126:100402, Mar 2021.
  * (40) Ian Hincks, Thomas Alexander, Michal Kononenko, Benjamin Soloway, and David G Cory.  Hamiltonian learning with online bayesian experiment design in practice.  arXiv preprint arXiv:1806.02427, 2018.
  * (41) Qiskit: An open-source framework for quantum computing, 2021.  https://qiskit.org/.
  * (42) Python code for bayesian estimation of qubit SPAM and gate error parameters, based on Qiskit for hardware access, 2021.  https://github.com/IBM/quantum-bayesian-estimation.
  * (43) D.J. Egger, M. Werninghaus, M. Ganzhorn, G. Salis, A. Fuhrer, P. Müller, and S. Filipp.  Pulsed reset protocol for fixed-frequency superconducting qubits.  Phys. Rev. Applied, 10:044030, Oct 2018.
  * (44) David C McKay, Christopher J Wood, Sarah Sheldon, Jerry M Chow, and Jay M Gambetta.  Efficient z gates for quantum computing.  Physical Review A, 96(2):022330, 2017.
  * (45) Jonathan J Burnett, Andreas Bengtsson, Marco Scigliuzzo, David Niepce, Marina Kudra, Per Delsing, and Jonas Bylander.  Decoherence benchmarking of superconducting qubits.  npj Quantum Information, 5(1):1–8, 2019.
  * (46) Philip Krantz, Morten Kjaergaard, Fei Yan, Terry P Orlando, Simon Gustavsson, and William D Oliver.  A quantum engineer’s guide to superconducting qubits.  Applied Physics Reviews, 6(2):021318, 2019.
  * (47) The experiment was run on the device _ibmq_paris_ on 05/07/2021, with backend version 1.7.16. Backends are listed in https://quantum-computing.ibm.com/.
  * (48) The experiments were run on the device _ibmq_paris_ on 04/28/2021, with backend version 1.7.15.
  * (49) The experiment was run on the device _ibmq_toronto_ on 01/31/2022 with backend version 1.6.9.
  * (50) The experiment was run on the device _ibmq_sydney_ on 08/05/2021 with backend version 1.0.68.
  * (51) The phase factor was chosen to avoid the expectation value being 0 or 1, which are nongeneric since they are at the boundary.
  * (52) The experiment was run on the device _ibmq_sydney_ on 05/20/2021 with backend version 1.0.47.
  * (53) Thomas Alexander, Naoki Kanazawa, Daniel J Egger, Lauren Capelluto, Christopher J Wood, Ali Javadi-Abhari, and David McKay.  Qiskit pulse: Programming quantum computers through the cloud with pulses.  arXiv preprint arXiv:2004.06755, 2020.
  * (54) The experiment was run on the device _ibmq_sydney_ on 05/24/2021 with backend version 1.0.47.
  * (55) The data was taken on the device _ibmq_sydney_ on 06/28/2021, with backend version 1.0.53.