Variational Quantum Factoring

Eric R. Anschuetz, Jonathan P. Olson, Alán Aspuru‐Guzik, Yudong Cao · DOI

Abstract

Integer factorization has been one of the cornerstone applications of the field of quantum computing since the discovery of an efficient algorithm for factoring by Peter Shor. Unfortunately, factoring via Shor's algorithm is well beyond the capabilities of today's noisy intermediate-scale quantum (NISQ) devices. In this work, we revisit the problem of factoring, developing an alternative to Shor's algorithm, which employs established techniques to map the factoring problem to the ground state of an Ising Hamiltonian. The proposed variational quantum factoring (VQF) algorithm starts by simplifying equations over Boolean variables in a preprocessing step to reduce the number of qubits needed for the Hamiltonian. Then, it seeks an approximate ground state of the resulting Ising Hamiltonian by training variational circuits using the quantum approximate optimization algorithm (QAOA). We benchmark the VQF algorithm on various instances of factoring and present numerical results on its performance.

Introduction

The ability to factor large integers exponentially faster than classical methods is often cited as the "killer app" for quantum computers. Shor’s algorithm, while theoretically sound, remains impractical for the current Noisy Intermediate-Scale Quantum (NISQ) era. Modern NISQ devices are limited by low qubit counts and high error rates, making the deep circuits required for Shor's algorithm impossible to execute.

Variational Quantum Factoring (VQF) addresses this gap by reframing factoring as a shallow-circuit optimization problem. By combining classical preprocessing with the Quantum Approximate Optimization Algorithm (QAOA), VQF significantly lowers the barrier to entry for factoring on near-term hardware.

Methodology: Factoring as Optimization

Unlike Shor’s algorithm, which relies on period-finding via the Quantum Fourier Transform, VQF treats factoring $m = p \times q$ as the inverse of a multiplication problem. The algorithm follows a hybrid classical-quantum pipeline:

  1. Equation Generation: The multiplication of two unknown integers $p$ and $q$ is represented as a system of Boolean equations.
  2. Classical Preprocessing: This is the critical innovation of the VQF approach. Before the problem is mapped to a quantum state, classical logic rules are used to simplify the Boolean equations. This step removes redundant variables and fixes known bits, drastically reducing the number of qubits required to represent the problem.
  3. Ising Hamiltonian Mapping: The simplified Boolean system is converted into a cost function where the global minimum corresponds to the correct factors. This cost function is then encoded into an Ising Hamiltonian, a structure naturally suited for quantum simulation.
  4. Variational Optimization (QAOA): A quantum processor executes a parameterized circuit (the "ansatz") to prepare a state. A classical optimizer, specifically the BFGS algorithm, iteratively updates these parameters to minimize the expected energy of the Hamiltonian, eventually converging on the ground state.
Figure 1: Comparison of qubit requirements for factoring biprimes with and without classical preprocessing. The preprocessing step reduces the scaling from $O(n_m \log n_m)$ to approximately $O(n_m)$.

Benchmarking and Performance

The researchers benchmarked VQF using a variety of biprime numbers (products of two primes). The test cases included small numbers like 35 ($5 \times 7$) and 77 ($7 \times 11$), as well as larger instances such as 291311 ($523 \times 557$).

Figure 2: Table of specific factoring instances solved by VQF, highlighting the drastic reduction in the number of qubits ($n$) needed after preprocessing.

The results highlight the efficiency of the VQF approach. For the largest instance, 291311, the preprocessing step reduced the problem complexity from an estimated 140+ qubits to just 6. The study also found that the number of classical optimization steps required scaled linearly with the depth of the quantum circuit, suggesting that the optimization overhead remains manageable as problem size increases.

Key Insights and Challenges

Several factors were found to influence the success of VQF:

  • Symmetry: Performance improved significantly when the factors $p$ and $q$ had the same bit length. This $p \leftrightarrow q$ symmetry creates a smoother energy landscape for the classical optimizer.
  • Carry Bits: The presence of "carry bits" in the multiplication logic remains a primary source of difficulty. These bits increase the complexity of the Hamiltonian's energy landscape, potentially leading to local minima.
  • Noise Resilience: Noisy simulations using the Pauli error model suggest that VQF maintains a stable success probability below certain error thresholds, making it a viable candidate for actual NISQ hardware experiments.

Conclusion and Future Work

VQF demonstrates a path forward for factoring on near-term quantum devices by leveraging classical preprocessing to minimize hardware requirements. While the algorithm successfully factored numbers up to 291311 in simulation, it remains a heuristic. Future research will need to address the "craggy" energy landscapes of much larger integers and investigate more advanced equation-mapping strategies to mitigate the impact of carry bits. The ultimate test will be the transition from simulated environments to physical NISQ processors.

Summary updated

BibTeX
@inproceedings{anschuetz2017variational,
  author = {Eric R. Anschuetz and Jonathan P. Olson and Alán Aspuru‐Guzik and Yudong Cao},
  title = {{Variational Quantum Factoring}},
  booktitle = {QTOP@NetSys},
  year = {2017},
  url = {https://openreview.net/forum?id=CfVyDtcrMF},
}
Figure