## Quantum Poker

## A game for quantum computers suitable for benchmarking error mitigation techniques on NISQ devices

Franz G. Fuchs , Vemund Falch , and Christian Johnsen † ‡ ‡

† SINTEF AS, Department of Mathematics and Cybernetics, Oslo, Norway ‡ NTNU, Department of Physics, Trondheim, Norway

March 24, 2020

## Abstract

Quantum computers are on the verge of becoming a commercially available reality. They represent a paradigm shift in computing, with a steep learning gradient. The creation of games is a way to ease the transition for beginners. We present a game similar to the Poker variant Texas hold 'em with the intention to serve as an engaging pedagogical tool to learn the basics rules of quantum computing. The concepts of quantum states, quantum operations and measurement can be learned in a playful manner. The difference to the classical variant is that the community cards are replaced by a quantum register that is 'randomly' initialized, and the cards for each player are replaced by quantum gates, randomly drawn from a set of available gates. Each player can create a quantum circuit with their cards, with the aim to maximize the number of 1's that are measured in the computational basis. The basic concepts of superposition, entanglement and quantum gates are employed. We provide a proof-of-concept implementation using Qiskit[1]. A comparison of the results for the created circuits using a simulator and IBM machines is conducted, showing that error rates on contemporary quantum computers are still very high. For the success of noisy intermediate scale quantum (NISQ) computers, improvements on the error rates and error mitigation techniques are necessary, even for simple circuits. We show that quantum error mitigation (QEM) techniques can be used to improve expectation values of observables on real quantum devices.

## 1 Introduction

Quantum computing is an emerging technology exploiting quantum mechanical phenomena - namely superposition, entanglement, and tunneling - in order to perform computation. Quantum computers have huge potential to transform society in a similar way that classical computers have, because they open up the possibility to tackle certain types of problems that are beyond the reach of classical computers. The first commercially available quantum computers are expected within the next five years, and it is expected that quantum computers will outperform their classical counterparts in some tasks within the same time period. In order to utilize the potential power of quantum computers, one has to formulate a given problem in a form that is suitable for a quantum computer (encoding step) and develop specialized algorithms. These type of algorithms are fundamentally different from classical algorithms. Getting accustomed to quantum algorithms has a considerable learning curve and requires a multidisciplinary approach. Typically, knowledge from physics, mathematics, computers science and a firm understanding from an application area such as quantum chemistry, optimization, or machine learning is required. In addition, it is advantageous to have knowledge of the underlying physics, particularly in the NISQ era.

The New York Times estimated in October 2018 1 that the global number of high-level researchers in quantum computing may be less than a thousand. The design of games that make use of the underlying rules of quantum computers is a way to attract more interest and ease the transition from classical algorithms to quantum algorithms for beginners. In order to play the basic version of this game, knowledge of quantum physics or advanced mathematics is not required. Just as with any other game, one has to learn a set of rules, which are described in Section 3. Since one of the best ways to learn is through play, this game can help to attract more people - from elementary school to post-graduate level at the university - to the field of quantum computing and we hope that the game awakens curiosity for present challenges in the field, such as the design of quantum algorithms and error mitigation schemes.

Near-term applications of early quantum devices, such as electronic structure problems and optimization, rely on accurate estimates of expectation values to become of practical relevance. However, inherent noise in quantum devices leads to wrong estimates of the expectation values of observables. Therefore, getting rid of (most of) the noise inherent in quantum computing is a critical step toward making it useful for practical applications. Quantum error correction (QEC) can only be achieved by increasing quantum resources (ancillary qubits). The first scheme was proposed by Shor (1995)[16] and many other schemes were proposed since then, e.g., the class called stabilizer

1 https://www.nytimes.com/2018/10/21/technology/quantum-computing-jobs-immigration-visas.html

codes, see Gottesman (1997)[4]. However, the number of ancillary qubits needed to achieve QEC depends intrinsically on the error rates and is out of reach for NISQ devices. Quantum error mitigation (QEM) , on the other hand can be achieved with additional classical resources only and is therefore applicable to NISQ devices.

The main contributions of this article are as follows.

- · We introduce a novel quantum game based on classic Poker. The game is useful to introduce basic quantum computing concepts to beginners.
- · We implement error mitigation schemes based on the extrapolation technique. A comparison of the results on simulators and real quantum devices is provided. We show that errors can successfully be mitigated when one is interested in expectation values of an observable.

This article is organized as follows. After describing related work in Section 2 we present the description of our game in Section 3. Using a representative circuit from an example game we report results of ideal and noisy circuit sampling in Section 4. Finally, we describe methods for error mitigation in Section 5 before concluding in Section 8.

## 2 Related Work

There exist a number of games based on quantum physics and they can be categorized into the following two types. The first type attempt to illustrate quantum mechanical effects, and one might therefore call them quantum mechanics games. The second type illustrate quantum computing via qubits and quantum circuit building. It is the latter type of game that has been developed in connection with this paper. For a recent review of the subject of quantum games we refer to, e.g., [7]. Existing quantum computing games include 'Battleships with partial NOT gates', solving puzzles by creating simple programs, and 'quantum chess'. Some are available as Jupyter Notebooks in Qiskit's Github repository of tutorials 2 .

Mitigating the effect of noise on the execution of circuits is critical for the success of NISQ devices. The ideal action of a gate is given by a unitary operator U transforming a state | φ 〉 into U φ | 〉 . The are two basic types of noise. Coherent noise means that a small perturbation ˜ U of U is executed, where ˜ U is still unitary and preserves the purity of the state | φ 〉 . An example is a slight over-rotation. Incoherent noise does not preserve the purity of the state. This type of noise comes from the (unwanted) interaction with the environment. In this case the evolution must be described through density matrices and Kraus operators. An example of incoherent noise is amplitude damping modeling relaxation from an excited state to the ground state. For a single qubit with decay probability p , the density √

matrix ρ = | φ 〉 〈 φ | is mapped to K ρK 0 † 0 + K ρK 1 † 1 with K 0 = 0 √ 1 -p , K 1 = 0 0 . Different techniques have been presented in the literature that can be used to mitigate the influence of noise on the ideal circuit.

$$\mathfrak { h } \, K _ { 0 } \, = \, \begin{pmatrix} 1 & \lambda ^ { 2 } _ { 0 } \\ 0 & \mathcal { v } / 1 - n \end{pmatrix}, K _ { 1 } \, = \, \begin{pmatrix} 0 ^ { 2 } & \lambda ^ { 2 } _ { 0 } \\ 0 & 0 \end{pmatrix}. \, \text{ Different types of}$$

In the following we discuss the most important ones.

Quantum subspace expansion (QSE). The main idea is to use operators from a given set (such as the set of Pauli operators) to expand about the variational solution. A generalized eigenvalue problem using linear subspaces is solved. This method leaves the circuit width (number of qubits) and depth (largest number of gates on any inputoutput path) unchanged. The method is introduced by Wecker et al. (2015)[19] where numerical evidence is provided. For the variational quantum eigensolver numerical evidence for error mitigation is provided by McClean et al. (2017) in [10]. An extension of the approach is given in Colless et al. (2018)[2]. The complete energy spectrum of the H2 molecule is calculated with near chemical accuracy. Premakumar and Joynt (2018)[13] generalize the concept of decoherence-free subspace (DFS) to noise with correlations in space to avoid regions where decoherence measures are high. However, as the authors point out themselves, only dephasing noise is considered and it is unlikely that the method is useful for general error models. DFSs do not exist for other types of noise, e.g., if noise flips spins.

Probabilistic error cancellation. The main idea is to represent the ideal circuit as a quasi-probabilistic mixture of noisy ones. The circuit depth and width remain unchanged with this method. Temme et al. (2017)[18] present the method together with numerical evidence. Song et al. (2019)[17] demonstrate an error mitigation protocol based on gate set tomography and quasiprobability decomposition. One- and two-qubit circuits are tested on a superconducting device, and computation errors are successfully suppressed. Process tomography is not feasible for more than a few qubits since it scales exponentially with the number of qubits. In addition, process tomography is sensitive to noise in the pre- and post rotation gates plus the measurements (SPAM errors). Gate set tomography can take these errors into account, but the scaling becomes even worse.

Extrapolation techniques. The main idea is to amplify the noise deliberately in a controlled way. The information of the dependence of the expectation value on the noise level is used to extrapolate back to the zero noise level. The circuit width remains unchanged, but the circuit depth is longer (or gate times are prolonged in case of phase control). Temme et al. (2017)[18] and Li and Benjamin (2017)[9] introduced the technique and provide numerical evidence. Endo et al. (2018)[3] extend the work of [18, 9] by accounting for the inevitable imperfections in the experimentalist's measuring the effect of errors in order to design efficient QEM circuits. Kandala et al. (2019)[6] presents important considerations for hardware and algorithmic implementations of the zero-noise extrapolation technique, and demonstrates tremendous improvements in the accuracy of variational eigensolvers implemented by a noisy superconducting

2 Qiskit tutorials - Quantum games https://github.com/Qiskit/qiskit-tutorials-community/tree/master/games

(a) A screenshot from the game at the end of all betting rounds. Niels (green) is the dealer and Max (red) is revealing his cards. For the community cards the color cyan, blue, pink indicate a 0%, 50%, 100% probability to obtain a 1, respectively.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-ae0d4e81-fc7b-47a4-812c-a6abd7e4240d.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-a8b4fb6b-ec65-4997-b960-f1a547bc45a9.jpg)

(b) Circuit that Max creates by placing his X, ZH and CX gates on the community cards. By doing so he changes the quantum state to obtain more 1's with a higher probability.

| X | 0 〉 = | 1 〉   | H | 0 〉 = | + 〉   | Z | 0 〉 = | 0 〉   | CX | 00 〉 = | 00 〉   | CX | +0 〉 = | 00 〉 + | 11 〉   | CX | ++ 〉 = | ++ 〉   |
|---------------------|---------------------|---------------------|------------------------|----------------------------------|------------------------|
| X | 1 〉 = | 0 〉   | H | 1 〉 = |-〉     | Z | 1 〉 = | 1 〉   | CX | 01 〉 = | 01 〉   | CX | +1 〉 = | 01 〉 + | 10 〉   | CX | + -〉 = |--〉     |
| X | + 〉 = | + 〉   | H | + 〉 = | 0 〉   | Z | + 〉 = |-〉     | CX | 10 〉 = | 11 〉   | CX |- 0 〉 = | 00 〉 -| 11 〉    | CX |- + 〉 = |- + 〉   |
| X |-〉 = |-〉       | H |-〉 = | 1 〉     | Z |-〉 = | + 〉     | CX | 11 〉 = | 10 〉   | CX |- 1 〉 = | 01 〉 -| 10 〉    | CX |--〉 = | + -〉     |

(c) List of useful rules showing the effect of gates on quantum states. The symbols X,H,Z,CX represent the available cards and | 〉 . is the state of the quantum register they act on. Global phase and normalization have been ignored.

Figure 1: Example of a quantum Poker game and the basic rules needed to play. The state of the quantum register before each player places their gates, is shown in the middle of (a). Max has one out of total four X, CX, and ZH gates and no H gate. (b) shows the underlying circuit generating the quantum register. Note that qubit q 2 is entangled with qubits q 0 and q 1 , but the resulting state is shown to be | 0 〉 in (a), since the bit gets flipped twice. In order to win, Max needs to alter the state of the 'community cards' in such a way that the states of the qubits get 'closer to | 1 . 〉 Looking at the list of operations shown in (c) Max applies his X-gate to change the state of q 2 to be | 1 . 〉 He then applies the ZH gate to qubit q 3 to obtain the state | 0 〉 and flips it to | 1 〉 by applying a CX with qubit q 2 , which is in state | 1 . 〉

quantum processor. Evidence on real quantum hardware is presented. In contrast to previous works, the increase of errors is not done by artificially introducing additional gates, but directly by pulse control. For IBM's quantum computers, access at this level (pulse/machine level) is only possible for customers of, which makes this technique inaccessible to us. Otten and Gray (2019)[12] introduce a technique that can be viewed as a multidimensional extension. The approach corresponds to repeating the same quantum evolution many times with known variations on the underlying systems' error properties. They show that the effective spontaneous emission, T1, and dephasing, T2, times can be increased using their method in both simulation and experiments on an actual quantum computer.

In this article we present results using the extrapolation method. We conduct experiments on simulators with error models and real quantum computers.

## 3 Quantum Poker Rules

The classical Texas hold'em round involves five community cards on the table shared by all the players, while each player holds 2 unique cards in their own hand. The small and big blind bets are placed at the start of each round, relative to a rotating dealer position. The community cards are gradually revealed, the first three - called 'the flop' are revealed simultaneously, and the last two called 'the turn' and 'the river' are revealed one at a time. The players take turns betting at the start of each round. In order to stay in the game one has to match or increase the highest bet currently in play. Otherwise, one can fold and forfeit the chance to win the pot, i.e., the sum of money that players wager during a single hand or game. After all five cards have been revealed there is a final round of betting before the players can choose to either show their hand in the hope of winning or folding it and forfeiting the pot. The goal is to combine up to five cards from both your own hand and the table to form the best Poker hand (hands are ordered by their probability and for equal probability by the 'highest' card) out of all the players. The player or players with the best hand win(s) the pot.

The quantum Poker game considered here draws inspiration from Texas hold 'em Poker and shares its structure. The betting rounds in the two games are identical. Community cards are replaced with qubits and the cards received by each player are replaced by quantum logic gates which can be applied to the qubits, i.e., community cards.

- · In quantum Poker each player acts on a personal 'copy' of the community cards , consisting of a quantum register. Hence, the only interaction between the players is through betting. An example initial state is shown

in Figure 1. The qubits can be in an any state, e.g. the ground state | 0 , 〉 the excited state | 1 , 〉 a state of superposition |±〉 = 1 √ 2 ( 0 | 〉 ± | 1 ), or in an entangled state like the Bell states 〉 1 √ 2 ( 00 | 〉 ± | 11 ). 〉

- · The personal cards come from a set of available quantum logic gates which can be applied to the qubits. This set is known to all players, such that they can deduce the probability of another player having, e.g., a CX gate. The set of quantum logic gates consist of operations acting on one or two qubits. In our implementation, the set consists of the Hadamard gate H, the phase flip gate Z, the NOT gate X and the controlled NOT gate CX. The action of each gate applied to the ( 1 | 〉 , | 0 )- and ( + 〉 | 〉 , |-〉 )-basis is shown in Figure 1c.
- · The final score of each player is the number of qubits measured to the state | 1 〉 in the computational basis at the end of the round. The winner(s) of each pot is/are the player(s) with the highest score.

The game is designed such that it can be played without knowledge of physics and advanced mathematics. The only rules to learn are given in the list shown in Figure 1c and the following rules: The state | 1 〉 has a 100% probability to 'give a 1', | 0 〉 a 0% probability to 'give a 1', and the states | + 〉 , |-〉 a 50% chance to 'give a 1'. In addition, states marked as 'Pair' the probabilities of the two qubits cannot be described independently. As an example, the Bell states 1 √ 2 ( 00 | 〉 ± | 11 ) 'give two 1s' with a probability of 50%. 〉 For the sake of correctness, the expression 'give a 1/give two 1s' refers to measurement in the computational basis. The idea of the game is that players will get familiar with the rules underlying quantum computing.

In the quantum Poker game a state

$$\left | \phi \right \rangle = V U \left | 0 \right \rangle ^ { \otimes n }$$

is created. The matrix U creates the n 'community cards' and is equal for all players. The matrix V is created by the players through placing their 'personal cards'. Given the state | φ 〉 and an observable A , the expectation value of A in the state φ is given by

$$\langle A \rangle _ { \phi } \coloneqq \langle \phi | \, A \, | \phi \rangle = \sum _ { i } \lambda _ { i } \, | \langle \phi | \psi _ { i } \rangle | ^ { 2 } \,.$$

Here, A is a self-adjoint operator on the Hilbert space C ⊗ n , and { λ , i | ψ i 〉} is the set of eigenvalues and eigenvectors of A . To match the objective of our game, we need to define an observable A such that 〈 A 〉 φ is equal to the expected number of ones in the computational basis. This can be done by choosing

$$A = \sum _ { i = 1 } ^ { 2 ^ { 5 } } b ( i ) P _ { i },$$

where b i ( ) is a function returning the number of ones of the binary representation of i , and P i = | i 〉 〈 i | is the measurement operator in the computational basis. A is a diagonal matrix with eigensystem { b i ( ) , | i 〉} . The matrix A can also be constructed via the number operator in the second quantization (a formalism used to describe and analyze quantum many-body systems), which is given by

$$A = \sum _ { i } N _ { i }, \quad \text{where } N _ { i } = a _ { i } ^ { \dagger } a _ { i }.$$

The creation and annihilation operators are given by

$$a _ { i } ^ { \dagger } & = I ^ { \otimes n - i - 1 } \otimes Q ^ { + } \otimes \sigma _ { z } ^ { \otimes i }, \\ a _ { i } & = I ^ { \otimes n - i - 1 } \otimes Q ^ { - } \otimes \sigma _ { z } ^ { \otimes i },$$

and the raising and lowering operator is given by

$$Q ^ { \pm } = \frac { 1 } { 2 } \left ( \sigma _ { x } \mp i \sigma _ { y } \right ),$$

i.e, Q + = ( 0 1 0 0 ) , Q -= ( 0 0 1 0 ) . As an example, for two qubits A is a diagonal matrix with entries (0 , 1 1 2), from , , upper left to lower right.

Using Equation 3, it is easy to calculate the expectation value as

$$\langle \Phi | A | \Phi \rangle = \langle \Phi | \sum _ { i = 1 } ^ { 2 ^ { 5 } } b ( i ) P _ { i } \, | \Phi \rangle = \sum _ { i = 1 } ^ { 2 ^ { 5 } } b ( i ) \, \langle \Phi | \, P _ { i } \, | \Phi \rangle = \sum _ { i = 1 } ^ { 2 ^ { 5 } } b ( i ) \, \langle \Phi | \, P _ { i } ^ { \dagger } P _ { i } \, | \Phi \rangle = \sum _ { i = 1 } ^ { 2 ^ { 5 } } b ( i ) P ( i ),$$

see Postulate 3 [11, page 84], where p i ( ) is the probability that result i occurs. In order to get the expectation value, we can therefore measure the states | Φ 〉 in the computational basis and multiply the resulting bit strings with b i ( ).

## 4 Ideal and noisy quantum circuit sampling

In the following we use Max's circuit, shown in Figure 1b, as an example to investigate the effects of noise in NISQ devices.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-c35be42f-b11a-4473-94e4-3c49517d4cbf.jpg)

(a) Distribution of the expectation value for Max's circuit.

(c) Convergence of the expectation values. Dashed lines represent the Pauli-twirled versions of the experiments.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-ed6abe96-aba4-40e0-a58f-6a2e5bcd6b7c.jpg)

(b) Same as (a), but with Pauli-twirling, see Section 5.1.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-012676ba-7cfc-49b0-8407-fabe723bd702.jpg)

Figure 2: Result for Max's circuit shown in Figure 1b using simulators and IBM's quantum devices. In total 1024 repetitions with 8192 shots each were used. The error models are more optimistic than the real quantum devices. Quantum noise on a real device leads to convergence of the expectation value to a much lower value than its simulated noise model, which is in turn lower than the theoretical value. A comparison of (a) and (b) shows that Pauli-twirling, see Section 5.1, has little to no effect on the obtained expectation value, even when noise is present. It leads, however, to an increased variance in the presence of noise.

## 4.1 Ideal simulator

The state that Max creates is given by | φ Max 〉 = 1 √ 2 ( 01101 | 〉 + 11111 ). | 〉 Each realization of the circuit on an ideal (simulated) quantum computer results in a classical bit string q n -1 . . . q 1 q 0 after measurement. A state φ = ∑ i α i | i 〉 induces a probability distribution P φ ( ) = i | α i | 2 . For Max's circuit this distribution is thus given by a 50% chance of being in either state | 01101 〉 and | 11111 . The expectation value for Max's circuit is thus 〉 〈 A 〉 | φ Max 〉 = 4. Figure 2 shows the convergence of sequence averages on an ideal simulator with respect to the number of repetitions to the expectation value, as well as the according probability distribution of the sequence. Here, we have used Qiskit's simulator with 1024 repetitions, each consisting of 8192 shots.

## 4.2 Set of universal quantum gates and circuit mappings

On a real quantum device, such as IBM's QX architectures, only certain types of operations/gates are supported. This set contains the single qubit gates U , U , U 1 2 3 , and the CX gate. In order to execute a circuit, one needs to express the circuit in these basis gates. The Solovay-Kitaev theorem guarantees that this is always possible up to a given accuracy.

An additional complication comes from the fact that only a subset of qubits are physically connected. On IBM's QX devices CX gates can only be applied to qubits that are connected by a bus resonator. Figures 3a,b show the connectivity graph of two of IBM's quantum devices, where edges mark qubits that are physically connected. In order to execute a circuit with CX gates between two not connected qubits, additional gates, such as SWAP or BRIDGE gates, need be used to transform the circuit into an equivalent one that obeys the connectivity graph. Inserting one SWAP or BRIDGE gate increases the number of CX gates by three. On current NISQ devices the noise level of two-qubit gate (CX) times and error rates are one order of magnitude higher than for single qubit gates[14], see also Figures 3a,b. One therefore wishes to find a mapping with the lowest number of CX gates. In general, the problem of finding an optimal mapping is NP -complete problem[20]. For recent heuristics we refer to [5, 20] and references therein. For Max's circuit it is easy to find an optimal mapping for IBM's QX2 device manually using only one extra SWAP gate. For the IBM's ourense device we have used the built-in optimizer. The resulting circuits which are shown in Figures 3c,d have the same number of CX gates. However, the circuit adapted to the ourense device has a larger depth due to lower connectivity of the qubits.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-f5bad390-3971-4277-b6b1-aa4faf560e8d.jpg)

(a) Connectivity and error rates on IBM's QX2. (Feb 6 2020)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-9acbe3f1-e3fa-48bd-b2b0-518a7c8e7662.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-b9268e60-b487-43d7-9587-05e0531ea434.jpg)

(b) Connectivity and error rates on IBM's ourense. (Feb 6 2020)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-adf66b3a-b223-4dea-ab79-2279ed4613d9.jpg)

- (c) Max's circuit transpiled for IBM's QX2. #CX gates = 9, depth = 11.

(d) Max's circuit transpiled for IBM's ourense. #CX gates = 9, Depth = 16.

Figure 3: A comparison of the two IBM devices used, shows that the qubits have better connectivity on the QX2 device (6 vs 4 bus resonators), the average readout error is much smaller, but the CX error rate is worse, as compared to IBM's ourense. In order to execute Max's circuit, shown in Figure 1b, equivalent circuits, shown in (c) and (d). Both use the same number of CX gates, but have different depth. The variables of the U , U 2 3 gates are skipped for simplicity. The average depth of the circuits can be reduced to a constant after combining neighboring single qubit gates.

## 4.3 The effect of noise on quantum computation

Noise is inherent to quantum computers. Qiskit provides methods for automatic generation of approximate noise models matching a given hardware device. This enables us to simulate the effects of realistic noise on our computation before we run our circuits on a real quantum computer. Figure 2 shows the results of the Max's circuit on different simulators and real quantum devices, using the transpiled circuits shown in Figure 3. Due to the influence of noise, the resulting expectation values converge to a value around 3 86/3 76 for the simulated noise model and 3 70/3 52 on . . . . the IBM's quantum computers for the QX2/ourense device. The gate noise level of IBM's ourense device is slightly better than that of IBM's QX2, but the average readout error and connectivity (and hence on average the depth of a circuit) is worse for the ourense device. In our case, we achieve better results with the QX2 device, since we can use a shorter depth circuit with less readout errors. Both values are far off the ideal value of 4, obtained through a noiseless simulation. In the following we will show how to mitigate the effect of errors on expectation values in order to get a better estimate of the ideal expectation value.

## 5 Error mitigation.

In this section we will apply the zero-noise extrapolation method to our circuit. The basic assumption of the method is that the expectation value of an observable depends smoothly on a small noise parameter λ glyph[lessmuch] 1 and admits the following power series,

$$\langle A \rangle _ { | \phi \rangle } ( \lambda ) = \langle A \rangle _ { | \phi \rangle } ^ { * } + \sum _ { i = 1 } ^ { n } a _ { i } \lambda ^ { i } + \mathcal { O } ( \lambda ^ { i + 1 } ),$$

where 〈 A 〉 ∗ φ is the zero noise value we are trying to recover. Richardson's deferred approach to the limit[15] can then be applied to get a better estimate of the zero noise value. The method requires to generate n estimates to the expectation value, i.e., 〈 A 〉 φ ( r λ i ) for r 1 &lt; r 2 &lt; · · · &lt; r n . A better estimate of 〈 A 〉 ∗ φ is then constructed by combining these values in such a way that the lowest order terms in the power series cancel. As an example we can get a second order approximation of the expectation value by combining the results for r 1 = 1 and r 2 = 2 through

$$2 \langle A \rangle _ { | \phi \rangle } ( \lambda ) - \langle A \rangle _ { | \phi \rangle } ( 2 \lambda ) = \langle A \rangle _ { | \phi \rangle } ^ { * } + \mathcal { O } ( \lambda ^ { 2 } ).$$

Clearly, using r 1 = 1 generates the expectation value with the least noise. Amplification of noise with the factors r i &gt; 1 can either be achieved directly through pulse control or through modifying the circuit by adding certain extra

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-9ca543d2-d527-45fa-af62-059fceed07df.jpg)

σ a 1 1 1 1 σ x σ x σ x σ x σ y σ y σ y σ y σ z σ z σ z σ z σ b 1 σ x σ y σ z 1 σ x σ y σ z 1 σ x σ y σ z 1 σ x σ y σ z σ c 1 1 σ z σ z σ x σ x σ y σ y σ y σ y σ x σ x σ z σ z 1 1 σ d 1 σ x σ y σ z σ x 1 σ z σ y σ x 1 σ z σ y 1 σ x σ y σ z

- (a) Pauli-twirling and noise amplification.

(b) Valid combinations for Pauli-twirling of the CX gate.

Figure 4: Pauli-twirling and noise amplification.

gates. For IBM's QX devices pulse control on devices with more than one qubit is only accessible for their customers, which leaves us with the second possibility.

## 5.1 Pauli-twirling

Before we apply the noise amplification, we convert the non-stochastic errors of CX gates into stochastic errors, see e.g. [9, section VII] for a detailed description. One way to achieve this is to apply Pauli-twirling. Given a finite group G of quantum operations and a quantum channel Λ the average

$$\frac { 1 } { | G | } \sum _ { U \in G } U ^ { \dagger } \Lambda U,$$

is called a twirl of the channel Λ. In our case gates σ , σ a b , σ c , σ d are inserted before and after each CX gate Λ, where σ i is chosen from the twirling set consisting of the Pauli gates { 1 , σ x , σ y , σ z } . After randomly (with uniform probability) choosing σ , σ a b the gates σ , σ c d are then chosen to satisfy

$$\sigma ^ { c } \otimes \sigma ^ { d } = \mathrm e ^ { i \theta } \Lambda ( \sigma ^ { a } \otimes \sigma ^ { b } ) \Lambda ^ { \dagger }.$$

This ensures that the overall effect results only in a phase change, which does not change the measurement outcome. The circuit constructed with Pauli-twirling applied to all CX gates is therefore equivalent to the original circuit. Figure 4 shows a schematic depiction of Pauli-twirling as well as all valid combinations for the CX gate. In practice this method is applicable, if the assumption holds that the qualities of single-qubit gates are an order of magnitude smaller than two-qubit gates. Twirling should then only have a negligible effect on the fidelity of the expectation value on NISQ devices. Figure 2 indicates that noise manifests itself in an increase of the variance of the distribution. There is no effect for the ideal simulator.

## 5.2 Noise amplification

In order to amplify the strength of the noise, we will apply random Pauli gates with a probability proportional to the error rate of the CX gate between a given pair of qubits. More precisely this is means applying gates σ , σ e f randomly chosen form the set of Pauli gates { 1 , σ x , σ y , σ z } after the twirled CX gates with probability ( r -1) glyph[epsilon1] i,j , see a depiction in Figure 4a. Note that there are only 15 possible choices for σ e ⊗ σ f , since 1 ⊗ 1 must be excluded because it does not increase the error. Here, glyph[epsilon1] i,j is the two-qubit gate error rate between qubits q i and q j . On average this increases the error rate to the desired value glyph[epsilon1] new = glyph[epsilon1] i,j +( r -1) glyph[epsilon1] i,j = rglyph[epsilon1] i,j .

Figure 5 shows the result for both the simulated error models and the real quantum devices. The assumption that the expectation value of an observable depends smoothly on r seems to hold for the simulator with the IBM QX2 noise model and the IBM QX2 device, but less so for the IBM ourense device, see Figure 5d. This is likely because some of the underlying assumptions of the method are violated for the ourense device, e.g., the existence of non-Markovian noise, spatially or temporally correlated noise, etc. The result shown in Figure 5d seems to justify the assumption of the exponential variant of the extrapolation method presented in [3].

Additional insight is provided by looking at the distribution for r ∈ { 1 4 32 , , } . Since we increase the noise of CX gates artificially by adding Pauli gates, this means that other outcome strings are becoming more likely. Figure 5a-c shows that expectation values of 1, 2, 3 become increasingly likely. The result is a multi-peaked distribution. The noisy results show the same basic behaviour as the ideal circuit. In general, the noise models seem to lead to better estimates of the expectation values than the real quantum devices, limiting their usefulness somewhat.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-3aedee76-8b99-4eaf-941e-d7be53cb7fb1.jpg)

(a) Result without noise amplification

r

= 1.

(b) Result for

r

= 4.

(c) Result for

r

= 32.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-4dd1133c-bb5b-48de-a272-3a2fe6d2ad12.jpg)

(d) Expectation value obtained for different noise amplification (e) Depth of the circuits for varying factors r . r . The average depth is roughly constant when combining single qubit gates.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-9c01bd26-ee71-4238-beb9-9ec6628ac239.jpg)

Figure 5: Effect of artificially amplifying the noise on Max's circuit. Each sample point uses N = 1024 randomly generated circuits with 8192 shots per circuit. The r -dependence of the simulated noise model is much smoother than that of IBM's QX2 device. Amplifying the noise with random Pauli gates leads to a multi-peaked distribution, because the expectation value is a sum of different outcomes.

## 5.3 Error mitigation of measurement noise

Measurement noise is another major source of error. Here, we use the model that assumes spatially uncorrelated errors of a bit flip. We compute the probability that the state | i 〉 is observed if the state | j 〉 is prepared, i.e. the conditional probability P i,j := P ( | i 〉 | | j 〉 ). The matrix

$$P = \begin{bmatrix} P _ { 1, 1 } & \dots & P _ { 1, 2 ^ { n } } \\ \vdots & \ddots & \vdots \\ P _ { 2 ^ { n }, 1 } & \dots & P _ { 2 ^ { n }, 2 ^ { n } } \end{bmatrix},$$

is a (right) stochastic matrix, as ∑ j P i,j = 1. In the absence of noise P i,j = δ i,j , but measurement (and other) noise leads to non-zero off-diagonal entries. The resulting probabilities for IBM's QX2 are shown in Figure 6a.

Let us assume that, for a quantum computer, we are given P and a probability distribution D noisy induced by measurement of a quantum state | Ψ . Using the equation 〉

$$D _ { \text{noisy} } = P D _ { \text{ideal} },$$

we can retrieve the ideal distribution D ideal of | Ψ . As an example, we are preparing the Bell state 〉 | Ψ = 1 〉 / √ 2( 00 | 〉 + | 11 ), but the resulting distribution is 〉 D noisy = (13 2 2 13) , , , / 30. In addition we have that P i,j is 0 8 if . i = j and 0 2 . / 3 otherwise. By solving (13) we can then retrieve the noiseless distribution D ideal = (1 / 2 0 0 1 , , , / 2).

In order for the method to work, measurement errors must be at least one order of magnitude larger than state preparation and the execution of the X gate. This condition is satisfied for IBM's QX2 and ourense device, compare Figure 3. In addition it must be mentioned that this requires an exponential amount (in the number of qubits) of states to be prepared and measured to build the matrix P . In this work we use the implementation provided by Qiskit[1]. Figure 6b and the column for E 1 in Table 7c show a clear improvement by applying the measurement filter for Max's circuit.

## 5.4 Overall results

In all of our experiments we generate N circuits randomly with Pauli-twirling and a noise amplification factor r . Each of these circuits is called a 'repetition' and uses 8192 shots. The number of this random circuits (repetitions) have to be large enough to cover the whole sample space. Max's circuits has 9 CX operations, which is why we used N = 1024

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-18f07ebb-2e9e-4433-8cb8-3d57714c5ecd.jpg)

- (a) Conditional probabilities P ( | i 〉 | | j 〉 ) for IBM's QX2 device.

Figure 6: The results from the prepared vs measured state can be used to construct a filter to mitigate measurement errors. The filter applied to Max's circuit improves the probabilities.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-f053adc2-e47a-4b24-b129-7874483f061e.jpg)

repetitions. We can see in Figures 7a,b that this number is sufficient for convergence. The results for other circuits are similar.

Figure 7 shows the convergence of the circuits and the effect of error mitigation techniques on the expectation value. With E r = E r ( ) we denote the expectation value achieved with amplification factor r , and by R . ( ) the Richardson extrapolation. Without error mitigation the expectation value for the X2 device is closer to the theoretical value than the ourense device. The execution on real devices leads to a worse result as the simulators. Compare also Figure 2b

Applying Richardson extrapolation clearly improves the resulting expectation value in all cases. With increasing number of terms the achieved estimate of the expectation value seems to converge. For the X2 device, already 2 to 3 terms are sufficient to achieve a very good approximation. For the ourense device, the results are not as good. This is most likely due to longer circuit depth and higher measurement errors.

Applying the measurement error filter alone helps to improve the expectation value as well, particularly when using a quantum simulator. However, on the real devices, the results are not as good as for the Richardson extrapolation. Combining Richardson extrapolation and measurement error filter seems to only work for the ourense model and device.

## 6 Relationship to benchmarking

We would like to remark that circuits from the proposed game could be used to benchmark quantum devices. In randomized benchmarking, see e.g., [8], random sequences are generated from the Clifford group, including a computed reversal element such that the overall unitary is the identity up to a global phase factor. Quantum Poker has a random part, the 'community cards', and a part that depends on the strategy of the individual player, see Equation (1). In order to use quantum poker in this setting, one would need to make the following changes:

- · Negate the original definition of winning to be maximizing the number of 0's that are measured.
- · Provide a player with enough cards, such that the overall unitary of an identity modulo global phase can be created, i.e., such that U = e iθ V .

With this changes the game can be used to benchmark subspaces of 5 qubits. A generalization to n qubits is also straight forward.

## 7 Availability of Data and Code

The open source python/jupyter notebook implementation of the game is available at https://github.com/sintefmath/ quantumpoker and the complete code for reproducing the results obtained in this article is available at https: //github.com/OpenQuantumComputing .

## 8 Conclusion

We have presented a game intended to serve as a pedagogical tool for learning the basic rules of quantum computers. The aim was to make it a fun experience in order to get more people acquainted with the rules of quantum computing and raise interest in algorithms and error mitigation. It could therefore help to avoid a shortage in experts when quantum computers become commercialized. To make the threshold for acquiring the game lower, it could be made

(a) Convergence of Expectation values for IBM QX2.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-1ecf0981-e850-4f84-b189-6000c4d97764.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00044v4-figure-42ed4de1-93fa-4539-a964-68734607449e.jpg)

(b) Convergence of Expectation values for IBM ourense.

E 1 R E ,E ( 1 2 ) R E ,E ,E ( 1 2 4 ) R E ,E ,E ,E ( 1 2 4 8 ) R E ,E ,E ,E ,E ( 1 2 4 8 16 ) R E ,E ,E ,E ,E ( 1 2 4 8 16 , E 32 )

| sim X2 sim ourense X2   |   3.85 |   3.97 |   3.97 |   3.97 |   3.97 |   3.96 |
|-------------------------|--------|--------|--------|--------|--------|--------|
|                         |   3.77 |   3.82 |   3.83 |   3.83 |   3.83 |   3.83 |
|                         |   3.68 |   3.9  |   3.96 |   3.98 |   3.99 |   4    |
| ourense                 |   3.45 |   3.53 |   3.54 |   3.54 |   3.53 |   3.53 |
| sim X2 (mf)             |   3.95 |   4.06 |   4.07 |   4.06 |   4.06 |   4.06 |
| sim ourense (mf)        |   3.87 |   3.93 |   3.94 |   3.94 |   3.94 |   3.94 |
| X2 (mf)                 |   3.8  |   4.04 |   4.1  |   4.12 |   4.13 |   4.14 |
| ourense (mf)            |   3.62 |   3.71 |   3.72 |   3.72 |   3.71 |   3.71 |

(c) Expectation values achieved by simulators and real quantum devices. 'mf' denotes results using the measurement filter.

Figure 7: Results achieved using the simulator and IBM's quantum devices. The symbols E , E , 1 2 · · · E 32 denote the expectation value for the noise amplification factor r equal to 1 , 2 , · · · , 32 respectively. R . ( ) denotes the Richardson extrapolation. All results were obtained by using 1024 repetitions with 8192 shots each.

available on smartphones as well. In order to make the game more difficult one could generate a completely random initial state. The quantum Poker game can be easily simulated on classical computers because it requires only 5 qubits. However, on contemporary quantum computers the use of multiple error-prone CX gates and measurement operations, gives a large error in the output state of the circuits. We have presented and discussed several error mitigation techniques that produce better estimates of expectation values. The overall results rely on Pauli-twirling to convert non-stochastic errors of CX gates into stochastic errors.

## References

- [1] Gadi Aleksandrowicz, Thomas Alexander, Panagiotis Barkoutsos, Luciano Bello, Yael Ben-Haim, David Bucher, Francisco Jose Cabrera-Hern´ndez, Jorge Carballo-Franquis, Adrian Chen, Chun-Fu Chen, Jerry M. Chow, Antoa nio D. C´rcoles-Gonzales, Abigail J. Cross, Andrew Cross, Juan Cruz-Benito, Chris Culver, Salvador De La Puente o Gonz´ alez, Enrique De La Torre, Delton Ding, Eugene Dumitrescu, Ivan Duran, Pieter Eendebak, Mark Everitt, Ismael Faro Sertage, Albert Frisch, Andreas Fuhrer, Jay Gambetta, Borja Godoy Gago, Juan Gomez-Mosquera, Donny Greenberg, Ikko Hamamura, Vojtech Havlicek, Joe Hellmers, glyph[suppress] Lukasz Herok, Hiroshi Horii, Shaohan Hu, Takashi Imamichi, Toshinari Itoko, Ali Javadi-Abhari, Naoki Kanazawa, Anton Karazeev, Kevin Krsulich, Peng Liu, Yang Luh, Yunho Maeng, Manoel Marques, Francisco Jose Mart´ ın-Fern´ndez, Douglas T. McClure, David a McKay, Srujan Meesala, Antonio Mezzacapo, Nikolaj Moll, Diego Moreda Rodr´ ıguez, Giacomo Nannicini, Paul Nation, Pauline Ollitrault, Lee James O'Riordan, Hanhee Paik, Jes´s P´rez, Anna Phan, Marco Pistoia, Viktor u e Prutyanov, Max Reuter, Julia Rice, Abd´n Rodr´ ıguez Davila, Raymond Harry Putra Rudy, Mingi Ryu, Ninad o Sathaye, Chris Schnabel, Eddie Schoute, Kanav Setia, Yunong Shi, Adenilton Silva, Yukio Siraichi, Seyon Sivarajah, John A. Smolin, Mathias Soeken, Hitomi Takahashi, Ivano Tavernelli, Charles Taylor, Pete Taylour, Kenso Trabing, Matthew Treinish, Wes Turner, Desiree Vogt-Lee, Christophe Vuillot, Jonathan A. Wildstrom, Jessica Wilson, Erick Winston, Christopher Wood, Stephen Wood, Stefan W¨rner, Ismail Yunus Akhalwaya, and Christa o Zoufal. Qiskit: An open-source framework for quantum computing, 2019.
- [2] J. I. Colless, V.V. Ramasesh, D. Dahlen, M.S. Blok, M.E. Kimchi-Schwartz, J. R. McClean, J. Carter, W. A. de Jong, and I. Siddiqi. Computation of molecular spectra on a quantum processor with an error-resilient algorithm. Physical Review X , 8(1), February 2018. doi: 10.1103/physrevx.8.011021. URL https://doi.org/ 10.1103/physrevx.8.011021 .

[3] Suguru Endo, Simon C. Benjamin, and Ying Li. Practical quantum error mitigation for near-future applica-

tions. Physical Review X , 8(3), July 2018. doi: 10.1103/physrevx.8.031027. URL https://doi.org/10.1103/ physrevx.8.031027 .

| [4]   | Daniel Gottesman. Stabilizer codes and quantum error correction. arXiv preprint quant-ph/9705052 , 1997.                                                                                                                                                                                                                                            |
|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [5]   | Toshinari Itoko, Rudy Raymond, Takashi Imamichi, and Atsushi Matsuo. Optimization of quantum circuit mapping using gate transformation and commutation. Integration , 70:43-50, January 2020. doi: 10.1016/j.vlsi. 2019.10.004. URL https://doi.org/10.1016/j.vlsi.2019.10.004 .                                                                    |
| [6]   | Abhinav Kandala, Kristan Temme, Antonio D. C´rcoles, o 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, March 2019. doi: 10.1038/s41586-019-1040-7. URL https://doi.org/10.1038/s41586-019-1040-7 .                               |
| [7]   | Faisal Shah Khan, Neal Solmeyer, Radhakrishnan Balu, and Travis S Humble. Quantum games: a review of the history, current state, and interpretation. Quantum Information Processing , 17(11):309, 2018.                                                                                                                                             |
| [8]   | Emanuel Knill, Dietrich Leibfried, Rolf Reichle, Joe Britton, R Brad Blakestad, John D Jost, Chris Langer, Roee Ozeri, Signe Seidelin, and David J Wineland. Randomized benchmarking of quantum gates. Physical Review A 77(1):012307, 2008.                                                                                                        |
| [9]   | Ying Li and Simon C. Benjamin. Efficient variational quantum simulator incorporating active error minimiza- tion. Physical Review X , 7(2), June 2017. doi: 10.1103/physrevx.7.021050. URL https://doi.org/10.1103/ physrevx.7.021050 .                                                                                                             |
| [10]  | Jarrod R. McClean, Mollie E. Kimchi-Schwartz, Jonathan Carter, and Wibe A. de Jong. Hybrid quantum-classical hierarchy for mitigation of decoherence and determination of excited states. Physical Review A , 95(4), April 2017. doi: 10.1103/physreva.95.042308. URL https://doi.org/10.1103/physreva.95.042308 .                                  |
| [11]  | M.A. Nielsen and I.L. Chuang. Quantum Computation and Quantum Information . Cambridge Series on Infor- mation and the Natural Sciences. Cambridge University Press, 2000.                                                                                                                                                                           |
| [12]  | Matthew Otten and Stephen K. Gray. Recovering noise-free quantum observables. Physical Review A , 99(1), January 2019. doi: 10.1103/physreva.99.012338. URL https://doi.org/10.1103/physreva.99.012338 .                                                                                                                                            |
| [13]  | Vickram N. Premakumar and Robert Joynt. Error mitigation in quantum computers subject to spatially correlated noise, 2018.                                                                                                                                                                                                                          |
| [14]  | 5 qubit backend: IBM Q team. 'IBM Q 5 yorktown backend specification v1.0.0'. Retrieved from https: //ibm.biz/qiskit-yorktown , (2018).                                                                                                                                                                                                             |
| [15]  | L. F. Richardson and J. A. Gaunt. The deferred approach to the limit. part i. single lattice. part II. interpenetrating lattices. Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences 226(636-646):299-361, January 1927. doi: 10.1098/rsta.1927.0008. URL https://doi.org/10.1098/rsta.1927. 0008 . |
| [16]  | Peter W. Shor. Scheme for reducing decoherence in quantum computer memory. Physical Review A , 52(4):R2493- R2496, October 1995. doi: 10.1103/physreva.52.r2493. URL https://doi.org/10.1103/physreva.52.r2493 .                                                                                                                                    |
| [17]  | Chao Song, Jing Cui, H. Wang, J. Hao, H. Feng, and Ying Li. Quantum computation with universal error mitigation on a superconducting quantum processor. Science Advances , 5(9):eaaw5686, September 2019. doi: 10.1126/sciadv.aaw5686. URL https://doi.org/10.1126/sciadv.aaw5686 .                                                                 |
| [18]  | Kristan Temme, Sergey Bravyi, and Jay M. Gambetta. Error mitigation for short-depth quantum circuits. Physical Review Letters , 119(18), November 2017. doi: 10.1103/physrevlett.119.180509. URL https://doi.org/ 10.1103/physrevlett.119.180509 .                                                                                                  |
| [19]  | Dave Wecker, Matthew B. Hastings, and Matthias Troyer. Progress towards practical quantum variational algo- rithms. Physical Review A , 92(4), October 2015. doi: 10.1103/physreva.92.042303. URL https://doi.org/10. 1103/physreva.92.042303 .                                                                                                     |
| [20]  | Robert Wille, Lukas Burgholzer, and Alwin Zulehner. Mapping quantum circuits to IBM QX architectures using the minimal number of SWAP and h operations. In Proceedings of the 56th Annual Design Automation Conference 2019 on - DAC 19 . ACMPress, 2019. doi: 10.1145/3316781.3317859. URL https://doi.org/10.1145/3316781.                        |
Franz G. Fuchs Vemund Falch Christian Johnsen
Quantum Poker A game for quantum computers suitable for benchmarking error mitigation techniques on NISQ devices
Quantum computers are on the verge of becoming a commercially available
reality. They represent a paradigm shift in computing, with a steep learning
gradient. The creation of games is a way to ease the transition for beginners.
We present a game similar to the Poker variant Texas hold 'em with the
intention to serve as an engaging pedagogical tool to learn the basics rules of
quantum computing. The concepts of quantum states, quantum operations and
measurement can be learned in a playful manner. The difference to the classical
variant is that the community cards are replaced by a quantum register that is
"randomly" initialized, and the cards for each player are replaced by quantum
gates, randomly drawn from a set of available gates. Each player can create a
quantum circuit with their cards, with the aim to maximize the number of $1$'s
that are measured in the computational basis. The basic concepts of
superposition, entanglement and quantum gates are employed. We provide a
proof-of-concept implementation using Qiskit. A comparison of the results for
the created circuits using a simulator and IBM machines is conducted, showing
that error rates on contemporary quantum computers are still very high. For the
success of noisy intermediate scale quantum (NISQ) computers, improvements on
the error rates and error mitigation techniques are necessary, even for simple
circuits. We show that quantum error mitigation (QEM) techniques can be used to
improve expectation values of observables on real quantum devices.