Quantum Algorithms for Deep Convolutional Neural Networks

Quantum computing is a powerful computational paradigm with applications in several fields , including machine learning . In the last decade , deep learning , and in particular Convolutional Neural Networks ( CNN ) , have become essential for applications in signal processing and image recognition . Quantum deep learning , however , remains a challenging problem , as it is difficult to implement non linearities with quantum unitaries Schuld et al . ( 2014 ) . In this paper we propose a quantum algorithm for evaluating and training deep convolutional neural networks with potential speedups over classical CNNs for both the forward and backward passes . The quantum CNN ( QCNN ) reproduces completely the outputs of the classical CNN and allows for non linearities and pooling operations . The QCNN is in particular interesting for deep networks and could allow new frontiers in the image recognition domain , by allowing for many more convolution kernels , larger kernels , high dimensional inputs and high depth input channels . We also present numerical simulations for the classification of the MNIST dataset to provide practical evidence for the efficiency of the QCNN . 1 INTRODUCTION . The growing importance of deep learning in research , in industry and in our society will require extreme computational power as the dataset sizes and the complexity of these algorithms is expected to increase . Quantum computers are a good candidate to answer this challenge . The recent progress in the physical realization of quantum processors and the advances in quantum algorithms increases the importance of understanding their capabilities and limitations . In particular , the field of quantum machine learning has witnessed many innovative algorithms that offer speedups over their classical counterparts Kerenidis et al . ( 2019 ) ; Lloyd et al . ( 2013 ; 2014 ) ; Kerenidis & Prakash ( 2017b ) ; Wiebe et al . ( 2014a ) . Quantum deep learning refers to the problem of creating quantum circuits that mimic and enhance the operations of neural networks . It has been studied in several works Allcock et al . ( 2018 ) ; Rebentrost et al . ( 2018 ) ; Wiebe et al . ( 2014b ) but remains challenging as it is difficult to implement non linearities with quantum unitaries Schuld et al . ( 2014 ) . In this work we propose a quantum algorithm for convolutional neural networks ( CNN ) , a type of deep learning designed for visual recognition , signal processing and time series . We also provide results of numerical simulations to evaluate the running time and accuracy of the quantum convolutional neural network ( QCNN ) . Note that our algorithm is theoretical and could be compiled on any type of quantum computers ( trapped ions , superconducting qubits , cold atoms , photons , etc . ) The CNN was originally developed by LeCun et al . ( 1998 ) in the 1980 ’ s . They have achieved great practical success over the last decade Krizhevsky et al . ( 2012 ) and have been used in cutting-edge domains like autonomous cars Bojarski et al . ( 2016 ) and gravitational wave detection George & Huerta ( 2018 ) . Despite these successes , CNNs suffer from computational bottlenecks due to the size of the optimization space and the complexity of the inner operations , these bottlenecks make deep CNNs resource expensive . The growing interest in quantum machine learning has led researchers to develop different variants of Quantum Neural Networks ( QNN ) . The quest for designing quantum analogs of neural networks is challenging due to the modular layer architecture of the neural networks and the presence of non linearities , pooling , and other non unitary operations , as explained in Schuld et al . ( 2014 ) . Several strategies have been tried in order to to implement some features of neural networks Allcock et al . ( 2018 ) ; Wiebe et al . ( 2014b ) ; Beer et al . ( 2019 ) in the quantum setting . Variational quantum circuits provide another path to the design of QNNs , this approach has been developed in Farhi & Neven ( 2018 ) ; Henderson et al . ( 2019 ) ; Killoran et al . ( 2018 ) . A quantum convolutional neural network architecture using variational circuits was recently proposed Cong et al . ( 2018 ) . However further work is required to provide evidence that such techniques can outperform classical neural networks in machine learning settings . 2 PRELIMINARIES . 2.1 CONVOLUTION PRODUCT AS MATRIX MULTIPLICATION . We briefly introduce the formalism and notation concerning classical convolution product and its equivalence with matrix multiplication . More details can be found in Appendix ( Section C ) . A single layer ` of the classical CNN does the following operations : from an input image X ` ∈ RH ` ×W ` ×D ` seen as a 3D tensor , and a kernel K ` ∈ RH×W×D ` ×D ` +1 seen as a 4D tensor , it performs a convolution product and outputs X ` +1 = X ` ∗K ` , with X ` +1 ∈ RH ` +1×W ` +1×D ` +1 . This convolution operation is equivalent to the matrix multiplication A ` F ` = Y ` +1 where A ` , F ` and Y ` +1 are suitably vectorized versions of X ` , K ` and X ` +1 respectively . The output of the layer ` of the CNN is f ( X ` +1 ) where f is a non linear function . 2.2 QUANTUM COMPUTING . For a detailed introduction to quantum computing and its applications to machine learning in the context of this work , we invite the reader to look at Appendix F. We also refer to Nielsen & Chuang ( 2002b ) for a more complete overview of quantum computing . In this part we will discuss only briefly the core notions of quantum computing . Like a classical bit , a quantum bit ( qubit ) can be |0〉 , |1〉 , but can also be in a superposition state α |0〉 + β |1〉 with amplitudes ( α , β ) ∈ C such that |α|2 + |β|2 = 1 . With n qubits it is then possible to construct a superposition of the 2n binary combinations possible , each with a specific amplitude . We will note the ith combination ( e.g . |01 · · · 110〉 ) as |i〉 . A vector v ∈ Rd can be encoded in a quantum state made of dlog ( d ) e qubits . This encoding is a quantum superposition , where the components ( v1 , · · · , vd ) of v are used as the amplitudes of the d binary combinations . We note this state |v〉 : = 1‖v‖ ∑ i∈ [ d ] vi |i〉 , where |i〉 is a register representing the ith vector in the standard basis . Quantum computation proceeds by applying quantum gates which are defined to be unitary matrices acting on 1 or 2 qubits , for example the Hadamard gate that maps |0〉 7→ 1√ 2 ( |0〉 + |1〉 ) and |1〉 7→ 1√ 2 ( |0〉 − |1〉 ) . The output of the computation is a quantum state that can be measured to obtain classical information . The measurement of a qubit α |0〉+β |1〉 yields either 0 or 1 , with probability equal to the square of the respective amplitude . A detailed discussion of the results from quantum machine learning and linear algebra used in this work can be found in Appendix ( Section F ) . 3 MAIN RESULTS . In this paper , we design a quantum convolutional neural network ( QCNN ) algorithm with a modular architecture that allows for any number of layers , any number and size of kernels , and that can support a large variety of non linearity and pooling methods . Our main technical contributions include a new notion of a quantum convolution product , the development of a quantum sampling technique well suited for information recovery in the context of CNNs and a proposal for a quantum backpropagation algorithm for efficient training of the QCNN . The QCNN can be directly compared to the classical CNN as it has the same inputs and outputs . We show that it offers a speedup compared to certain cases of classical CNN for both the forward pass and for training using backpropagation . For each layer , on the forward pass ( Algorithm 1 ) , the speedup is exponential in the size of the layer ( number of kernels ) and almost quadratic on the spatial dimension of the input . We next state informally the speedup for the forward pass , the formal version appears as Theorem D.1 . Result 1 ( Quantum Convolution Layer ) Let X ` be the input and K ` be the kernel for layer ` of a convolutional neural network , and f : R 7→ [ 0 , C ] with C > 0 be a non linear function so that f ( X ` +1 ) : = f ( X ` ∗K ` ) is the output for layer ` . Given X ` and K ` stored in QRAM ( Quantum Random Access Memory ) , there is a quantum algorithm that , for precision parameters > 0 and η > 0 , creates quantum state |f ( X ` +1 ) 〉 such that ∥∥∥f ( X ` +1 ) − f ( X ` +1 ) ∥∥∥ ∞ ≤ 2 and retrieves classical tensor X ` +1 such that for each pixel j , { |X ` +1j − f ( X ` +1 j ) | ≤ 2 if f ( X ` +1 j ) ≥ η X ` +1j = 0 if f ( X ` +1 j ) < η ( 1 ) The running time of the algorithm is Õ ( 1 η2 · M √ C√ E ( f ( X ` +1 ) ) ) where E ( · ) represents the aver- age value , Õ hides factors poly-logarithmic in the size of X ` and K ` and the parameter M = maxp , q ‖Ap‖ ‖Fq‖ is the maximum product of norms from subregions of X ` and K ` . We see that the number of elements in the input and the kernels appear only with a poly-logarithmic contribution in the running time . This is one of the main advantages of our algorithm and it allows us to use for larger and even exponentially deeper kernels . For the number of elements in the input , their number is hidden in the precision parameter η in the running time . Indeed , a sufficiently large fraction of pixels must be sampled from the output of the quantum convolution to retrieve the meaningful information . In the Numerical Simulations ( Section 6 ) we provide empirical estimates for η . For details about the QRAM , see Appendix F.2 . Following the forward pass , a loss function L is computed for the output of a classical CNN . The backpropagation algorithm is then used to calculate , layer by layer , the gradient of this loss with respect to the elements of the kernelsK ` , in order to update them through gradient descent . We state our quantum backpropagation algorithm next , the formal version of this result appears as Theorem E.1 Result 2 ( Quantum Backpropagation for Quantum CNN ) Given the forward pass quantum algorithm in Result 1 , and given the kernel matrix F ` , input matrices A ` and Y ` , stored in the QRAM for each layer ` , and a loss function L , there is a quantum backpropagation algorithm that estimates each element of the gradient tensor ∂L ∂F ` within additive error δ ∥∥ ∂L ∂F ` ∥∥ , and updates F ` according to a gradient descent update rule . The running time of a single layer ` for quantum backpropagation is given by O ( ( ( µ ( A ` ) + µ ( ∂L ∂Y ` +1 ) ) κ ( ∂L ∂F ` ) + ( µ ( ∂L ∂Y ` +1 ) + µ ( F ` ) ) κ ( ∂L ∂Y ` ) ) log 1/δ δ2 ) ( 2 ) where for a matrix V ∈ Rn×n , κ ( V ) is the condition number and µ ( V ) ≤ √ n is a matrix dependent parameter defined in Equation ( 5 ) . For the quantum back-propagation algorithm , we introduce a quantum tomography algorithm with ` ∞ norm guarantees , that could be of independent interest . It is exponentially faster than tomography with ` 2 norm guarantees and is given as Theorem G.1 in Section G. Numerical simulations on classifying the MNIST dataset show that our quantum CNN achieves a similar classification accuracy as the classical CNN .

Summary: This paper presents a quantum version of the convolutional neural networks. They derive equivalent versions the computation of both the convolution operation and the back-propagation in the quantum computing framework. The authors claim a potential exponential speed up in the computation in the size of the kernel which would make possible to process much bigger inputs or just speed up current tasks involving images mainly. They exemplify the method on MNIST using quantum artifacts simulation using PyTorch and show their method is competitive with SoA.