# The dilemma of quantum neural networks

Yang Qian School of Computer Science, The University of SydneyJD Explore
Academy Xinbiao Wang 22footnotemark: 2 Institute of Artificial Intelligence,
School of Computer Science, Wuhan University Yuxuan Du 22footnotemark: 2
Corresponding author<EMAIL_ADDRESS>Xingyao Wu 22footnotemark: 2
Dacheng Tao 22footnotemark: 2

###### Abstract

The core of quantum machine learning is to devise quantum models with good
trainability and low generalization error bound than their classical
counterparts to ensure better reliability and interpretability. Recent studies
confirmed that quantum neural networks (QNNs) have the ability to achieve this
goal on specific datasets. With this regard, it is of great importance to
understand whether these advantages are still preserved on real-world tasks.
Through systematic numerical experiments, we empirically observe that current
QNNs fail to provide any benefit over classical learning models. Concretely,
our results deliver two key messages. First, QNNs suffer from the severely
limited effective model capacity, which incurs poor generalization on real-
world datasets. Second, the trainability of QNNs is insensitive to
regularization techniques, which sharply contrasts with the classical
scenario. These empirical results force us to rethink the role of current QNNs
and to design novel protocols for solving real-world problems with quantum
advantages.

##  1 Introduction

The theme of deep learning is efficiently optimizing a good neural network
architecture with low generalization error such that it can well extrapolate
the underlying rule from the training data to new unseen data [1, 2, 3].
During the past decades, deep neural networks (DNNs) with diverse
architectures have been carefully designed to accomplish different tasks with
both low train and test error. Moreover, these DNNs have achieved state-of-
the-art performance compared with conventional machine learning models such as
support vector machines [2]. Concrete examples include the exploitation of
convolutional neural networks to tackle computer vision tasks [4, 5] and the
employment of recurrent neural networks to solve natural language processing
tasks [6, 7]. Alongside the huge empirical success of deep learning, numerous
studies have been dedicated to investigating the excellent trainability and
generalization ability of DNNs [8, 9, 10], since a good understanding of these
two properties does not only contribute to make DNNs more interpretable, but
it might also lead to more reliable model architecture design.

A milestone in the regime of quantum computing is Google’s experimental
demonstration that modern quantum machines can solve certain computational
tasks faster than classical computers [11, 12]. Such a superior power fuels a
growing interest of designing quantum machine learning (QML) models, which can
be effectively executed on both noisy intermediate-scale quantum (NISQ) and
fault-tolerant quantum machines with provable advantages [13, 44, 14, 15].
Following this routine, the quantum neural networks (QNNs), as the quantum
extension of DNNs, has been extensively investigated [16, 17, 18, 19, 20, 21,
22]. Celebrated by their flexible structures, experimental studies have
implemented QNNs on different NISQ platforms to accomplish various learning
tasks such as data classification [20, 23], image generation [24, 25, 26], and
electronic-structure problems in material science and condensed matter physics
[27, 28, 29, 30].

Driven by the promising empirical achievements of QML and the significance of
understanding the power of QNNs, initial studies have been conducted to
explore the trainability and the generalization ability of QNNs [31, 32, 33,
34, 35, 36, 37] by leveraging varied model complexity measures developed in
statistical learning theory [38] and advanced tools in optimization theory
[39]. Notably, the obtained results transmitted both positive and negative
signals, as indicated in Figure 1. To be more concrete, theoretical evidence
validated that QNNs can outperform DNNs for specific learning tasks, i.e.,
quantum synthetic data classification [20] and discrete logarithm problem
[36]. However, Ref. [40] revealed the barren plateaus’ issue of QNNs, which
challenges the applicability of QNNs on large-scale problems. Considering that
an ambitious aim of QNNs is providing computational advantages over DNNs on
real-world tasks, it is important to answer: ‘Are current QNNs sufficient to
solve certain real-world problems with potential advantages?’ If the response
is negative, it is necessary to figure out ‘how is the gap between QNNs and
DNNs?’

Figure 1: An overview of the classical and quantum learning models.
Generalization ability: $\mathcal{H}$ is the whole hypothesis space.
$\mathcal{H}_{D}$ and $\mathcal{H}_{Q}$ refer to the hypothesis space
represented by QNN and DNN respectively. When the target concept is covered by
$\mathcal{H}_{Q}\backslash\mathcal{H}_{D}$
($\mathcal{H}_{D}\backslash\mathcal{H}_{Q}$), as highlighted by the red
(green) hollow star, QNNs can definitely (fail to) guarantee computational
advantages over DNNs. When the target concept lies in
$\mathcal{H}_{D}\cap\mathcal{H}_{Q}$ (highlighted by the black color), it is
unknown whether QNNs may possess any advantage over DNNs. Trainability: The
function graph corresponding to the arrow of the optimization path of QNN
indicates the possible barren plateau which is characterized by the vanished
gradients.

Problem setup. We inherit the tradition in DNNs to understand the trainability
and generalization of QNNs [41]. Particularly, the explicit form of the
measure of the generalization error bound is

$\displaystyle\hat{\mathcal{R}}_{S}(\hat{\bm{\theta}})-\mathcal{R}(\hat{\bm{\theta}}):=$
$\displaystyle\frac{1}{n}\sum_{i=1}^{n}C\left(h(\hat{\bm{\theta}},\bm{x}^{(i)}),\bm{y}^{(i)}\right)-\mathbb{E}_{\bm{x},\bm{y}}\left(C(h(\hat{\bm{\theta}},\bm{x}),\bm{y})\right),$

where $S=\\{(\bm{x}^{(i)},\bm{y}^{(i)})\\}_{i=1}^{n}$ denotes the given
training dataset sampled from the domain $\mathcal{X}\times\mathcal{Y}$,
$h(\hat{\bm{\theta}},\cdot)\in\mathcal{H}$ refers to the hypothesis inferred
by QNN with $\mathcal{H}$ being the hypothesis space and $\hat{\bm{\theta}}$
being the trained parameters,
$C:\mathcal{H}\times\mathcal{(}\mathcal{X}\times\mathcal{Y})\to\mathbb{R}^{+}$
is the designated loss function, and
$\hat{\mathcal{R}}_{S}(\hat{\bm{\theta}})$ (or
$\mathcal{R}(\hat{\bm{\theta}})$) represents the empirical (or expected) risk
[42]. The generalization error bound in Eqn. (1) concerns when and how
minimizing $\hat{\mathcal{R}}_{S}(\hat{\bm{\theta}})$ is a sensible approach
to minimizing $\mathcal{R}(\hat{\bm{\theta}})$. A low error bound suggests
that the unearthed rule $h(\hat{\bm{\theta}})$ from the dataset $S$ can well
generalize to the unseen data sampled from the same domain. Note that since
the probability distribution behind data domain is generally inaccessible, the
term $\mathcal{R}(\hat{\bm{\theta}})$ is intractable. A generic strategy is
employing the test dataset $\tilde{S}\sim\mathcal{X}\times\mathcal{Y}$ to
estimate this term, i.e.,
$\mathcal{R}(\hat{\bm{\theta}})\approx\frac{1}{\tilde{n}}\sum_{i=1}^{\tilde{n}}\ell(h(\hat{\bm{\theta}},\tilde{\bm{x}}^{(i)}),\tilde{\bm{y}}^{(i)})$
with $(\tilde{\bm{x}}^{(i)}),\tilde{\bm{y}}^{(i)})\in\tilde{S}$.

The trainability concerns the convergence rate of the trained parameters of
QNN towards the optimal parameters. The mathematical form of the optimal
parameters $\bm{\theta}^{*}$ satisfies

$\bm{\theta}^{*}=\arg\min_{\bm{\theta}}\hat{\mathcal{R}}_{S}({\bm{\theta}})=\arg\min_{\bm{\theta}}\frac{1}{n}\sum_{i=1}^{n}C\left(h({\bm{\theta}},\bm{x}^{(i)}),\bm{y}^{(i)}\right).$
(1)

Intuitively, the inferred hypothesis (or equivalently, the trained parameters)
is expected to achieve the minimized empirical risk
$\hat{\mathcal{R}}_{S}(\bm{\theta})$. Considering that the loss landscape of
QNNs is generally non-convex and non-concave, which implies the computational
hardness of seeking $\bm{\theta}^{*}$, an alternative way to examine the
trainability of QNN is analyzing its convergence rate, i.e.,

$\mathcal{J}(\bm{\theta})=\mathbb{E}[\|\nabla_{\bm{\theta}}\hat{\mathcal{R}}_{S}(\bm{\theta})\|],$
(2)

where the expectation is taken over the randomness from the sample error and
gate noise [34]. In other words, the metric $\mathcal{J}(\bm{\theta})$
evaluates how far the trainable parameters of QNN are away from the stationary
point $\|\nabla_{\bm{\theta}}\hat{\mathcal{R}}_{S}(\bm{\theta})\|=0$.

Following the above explanations, understanding the learnability of QNNs
amounts to exploring whether QNNs possess better generalization ability than
DNNs on certain real-world datasets in terms of Eqn. (1) under both the
noiseless and NISQ scenarios. Furthermore, it is crucial to understand whether
the trainability of QNNs can be enhanced by regularization techniques measured
by Eqn. (2).

Contributions. Through systematic numerical simulations, we empirically
exhibit the dilemma of QNNs such that it is hard to directly use current QNNs
to gain quantum advantages on real-world datasets. Meanwhile, current QNNs
suffers from the poor trainability. The main contributions of our study are as
follows.

  1. 1.

We compare the performance of QNNs and DNNs on larger-scale datasets than
those used in previous literature to quantify the trainability and
generalization ability of QNNs under both the noiseless and NISQ scenarios. As
exhibited in Figure 1, we observe the poor model capacity of QNNs by
conducting randomization experiments proposed by [10]. Since the effective
model capacity determines the model’s generalization error bounds, our results
suggest that the generalization error bounds of QNNs achieved by statistical
learning theory are generally tight [31, 32, 33, 35, 36, 37]. In addition,
QNNs do not gain obvious trainability enhanced assisted by regularization
techniques, which sharply differs from DNNs. These observations partially
explain why current QNNs fail to surpass DNNs on real-world tasks.

  2. 2.

We indicate the negative role of noise with respect to the generalization
ability and trainability of QNNs. Specifically, quantum noise degenerates the
model capacity and exacerbates the difficulty of optimization. To this end, we
discuss possible solutions such as advanced error mitigation techniques to
enhance the capability of QNNs on real-world datasets.

  3. 3.

We build a benchmark to evaluate the performance of QNNs and DNNs on both
quantum synthetic data and classical data, supporting a variety of predefined
models of QNNs and providing flexible interface for researchers to define
customizable architectures. The released benchmark will facilitate the
standardization of assessment of various QNNs in QML community and provide a
comparable reference in the design of QNNs. The related code will be released
to the Github repository.

##  2 Preliminary

Here we briefly recap QNNs that will be explored in this study. The foundation
of quantum computing is provided in Appendix A. Please refer to literature
[43, 44, 45, 46] for comprehensive explanations.

###  2.1 Quantum neural network

Quantum neural networks (QNNs) can be treated as the quantum generalization of
deep neural networks (DNNs), as illustrated in Figure 2. Both of them leverage
an optimizer to iteratively update parameters $\bm{\theta}$ of a trainable
model $h(\bm{\theta},\cdot)$ to minimize a predefined loss function
$C(\cdot,\cdot)$.

The key difference between QNNs and DNNs is the strategy to implement the
trainable model $h(\bm{\theta},\cdot)$, where the former employs the parameter
quantum circuits (PQCs), or equivalently ansätzes [43, 44, 47], while the
latter utilizes neural networks [1]. In particular, PQCs are constituted by
the encoding part $U_{E}(\cdot)$, the trainable part $U(\bm{\theta})$, and the
readout part. The purpose of $U_{E}(\cdot)$ is loading classical information
into the quantum form, as the precondition to proceed further quantum
operators. Although there are many data encoding methods [48], here we mainly
focus on the qubit-encoding method and its variants, because of their
resource-efficient property. Once the quantum example is prepared, the
trainable unitary $U(\bm{\theta})$ is applied to this state, followed by the
quantum measurement $\\{\Pi_{i}\\}$ to extract quantum information into the
classical form (see following subsections for details). The collect classical
information can either be used as the predicted label or the hidden feature,
depending on the detailed QNN-based protocols.

In the subsequent three subsections, we elaborate on the implementation of
three representative protocols, i.e., quantum naive neural network (QNNN)
[20], quantum embedding neural network (QENN) [49], and quantum convolutional
neural network (QCNN) [50], respectively.

Figure 2: The machinery of various QNNs. The schematic of QNN, depicted in the
upper left, consists of a hybrid quantum-classical loop, where the quantum
computer is employed to train the learnable parameters and the classical
processor is utilized to perform the optimization or post-processing to the
collected information from the quantum computer. The dashed arrows mean that
the loop is finite and terminated in the classical processor. The paradigms of
QNNN, QENN, and QCNN are shown in the lower left, lower right, and upper
right, respectively. The detailed realization of these QNNs is presented in
Sections 2.1.1, 2.1.2, and 2.1.3.

####  2.1.1 Quantum naive neural network

We first follow Eqn. (1) to elaborate on the implementation of PQCs, or
equivalently, the hypothesis $h(\bm{\theta},\bm{x}^{(i)})$, in QNNN. As shown
in Figure 2, the encoding circuit $U_{E}(\cdot)$ loads the classical example
into the quantum state by specifying data features as rotational angles of
single-qubit gates. Note that the topology of quantum in $U_{E}(\cdot)$ can be
varied, e.g., a possible implementation is
$U_{E}(\bm{x}^{(i)})=\bigotimes_{j=1}^{d}\mathop{\text{RY}}(\bm{x}^{(i)}_{j})$
[49]. The trainable part $U(\bm{\theta})$ consists of trainable single-qubit
quantum gates and fixed two quantum gates. Analogous to $U_{E}(\cdot)$, the
topology of $U(\bm{\theta})$ are versatile, where involving more gates
promises a higher expressivity but a more challenged trainability [35, 51].
Here we mainly focus on the hardware-efficient structure such that the
construction of $U(\bm{\theta})$ obeys a layer-wise structure and the gates
arrangement in each layer is identical. The explicit form satisfies
$U(\bm{\theta})=\prod_{l=1}^{L}U_{l}{(\bm{\theta}_{l})}$, where $L$ is the
layer number and $\bm{\theta}_{l}$ denotes the trainable parameters at the
$l$-th layer. To extract the quantum information into the classical form, QNNN
applies POVMs $\\{\Pi_{i}\\}_{i=1}^{d_{y}}$ to the state
$\ket{\psi(\bm{x}^{(i)},\bm{\theta})}=U(\bm{\theta})U_{E}(\bm{x}^{(i)})\ket{0}^{\otimes
d}$, i.e.,

$\displaystyle h(\bm{\theta},\bm{x}^{(i)})=\Big{[}$
$\displaystyle\operatorname{Tr}\left(\Pi_{1}\ket{\psi(\bm{x}^{(i)},\bm{\theta})}\bra{\psi(\bm{x}^{(i)},\bm{\theta})}\right),\cdots,\operatorname{Tr}\left(\Pi_{d_{y}}\ket{\psi(\bm{x}^{(i)},\bm{\theta})}\bra{\psi(\bm{x}^{(i)},\bm{\theta})}\right)\Big{]}^{\top},$
(3)

where $d_{y}$ is the dimension of the label space. In the training process, we
adopt the first-order optimizer to update the parameters $\bm{\theta}$ to
minimize the loss function in Eqn. (1), where the gradients $\partial
C\left(h(\bm{\theta},\bm{x}^{(i)}),y^{(i)}\right)/\partial\bm{\theta}$ can be
analytically evaluated by the parameter shift rule [21]. The specific
optimization algorithms used in this study are stochastic gradient descent
(SGD) [52] and stochastic quantum natural gradient descent (SQNGD) [53]. More
details can be seen in Appendix B.

####  2.1.2 Quantum embedding neural network

Instead of separating the encoding part from the training part, QENN
integrates them together into the embedding circuit where the encoding circuit
and the training circuit are carried out alternately. Specifically, in QENN,
the employed PQCs are composed of multiple embedding layers equipped with
trainable parameters, i.e., in each layer an encoding circuit
$U_{E}^{(l)}(\bm{x}^{(i)})$ is followed by a trainable circuit
$U_{l}(\bm{\theta}_{l})$, as shown in Figure 2. Throughout the whole study, we
consider an identical topology of $U_{E}^{(l)}(\cdot)$ for different layers,
as the repetition of embedding layer is demonstrated to implement the
classically intractable feature maps [54] and increase the expressive power of
QNN [55]. The explicit form of such PQCs can be written as
$U(\bm{x},\bm{\theta})=\prod_{l=1}^{L}U_{E}(\bm{x}^{(i)})U_{l}(\bm{\theta}_{l})$,
where the meanings of $L$ and $\bm{\theta}_{l}$ are the same with those in
QNNN. As for the training of QENN, the strategy of measurement and
optimization are identical to QNNN in Subsection 2.1.1.

####  2.1.3 Quantum convolutional neural network

Convolutional neural network (CNN) has demonstrated the superiority in images
processing tasks, including two special local operators, i.e., convolution and
pooling. The function of convolutional and pooling operations is extracting
local features from the whole image and aggregating information from adjacent
patches, respectively. Unlike CNN, quantum CNN (QCNN) [50] completes the
convolutional operation by the quantum convolutional layer to pursue better
learning performance. Particularly, in the quantum convolutional layer, a
fraction of the input image is embedded into the quantum circuit
$U_{E}(\cdot)$, interacted with PQCs $U(\bm{\theta})$, followed by the quantum
measurements to extract the corresponding semantic features. As shown in
Figure 2, unlike QNNN and QENN, where the collected classical information is
directly utilized as the predictable label, the output of the quantum
convolutional layer is treated as a hidden feature map which is taken as the
input for the next quantum convolutional layer. After several quantum
convolutional operations, a classical fully connected layer with activation
function [1] acts on the extracted features to make predictions.

##  3 The generalization of quantum neural networks

In this section, we explore the generalization ability of representative QNNs
introduced in Section 2. To be more concrete, we first apply these QNNs to
learn real-world datasets and compare their performance with classical DNNs
with varied parameter settings, i.e., the multi-layer perceptron (MLP) and
convolutional neural network (CNN) whose number of trainable parameters is
similar to QNNs, the over-parameterized multi-layer perceptron (MLP++) whose
number of trainable parameters can be extremely large [56, 5]. We further
conduct systematical simulations to benchmark the effective model capacity of
QNNs and DNNs, since this measure the determines generalization ability of
learning models [2, 10],

We experiment on two real-world datasets, i.e., the Wine dataset [57] and
MNIST handwritten digit dataset [58], to examine the generalization ability of
QNNs and DNNs. The Wine dataset, collected from UCI Machine Learning
Repository [57], consists of 130 examples, where each example is described by
a feature vector with $13$ attributes determining the origin of wines. MNIST
dataset includes ten thousands hand-written digit images, where each image has
$28\times 28$ pixels. With the aim of removing data-dependent bias as much as
possible, we also assess the generalization ability of the quantum synthetic
data proposed by [20]. Specifically, we train QNNN, QENN, and MLP on the Wine
dataset and quantum synthetic dataset which represent 1-dimensional features;
and apply QCNN, CNN and MLP on MNIST dataset for the case of $2$-dimensional
features. Note that QNNN and QENN are excluded when processing image data
because it requires unaffordable number of qubits when embedding the high
dimensional image into a quantum circuit. For suppressing the effects of
randomness, the statistical results are collected by repeating each setting
with $10$ times.

Figure 3: Learning performance on quantum data and classical data with true
labels. G-Error represents the generalization error. (a), (b) and (c) show the
accuracy of various models changing with training epochs, when training on
quantum synthetic data, the Wine data and MNIST respectively. The bar chart
inserted into each figure represents the generalization error of each model.

Before moving on to present experiment results, let us address the
generalization error measure defined in Eqn. (1). Particularly, there are two
components that together completely characterize the generalization error,
i.e., the empirical risk $\hat{\mathcal{R}}_{S}(\hat{\bm{\theta}})$ and the
expected risk $\mathcal{R}(\hat{\bm{\theta}})$. In our experiments, we employ
the accuracy of the training set to quantify the empirical risk in which high
train accuracy reflects low $\hat{\mathcal{R}}_{S}(\hat{\bm{\theta}})$.
Meanwhile, following the explanation in Eqn. (1), the accuracy on the test set
is adopted to estimate the expected risk such that high test accuracy implies
low $\mathcal{R}(\hat{\bm{\theta}})$. Under the above insights, when a
learning model possesses a good generalization ability, it should achieve high
train accuracy and test accuracy, as well as a small gap between them.

The learning performance of QNNs and DNNs for the quantum synthetic dataset
and real-world datasets is exhibited in Figure 3. Towards the quantum
synthetic dataset, both the train and test accuracy of QNNN and QENN fast
converge to the $92\%$ after $20$ epoch. Conversely, although the train
accuracy of MLP reaches $90\%$ after $30$ epoch, its test accuracy is no
better than the random guess. Therefore, the generalization error of classical
DNNs, i.e., the discrepancy between train accuracy and test accuracy, is much
higher than that of quantum models ($0.4$ for MLP versus $0.01$ for QNNN and
QENN), as demonstrated in the bar chart inserted in Figure 3 (a). However, the
learning performance behaves quite different when the above models are applied
to learn real-world datasets. As shown in Figure 3 (b), there exists an
evident step-by-step accuracy dropping on Wine dataset along the sequence of
MLP, QENN, and QNNN. In particular, QNNN and QENN fall behind MLP by $10\%$ to
$20\%$. Meantime, there is a more serious performance degradation for quantum
models evaluated by test accuracy, especially for QNNN which holds almost
$15\%$ generalization error that is three times higher than that of MLP. The
learning performance of QCNN and CNN on MNIST dataset obeys the same manner.
As depicted in Figure 3 (c), QCNN achieves $93\%$ accuracy on both training
and test set, which is slightly worse than CNN by approximately $3\%$. It is
worth noting that the relatively small gap among three models is most
attributed to the subtle differences in the network structure, where QCNN, CNN
and MLP only differs in the first layer (Appendix C).

Figure 4: Trainability of different models on quantum data and classical data
with random labels. (a) shows how various models fit quantum data with random
labels. MLP++, representing MLP with larger scale, achieves zero training
error. (b) shows the changes of accuracy when fitting classical data with
random labels. MLP can still completely fit the random labels. (c) shows the
ability of fitting MNIST with random labels. No model performs better than
random guess.

The generalization ability of a learning model is dominated by its effective
model capacity, which concerns the model’s ability to fit random labels [10].
Namely, a learning model possesses a high effective model capacity when it
reaches a high train accuracy on a dataset with random labels, as ensured by
the randomization test in non-parametric statistics. Empirical studies have
validated that DNNs possess sufficient effective model capacity and speculated
that this property contributes to the great success of DNN. With this regard,
we conduct randomization experiments on both QNNs and DNNs to compare their
effective model capacity.

The results related to the effective model capacity are shown in Figure 4,
which reveal a large gap between QNNs and DNNs, regardless of whether the
training data is quantum or classical. In particular, QNNs achieve relatively
low train accuracy ($0.562$ for QNNN and $0.630$ for QENN) which is only
slightly better than random guess. By contrast, for DNNs, MLP reaches $90\%$
and the perfect $100\%$ train accuracy on the quantum synthetic dataset and
Wine dataset respectively after $40$ epochs. If we further increase the number
of trainable parameters of MLP (MLP++), it will also completely fit the
quantum synthetic data with random labels, as shown by the purple line in
Figure 4 (a). Note that the same strategy is inappropriate to be applied to
QNNs, because increasing trainable parameters will incur both the barren
plateau issues and the accumulated quantum noise, which hinder the
optimization [34]. As for MNIST, all these models fail to fit the random
labels, whose behavior imitates the random guess. Similarly, we can enlarge
the scale of MLP to obtain a leap of accuracy on training set with random
labels at the expense of little growth of training time, as indicated by the
purple line in Figure 4 (c).

Remark. We defer the study of the generalization ability of QNNs under the
NISQ case in Appendix D. In a nutshell, by realizing QNNs on NISQ chips to
complete above experiments, we conclude that quantum noise largely weakens the
effective model capacity and generalization of QNNs.

###  3.1 Implications

The achieved results indicate the following three substantial implications
with respect to the dilemma of existing QNNs.

  1. 1.

The learning performance of current QNNs is no better than DNNs on real-world
datasets. This observation questions the necessity to employ QNNs to tackle
real-world learning tasks, since it remains elusive how QNNs can benefit these
tasks.

  2. 2.

The effective model complexity of current QNNs is poor, which is stark
contrast with DNNs. The low effective model complexity enables us to leverage
statistical learning theory to analyze the generalization ability of QNNs with
a tight bound [36, 32]. Nevertheless, as shown in Figure 1, a severely
restricted model capacity fails to cover complicated target concepts in real-
world tasks, which prohibits the applicability of QNNs.

  3. 3.

The limited model capacity is further reduced by imperfection of NISQ
machines. The narrowed hypothesis space deteriorates the performance of QNNs.

There are two possible directions to seek potential advantages of QNNs over
DNNs. The first way is designing clever over-parameterization quantum learning
models as with DNNs. Partial evidence to support this solution is the improved
performance of QENN compared with QNNN. A critical issue in such a model
design is how to avoid barren plateau phenomenons [40]. The second way is to
develop new paradigm of quantum models to further introduce nonlinearity into
quantum learning pipeline. For instance, theoretical results have proven
potential advantages of quantum kernels [20, 59, 60].

##  4 Trainability of quantum models

Here we investigate the trainability of QNNs, which serves as another dominant
factor manipulating the learnability of quantum models. In particular, we
first examine the performance of QNNN and QENN on the Wine dataset with
consideration of various implicit and explicit regularization techniques under
the noiseless scenario. Subsequently, for the purpose of understanding how
quantum noise affects the performance of QNNs, we conduct the same experiments
under the noisy scenario in which the noisy model is extracted from
ibmq_16_melbourne, which is one of the IBM Quantum Canary Processors [61].

Recall a learning model, e.g., QNNs or DNNs, is warranted to possessing a good
trainability if it requires a small number of epochs to surpass a threshold
accuracy and fast converges to a stationary point, i.e., the term
$\mathcal{J}(\bm{\theta})\rightarrow 0$ in Eqn. (2). Many theoretical studies
in the regime of deep learning have proven that SGD can help learning models
escape saddle points efficiently [62, 63]. Moreover, recent study demonstrated
that a quantum variant of SGD, i.e., stochastic quantum natural gradient
descent (SQNGD) [53], can well address the barren plateau’s issue. Driven by
the success of SGD in deep learning and the power of SQNGD, an immediate
interest is exploring whether these two methods can enhance the trainability
of QNNs, especially for alleviating barren plateaus issues.

Figure 5: Effects of regularizations on the performance of quantum model on
Wine dataset. The labels ‘GD’, ‘SGD’, ‘SQNGD’, ‘WD’, and ‘N’ refer to the
gradient descent optimizer, stochastic gradient descent optimizer, the
stochastic quantum natural gradient descent optimizer, the weight decay, and
execution of experiments on NISQ chips, respectively. (a) describes the
effects of regularizations on optimization. SGD plays a significant role in
accelerating convergence and achieving higher accuracy, while others the
optimization process instead of boosting performance. (b) is the learning
curve of GD with more training epochs.

The experiment results are summarized in Figure 5. With the aim of
investigating whether SGD facilitates the quantum model optimization, we also
apply gradient descent (GD) optimizer to learn the same tasks as a reference.
Specifically, Figure 5 (a) depicts that the train accuracy of QNNN and QENN
optimized by SGD rapidly rises to $70\%$ after $20$ epochs, while its train
accuracy remains at around $50\%$ with the GD optimizer. Meanwhile, QNNN with
SGD optimizer achieves higher test accuracy than that in the setting of GD (at
least $20\%$). Surprisingly, SQNGD, the quantum natural gradient version of
SGD, further expands the accuracy gap by $10\%$, reaching to the highest
accuracy and fastest convergence of QNNN. Notably, the performance of QNNN
with GD optimizer presents a monotone increasing trend, which suggests that
the model may potentially reach higher performance with more training epochs.
Therefore, we extend the total training epochs from $100$ to $500$ and train
the QENN with GD. Figure 5 (b) shows that the accuracy of QENN trained by GD
has been increasing smoothly and reaches $80\%$ after $500$ epochs, narrowing
the gap between GD and SGD from $30\%$ to $10\%$.

Motivated by the large gain from SGD, we conduct additional experiments to
exploit how the batch size affects the learning performance of QNNs.
Specifically, we train QNNs many times on the Wine data by SGD with batch size
growing exponentially. As shown in Figure 6, for both QNNN and QENN, the
increased batch size suppresses the convergence rate. For example, QNNN
achieves $80\%$ accuracy on the Wine dataset when batch size equals to $4$
after $40$ epochs, which is $10\%$ higher than that of batch size with $8$.

(a) Training process (b) Accuracy vs batch size

Figure 6: The relation between batch size of SGD and trainability of QNNs on
Wine dataset. (a) shows the convergence of quantum models with different
setting of batch size. bs is abbreviation of batch size. (b) shows the the
fluctuation of training accuracy with respective to batch size.

We then study how the explicit regularization technique, i.e., the weight
decay, effects the trainability of QNNs. Mathematically, the weight decay
stragety refers to adding a penalty term for the trainable paremters, i.e.,
$\arg\min_{\bm{\theta}}\mathcal{L}(\bm{\theta})=\frac{1}{n}\sum_{i=1}^{n}\ell(y^{(i)},\hat{y}^{(i)})+\lambda\|\bm{\theta}\|$.
The effect of weight decay on the trainability of QNNs is shown in Figure 5.
An immediate observation is that this strategy fails to enhance the
performance of QNNN with GD optimizer. With respect to SGD optimizer, the
weight decay method improves the test accuracy of QNNN by $2\%$ at the expense
of slightly low convergence rate. For QENN, weight decay together with SGD
assists models to obtain the fastest convergence in the first $20$ epochs.
However, it fails to efficiently narrow the gap between train accuracy and
test accuracy after the $40$-th epoch when the phenomenon of over fitting
begins to appear.

We last explore the performance of QNNs under the NISQ scenario. As depicted
by the brown line in Figure 5, quantum noise leads to the degraded
trainability QNNs, i.e., around $10\%$ accuracy decline compared with
noiseless settings. We defer the comparison of the runtime cost of simulating
QNNs and DNNs in Appendix D, which shows that QNNN under NISQ setting spends
up to $126s$ on one iteration, while the noiseless setting and classical MLP
only need $4s$ and $0.02s$ respectively.

###  4.1 Implications

The achieved results indicate that the widely used regularization techniques
in classical deep learning plays a different role in quantum machine learning.
Although SGD with the appropriate batch size slightly benefits the
optimization of QNNs, others regularization strategies such as weight decay
fail to enhance the trainability of QNNs. This differs QNNs with DNNs.
Advanced techniques are highly desired to improve the trainability of QNNs,
especially addressing the barren plateaus phenomenons. In addition, empirical
results exhibit that quantum system noise exacerbates the training difficulty
of QNNs. A promising way to resolve this issue is introducing various error
mitigation techniques into QNNs [64, 65, 66, 67, 68, 69].

##  5 Discussion and conclusions

In this study, we proceed systematic numerical experiments to understand the
generalization ability and trainability of typical QNNs in the view of
statistical learning theory. The achieved results exhibited that current QNNs
struggle a poor effective model capacity. As depicted in Figure 1, this
observation well explains why current QNNs can attain computational advantages
on quantum synthetic data classification tasks and discrete logarithm
problems, while they fail to compete with DNNs in tackling real-world learning
tasks. Moreover, our study illustrate that the regularization techniques,
which greatly contribute to the success of DNNs, have limited effects towards
the trainability of QNNs. In addition, our study exhibits that quantum system
noise suppresses the learnability of QNNs, which echoes with the theoretical
study [35]. Last, to alleviate the dilemma of current QNNs, we discuss several
prospective directions such as designing over-parameterized QNNs without
barren plateaus and developing effective error mitigation techniques.

Besides the contributions towards the understanding the power of QNNs, we
build an open-source benchmark to fairly and comprehensively assess the
learnability of various QNNs in a standard process, and consequently benefit
the design of new paradigms of QNNs. Specifically, this benchmark provides
several ready-to-use datasets, quantum and classical models as well as
evaluation scripts. Furthermore, we adopt the factory method in the software
design to help users easily register their self-defined models into the whole
framework. More models and tasks will be supported in the future. We believe
that this benchmark will facilitate the whole quantum machine learning
community.

Note added. During the preparation of the manuscript, we notice that a very
recent theoretical study [70] indicated that to deeply understand the power of
QNNs, it is necessary to demonstrate whether QNNs possess the ability to
achieve zero risk for a randomly-relabeled real-world classification task.
Their motivation highly echoes with our purpose such that statistical learning
theory can be harnessed as a powerful tool to study the capability and
limitations of QNNs. In this perspective, the achieved results in this study
provide a negative response to their question. Combining the analysis in [70]
and our results, a promising research direction is analyzing the non-uniform
generalization bounds of QNNs to understand their power.

## References

  * [1] Ian Goodfellow, Yoshua Bengio, and Aaron Courville.  Deep learning.  MIT press, 2016.
  * [2] Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar.  Foundations of machine learning, 2012.
  * [3] Vladimir Vapnik.  The nature of statistical learning theory.  Springer science & business media, 2013.
  * [4] Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger.  Densely connected convolutional networks.  In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4700–4708, 2017.
  * [5] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton.  Imagenet classification with deep convolutional neural networks.  Advances in neural information processing systems, 25:1097–1105, 2012.
  * [6] Sepp Hochreiter and Jürgen Schmidhuber.  Long short-term memory.  Neural computation, 9(8):1735–1780, 1997.
  * [7] Mike Schuster and Kuldip K Paliwal.  Bidirectional recurrent neural networks.  IEEE transactions on Signal Processing, 45(11):2673–2681, 1997\.
  * [8] Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nathan Srebro.  Exploring generalization in deep learning.  In Proceedings of the 31st International Conference on Neural Information Processing Systems, NIPS’17, page 5949–5958, Red Hook, NY, USA, 2017. Curran Associates Inc.
  * [9] Ruoyu Sun.  Optimization for deep learning: theory and algorithms.  arXiv preprint arXiv:1912.08957, 2019.
  * [10] Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals.  Understanding deep learning requires rethinking generalization.  In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017.
  * [11] Frank Arute, Kunal Arya, Ryan Babbush, Dave Bacon, Joseph C Bardin, Rami Barends, Rupak Biswas, Sergio Boixo, Fernando GSL Brandao, David A Buell, et al.  Quantum supremacy using a programmable superconducting processor.  Nature, 574(7779):505–510, 2019.
  * [12] John Preskill.  Quantum computing in the nisq era and beyond.  Quantum, 2:79, 2018.
  * [13] Jacob Biamonte, Peter Wittek, Nicola Pancotti, Patrick Rebentrost, Nathan Wiebe, and Seth Lloyd.  Quantum machine learning.  Nature, 549(7671):195, 2017.
  * [14] Aram W Harrow and Ashley Montanaro.  Quantum computational supremacy.  Nature, 549(7671):203, 2017.
  * [15] Maria Schuld, Ilya Sinayskiy, and Francesco Petruccione.  The quest for a quantum neural network.  Quantum Information Processing, 13(11):2567–2586, 2014.
  * [16] Kerstin Beer, Dmytro Bondarenko, Terry Farrelly, Tobias J Osborne, Robert Salzmann, Daniel Scheiermann, and Ramona Wolf.  Training deep quantum neural networks.  Nature Communications, 11(1):1–6, 2020.
  * [17] Iris Cong, Soonwon Choi, and Mikhail D Lukin.  Quantum convolutional neural networks.  Nature Physics, 15(12):1273–1278, 2019.
  * [18] Yuxuan Du, Min-Hsiu Hsieh, Tongliang Liu, and Dacheng Tao.  A grover-search based quantum learning scheme for classification.  New Journal of Physics, 2021.
  * [19] Edward Farhi and Hartmut Neven.  Classification with quantum neural networks on near term processors.  arXiv preprint arXiv:1802.06002, 2018.
  * [20] Vojtěch Havlíček, Antonio D Córcoles, Kristan Temme, Aram W Harrow, Abhinav Kandala, Jerry M Chow, and Jay M Gambetta.  Supervised learning with quantum-enhanced feature spaces.  Nature, 567(7747):209, 2019.
  * [21] Kosuke Mitarai, Makoto Negoro, Masahiro Kitagawa, and Keisuke Fujii.  Quantum circuit learning.  Physical Review A, 98(3):032309, 2018.
  * [22] Maria Schuld and Nathan Killoran.  Quantum machine learning in feature hilbert spaces.  Physical review letters, 122(4):040504, 2019.
  * [23] Takeru Kusumoto, Kosuke Mitarai, Keisuke Fujii, Masahiro Kitagawa, and Makoto Negoro.  Experimental quantum kernel machine learning with nuclear spins in a solid.  arXiv preprint arXiv:1911.12021, 2019.
  * [24] He-Liang Huang, Yuxuan Du, Ming Gong, Youwei Zhao, Yulin Wu, Chaoyue Wang, Shaowei Li, Futian Liang, Jin Lin, Yu Xu, et al.  Experimental quantum generative adversarial networks for image generation.  arXiv preprint arXiv:2010.06201, 2020.
  * [25] Manuel S Rudolph, Ntwali Toussaint Bashige, Amara Katabarwa, Sonika Johr, Borja Peropadre, and Alejandro Perdomo-Ortiz.  Generation of high resolution handwritten digits with an ion-trap quantum computer.  arXiv preprint arXiv:2012.03924, 2020.
  * [26] Daiwei Zhu, Norbert M Linke, Marcello Benedetti, Kevin A Landsman, Nhung H Nguyen, C Huerta Alderete, Alejandro Perdomo-Ortiz, Nathan Korda, A Garfoot, Charles Brecque, et al.  Training of quantum circuits on a hybrid quantum computer.  Science advances, 5(10):eaaw9918, 2019.
  * [27] Cornelius Hempel, Christine Maier, Jonathan Romero, Jarrod McClean, Thomas Monz, Heng Shen, Petar Jurcevic, Ben P Lanyon, Peter Love, Ryan Babbush, et al.  Quantum chemistry calculations on a trapped-ion quantum simulator.  Physical Review X, 8(3):031022, 2018.
  * [28] Abhinav Kandala, Antonio Mezzacapo, Kristan Temme, Maika Takita, Markus Brink, Jerry M Chow, and Jay M Gambetta.  Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets.  Nature, 549(7671):242–246, 2017.
  * [29] Google AI Quantum et al.  Hartree-fock on a superconducting qubit quantum computer.  Science, 369(6507):1084–1089, 2020.
  * [30] Alberto Peruzzo, Jarrod McClean, Peter Shadbolt, Man-Hong Yung, Xiao-Qi Zhou, Peter J Love, Alán Aspuru-Guzik, and Jeremy L O’brien.  A variational eigenvalue solver on a photonic quantum processor.  Nature communications, 5:4213, 2014.
  * [31] Amira Abbas, David Sutter, Christa Zoufal, Aurélien Lucchi, Alessio Figalli, and Stefan Woerner.  The power of quantum neural networks.  arXiv preprint arXiv:2011.00027, 2020.
  * [32] Leonardo Banchi, Jason Pereira, and Stefano Pirandola.  Generalization in quantum machine learning: a quantum information perspective.  arXiv preprint arXiv:2102.08991, 2021.
  * [33] Kaifeng Bu, Dax Enshan Koh, Lu Li, Qingxian Luo, and Yaobo Zhang.  On the statistical complexity of quantum circuits.  arXiv preprint arXiv:2101.06154, 2021.
  * [34] Yuxuan Du, Min-Hsiu Hsieh, Tongliang Liu, Shan You, and Dacheng Tao.  On the learnability of quantum neural networks.  arXiv preprint arXiv:2007.12369, 2020.
  * [35] Yuxuan Du, Zhuozhuo Tu, Xiao Yuan, and Dacheng Tao.  An efficient measure for the expressivity of variational quantum algorithms.  arXiv preprint arXiv:2104.09961, 2021.
  * [36] Hsin-Yuan Huang, Michael Broughton, Masoud Mohseni, Ryan Babbush, Sergio Boixo, Hartmut Neven, and Jarrod R McClean.  Power of data in quantum machine learning.  arXiv preprint arXiv:2011.01938, 2020.
  * [37] Hsin-Yuan Huang, Richard Kueng, and John Preskill.  Information-theoretic bounds on quantum advantage in machine learning.  arXiv preprint arXiv:2101.02464, 2021.
  * [38] Vladimir Vapnik.  Principles of risk minimization for learning theory.  In Advances in neural information processing systems, pages 831–838, 1992.
  * [39] Stephen Boyd and Lieven Vandenberghe.  Convex optimization.  Cambridge university press, 2004.
  * [40] Jarrod R McClean, Sergio Boixo, Vadim N Smelyanskiy, Ryan Babbush, and Hartmut Neven.  Barren plateaus in quantum neural network training landscapes.  Nature communications, 9(1):1–6, 2018.
  * [41] Zeyuan Allen-Zhu, Yuanzhi Li, and Yingyu Liang.  Learning and generalization in overparameterized neural networks, going beyond two layers.  In Advances in neural information processing systems, pages 6158–6169, 2019.
  * [42] Kenji Kawaguchi, Leslie Pack Kaelbling, and Yoshua Bengio.  Generalization in deep learning.  arXiv preprint arXiv:1710.05468, 2017.
  * [43] Marcello Benedetti, Erika Lloyd, Stefan Sack, and Mattia Fiorentini.  Parameterized quantum circuits as machine learning models.  Quantum Science and Technology, 4(4):043001, 2019.
  * [44] M Cerezo, Andrew Arrasmith, Ryan Babbush, Simon C Benjamin, Suguru Endo, Keisuke Fujii, Jarrod R McClean, Kosuke Mitarai, Xiao Yuan, Lukasz Cincio, et al.  Variational quantum algorithms.  arXiv preprint arXiv:2012.09265, 2020.
  * [45] Michael A Nielsen and Isaac L Chuang.  Quantum computation and quantum information.  Cambridge University Press, 2010.
  * [46] Peter Wittek.  Quantum machine learning: what quantum computing means to data mining.  Academic Press, 2014.
  * [47] Yuxuan Du, Min-Hsiu Hsieh, Tongliang Liu, and Dacheng Tao.  Expressive power of parametrized quantum circuits.  Phys. Rev. Research, 2:033125, Jul 2020.
  * [48] Ryan LaRose and Brian Coyle.  Robust data encodings for quantum classifiers.  Physical Review A, 102(3):032420, 2020.
  * [49] Seth Lloyd, Maria Schuld, Aroosa Ijaz, Josh Izaac, and Nathan Killoran.  Quantum embeddings for machine learning.  arXiv preprint arXiv:2001.03622, 2020.
  * [50] Maxwell Henderson, Samriddhi Shakya, Shashindra Pradhan, and Tristan Cook.  Quanvolutional neural networks: powering image recognition with quantum circuits.  Quantum Machine Intelligence, 2(1):1–9, 2020.
  * [51] Zoë Holmes, Kunal Sharma, M Cerezo, and Patrick J Coles.  Connecting ansatz expressibility to gradient magnitudes and barren plateaus.  arXiv preprint arXiv:2101.02138, 2021.
  * [52] Diederik P Kingma and Jimmy Ba.  Adam: A method for stochastic optimization.  arXiv preprint arXiv:1412.6980, 2014.
  * [53] James Stokes, Josh Izaac, Nathan Killoran, and Giuseppe Carleo.  Quantum natural gradient.  Quantum, 4:269, 2020.
  * [54] Seth Lloyd.  Quantum approximate optimization is computationally universal.  arXiv preprint arXiv:1812.11075, 2018.
  * [55] Maria Schuld, Ryan Sweke, and Johannes Jakob Meyer.  Effect of data encoding on the expressive power of variational quantum-machine-learning models.  Physical Review A, 103(3):032430, 2021.
  * [56] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun.  Deep residual learning for image recognition.  In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
  * [57] Dheeru Dua and Casey Graff.  UCI machine learning repository, 2017.
  * [58] Yann LeCun.  The mnist database of handwritten digits.  http://yann. lecun. com/exdb/mnist/, 1998.
  * [59] Maria Schuld.  Quantum machine learning models are kernel methods.  arXiv preprint arXiv:2101.11020, 2021.
  * [60] Xinbiao Wang, Yuxuan Du, Yong Luo, and Dacheng Tao.  Towards understanding the power of quantum kernels in the nisq era.  arXiv preprint arXiv:2103.16774, 2021.
  * [61] IBM Quantum.  https://quantum-computing.ibm.com/, 2021.
  * [62] Léon Bottou, Frank E Curtis, and Jorge Nocedal.  Optimization methods for large-scale machine learning.  Siam Review, 60(2):223–311, 2018.
  * [63] Rong Ge, Furong Huang, Chi Jin, and Yang Yuan.  Escaping from saddle points—online stochastic gradient for tensor decomposition.  In Conference on learning theory, pages 797–842. PMLR, 2015.
  * [64] Yuxuan Du, Tao Huang, Shan You, Min-Hsiu Hsieh, and Dacheng Tao.  Quantum circuit architecture search: error mitigation and trainability enhancement for variational quantum solvers.  arXiv preprint arXiv:2010.10217, 2020.
  * [65] Suguru Endo, Simon C Benjamin, and Ying Li.  Practical quantum error mitigation for near-future applications.  Physical Review X, 8(3):031027, 2018.
  * [66] Suguru Endo, Zhenyu Cai, Simon C Benjamin, and Xiao Yuan.  Hybrid quantum-classical algorithms and quantum error mitigation.  Journal of the Physical Society of Japan, 90(3):032001, 2021.
  * [67] Abhinav Kandala, Kristan Temme, Antonio D Córcoles, Antonio Mezzacapo, Jerry M Chow, and Jay M Gambetta.  Error mitigation extends the computational reach of a noisy quantum processor.  Nature, 567(7749):491–495, 2019.
  * [68] Armands Strikis, Dayue Qin, Yanzhu Chen, Simon C Benjamin, and Ying Li.  Learning-based quantum error mitigation.  arXiv preprint arXiv:2005.07601, 2020.
  * [69] Kristan Temme, Sergey Bravyi, and Jay M Gambetta.  Error mitigation for short-depth quantum circuits.  Physical review letters, 119(18):180509, 2017.
  * [70] Matthias C. Caro, Elies Gil-Fuster, Johannes Jakob Meyer, Jens Eisert, and Ryan Sweke.  Encoding-dependent generalization bounds for parametrized quantum circuits, 2021.
  * [71] Aram W Harrow and John C Napp.  Low-depth gradient measurements can improve convergence in variational hybrid quantum-classical algorithms.  Physical Review Letters, 126(14):140502, 2021.
  * [72] Ville Bergholm, Josh Izaac, Maria Schuld, Christian Gogolin, M Sohaib Alam, Shahnawaz Ahmed, Juan Miguel Arrazola, Carsten Blank, Alain Delgado, Soran Jahangiri, et al.  Pennylane: Automatic differentiation of hybrid quantum-classical computations.  arXiv preprint arXiv:1811.04968, 2018.
  * [73] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala.  Pytorch: An imperative style, high-performance deep learning library.  In Advances in Neural Information Processing Systems 32, pages 8024–8035. Curran Associates, Inc., 2019.

##  Appendix A Quantum computing

Analogous to the fundamental role of bit in classical computing, the
fundamental unit in quantum computation is quantum bit (qubit), which refers
to a two-dimensional vector. Under Dirac notation, a qubit state is defined as
$\ket{\bm{\alpha}}=a_{0}\ket{0}+a_{1}\ket{1}\in\mathbb{C}^{2}$, where
$\ket{0}=[1,0]^{\top}$ and $\ket{1}=[0,1]^{\top}$ specify two unit bases, and
the coefficients $a_{0},a_{1}\in\mathbb{C}$ satisfy
$|a_{0}|^{2}+|a_{1}|^{2}=1$. Similarly, an $N$-qubit state is denoted by
$\ket{\Psi}=\sum_{i=1}^{2^{N}}a_{i}\ket{\bm{e}_{i}}\in\mathbb{C}^{2^{N}}$,
where $\ket{\bm{e}_{i}}\in\mathbb{R}^{2^{N}}$ is the unit vector whose $i$-th
entry being 1 and other entries are 0, and $\sum_{i=0}^{2^{N}-1}|a_{i}|^{2}=1$
with $a_{i}\in\mathbb{C}$. Apart from Dirac notation, the density matrix can
be used to describe more general qubit states. For example, the density matrix
corresponding to the state $\ket{\Psi}$ is
$\rho=\ket{\Psi}\bra{\Psi}\in\mathbb{C}^{2^{N}\times 2^{N}}$. For a set of
qubit states $\\{p_{i},\ket{\Psi_{i}}\\}_{i=1}^{m}$ with $p_{i}>0$,
$\sum_{i=1}^{m}p_{i}=1$, and $\ket{\Psi_{i}}\in\mathbb{C}^{2^{N}}$ for
$\forall i\in m$, its density matrix is $\rho=\sum_{i=1}^{m}p_{i}\rho_{i}$
with $\rho_{i}=\ket{\psi_{i}}\bra{\psi_{i}}$ and
$\operatorname{Tr}({\rho})=1$.

Figure 7: The quantum logic gates. The table contains the abbreviation, the
mathematical form, and the graph representation of a set of universal quantum
gates explored in this study.

There are three types of quantum operations using to manipulate qubit states,
which are quantum (logic) gates, quantum channels, and quantum measurements.
Specifically, quantum gates, as unitary transformations, can be treated as the
computational toolkit for quantum circuit models, i.e., an $N$-qubit gate
$U\in\mathcal{U}(2^{N})$ obeys $UU^{\dagger}=\mathbb{I}_{2^{N}}$, where
$\mathcal{U}(\cdot)$ stands for the unitary group. Throughout the whole study,
we focus on the single-qubit and two-qubit quantum gate set
$\\{\mathop{\text{H}},\mathop{\text{X}},\mathop{\text{Y}},\mathop{\text{Z}},\mathop{\text{RX}},\mathop{\text{RY}},\mathop{\text{RZ}},\mathop{\text{CNOT}},\mathop{\text{CZ}}\\}$,
as summarized in Figure 7. Note that the investigated set is universal such
that such that these quantum gates can be used to reproduce the functions of
all the other quantum gates [45]. Different from quantum gates that evolve
qubit states in the closed system, quantum channels are applied to formalize
the evolving of qubits states in the open system. Mathematically, every
quantum channel $\mathcal{E}(\cdot)$ is a linear, completely positive, and
trace-preserving map [45]. A special quantum channel is called depolarization
channel, which is defined as

$\mathcal{E}_{p}(\rho)=(1-p)\rho+p\frac{\mathbb{I}_{2^{N}}}{2^{N}}.$ (4)

Intuitively, the depolarizing channel considers the worst-case scenario such
that the information of the input state can be entirely lost with some
probability. The aim of quantum measurements is extracting quantum information
of the evolved state, which contains the computation result, into the
classical form. In this study, we concentrate on the positive operator-valued
measures (POVM), which is described by a collection of positive operators
$0\preceq\Pi_{i}$ satisfying $\sum_{i}\Pi_{i}=\mathbb{I}$. Specifically,
applying the measurement $\\{\Pi_{i}\\}$ to the state $\rho$, the probability
of outcome $i$ is given by

$\Pr(i)=\operatorname{Tr}(\rho\Pi_{i}).$ (5)

##  Appendix B Optimization of QNNs

There are many methods to optimize Eqn. (1) when the hypothesis is represented
by Eqn. (3), which include the zero-order, the first-order, and the second-
order optimizers [43]. For clearness, here we concentrate on the first-order
optimizer, where the gradients $\partial
C\left(h(\bm{\theta},\bm{x}^{(i)}),y^{(i)}\right)/\partial\bm{\theta}$ are
obtained by the parameter shift rule [21], which can be effectively realized
on NISQ devices. Specifically, we denote the parameter as
$\bm{\theta}=(\bm{\theta}_{1}^{T},\cdots,\bm{\theta}_{L}^{T})^{T}$ with
$\bm{\theta}_{l}=(\theta_{l1},\cdots,\theta_{l,k_{l}})^{T}$, where the
subscript $l_{k}$ refers to the number of parameters or gates of the $l$-th
learnable circuit layer. Then the derivative of the hypothesis
$h(\bm{\theta},\bm{x}^{(i)})$ with respect to $\theta_{l,k_{l}}$ can be
evaluated by running twice the same quantum circuit which differs only in a
shift of this parameter. Mathematically, as each parameter gate we use in the
designed circuit is generated by a Pauli operator $P_{l,k_{l}}$, i.e.,
$U_{l,k_{l}}(\theta_{l,k_{l}})=\exp(-i\theta_{l,k_{l}}P_{l,k_{l}}/2)$, the
parameter shift rule yields the equality

$\frac{\partial
h(\bm{\theta},\bm{x}^{(i)})}{\partial{\theta}_{l,k_{l}}}=\frac{1}{2\sin\alpha}\left[h(\bm{\theta}+\alpha\bm{e}_{l,k_{l}},\bm{x}^{(i)})-h(\bm{\theta}-\alpha\bm{e}_{l,k_{l}},\bm{x}^{(i)})\right],$
(6)

where $\bm{e}_{l,k_{l}}$ is the unit vector along the $\theta_{l,k_{l}}$ axis
and $\alpha$ can be any real number but the multiple of $\pi$ because of the
diverging denominator. The gradient of
$C\left(h(\bm{\theta},\bm{x}^{(i)}),y^{(i)}\right)$ can be computed by using
the chain rule.

With the gradient $\partial
C\left(h(\bm{\theta},\bm{x}^{(i)}),y^{(i)}\right)/\partial\bm{\theta}$ at
hand, many gradient descent algorithms can be employed to find the optimal
parameter point. In this paper, we mainly consider stochastic gradient descent
(SGD) algorithm and stochastic quantum natural gradient descent (SQNGD)
algorithm, which both effectively deal with the randomness of gradient induced
by finite measurement and hardware noise. SGD is widely used in deep learning,
whose optimization strategy is to update the trainable parameters in the
steepest direction indicated by the gradient. Formally, each optimization step
is given by

$\bm{\theta}_{t+1}=\bm{\theta}_{t}-\eta\nabla C\left(\bm{\theta}\right)$ (7)

where $\eta$ is the learning rate and $C(\bm{\theta})$ is short for the loss
function regarding the parameter $\bm{\theta}$.

Unlike SGD which chooses vanilla gradient as its optimization guidance, SQNGD
employs the quantum natural gradient, a quantum analogy of natural gradient,
to perform the parameter updating. While vanilla gradient descent chooses the
steepest descent direction in the $l_{2}$ geometry of parameter space, which
has been shown to be sub-optimal for the optimization of quantum variational
algorithms [71], quantum natural gradient descent works on the space of
quantum states equipped with a Riemannian metric tensor (called Fubini-Study
metric tensor) that measures the sensitivity of the quantum state to
variations in the parameters. This method always updates each parameter with
optimal step-size independent of the parameterization, achieving a faster
convergence than SGD. Formally, we denote the quantum state produced by the
PQC as $\ket{\psi_{\bm{\theta}}}$. The optimization rule of SQNGD involving
the pseudo-inverse $g^{+}(\bm{\theta}_{t})$ of the metric tensor yields

$\bm{\theta}_{t+1}=\bm{\theta}_{t}-\eta g^{+}(\bm{\theta}_{t})\nabla
C\left(\bm{\theta}\right),$ (8)

where $g_{ij}(\bm{\theta})=\operatorname{Re}[G_{ij}(\bm{\theta})]$ is the
Fubini-Study metric tensor, and $G_{ij}(\bm{\theta})$ is the Quantum Geometric
Tensor which can be written as

$G_{ij}(\bm{\theta})=\braket{\frac{\partial\psi_{\bm{\theta}}}{\partial{\theta}_{i}},\frac{\partial\psi_{\bm{\theta}}}{\partial{\theta}_{j}}}-\braket{\frac{\partial\psi_{\bm{\theta}}}{\partial{\theta}_{i}},\psi_{\bm{\theta}}}\braket{\psi_{\bm{\theta}},\frac{\partial\psi_{\bm{\theta}}}{\partial{\theta}_{j}}}$
(9)

with $\theta_{i}$ being the $i$-th entry of parameter vector $\bm{\theta}$.

##  Appendix C Numerical simulation details

The outline of this section is as follows. The configuration of numerical
simulations conducted in Section 3 and 4 is introduced in this section. First,
we will give a detailed description about the datasets used in Section 3 and
4. Next, we present the implementation details of each type of QNNs. Last, the
deployed simulation hardware and hyper-parameters settings are demonstrated.

###  C.1 Dataset

Quantum synthetic dataset. We randomly sample classical data from uniform
distribution and then embed them into quantum circuit by assigning each
classical sample to the rotation angle of each quantum rotation gate. After
converting classical data $\bm{x}$ to quantum state $\rho(\bm{x})$, we run the
quantum circuit shown in Figure and measure the expectation of observable $O$.
The whole process is expressed as

$f_{\bm{\theta}}(\bm{x})=\bra{\bm{0}}U^{\dagger}(\bm{x},\bm{\theta})OU(\bm{x},\bm{\theta})\ket{\bm{0}},$
(10)

where $U$ denotes the quantum circuit which depends on classical sample
$\bm{x}$ and trainable parameter $\bm{\theta}$. For binary classification
task, the label $y$ of input $\bm{x}$ is calculated by
$sign(f_{\bm{\theta}}(\bm{x}))$. We totally collect 200 positive samples and
200 negative samples, and split them into training set and test set equally.

Wine dataset. For 1-D signal, we select the Wine Data Set from UCI Machine
Learning Repository, whose feature dimension is similar to the quantum
synthetic data so that they can be flexibly encoded into quantum circuit. In
addition, the categories are truncated to two classes, keeping consistent with
the quantum data.

MNIST dataset. For 2-D images, a subset of MNIST is extracted to evaluate
performance of QCNN and CNN. At the same time, the original digit images with
size of $28*28$ are resized to $10*10$ for reducing resource consumption.
License: Yann LeCun and Corinna Cortes hold the copyright of MNIST dataset,
which is a derivative work from original NIST datasets. MNIST dataset is made
available under the terms of the Creative Commons Attribution-Share Alike 3.0
license.

In summary, the statistical characteristics of three datasets are listed in
Tabel 1.

Table 1: Three datasets used in experiments Dataset | Dimension | Class number | Training sample | Test sample
---|---|---|---|---
Quantum synthetic data | 16 | 2 | 200 | 200
The Wine data | 13 | 2 | 65 | 65
MNIST | $10\times 10$ | 10 | 2000 | 2000

###  C.2 Implementation details

QNNN. QNNN is roughly divided into two blocks, including the feature embedding
block and trainable measurement block. In this paper, the feature embedding
block converts the classical data into quantum state by setting the parameter
of quantum gates with classical data. The measurement block consists of a
variational quantum circuit that linearly transforms the prepared quantum
state and the measurement operation that calculates the expectation of Pauli Z
basis. The number of qubits in experiments depends on the feature dimension of
datasets. Concretely, we employ quantum circuits with 16, 13 and 4 qubits for
quantum synthetic data, the Wine Data Set and MNIST respectively. The detailed
circuit arrangement is described in Figure 8 (a).

(a) QNNN (b) QENN

Figure 8: Layout of QNNN and QENN. (a) QNNN. Gate $R_{y}(x)$ means the
rotation gate generated by Pauli Y, whose angle is determined by the given
classical data $x$. $Rot(\theta)$ represents the general rotation gate with
three rotation angles $\theta_{x},\theta_{y},\theta_{z}$. $[\cdot]_{\times l}$
denotes the layer is repeated $l$ times. The initial state $\ket{0}^{\otimes
n}$ is processed by the whole circuit, and the prediction of input $x$ is
calculated by measuring the expectation of Pauli Z basis on the first qubit.
(b) QENN. The only difference compared with the QNNN is the embedding layer,
where there are additional trainable parameters to flexibly encode the
classical data according to the feedback of measurement. $ZZ(\theta)$ gate is
formulated by $\exp(-i\frac{\theta}{2}Z^{\otimes 2})$, which is a type of two-
qubit gate introducing entanglement.

QENN. The basic architecture of QENN model is the same as that of QNNN. What
is different is that the embedding layer also contains trainable parameters.
By making the feature embedding learnable, the quantum circuit forms a more
flexible and complicated transform function, which is more powerful than the
vanilla QNNN. The detailed layout of QENN is shown in Figure 8 (b).

QCNN. The QCNN employed in this paper can be regarded as a quantum version of
classical CNN, where the classical convolutional kernel is replaced with
quantum circuit, as demonstrated in 2. In particular, we implement a $2\times
2$ kernel with a variational quantum circuit of 4 qubits and 6 trainable
parameters, as depicted in Figure 9. In addition, multiple duplicates of the
quantum circuit are introduced to simulate the multi-channel mechanism. The
feature maps returned by quantum kernels are further processed by two fully-
connected layer of 32 and 10 nodes respectively.

Figure 9: Layout of CNN and QCNN. The top half represents the overall
structure of these two models. What is the difference between CNN and QCNN is
the convolution kernel. (a) CNN kernel. The classical convolution kernel is
implemented by the fully-connected layer, which takes the flattened pixels
inside a local patch as input and outputs the convolutional result. (b) QCNN
kernel. Firstly, the value of each pixel inside the same window of a kernel is
encoded as the angle of $RX$ gate. Then several controlled-RZ (CRZ) and
controlled-RX (CRX) operators are employed to learn the transformation.
Finally, we measure the expectation of Pauli Z basis on the first qubit as the
result of quantum convolution.

CNN. As shown in Figure 9, the structure of CNN adopted in the experiments is
the same as that of QCNN, with the quantum convolutional kernels substituted
by classical convolutional kernels and other components unchanged.

MLP. MLP is constructed by sequentially connecting multiple fully-connected
layers one by one. When processing quantum synthetic data and the Wine data,
we adopt a three-layer MLP, with the dimension of hidden layer depending on
the limitation of total number of trainable parameters. For MNIST dataset, the
original 2-D image is firstly flattened into an 1-D vector, which then input
into a three-layer MLP with 32 hidden nodes, as described in Figure 10.
Therefore, the MLP designed for MNIST replaces the convolution layer by the
fully-connected layer. In this way, we can observe how quantum convolution
affects the training process.

Figure 10: Layout of MLP for MNIST. We first convert the image to an 1-D
vector, followed by two FC (fully-connected) layers. By only replacing the
first convolutional layer of CNN and QCNN with a FC layer, we can figure out
the role of quantum convolutional kernel in the training.

###  C.3 The deployed hardware and hyper-parameter settings

The QNNs referred in this paper are implemented based on Pennylane [72] and
PyTorch [73]. Due to the limited accessibility of physical quantum computers,
all experiments are simulated on classical computers with Intel(R) Xeon(R)
Gold 6267C CPU @ 2.60GHz and 128 GB memory. To simulate the quantum noise, we
adopt the noise model from ibmq_16_melbourne, which is one of the IBM Quantum
Canary Processors [61].

For fair comparison, the number of trainable parameters of different models
for the same task is kept close and the structure-independent hyper-parameters
during training are not fine tuned specifically for each model but always keep
the same setting for one task. Meantime, the experiment with a specific
configuration is repeated 10 times and calculate the average as final
experiment result. The rigorous experiment setup is listed in Table 2.

Table 2: Hyper-parameter setting in the experiments Model | Learning rate | Batch size | Optimizer
---|---|---|---
QNNN | 0.01 | 4 | SGD
QENN | 0.01 | 4 | SGD
QCNN | 0.001 | 5 | Adam
CNN | 0.001 | 5 | Adam

##  Appendix D The performance of QNNs in the NISQ scenario

In this section, we explore the performance of QNNs under the NISQ scenario.
The achieved results are depicted in Figure 11. In particular, the solid and
dashed lines describe the training process on noiseless and NISQ devices
respectively. An immediate observation is that quantum system noise largely
weaken the power of quantum models, leading to a severe accuracy drop (from
about $94\%$ to $80\%$) on quantum synthetic data. Furthermore, the noisy QNNs
seems to completely lose the ability of matching the random data.

Figure 11: Quantum noise reduces quantum model capacity. FT denotes the fault-
tolerant devices, TL is the abbreviation of "true label", and RL is the
abbreviation of "random label". When running the same quantum circuit on noisy
devices,there is a serious performance decline in terms of the ability of
learning the original data and fitting random label.

##  Appendix E Trainability of QNNs on other datasets

Here we proceed a series of experiments investigate the trainability of QNNs
with respect to the two regularization techniques, i.e., stochastic gradient
descent (SGD) and weight decay, on the quantum synthetic dataset. The
collected results are shown in Figure 12.

Figure 12: Effects of regularization techniques on the training of QNNs on
quantum synthetic data. GD is gradient decent, SGD is stochastic gradient
descent, WD is weight decay and N means running the experiments on NISQ chips.
SGD plays a significant role in accelerating convergence and achieving higher
accuracy, while early stopping hinders the optimization process instead of
boosting performance.

SGD. The batch SGD optimizer effectively boosts the convergence rate of QNNs
without obvious over-fitting. Specifically, in the first 20 epochs, the train
and test accuracy of QNNN (QENN) with SGD rapidly rise to nearly $95\%$
($80\%$), while GD optimizer only helps QNNN (QENN) achieve $3\%$ ($2\%$)
accuracy growth with respect to the initial models. After finishing the whole
training process after 100 epochs, there is still a $20\%$ ($30\%$) accuracy
gap between QNNN (QENN) optimized by the vanilla GD and SGD optimizers.

In view of the substantial positive effects brought by SGD on the training of
QNNs, we further exploit how the batch size effects the trainability of QNNs.
As depicted in Figure 13, it appears an nonmonotonic decline of the
convergence rate and accuracy with respect to the increment of batch size. And
there exists an optimal batch size, which allows the best convergence rate and
the highest accuracy (the best batch size is around 8 in our setting).

NISQ. Although SGD optimizer facilitates the trainability of QNNs, the system
noise in NISQ devices weakens the positive effect brought by SGD. As indicated
by the purple line in Figure 12, it appears almost $10\%$ ($5\%$) accuracy
decay for QNNN (QENN) in the first 20 training epochs in the NISQ scenario.
Meantime, the existence of noise extremely amplifies the runtime of QNNs by
classical simulations (Please refer to Appendix F for more details).

(a) Training process (b) Accuracy vs batch size

Figure 13: Batch size of SGD significantly influences the training of quantum
models. (a) shows the convergence of quantum models with different setting of
batch size. bs is abbreviation of batch size. (b) shows the the fluctuation of
test accuracy with respective to batch size.

Weight decay. Weight decay plays a slightly different role in the training of
QNNN and QENN. For QNNN, there is no significant effect after applying the
weight decay regularizer to the SGD optimizer. For QENN which is more powerful
than QNNN, the strategy of weight decay leads to faster convergence and
finally achieve a higher accuracy. Note that both QNNN and QENN do not
encounter apparent over-fitting issue on quantum synthetic data, which leaves
little space for weight decay to show its potential in alleviating over-
fitting.

##  Appendix F Runtime analysis

We compare the runtime of QNNs and DNNs when processing the Wine dataset with
the fixed number of qubits. As shown in Figure 14 (a), simulating QNNs under
the NISQ setting suffers from the lowest efficiency, which averagely spends
$126$s to execute one iteration. For the fault-tolerant setting, the running
time of every optimization step steeply declines to $3$s. However, there still
exists a huge gap of time cost between simulating QNNs and DNNs on classical
computers. Another noticeable phenomenon is that noise cause a greater
negative impact on the running time of larger-scale QNNs. After applying noise
in the training, QENN spends more $114$s than QNNN on every iteration, while
the increment in time with fault-tolerant setting is $1$s.

In light of the exponential growth of runtime with the increased scale of
QNNs, we next indicate how the number of qubits effects their simulation time.
As shown in Figure 14 (b), the runtime of simulating QNNN is sensitive to the
qubit scale, appearing an exponential growth with the increment of qubits,
especially for QNNN in NISQ environment. On the contrary, MLP experiences a
negligible growth of time on every training iteration when the dimensions of
input feature vector and hidden layer steadily increase.

Figure 14: Runtime of QNNs and DNNs simulated by classical computers. FT is
the abbreviation of "Fault-tolerant". (a) Comparison of running time of every
iteration for each setting. Currently, the time cost of simulating noisy
quantum circuits on classical computers is unacceptable, which is hundreds of
times higher than that of the counterpart of classical version. (b) With the
increasing number of required qubits for feature embedding, the time of
training noisy QNNN grows exponentially while MLP sees a slow and negligible
growth of running time.