Logical Abstractions for Noisy Variational Quantum Algorithm
Total Page:16
File Type:pdf, Size:1020Kb
Logical Abstractions for Noisy Variational antum Algorithm Simulation Yipeng Huang Steven Holtzen Todd Millstein [email protected] [email protected] [email protected] Rutgers University University of California, Los Angeles University of California, Los Angeles New Brunswick, NJ, United States Los Angeles, CA, United States Los Angeles, CA, United States Guy Van den Broeck Margaret Martonosi [email protected] [email protected] University of California, Los Angeles Princeton University Los Angeles, CA, United States Princeton, NJ, United States ABSTRACT KEYWORDS Due to the unreliability and limited capacity of existing quantum quantum circuits, Bayesian networks, conjunctive normal form, computer prototypes, quantum circuit simulation continues to be a knowledge compilation, exact inference, simulation vital tool for validating next generation quantum computers and ACM Reference Format: for studying variational quantum algorithms, which are among Yipeng Huang, Steven Holtzen, Todd Millstein, Guy Van den Broeck, and Mar- the leading candidates for useful quantum computation. Existing garet Martonosi. 2021. Logical Abstractions for Noisy Variational Quantum quantum circuit simulators do not address the common traits of Algorithm Simulation. In Proceedings of the 26th ACM International Con- variational algorithms, namely: 1) their ability to work with noisy ference on Architectural Support for Programming Languages and Operating qubits and operations, 2) their repeated execution of the same cir- Systems (ASPLOS ’21), April 19–23, 2021, Virtual, USA. ACM, New York, NY, cuits but with dierent parameters, and 3) the fact that they sample USA, 17 pages. https://doi.org/10.1145/3445814.3446750 from circuit nal wavefunctions to drive a classical optimization routine. We present a quantum circuit simulation toolchain based Before After on logical abstractions targeted for simulating variational algo- rithms. Our proposed toolchain encodes quantum amplitudes and noise probabilities in a probabilistic graphical model, and it com- piles the circuits to logical formulas that support ecient repeated simulation of and sampling from quantum circuits for dierent parameters. Compared to state-of-the-art state vector and density matrix quantum circuit simulators, our simulation approach oers greater performance when sampling from noisy circuits with at Figure 1: Equivalent knowledge com- least eight to 20 qubits and with around 12 operations on each pilation representations of a 4-qubit qubit, making the approach ideal for simulating near-term varia- noisy QAOA quantum circuit. In this tional quantum algorithms. And for simulating noise-free shallow work we calculate and sample ampli- quantum circuits with 32 qubits, our simulation approach o ers a tudes from arithmetic circuits (ACs) 66 reduction in sampling cost versus quantum circuit simulation ⇥ representing noisy quantum circuits. techniques based on tensor network contraction. To the left, direct compilation results in ACs where qubit states ordered in time CCS CONCEPTS progresses from top to bottom. Above, • Computer systems organization Quantum computing; • optimizations such as logical minimiza- ! Mathematics of computing Probabilistic inference prob- tion, qubit state reordering, and eliding ! lems; Bayesian networks; Decision diagrams; • Computing method- internal qubit states reduce the size of ologies Knowledge representation and reasoning. the AC. The reduced but equivalent rep- ! resentation leads to more ecient sim- Permission to make digital or hard copies of all or part of this work for personal or ulation and sampling. classroom use is granted without fee provided that copies are not made or distributed for prot or commercial advantage and that copies bear this notice and the full citation on the rst page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, 1 INTRODUCTION to post on servers or to redistribute to lists, requires prior specic permission and/or a fee. Request permissions from [email protected]. Consensus among quantum systems researchers is that variational ASPLOS ’21, April 19–23, 2021, Virtual, USA algorithms are among the most important near-term applications of © 2021 Association for Computing Machinery. ACM ISBN 978-1-4503-8317-2/21/04. quantum computing [50, 55]. Variational algorithms work by using https://doi.org/10.1145/3445814.3446750 a classical computer to train for optimal parameters that minimize 456 ASPLOS ’21, April 19–23, 2021, Virtual, USA Yipeng Huang, Steven Holtzen, Todd Millstein, Guy Van den Broeck, and Margaret Martonosi a function evaluated by a quantum computer. Examples include (1) A front-end for converting noisy quantum circuits (specied the quantum approximate optimization algorithm (QAOA) [26, 27] in Google’s Cirq framework1) to complex-valued Bayesian and the variational quantum eigensolver (VQE) [53] algorithm for networks [8, 10, 47, 54, 63, 66], which we extend to correctly physical simulations. Unlike prominent quantum algorithms such encode quantum noise mixtures and channels. Compared as Shor’s factoring [58] and Grover’s search [30] algorithms, vari- to conventional quantum circuits where complex-valued ational algorithms can extract useful computation out of noisy quantum amplitudes and real-valued noise probabilities are intermediate-scale quantum (NISQ) computer prototypes, which treated separately, the Bayesian network encoding unies only support unreliable operations on a limited number of qubits quantum states and noise events in a single representation. (the fundamental unit of quantum computing). (2) A compiler that converts Bayesian networks representing A further consequence of the limited capacity, reliability, and noisy quantum circuits into conjunctive normal form (CNF) endurance of existing quantum prototypes is that simulation using logic formulas. The CNFs encode the quantum circuits’ struc- classical computers continues to be a critical research tool [50, tural information: the sets of logic variable assignments that Chapter 6.3]. Classical computer simulations of quantum algorithm satisfy the CNF correspond to all sets of qubit state assign- circuits are important for developing new quantum algorithms and ments that are consistent with the original quantum cir- for validating results from quantum prototypes. cuit’s semantics. This structural information can be reused Thus far, the most advanced quantum circuit simulators are not across simulations independently of quantum amplitude and geared for simulating important variational quantum algorithms. noise probability parameters, which vary across simulations, Quantum computing research would benet from a simulator that which is a key benet over prior simulation techniques. supports variational algorithms specically, which would require (3) A compiler that converts CNFs to ACs. An AC enumerates a simulator that 1) supports simulating the eect of noise, 2) e- and assigns a weight value to each set of variable assignments ciently supports repeated simulations with dierent parameters, 3) that satisfy a logical formula [22]. Summing the weights oers an ability to sample from the output of the quantum computer, across all qubit state assignments results in the output ampli- and 4) excels at simulating quantum circuits with many qubits and tudes that we seek to nd in the quantum circuit simulation relatively few operations per qubit. Unfortunately, leading quantum task. The compiler can factor away the variables that repre- circuit simulators have instead focused on simulations that estab- sent intermediate qubit states, thereby enabling the quantum lish the point at which limitations of classical computing give way circuit simulator to nd the probability amplitude for an out- to quantum computers having an advantage, a milestone termed come without incurring the cost of nding the amplitudes quantum supremacy [3, 32, 48, 62]. Such simulators can only simu- of intermediate qubit states. The ACs also enable a Markov late quantum circuits that are ideal (noise-free), and they cannot chain Monte Carlo procedure for sampling sets of qubit out- reuse computation results across simulation runs. The clear mis- comes according to their measurement probability. match between the requirements for variational algorithm versus supremacy simulations have resulted in simulators that do not We validate our compilation and simulation approach for both adequately support important variational workloads. noise-free and noisy quantum circuits, demonstrating correct re- The key insight of our paper is that knowledge compilation—a sults for a suite of quantum algorithms including Deutsch-Jozsa, technique for ecient repeated inference originating in articial Bernstein-Vazirani, hidden shift, quantum Fourier transform, Shor’s, intelligence research [22, 23]—can serve as the basis for a quantum and Grover’s algorithms. circuit simulation toolchain geared for variational algorithms. In a We benchmark the performance of our simulator for sampling knowledge compilation approach to performing inference, knowl- outputs for a QAOA algorithm for Max-Cut and a VQE algorithm edge about probabilistic relationships between events is rst en- for nding the minimum energy con guration of a 2D Ising model. coded in a graphical model such as a Bayesian network [22, 42, 52]. Compared to state-of-the-art simulators for both ideal and noisy The knowledge compilation techniques convert Bayesian