Chapter 4 Forging quantum data: classically defeating an IQP-based quantum test

4.1 Introduction

Recent experiments have demonstrated groundbreaking quantum computational power in the laboratory, showing quantum computational advantage [AAB+19, ZWD+20, WBC+21, ZCC+22]. In the past decade, much theoretical work has gone into designing experimental protocols expressly for this purpose, and providing evidence for the classical hardness of reproducing the experimental results [AA11, FH19, LBR17, HM17, BIS+18, TER18, NRK+18, BGK18, BGK+20, BFN+19, AG20, BCM+21, BKV+20, KCV+22]. A difficulty with many of them, however, is that the quantum machine’s output is hard to verify. In many cases, the best known algorithm for directly checking the solution is equivalent to classically performing the computational task itself. This presents challenges for validation of the test’s results, because an ideal demonstration of quantum advantage occurs in the regime where a classical solution is not just difficult, but impossible with current technology. In that regime, experiments have had to resort to indirect methods to demonstrate that their devices are producing correct results [AAB+19, ZWD+20, WBC+21, ZCC+22].

Figure 4.1: Algorithm runtime. Mean time to extract the secret vector from -programs constructed as described in [SB09]. Shaded region is the first to third quartile of the distribution of runtimes. We observe that the time is polynomial and fast in practice even up to problem sizes of hundreds of qubits. See Section 4.3.2 for a discussion of the scaling. The data points were computed by applying the algorithm to 1000 unique -programs at each problem size. The secret vector was successfully extracted for every -program tested. Experiments were completed using one thread on an Intel 8268 “Cascade Lake” processor.

In 2008, an efficiently-verifiable test of quantum computational advantage was proposed based on “instantaneous quantum polynomial-time” (IQP) circuits—quantum circuits in which all operations commute [SB09]. The protocol places only moderate requirements on the quantum device, making it potentially a good candidate for near-term hardware. Furthermore, later papers showed based on reasonable assumptions that classically sampling from the resulting distribution should be hard [BJS11, BMS16]. This suggests that a “black-box” approach to cheating classically (by simply simulating the quantum device) is indeed computationally hard, and only a couple hundred qubits would be required to make a classical solution intractable.

Importantly, however, the classical verifier of the efficiently-verifiable protocol does not explicitly check whether the prover’s samples come from the correct distribution (in fact, doing such a check efficiently is probably not possible [BJS11]). Instead, the sampling task is designed such that bitstrings from its distribution will be orthogonal to some secret binary vector with high probability, and it is this property that is checked by the verifier. A question that has remained open is whether a classical machine can efficiently generate samples satisfying the orthogonality check, without necessarily approximating the actual circuit’s distribution. In this work we show that the answer to this question is yes. We give an explicit algorithm that can extract the secret bistring underlying any instance of the protocol, thus making it trivial to generate orthogonal samples that pass the verifier’s test. The main results described here are a statement of the algorithm, a proof that a single iteration of it will extract the secret vector with probability (which can be made arbitrarily close to 1 by repetition), and empirical results demonstrating that the algorithm is efficient in practice (summarized in Figure 4.1).

The following is a summary of the paper’s structure. In Section 4.2, we review the protocol’s construction and some relevant analysis from the original paper. In Section 4.3 we describe the algorithm to extract the secret key, and therefore break the protocol’s security against classical provers. There we also discuss briefly our implementation of the algorithm. In Section 4.4 we discuss the results, and provide the secret key underlying the “$25 challenge” that accompanied the publication of the protocol.

4.2 Background

Overview of protocol

Here we summarize the IQP-based protocol for quantum advantage, in the standard cryptographic terms of an ostensibly quantum prover attempting to prove its quantum capability to a classical verifier. We refer the reader to the work that proposed the protocol for any details not covered here [SB09]. The core of the protocol is a sampling problem. The verifier generates a Hamiltonian consisting of a sum of products of Pauli operators, and asks the quantum prover to generate samples by measuring the state for some value of the “action” . The Hamiltonian is designed such that the measured bitstrings are biased with respect to a secret binary vector , so that with high probability (where represents the binary inner product, modulo 2). The classical verifier, with knowledge of , can quickly check that the samples have such a bias. Since should be only known to the verifier, it was conjectured that the only efficient way to generate such samples is by actually computing and measuring the quantum state [SB09]. However, in Section 4.3 we show that it is possible to extract classically from just the description of the Hamiltonian.

X-programs

A Hamiltonian of the type used in this protocol can be described by a rectangular matrix of binary values, for which each row corresponds to a term of the Hamiltonian. Given such a binary matrix (called an “-program”), the Hamiltonian is

(4.1)

In words, a 1 in at row and column corresponds to the inclusion of a Pauli operator on the site in the term of the Hamiltonian. The -program also has one additional parameter , which is the “action”—the integrated energy over time for which the Hamiltonian will be applied. For the protocol relevant to this work, the action is set to (see below).

Embedding a bias and verifying the output

In order to bias the output distribution along , a submatrix with special properties is embedded within the matrix . Notationally, for a vector and matrix , let the submatrix be that which is generated by deleting all rows of that are orthogonal to . Letting represent the distribution of measurement results for a given -program, it can be shown that the probability that a measurement outcome is orthogonal to the vector , , depends only on the submatrix . The rows of that are orthogonal to are irrelevant. The protocol uses that fact to attempt to hide (and thus ): starting with a matrix that produces a bias, we may attempt to hide it in a larger matrix by appending rows that are random aside from having , and then scrambling the new, larger matrix in a way that preserves the bias.

But what matrix should one start with? In the protocol, the verifier sets to the generator matrix for a binary code of block length whose codewords have (and both those weights are represented, that is, the codewords do not all have weight ). In [SB09], the authors suggest specifically using a binary quadratic residue (QR) code because it has the desired codeword weights. The action is set to . As described in Facts 1 and 2 below, this configuration leads to a gap between the quantum and classical probabilities of generating samples orthogonal to (for the best known classical strategy before this work). The verifier’s check is then simply to request a large number of samples, and determine if the fraction orthogonal to is too large to have likely been generated by any classical strategy.

In the two Facts below, we recall the probabilities corresponding to the quantum strategy and previously best-known classical strategy [SB09]. The reasoning behind the classical strategy (Fact 2) forms the setup for the new algorithm described in this paper; it is worth understanding its proof before moving on to the algorithm in Section 4.3.

Fact 1.

Quantum strategy

Let be an -program constructed by embedding a submatrix with the properties described above. Let be a random variable representing the distribution of bitstrings from an -qubit quantum state measured in the basis, where is defined as in Equation 4.1. Then,

(4.2)
Proof.

The entire proof is contained in [SB09]. To summarize, it is shown that for any string and corresponding submatrix , the probability is

(4.3)

where is the action, is the number of rows in and the expectation is taken over the codewords of the code generated by the submatrix . When the values of , and corresponding to the specific submatrix are substituted into this expression, the result is Equation 4.2.

Fact 2.

Classical strategy of [SB09]

Again let be an -program constructed by embedding a submatrix with the properties described above. Let be two bitstrings of length (the length of a row of ). Define as the matrix generated by deleting the rows of orthogonal to or . 11 1 In [SB09], is written as . Let be the vector sum of the rows of . Letting be the random variable representing the distribution of when and are chosen uniformly at random, then

(4.4)
Proof.

(From [SB09]) With defined as above, we have

(4.5)

By defintion, if . Therefore is equivalent to simply counting the number of rows common to and , or equivalently, counting the rows in for which and are both 1. We can express this using the matrix-vector products of with and :

(4.6)
(4.7)

Considering that is the generator matrix for an error correcting code, denote as the encoding of under . Then we have

(4.8)

Now, note that if a code has for all codewords , the extended version of that code (created by adding a single parity bit) is doubly even, that is, has all codeword weights exactly . A doubly even binary code is necessarily self-dual, meaning all its codewords are orthogonal. This implies that any two codewords and of the original (non-extended) code have iff either or has even parity. Half of our code’s words have even parity and and are random codewords, so the probability that either of them has even parity is . Thus, the probability that is , proving the fact. ∎

In the next section, we show that the classical strategy just described can be improved.

4.3 Algorithm

The classical strategy described in Fact 2 above generates vectors that are orthogonal to with probability . The key to classically defeating the protocol is that it is possible to correlate the vectors generated by that strategy, such that there is a non-negligible probability of generating a large set of vectors that all are orthogonal to . These vectors form a system of linear equations that can be solved to yield . Finally, with knowledge of it is trivial to generate samples that pass the verifier’s test.

We follow a modified version of the classical strategy of Fact 2 to generate each vector in the correlated set. Crucially, instead of choosing random bitstrings for both and each time, we generate a single random bitstring and hold it constant, only choosing new random values for with each iteration. If the encoding of under has even parity, all of the generated vectors will have (see Theorem 1 below). This occurs with probability over our choice of .

In practice, it is more convenient to do the linear solve if all instead of 0. This can be easily accomplished by adding to each a vector with . It turns out that has this property; see proof of Theorem 1.

The explicit algorithm for extracting the vector is given in Algorithm 4.1.

1 Let .
2 Pick .
3 Generate a large number (say ) of vectors via the following steps, collecting the results into the rows of a matrix .;
for  in  do
       4 Pick ;
       5 Let ;
      
end for
6 Via linear solve, find the set of vectors satisfying , where is the vector of all ones.;
foreach candidate vector  do
       7 Extract from by deleting the rows of orthogonal to ;
       8 If adding a parity bit to each of the columns of yields the generator matrix for a code that is doubly even (all basis codewords are doubly even and mutually orthogonal), return and exit. ;
      
end foreach
9 No candidate vector was found; return to step 2. ;
Algorithm 4.1 ExtractKey The algorithm to extract the secret vector from an -program .  is the number of columns in the -program, and means “select uniformly from the set.”

4.3.1 Analysis

In this section we present a theorem and an empirical claim which demonstrate together that Algorithm 4.1 can be used to efficiently extract the key from any -program constructed according to the protocol described in Section 4.2. The theorem shows that with probability  a single iteration of the algorithm finds the vector . The empirical claim is that Algorithm 4.1 is efficient.

Theorem 1.

On input an -program containing a unique submatrix with the properties described in Section 4.2, a single iteration of Algorithm 4.1 will output the vector corresponding to with probability .

Proof.

If is contained in the set generated in step 4 of the algorithm, the correct vector will be output via the check in step 5 because there is a unique submatrix with codewords having . will be contained in as long as satisfies the equation . Thus the proof reduces to showing that with probability .

Each row of is

(4.9)

for a vector defined as

(4.10)

Here we will show that always and for all with probability , implying that with probability .

First we show that . is the sum of all rows of , so we have

(4.11)

We see that the inner product is equal to the number of rows in the submatrix (mod 2). This submatrix is a generator matrix for a code of block size ; thus the number of rows is odd and

(4.12)

Now we turn to showing that for all with probability . In the proof of Fact 2, it was shown that for any two vectors and , vectors generated by summing rows of for which have

(4.13)

where and are the encodings under of and respectively. If is held constant for all , and happened to be chosen such that has even parity, then for all by Equation 4.13. Because half of the codewords have even parity, for selected uniformly at random we have for all with probability .

We have shown that always and for all with probability . Therefore we have

Thus with probability . The algorithm will output whenever , proving the theorem. ∎

 

Before we move on, we remark that while Theorem 1 treats -programs containing a single unique submatrix with the relevant properties, the algorithm can easily be modified to return the vectors corresponding to all such submatrices, if more exist, by simply accumulating all vectors for which the check in Step 5(b) succeeds. We do note, however, that for the protocol described in Section 4.2, the probability of “extraneous” submatrices other than the one intentionally built into the matrix arising by chance is vanishingly small—corresponding to the probability that a random binary linear code happens to be doubly even and self-dual, which is bounded from above by .

Now, having established that each iteration of the algorithm outputs with probability 1/2, we now turn to analyzing its runtime.

Claim 1.

(empirical) Algorithm 4.1 halts in time on average.

All steps of the algorithm except for step 5 have scaling by inspection. The obstacle preventing Claim 1 from trivially holding is that it is hard to make a rigorous statement about how large the set of candidate vectors is. Because , we’d like to show that on average, the rank of is close to or equal to . It seems reasonable that this would be the case: we are generating the rows of by summing rows from , and must have full rank because it contains a rank- error correcting code. But the rows of summed into each are not selected independently—they are always related via their connection to the vectors and , and it’s not clear how these correlations affect the linear independence of the resulting .

Figure 4.2: Analysis of number of candidate vectors to be checked. (a) The average number of candidate vectors checked before the secret vector was found, when the algorithm was applied to 1000 unique -programs at each problem size tested. We observe that the number of vectors to check is qualitatively constant in . (b) The number of unconstrained degrees of freedom for matrices generated in step 3 of Algorithm 4.1, for “good” choices of such that . The rapidly decaying tail qualitatively implies that it is rare for any more than a few degrees of freedom to remain unconstrained. The blue bars represent the distribution over 1000 unique -programs of size . The algorithm was then re-run on the -programs that had to generate the orange bars.

Despite the lack of a proof, empirical evidence supports Claim 1 when the algorithm is applied to -programs generated in the manner described in Section 4.2. Figure 4.2(a) shows the average number of candidate keys checked by the algorithm before is found, as a function of problem size. The value is constant, demonstrating that the average size of the set does not scale with . Furthermore, the value is small—only about 4. This implies that usually has high rank. In Figure 4.2(b) we plot explicitly the distribution of the rank of the matrix over 1000 runs of the algorithm on unique -programs of size . The blue bars (on the left of each pair) show the distribution over all -programs tested, and the sharply decaying tail supports the claim that low-rank almost never occur.

A natural next question is whether there is some feature of the -programs in that tail that causes to be low rank. To investigate that question, the algorithm was re-run 100 times on each of the -programs that had in the blue distribution. The orange bars of Figure 4.2(b) (on the right of each pair) plot the distribution of for that second run. The similarity of the blue and orange distributions suggests that the rank of is not correlated between runs; that is, the low rank of in the first run was not due to any feature of the input -programs. From a practical perspective, this data suggests that if the rank of is found to be unacceptably low, the algorithm can simply be re-run with new randomness and the rank of is likely to be higher the second time.

4.3.2 Implementation

An implementation of Algorithm 4.1 in the programming language Julia (along with the code to generate the figures in this manuscript) is available online [KAH23]. Figure 4.1 shows the runtime of this implementation for various problem sizes. Experiments were completed using one thread on an Intel 8268 “Cascade Lake” processor.

Note that Figure 4.1 shows scaling, rather than from Claim 1. This is due to data-level parallelism in the implementation. vectors are stored as the bits of 64-bit integers, so operations like vector addition can be performed on 64 elements at once via bitwise operations. Furthermore, with AVX SIMD CPU instructions, those operations can be applied to multiple 64-bit integers in one CPU cycle. Thus, for of order 100, the ostensibly vector inner products and vector sums are performed in constant time, removing one factor of from the runtime. The tests in Figure 4.1 were performed on a CPU with 512 bit vector units.

4.4 Discussion

Modifications to the protocol

A natural question is whether it is possible to modify the original protocol such that this attack is not successful. Perhaps can be engineered such that either 1) it is not possible to generate a large number of vectors that all have a known inner product with , or 2) the rank of the matrix formed by these generated vectors will never be sufficiently high to allow solution of the linear system.

For 1), our ability to generate many vectors orthogonal to relies on the fact that the code generated by the hidden submatrix has codewords with , as shown in the proof of Theorem 1. Unfortunately, this property regarding the weights of the codewords is precisely what gives the quantum sampling algorithm its bias toward generating vectors with (see Fact 1). This fact seems to preclude the possibility of simply removing the special property of the submatrix to prevent the attack.

For 2), the main obstacle is that the matrix must have rank because embedded in it is a code of rank . The only hope is to somehow engineer the matrix such that linear combinations generated in the specific way described above will not themselves be linearly independent. It is not at all clear how one would do that, and furthermore, adding structure to the previously-random extra rows of runs the risk of providing even more information about the secret vector . Perhaps one could prove that the rank of will be large even for worst-case inputs —this could be an interesting future direction.

Protocols with provable hardness

The attack described in this paper reiterates the value of building protocols for which passing the test itself, rather than just simulating the quantum device, can be shown to be hard under well-established cryptographic assumptions. In the past few years, a number of new trapdoor claw-free function based constructions have been proposed for demonstrating quantum computational advantage [BCM+21, BKV+20, KCV+22, AMM+22], as well as some based on other types of cryptography [YZ22, KLV+22]. Unfortunately, such rigorous results come with a downside, which is an increase in the size and complexity of circuits that must be run on the quantum device. Exploring simplified protocols that are provably secure is an exciting area for further research.

The $25 challenge

When the protocol was first proposed in [SB09], it was accompanied by an internet challenge. The authors posted a specific instance of the matrix , and offered $25 to anyone who could send them samples passing the verifier’s check. The secret vector corresponding to their challenge matrix is (encoded as a base-64 string):


BilbHzjYxrOHYH4OlEJFBoXZbps4a54kH8flrRgo/g==

The key was extracted using the implementation of Algorithm 4.1 described in Section 4.3.2.

Shepherd and Bremner, the authors of the challenge, have graciously confirmed that this indeed is the correct key.

Summary and outlook

Here we have described a classical algorithm that passes the interactive quantum test described in [SB09]. We have proven that a single iteration of the algorithm will return the underlying secret vector with probability , and empirically shown that it is efficient. The immediate implication of this result is that the protocol in its original form is no longer effective as a test of quantum computational power. While it may be possible to reengineer that protocol to thwart this attack, this paper reiterates the value of proving the security of the verification step. Furthermore, while protocols for quantum advantage with provable classical hardness are valuable in their own right, they can also be used as building blocks for achieving new, more complex cryptographic tasks, like certifiable random number generation, secure remote state preparation, and even the verification of arbitrary quantum computations [BCM+21, GV19, MAH18]. As quantum hardware continues to improve and to surpass the abilities of classical machines, quantum cryptographic tools will play an important role in making quantum computation available as a service. Establishing the security of these protocols is an important first step.