QTN-VQC: An End-to-End Learning Framework for Quantum Neural Networks

1 INTRODUCTION . The state-of-the-art machine learning ( ML ) , particularly based on deep neural networks ( DNN ) , has enabled a wide spectrum of successful applications ranging from the everyday deployment of speech recognition ( Deng et al. , 2013 ) and computer vision ( Sermanet et al. , 2014 ) through to the frontier of scientific research in synthetic biology ( Jumper et al. , 2021 ) . Despite rapid theoretical and empirical progress in DNN based regression and classification ( Goodfellow et al. , 2016 ) , DNN training algorithms are computationally expensive for many new scientific applications , such as new drug discovery ( Smalley , 2017 ) , which requires computational resources that are beyond the computational limits of classical hardwares ( Freedman , 2019 ) . Fortunately , the imminent advent of quantum computing devices opens up new possibilities of exploiting quantum machine learning ( QML ) ( Biamonte et al. , 2017 ; Schuld et al. , 2015 ; Schuld & Petruccione , 2018 ; Schuld & Killoran , 2019 ; Saggio et al. , 2021 ; Dunjko , 2021 ) to improve the computational efficiency of ML algorithms in the new scientific domains . Although the exploitation of quantum computing devices to carry out QML is still in its initial exploratory stages , the rapid development in quantum hardware has motivated advances in quantum neural networks ( QNN ) to run in noisy intermediate-scale quantum ( NISQ ) devices ( Preskill , 2018 ; Huggins et al. , 2019 ; Huang et al. , 2021 ; Kandala et al. , 2017 ) . A NISQ device means that not enough qubits could be spared for quantum error correction , and the imperfect qubits have to be directly used at the physical layer . Even though , a compromised QNN approach is proposed by employing hybrid quantum-classical models that rely on the optimization of variational quantum circuits ( VQC ) ( Benedetti et al. , 2019 ; Mitarai et al. , 2018 ) . The resilience of the VQC based models to certain types of quantum noise errors and high flexibility concerning coherence time and gate requirements ( McClean et al. , 2018 ) admit many practical implementations of QNN on NISQ devices ( Chen et al. , 2020b ; Yang et al. , 2021 ; Du et al. , 2020 ; 2021 ; Skolik et al. , 2021 ; Dunjko et al. , 2016 ; Jerbi et al. , 2021 ; Ostaszewski et al. , 2021 ) . One notable limitation in the current QNN training pipeline is that the quantum embedding is not fully realizable in a quantum computer , which may impede the learning of the QNN . Hence , this work proposes QTN-VQC to enable an end-toend trainable QNN , including data embedding to quantum measurements , that are easily realizable in quantum devices , where QTN stands for the quantum tensor network ( Orús , 2019 ; Huckle et al. , 2013 ; Biamonte et al. , 2017 ; Murg et al. , 2010 ) for generating quantum embedding . As shown in Figure 1 , our QNN builds a unitary linear operator that consists of three main components : ( 1 ) quantum embedding generation ; ( 2 ) variational quantum circuit ; ( 3 ) measurement . Quantum embedding generation , also known as quantum encoding , applies a fixed unitary linear operator Hx transforming classical vectors x to quantum states |ψx〉 in a Hilbert space . This step is an important aspect of designing quantum algorithms that directly impact the entire computation cost of VQC and owns a characteristic of quantum superposition . Moreover , the VQC comprises two types of quantum gates : ( 1 ) Controlled-NOT ( CNOT ) gates ; ( 2 ) learnable parametric quantum gates . The CNOT gates ensure the property of quantum entanglement through mutually connecting the qubits , and the parametric quantum gates can be adjustable to best fit the quantum input states . The model parameters of VQC should be optimized by employing variants of gradient descent algorithms during the training process . Those parametric quantum gates of VQC are similar to the weights assigned to DNN , and such quantum circuits have been justified to be resilient to quantum noises ( Farhi et al. , 2014 ; Kandala et al. , 2017 ; McClean et al. , 2016 ) . Besides , the measurement M ( |gθ ( x ) 〉 ) aims at projecting the quantum output states |gθ ( x ) 〉 to one classical output zi . This work focuses on quantum embedding generation because it is quite related to the practical usage in machine learning applications in terms of computational cost and representation capability of classical input features . In particular , we design a novel quantum tensor network ( QTN ) for quantum embedding generation . More specifically , the QTN consists of a tensor-train network ( TTN ) for dimension reduction and a quantum tensor encoding framework for outputting quantum embeddings . The dimension reduction is a necessary procedure before the quantum encoding because only a small number of qubits could be supported on available NISQ computers at this moment . A typical approach for dimension reduction relies on a classical fully-connected layer , also known as a dense layer , to convert high-dimensional input vectors y into low-dimensional ones x . However , since a dense layer can not be physically mapped on a quantum computer , much overhead has to be incurred by frequently communicating between classical and quantum devices during the end-to-end training pipeline . As shown in Figure 2 ( b ) , one of our contribution is to leverage a tensor train network ( TTN ) to replace the dense layer in Figure 2 ( a ) . The benefits of applying TTN arise from two aspects : ( 1 ) TTN can maintain the representation power of the dense layer , which will be justified in our theorems ; ( 2 ) TTN is a tensor network and can be flexibly placed in quantum computers , which enables an end-to-end training process fully conducted in a quantum computer . Moreover , in this work , a tensor product encoding ( TPE ) is delicately designed for generating quantum embedding , which builds the relationship between a classical vector x and the corresponding quantum state |x〉 ; Besides , we further investigate the representation of QTN-VQC in terms of model size and nonlinear activation function used in TTN . We denote a QTN as the combination of TTN and TPE and utilize QTN-VQC as a genuine end-to-end learning framework for QNN . 2 RELATED WORK . The work ( Schuld & Petruccione , 2018 ; Biamonte et al. , 2017 ; Dunjko & Briegel , 2018 ) demonstrate that VQC shows great promise in surpassing the performance of classical ML . Prominent examples of VQC based models include quantum approximate optimization algorithm ( QAOA ) ( Farhi et al. , 2014 ) , and quantum circuit learning ( QCL ) ( Mitarai et al. , 2018 ) . Various architectures and geometries of VQC have been shown in tasks ranging from image classification ( Henderson et al. , 2020 ; Chen et al. , 2020a ; Kerenidis et al. , 2020 ) to reinforcement learning ( Chen et al. , 2020b ) . As for quantum embedding , basis encoding is the process of associating classical input data in the form of binary strings with the computational basis state of a quantum system ( Leymann & Barzen , 2020 ) . Similarly , amplitude encoding is a technique involving encoding data into the amplitudes of a quantum state ( Soklakov & Schack , 2006 ) . Unfortunately , the computational cost of both quantum embedding and amplitude encoding becomes exponentially expensive with the increasing number of qubits ( Schuld & Killoran , 2019 ) . A new technique of angle embedding makes use of the quantum gates to generate quantum states ( Fu et al. , 2011 ) , but it can not deal with the high-dimensional feature inputs . Therefore , this work exploits the use of TTN for dimension reduction followed by a TPE for generating quantum embedding . In particular , this work employs the TTN for dimensionality reduction . The TTN model based on TT decomposition in neural networks was first proposed in ( Oseledets , 2011 ) , and it could be flexibly extended the convolutional neural network ( CNN ) ( Garipov et al. , 2016 ) and recurrent neural network ( RNN ) ( Tjandra et al. , 2017 ) . The empirical study of TTN on machine learning tasks shows that TTN is capable of maintaining the DNN baseline results ( Qi et al. , 2020a ; Yu et al. , 2017 ; Yang et al. , 2017 ; Jin et al. , 2020 ) . However , to our best knowledge , no existing works have applied TTN to QML . Besides , since the tensor network-based machine learning model like TTN is closely related to quantum machine learning in terms of their model structures ( Liu & Wang , 2018 ; Gao et al. , 2017 ) , the QTN-VQC model can be directly regarded as the classical simulation of the corresponding quantum machine learning . In addition to a classical dense layer , more complicated architectures like AlexNet ( Lloyd et al. , 2020 ) could be used for dimension reduction , and we also compare the performance between TTN and AlexNet-based models . 3 NOTATIONS . We denote RI as a I-dimensional real coordinate space , and RI1×I2×···IK refers to a space of Korder tensors . The symbol W ∈ RI1×I2×···×IK represents a K-order multi-dimensional tensor in RI1×I2×···IK , and the symbols v ∈ RI and W ∈ RI×J represent a vector and a matrix , respectively . For the notations of quantum computing , ∀ v ∈ RI , the symbol |v〉 denotes a quantum state associated with a 2I -dimensional vector in a Hilbert space . Particularly , |0〉 = [ 1 0 ] T and |1〉 = [ 0 1 ] T . The quantum gate RY ( θ ) means a Pauli-Y gate with a unitary operator as defined in Eq . ( 1 ) , which implies a qubit rotates the Bloch sphere along the Y-axis by a given angle θ. RY ( θ ) = [ cos θ2 −i sin θ 2 −i sin θ2 cos θ 2 ] ( 1 ) Moreover , the operator ⊗ is a tensor product . Given the vectors vi ∈ RI , the tensor product of I vectors is defined as ⊗Ii=1vi , which is a 2I -dimensional vector and can provide a compact represen- tation for v1 ⊗ v2 ⊗ · · · ⊗ vI . Similarly , the symbol |0〉⊗S means a tensor product of S quantum states of |0〉 . Furthermore , for a scalar v , the quantum state |v〉 can be written as : |v〉 = cos v|0〉+ sin v|1〉 = [ cos v sin v ] . ( 2 ) 4 QTN-VQC : OUR PROPOSED END-TO-END LEARNING FRAMEWORK . This section introduces our proposed end-to-end learning framework , namely QTN-VQC in this work . As shown in Figure 3 , the QTN model includes two components ( a ) TTN and ( b ) TPE , which will be separately introduced in Section 4.1 and Section 4.2 . Moreover , Figure 4 illustrates the framework of VQC and Section 4.3 is devoted to discussing the details of VQC . 4.1 TENSOR TRAIN NETWORK FOR DIMENSION REDUCTION . We leverage TTN ( Novikov et al. , 2015 ) for the dimension reduction of input features . TTN relies on the TT decomposition ( Oseledets , 2011 ) and has been commonly employed in machine learning tasks like speech processing ( Qi et al. , 2020b ) and computer vision ( Yang et al. , 2017 ) . The TT decomposition assumes that given a set of TT-ranks { r0 , r1 , ... , rK } , a K-order tensor W ∈ RI1×I2×···×IK is factorized into the multiplication of 3-order tensors Xk ∈ Rrk−1×Ik×rk . In more detail , given a set of indices { i1 , i2 , ... , iK } , X ( i1 , i2 , ... , iK ) is decomposed as : X ( i1 , i2 , ... , iK ) = K∏ k=1 Xk ( ik ) , ( 3 ) where ∀ik ∈ [ Ik ] , Xk ( ik ) ∈ Rrk−1×rk . Since r0 = r1 = 1 , the term ∏K k=1 Xk ( ik ) is a scalar value . TTN employs the TT decomposition in a dense layer and is explicitly demonstrated in Figure 3 ( a ) . In more detail , for an input tensor X ∈ RI1×I2×···×IK and an output tensor Y ∈ RJ1×J2×···×JK , we achieve Y ( j1 , j2 , ... , jK ) = I1∑ i1=1 I2∑ i2=1 · · · IK∑ iK=1 W ( ( i1 , j1 ) , ( i2 , j2 ) , ... , ( iK , jK ) ) X ( i1 , i2 , ... , iK ) = I1∑ i1=1 I2∑ i2=1 · · · IK∑ iK=1 ( K∏ k=1 Wk ( ik , jk ) ) · K∏ k=1 Xk ( ik ) = K∏ k=1 ( Ik∑ ik=1 Wk ( ik , jk ) Xk ( ik ) ) = K∏ k=1 Yk ( jk ) , ( 4 ) where Xk ( ik ) ∈ Rrk−1×rk , and Yk ( jk ) ∈ Rrk−1×rk which results in a scalar ∏K k=1 Yk ( jk ) because of the ranks r0 = r1 = 1 ; W ( ( i1 , j1 ) , ( i2 , j2 ) , ... , ( iK , jK ) ) is closely associated with W ( m1 , m2 , ... , mK ) as defined in Eq . ( 3 ) , if each index mk = ik× jk is set . The multi-dimensional tensorW is decomposed into the multiplication of 4-order tensorsWk ∈ Rrk−1×Ik×Jk×rk . A nonlinear activation function , e.g. , Sigmoid , Tanh , and ReLU , is imposed upon the tensor Y . Compared with a dense layer with ∏K k=1 IkJk parameters , a TTN owns as few as ∑K k=1 rkrk−1IkJk trainable parameters . When a TTN is utilized for the dimension reduction , the high-dimensional input vector x ∈ RI is first reshaped into a tensor X ∈ RI1×I2×···×IK , and then we can represent X as a TT format that goes through TTN . The outputs of TTN can be converted back to a tensor Y ∈ RJ1×J2×···×JK , which is further reshaped to a lower dimensional vector y ∈ RJ . Here , we define ∏K k=1 Ik = I and∏K k=1 Jk = J . Moreover , the computational complexities of TTN and the related dense layer are in the same scale , which is discussed in ( Yang et al. , 2017 ) . Eq . ( 4 ) suggests that TTN is a multi-dimensional extension of a dense layer , where the trainable weight matrix of a dense layer is changed to the learnable core tensors . Additionally , many empirical studies demonstrate that a TTN is capable of maintaining the baseline results of the dense layer ( Qi et al. , 2020b ; Yang et al. , 2017 ; Novikov et al. , 2015 ; Qi et al. , 2020a ) . More significantly , since TTN can be flexibly mapped into a quantum circuit , the quantumness inherent in TTN brings great advantages over other architectures like the dense layer . In other words , although TTN is treated classically , it is possible to substitute equivalent quantum circuits for TTN when more qubits become available ( Du et al. , 2020 ) , which implies that QTN-VQC stands for a genuine end-to-end QNN learning architecture on a quantum computer . Furthermore , since the gradient exploding and diminishing problems are serious issues in the TTN training . To avoid those training problems , we only consider 3-order core tensors and small TT-ranks to configure a simple TTN in our experimental simulations . Our theoretical analysis of QTN-VQC based on Theorem 3 in Section 5 suggests that the representation power is not related to TT-ranks and the tensor order K , thus small TT-ranks and the tensor order K are preferred . In particular , a lower K can significantly reduce the computational cost and speed up the convergence rate .

Summary: As it was already studied in the literature, one way to implement a machine learning classifier in quantum computers is to convert classical input data like images into quantum states that are fed to a Variational Quantum Circuit (VQC). However, current quantum computers have a small number of qbits, which requires to perform a dimensionally reduction of the input datasets as a preprocessing step. In this paper, the authors propose to use data compression based on the Tensor Train Network (TTN) model, which is a very well-known compression technique. They compare TTN compression against a straightforward dense layer and the PCA-based dimension reduction techniques. The paper includes experimental results on MNIST dataset by simulating quantum circuits with up to 8qbits for noisy and noiseless scenarios.