Analyzing the performance of variational quantum factoring on a superconducting quantum processor

In the near-term, hybrid quantum-classical algorithms hold great potential for outperforming classical approaches. Understanding how these two computing paradigms work in tandem is critical for identifying areas where such hybrid algorithms could provide a quantum advantage. In this work, we study a QAOA-based quantum optimization approach by implementing the Variational Quantum Factoring (VQF) algorithm. We execute experimental demonstrations using a superconducting quantum processor, and investigate the trade off between quantum resources (number of qubits and circuit depth) and the probability that a given biprime is successfully factored. In our experiments, the integers 1099551473989, 3127, and 6557 are factored with 3, 4, and 5 qubits, respectively, using a QAOA ansatz with up to 8 layers and we are able to identify the optimal number of circuit layers for a given instance to maximize success probability. Furthermore, we demonstrate the impact of different noise sources on the performance of QAOA, and reveal the coherent error caused by the residual ZZ-coupling between qubits as a dominant source of error in a near-term superconducting quantum processor.


I. INTRODUCTION
While near-term quantum devices are approaching the limits of classical tractability [1,2], they are limited in the number of physical qubits, and can only execute finitedepth circuits with sufficient fidelity to be useful in applications [3].Hybrid quantum-classical algorithms hold great promise for achieving a meaningful quantum advantage in the near-term [4][5][6] by combining the quantum resources offered by near-term devices with the computational power of classical processors.In a hybrid algorithm, a classical computer pre-processes a problem instance to expose the core components which capture its essential computational hardness, and is also in a form compatible with a quantum algorithm.The classical computer then utilizes a near-term quantum computer to finish solving the problem.The output of the quantum computer is classical bitstrings which are postprocessed classically.This interaction may be iterative: the classical computer may also send communication and control signals to and from the quantum device, for example, by proposing new parameter values to be used in a parameterized quantum circuit.
Quantum algorithms developed for near-term quantum hardware will have to contend with several hardware restrictions, such as number of qubits, coupling connectivity, gate fidelities, and various sources of noise, which are all highly dependent on the particular quantum processor the algorithm is being run on.Tradeoffs between different resources have recently been demonstrated in the context of running quantum circuits [7].However, even as faulttolerant quantum processors are built, classical computing will still be required to perform pre-processing and post-processing, as well as for quantum error-correction [8].Therefore, understanding how quantum and classical computing resources can be leveraged together is imperative for extracting maximal utility from quantum computers.
An illustration of this hybrid scheme, in the context of this work, is shown in Fig. 1.In this work, we implement the variational quantum factoring (VQF) algorithm [9] on a superconducting quantum processor [10].VQF is an algorithm for tackling an NP problem with a tunable trade off between classical and quantum computing resources, and is feasible for near-term devices.VQF uses classical pre-processing to reduce integer factoring to a combinatorial optimization problem which can be solved using the quantum approximate optimization algorithm (QAOA) [11].
VQF is a useful algorithm to study for several reasons.First, an inverse relationship exists between the amount of classical pre-processing and the number of required qubits needed to finish solving the problem, resulting in a tunable tradeoff between the amount of classical computation and qubits used.Second, the complexity of the quantum circuit acting on those qubits is tunable by adjusting the number of layers used in the QAOA ansatz.Finally, VQF has the advantage that its success is quickly verifiable on a classical computer, by checking if the proposed factors multiply to the input biprime.
This paper is organized as follows.Section II provides an overview of the variational quantum factoring algorithm.Section III describes the experimental results from our implementation.Furthermore, we study the impact of different sources of noise on the algorithm's performance.The analysis in this section extends beyond VQF and to any general instance of QAOA.We conclude in Section IV, and consider the implications of this work.

II. VARIATIONAL QUANTUM FACTORING
The variational quantum factoring (VQF) algorithm maps the problem of factoring into an optimization problem [12].Given an n-bit biprime number factoring involves finding the two prime factors p and q satisfying N = pq, where That is, p and q can be represented with n q and n p bits, respectively.
Factoring in this way can be thought of as the inverse problem to the "longhand" binary multiplication: the value of the i th bit of the result, N i , is known and the task is to solve for the bits of the prime factors {p i } and {q i }.An explicit binary multiplication of p and q yields a series of equations that have to be satisfied by {p i } and {q i }, along with carry bits {z i,j } which denote a bit carry from the i th to the j th position.Re-writing each equation in the series allows it to be associated to a particular clause in an optimization problem relating to the bit N i : In order for each clause, C i , to be 0, the values of {p i }, {q i } and the carry bits {z i,j } in the clause must be correct.By satisfying the constraint for all clauses, the factors p and q can be retrieved.
Given this, the problem of factoring is thus reduced to a combinatorial optimization problem.Such problems can be solved using quantum computers by associating a qubit with each bit in the cost function.The number of qubits needed depends on the number of bits in the clauses.As discussed in [9], some number of classical preprocessing heuristics can be used to simplify the clauses (that is, assign values to some of the bits {p i } and {q i }).As classical preprocessing removes variables from the optimization problem (by explicitly assigning bit values), the number of qubits needed to complete the solution to the problem is reduced.The new set of clauses will be denoted as {C i }; Appendix C discusses details of this classical preprocessing.
Each clause C i can be mapped to a term in an Ising Hamiltonian Ĉi by associating each bit value (b k ∈ {p i , q i , z i,j }) to a corresponding qubit operator: The solution to the factoring problem corresponds to finding the ground state of the Hamiltonian with a well defined ground state energy E 0 = 0.Because each clause C i in equation 4 contains quadratic terms in the bits and the Hamiltonian ĤC is a sum of squares of Ĉi , ĤC includes 4-local terms of the form  [16,17].However, the interactions between the qubits in the resulting 2-local Hamiltonian is not guaranteed to correspond to a d-regular graph, which again falls outside the scope of existing considerations in the literature.
The ground state of the Hamiltonian in equation ( 6) can be approximated on near-term, digital quantum computers using QAOA [11].QAOA is a good candidate for demonstrating quantum advantage through combinatorial optimization [18][19][20].Each layer of a QAOA ansatz consists of two unitary operators, each with a tunable parameter.The first unitary operator is which applies an entangling phase according to the cost Hamiltonian ĤC .The second unitary is the admixing operation which applies a single-qubit rotation around the X-axis with angle 2β to each qubit.For a given number of layers p, the combination of U H (γ) and U a (β) are repeated sequentially with different parameters, generating the ansatz state . The approximate ground state for the cost Hamiltonian can reached by tuning these 2p parameters.Given this ansatz state, a classical optimizer is used to find the optimal parameters γ opt and β opt that minimize the expected value of the cost Hamiltonian where for each γ and β the value E(γ, β) is estimated on a quantum computer.The circuit γ opt , β opt is then prepared on the quantum computer and measured.If the outcome of the measurement satisfies all the clauses, it can be mapped to the remaining unsolved binary variables in {p i }, {q i }, and {z i,j }, resulting in the prime factors p and q.
The success of VQF is measured by the probability that a measured bitstring encodes the correct factors.We define the set M s = {m j } consisting of all bitstrings sampled from the quantum computer that satisfy all the clauses in the Hamiltonian, ĤC .We can therefore define the success rate, s(γ, β), as the proportion of the bitstrings sampled from |γ, β that satisfy all clauses in {C i }: where |M s | is the number of samples satisfying all the clauses and |M | is the total number of measurements sampled.
In order to successfully factor the input biprime, only one such satisfactory bitstring needs to be observed.However, if that bitstring occurs very rarely, then many repeated preparations and measurements of the trial state are necessary.Therefore, a higher value of s(γ, β) is generally preferred.E(γ, β) ≥ 0, with the equality condition satisfied if s(γ, β) = 1.
FIG. 2. QAOA optimization landscapes.For a fixed VQF instance on 3 qubits, we study the impact of noise (rows) on the optimization landscape as a function of the number of QAOA layers in the ansatz (columns).To produce these landscapes, we use a resolution of π/32, resulting in 1024 grid points.For the second and third layers, the ansatz parameters for the previous layers are fixed to the optimal parameters found through ideal simulation.3. Success rates for running VQF on the integers (a) 1099551473989 (b) 3127 and (c) 6557 using 3, 4, and 5 qubits, respectively.We compare the results obtained from experiments (red line) to ideal simulation (blue line), simulation containing phase and amplitude damping noise (orange line), and the residual ZZ-coupling (green line).The amplitude damping rate (T1≈64µs), dephasing rate (T2≈82µs), and residual ZZ-coupling (Table B) reflect the values measured on the quantum processor.We observe that our experimental performance is limited by the residual ZZ-coupling present in the quantum processor.

III. EXPERIMENTAL ANALYSIS
In this work, we implement the VQF algorithm using the QAOA ansatz on the ibmq boeblingen superconducting quantum processor (Appendix A) to factor three biprime integers: 1099551473989, 3127, and 6557 which are classically preprocessed to instances with 3, 4, and 5 qubits respectively.The number of qubits required for each instance varies based the amount of classical pre-processing performed; 24 iterations of classical preprocessing were used for 1099551473989, 8 iterations for 3127, and 9 iterations for 6557.
In order to optimize the QAOA circuit to find γ opt and β opt we employ a layer-by-layer approach [21].Although there are alternative strategies for training QAOA circuits [22,23], this approach has been shown to require a grid resolution that scales polynomially with respect to the number of qubits required [9].This approach has two phases.
In the first phase, for each layer k, we first evaluate a two-dimensional energy landscape by sweeping through different γ k and β k values while fixing the parameters for the previous layers (1, 2, ... through k − 1) to the optimal values found earlier.In our experiments, for 1099551473989 we evaluate the energy for discrete values of γ k and β k ranging from 0 to 2π with a resolution of π/6, which yields 144 circuit evaluations for each layer.For 3127 and 6557, we use a resolution of 2π/23, which yields 529 circuit evaluations for each layer (Appendix F).We use the degeneracy in the energy landscape caused by evaluating β up to 2π instead of π as a feature to better understand the pattern of the energy landscape.We then select the optimal values for γ k and β k from this grid, and combine them with the optimal values from the previous layer.We increment k until it reaches the last layer, in which case the completion of the final round of the above steps marks the end of the first phase of the algorithm.
In the second phase, we use the values {(γ k , β k )} obtained from the first phase as the initial point for a gradient-based optimization using the L-BFGS-B method over all 2k parameters.In order to measure the gradient of E(γ, β) with respect to the individual variational parameters, we use analytical circuit gradients using the parameter-shift rule [24].As shown in Fig. 3, we use the optimal parameters found for a circuit with p layers using this method to prepare and measure γ opt , β opt in order to calculate the algorithm success rate as defined by equation (11).
The performance of our algorithm relies on the optimization over an energy surface spanned by the variational parameters γ and β for each layer.Consequently, by studying this energy surface, we can understand the performance of the optimizer in tuning the parameters of the ansatz state, which in turn impacts the success rate.We do so by visualizing the energy landscape for the k th layer of the ansatz as a function of the two variational parameters, β k and γ k , fixing γ = (γ 0 , .., γ k−1 ) and β = (β 0 , .., β k−1 ) to the optimal values obtained through ideal simulation.Comparing these landscapes between experimental results, ideal simulation, and noisy simulation provides us with a valuable insight into the performance of the algorithm on quantum hardware.
The main sources of incoherent noise present in the quantum processor are qubit relaxation and decoherence.In order to capture the effects of these sources of noise on our quantum circuit in simulation, we apply a relaxation channel with relaxation parameter r and a dephasing channel with dephasing parameter d after each gate, described by: with Kraus operators Furthermore, a dominant source of coherent error is a residual ZZ-coupling between the transmon qubits [25].This interaction is caused by the coupling between the higher energy levels of the qubits, and is especially pronounced in transmons due to their weak anharmonicity.
In our experiments, we measure the average residual ZZcoupling strength to be ξ/2π = 102 ± 124kHz (Appendix B).While the additional ZZ rotation caused by this interaction when the qubits are idle between gates can be compensated by the tunable parameters γ, this interaction has a severe impact on the two-qubit gates.In our experiments the Ising terms e iγZZ = CNOT • I ⊗ Z(γ) • CNOT are realized using a single-qubit Z rotation conjugated by CNOT gates.Each CNOT is comprised of a ZX term generated by a two-pulse echo cross-resonance gate [26] and single-qubit rotations: However, in the presence of residual ZZ-coupling, the axis of rotation of the cross-resonance (CR) gate is altered: where Γ is the ZX coupling strength between the qubits as the result of the cross-resonance drive and Ξ is the overall effect of the residual ZZ-coupling between the qubits involved in the drive and their neighbors (see Appendix B).As a result the two-qubit interactions are fundamentally altered, which leads to a source of error that cannot be corrected for through the variational parameters.Fig. 2 shows the energy landscapes from factoring 1099551473989 across 3 layers.Comparing the the energy landscape produced in experiment with the ideal simulation and noisy simulations indicates that the energy landscapes produced in experiment is in close agreement with those produced by the ideal simulation and the simulation with incoherent noise for p = 1 and p = 2.However, for p = 3 the energy landscapes produced in experiment have considerable deviations from the ideal simulations due to coherent errors.The presence of incoherent sources of noise do not change the energy landscape pattern, and only reduce the contrast at every layer.On the other hand, the residual ZZ-coupling between qubits alters the pattern of the energy landscape.While at lower depths the impact of this noise source is minor, yet as we add more layers of the ansatz the effects accumulate, constructively interfere, and amplify due to the coherent nature of the error.Fig. 3 reports the average success rate of VQF as a function of the number of layers in the ansatz for experiment and simulation.As would be expected, in the ideal case the average success rate approaches the ideal value of 1 with increasing layers of the ansatz for each of the instances studied.Comparing experimental results to those obtained from ideal simulation shows a large discrepancy in the success rate.This discrepancy is not explained by the incoherent noise caused by qubit relaxation and dephasing; the coherent error caused by the residual ZZ-coupling is the dominant effect negatively impacting the success rate.Therefore we conclude that the performance of VQF, and other QAOA-based hybrid quantum-classical algorithms by extension, is limited by the residual ZZ-coupling between the qubits on transmon-based superconducting quantum processors.
We investigate the impact of different noise channels on the success rate scaling of VQF, with results shown in Fig. 4. In the ideal scenario, with every added layer of QAOA, which increases the ansatz expressibility [27], the algorithm success rate increases.However, in the presence of phase damping, after an initial increase in the success rate we observe a plateau after which the succcess rate neither increases nor decreases as more layers of the ansatz circuit are added.We expect that this behavior is caused by a loss of quantum coherence at higher layers of circuit, which hinders the quantum interference required for the algorithm.In constrast, while undergoing amplitude damping, after an initial increase in the success rate we observe a steady decay in the algorithm's performance.This decay is a result of qubit relaxation back to the |0 state.When examining the effect of the coherent error induced by the residual ZZ-coupling, we see a more dramatic effect than that induced by either phase damping or amplitude damping.In the presence of the coherent error induced by the residual ZZ-coupling, we observe a plateau in the success rate for lower frequencies (10 kHz and 25 kHz) and a decline in success rate for higher frequencies (50 kHz and 100 kHz) within the first twenty layers of the ansatz.
While each of the sources of noise impact the algorithm's performance, the residual ZZ-coupling between the qubits in the quantum processor has the most dominant impact on the success rate; Our analysis indicates that this coherent error is the main source of error impeding the effectiveness of the algorithm.The accumulation of coherent noise from this source significantly alters the ansatz at higher layers, and cannot be corrected using the variational parameters.The results shown in Fig. 4 indicate that the performance of VQF can be significantly improved by engineering ZZ suppression [28,29].Since VQF is a non-trivial instance of QAOA we expect this performance analysis to also hold for other quantum algorithms based upon QAOA.

IV. CONCLUSION
In this work, we analyzed the performance of VQF on a fixed-frequency transmon superconducting quantum processor and investigated several kinds of classical and quantum resource tradeoffs.We map the problem of factoring to an optimization problem and use variable amounts of classical preprocessing to adjust the number of qubits required.We then use the QAOA ansatz with a variable number of layers to find the solution to the optimization problem.We find that the success rate of the algorithm saturates as p increases, instead of decreasing to the accuracy of random guessing.While more layers increases the expressibility of the ansatz, at higher depths the circuit suffer from the impacts of noise.
Our analysis indicate that the residual ZZ-coupling between the transmon qubits significantly impacts performance.While relaxation and decoherence have an impact on the quantum coherence, especially at the deeper layers of QAOA, the effect of coherent noise can quickly accumulate and limit performance.By developing a noise model incorporating the coherent sources of noise, we are able to much more accurately predict our experimental results.
There have been various techniques [7,30] proposed for benchmarking the capability of a quantum device for performing arbitrary unitary operations.However, recent findings on experimental systems [3] suggest that existing benchmarking methods may not be effective for predicting the capability of a quantum device for specific applications.This has motivated recent works that focus on benchmarking the performance of a quantum device for applications such as generative modeling [31] and fermionic simulation [32].Our study of VQF on a superconducting quantum processor has the potential to become another entry in the collection of such "applicationbased" benchmarks for quantum computers.To factor 1099551473989 we use qubits 0, 1, and 2 (shaded in maroon).To factor 3127 we use qubits 0, 1, 2, and 3 (shaded in yellow).To factor 6557 we use qubits 3, 6, 7, 8, and 12 (shaded in green).
For our experiments we use the 20 qubit Boeblingen system.This quantum processor consists of 20 fixed-frequency transmon qubits, with microwave-driven single and two-qubit gates, and with a connectivity map as depicted in Fig. 5.For the experiments discussed in this paper use the CNOT as our native two-qubit gate which is driven via the cross-resonance interaction between coupled qubits.Experiments were conducted on the highlighted qubits, for their respective single and two qubit gate fidelities have a higher fidelity, as well as a relatively low readout error.Qubit properties and two-qubit gate characterization can be found in table I and II respectively.For factoring 1099551473989 we use Q0, Q1, and Q2, for factoring 3127 we use Q0, Q1, Q2, and Q3, and for factoring 6557 we use Q3, Q6, Q7, Q8, and Q12.The runtime of the classical preprocessor is O(n 2 ) [9].Without preprocessing the VQF qubit requirements scale as O(nlog n), whereas this resource bound empirically gets reduced to O(n) using the classical preprocessor (Fig. 8).We additionally note that for certain biprimes, the preprocessor is able to significantly reduce the number of required qubits, in some cases completely solving the clauses.Additionally, in Fig. 9, we show the scaling of 1-local, 2-local, 3-local, and 4-local terms in the resulting hamiltonians, after classical preprocessing, for factoring a given biprime N .In Tables IV, V, and VI, we show the relevant properties for the circuits used in both simulation and experiment for each of the problems studied.We use the Qiskit transpiler, with the optimization level set to 1, to create the circuits with the correct gate set for IBMQ devices.Due to the non-deterministic nature of this transpiler, we independently run the transpilation process 10 times, using the circuit with the least number of cx gates.

FIG. 4 .
FIG.4.Impact of different sources of noise on success rate when factoring 6557 using 5 qubits: (a) phase damping, (b) amplitude damping, and (c) residual ZZ-coupling between qubits with a two-qubit gate time of tg = 315 ns.The average T2, T1, and frequency of the residual ZZ-coupling for the given device are 82µs, 64µs, and 102 kHz respectively.

FIG. 8 .
FIG.8.Empirical results on number of qubits required for factoring a biprime N after classical preprocessing.n represents the number of bits needed to represent the given biprime.

FIG. 9 .
FIG.9.Empirical results on number of n-local terms in the hamiltonain for factoring a biprime N after classical preprocessing.
[14,15], can be directly mapped to ground state problems of 3-local Hamiltonians.The 4-local Ising Hamiltonian problems produced for VQF motivates a new entry to the classes of Ising Hamiltonian problems currently studied in the context of QAOA.In principle, one can reduce any k-local Hamiltonian to 2-local by wellknown techniques

TABLE I .
Single-qubit characterization.Data acquired over the span of 14 days.

TABLE II .
Two-qubit properties.Data acquired over the span of 14 days.Effects of residual ZZ-coupling on spectator qubits with different cross-resonance gate decompositions.We compare the effects of incorporating the residual ZZ-coupling noise on spectator qubits during the cross resonance gate under both the single CR pulse and ECR 2−pulse protocols.