When we talk about error rates in quantum computing, we’re usually referring to the quality of a
system's quantum *gates, *the operations that actually make up the computation. But there
is also another source of error, which every quantum computer has to deal with: state
preparation and measurement, or SPAM.

By using barium qubits instead of ytterbium qubits in our trapped ion quantum computers, IonQ is now able to announce a significant breakthrough in improving our SPAM error rates. Because this is an unfamiliar concept to many readers, this blog post explains exactly what SPAM is, how it can determine whether a quantum computer is useful at all, and how using barium qubits is enabling us to exceed all prior results.

### The Ingredients of SPAM

Every quantum computation goes through three steps:

**State Preparation**, where we put the qubits into their initial state

**Computation, **where we run an algorithm made up of a series of quantum gates

**Measurement, **where we read out the final state of each qubit after the
calculation — this is also sometimes called “state detection” or “readout.”

By analogy, if you want a calculator to compute 5^{2} = 25,
**state preparation** is when you type “5” into the calculator. The
**gates** are the rest of the buttons you press (^2), that manipulate
your starting state into the result, and **measurement** is the calculator showing
the number 25 on the screen once you hit the “=” button. If any one of those steps doesn’t go as
intended, you will get the wrong answer. If you hit the wrong button, or if the wiring inside
the calculator is poor, you might end up with the wrong result. While we’ve largely solved these
sorts of issues in classical computers, we’re still working to perfect them in the quantum
realm.

Even though the final “algorithmic” result of a computation includes both sources of error (and
more!) we can understand each of them individually by measuring SPAM directly — we prepare a
|0〉^{1} state on a qubit, then immediately
measure it without performing any gates, effectively asking “did I read a |0〉?” without worrying
about gates having introduced other errors.

Because this test involves first preparing and then immediately measuring the qubit, it’s very challenging to distinguish where the error occurred—when you get a wrong answer, you don’t know if the error is due to not preparing the qubit correctly or not measuring it correctly.

For this reason, state preparation and measurement are typically lumped together under a single
measurement called State Preparation and Measurement error, or **SPAM error** for
short. We often describe this as the SPAM *error rate*, the percentage likelihood that
the test will produce the wrong answer, but you’ll also see it described as the SPAM
*fidelity*, which is the percentage likelihood that it will produce the right one.

Strictly speaking, there is a separate |0〉 SPAM error and |1〉 SPAM error. To measure the |0〉 SPAM error, we prepare the qubit in |0〉 and then read out its state, repeating this cycle thousands of times. In some fraction of these cycles, we mean to prepare |0〉 but actually read out |1〉. That fraction is your |0〉 SPAM error. The |1〉 SPAM error works the same way, but we where we prepare a |1〉, then measure it, counting the measured |0〉 states as errors.

When we present a single number for SPAM error, as below, it’s the *average* of the |0〉 SPAM error and |1〉 SPAM error. Because quantum algorithms produce both |0〉 and |1〉 in their
answer, this gives us an overall sense of the SPAM error in practice.

### How State Detection Works with Ions

With trapped ion qubits like IonQ’s, state detection (measurement) is done through
*fluorescence, *or* *the emission of light. A specially tuned laser beam
illuminates the ions, causing any ion in the |1〉 state to “glow,” scattering many photons. Any
ion in the |0〉 state, however, will stay dark, scattering very few photons, if any at all.

This effect, known as *state-dependent fluorescence*, gives us a straightforward way to
distinguish between |0〉 and |1〉. We simply count how many photons are emitted by each ion while
illuminated by our tuned laser beam. Some number of photons is picked as the dividing line,
known as the *threshold value*. If we detect a number of photons above this threshold
value, we conclude the ion was in the |1〉 state. Otherwise, we conclude it was in the |0〉 state.

To set this threshold, we attempt to prepare |0〉 and then measure the qubit many times, normally thousands. We then construct a histogram of the number of times we measured a given number of photons. We repeat that process for the |1〉 state. We can then draw a line between the histograms, and that is our threshold. Anything that we expected to be a |0〉 but falls above the threshold line is an error in our state preparation and measurement, and the same is true for |1〉.

### Barium Ions

IonQ has worked with ytterbium ions for most of the company's history. We are now also exploring barium ions as qubits, because barium ions have a number of intrinsic features that we expect will improve the performance of our computers.

During the traditional state-dependent fluorescence technique described above, it’s possible for the detection laser itself to cause the ion to move from the |0〉 state to the |1〉 state, or vice versa. If this happens, the state will be read out incorrectly. This error mechanism places a limit on the number of photons that can be emitted per readout attempt, which in turn limits the amount of information we can collect on the qubit state per readout attempt. Ultimately, this limits our SPAM fidelity.

With barium ions, it’s possible to use a readout technique known as *shelving*. In this
technique, the |0〉 state is first transferred to a different atomic level that does not interact
with the detection laser at all.

Once this is done, this common source of error can no longer occur, and we can collect much more fluorescence from the |1〉 state. By extracting more information per readout attempt, we have higher confidence in the outcome, which lowers our SPAM error rate.

### Recent Results with Barium

Below is a histogram that represents SPAM data taken from IonQ Aria, our latest ytterbium-based system. Red is the data from our |0〉 SPAM tests, and blue is the data from our |1〉 SPAM tests. The vertical dotted line is the threshold where we distinguish |1〉 from |0〉.

All red to the right of the threshold line and all blue to the left of the line represent
errors. We typically see error rates of between 30 and 50 errors per 10,000, and in this test,
we meant to prepare |0〉 10,000 times but measured |1〉 27 times. We meant to prepare |1〉 10,000
times but measured |0〉 41 times. This gives a SPAM error of (27+41)/2 =**
34 errors per 10,000 runs**, for a SPAM fidelity of 99.66%.

We can compare this result with the same measurement made using barium qubits. As you can see, in our barium histogram, the gap between |0〉 and |1〉 is much wider, and the number of errors is also much lower.

Here, we meant to prepare |0〉 20,000 times but measured |1〉 5 times, and we meant to prepare |1〉 20,000 times but measured |0〉 9 times.
**This gives a combined SPAM error of 3.6 +- 0.9 for every 10,000 runs, or a SPAM fidelity of
99.96%.**

This SPAM fidelity is better than all other SPAM data published by all other commercial quantum computing manufacturers.^{2}

### Future Implications

SPAM is very important for scaling to hundreds or thousands of qubits because these numbers are
*per *each *qubit.*

Given a SPAM fidelity of *F* (per qubit), the SPAM fidelity for a qubit register of N
qubits is F^{N}. With many qubits, our overall SPAM fidelity goes down quickly. For
example, with a SPAM fidelity of 99%, a 100 qubit register has an overall SPAM fidelity of only
0.99^{100} = 37%. That means there would be only a 37% chance of getting the right
answer, even with flawless gates!

In that scenario, the quantum computer is very unlikely to return the correct answer, even if it computes that answer perfectly. With a per-qubit SPAM fidelity of 99%, this hypothetical 100-qubit computer can’t even report what answer it got 63% of the time.

For a SPAM fidelity of 99.96%, a 100 qubit register would have an overall SPAM fidelity of 96%—a much better likelihood of success.

IonQ's barium bet is paying off. Driving down SPAM error rates is a critical component of making quantum hardware useful in the near-term, and our barium-based systems have already shown dramatic improvement in this critical aspect of computation.

What’s more, our current results are not at the limit of performance that we believe to be possible with this system. With continued improvements, we anticipate being able to achieve an average SPAM error of less than 1 per 10,000, or 99.99% fidelity using barium.

Of course, SPAM is not the only thing to worry about. It takes a wide variety of metrics — or one well-crafted summary metric like the #AQ benchmark — to understand the real algorithmic performance of a system and its utility to customers. We look forward to sharing more about this system, including its gate fidelities and #AQ, in the coming months.

**1** This notation, called
bra-ket notation,
indicates that we’re dealing with quantum states, rather than classical ones. While these
states can get complex, SPAM only deals with the two simplest ones: a pure zero, |0〉 and a pure one, |1〉 ↫

**2** Update 04 March 2022: while this was true at the time of publication, Quantinuum has since announced a SPAM fidelity of 99.9904%, also with barium-based trapped ion qubits. We're excited for their achievement and its validation of barium as a promising qubit platform, and believe we can achieve similar error rates as our hardware progresses.↫