# A Hybrid Quantum-Classical
Generative Adversarial Network
for Near-Term Quantum Processors

Albha O’Dwyer Boyle and Reza Nikandish A. O’Dwyer Boyle was with the School of
Electrical and Electronic Engineering, University College Dublin, Ireland.R.
Nikandish is with the School of Electrical and Electronic Engineering,
University College Dublin, Ireland, and also with the Center for Quantum
Engineering, Science, and Technology, University College Dublin, Ireland
(e-mail: reza.nikandish@ieee.org).

###### Abstract

In this article, we present a hybrid quantum-classical generative adversarial
network (GAN) for near-term quantum processors. The hybrid GAN comprises a
generator and a discriminator quantum neural network (QNN). The generator
network is realized using an angle encoding quantum circuit and a variational
quantum ansatz. The discriminator network is realized using multi-stage
trainable encoding quantum circuits. A modular design approach is proposed for
the QNNs which enables control on their depth to compromise between accuracy
and circuit complexity. Gradient of the loss functions for the generator and
discriminator networks are derived using the same quantum circuits used for
their implementation. This prevents the need for extra quantum circuits or
auxiliary qubits. The quantum simulations are performed using the IBM Qiskit
open-source software development kit (SDK), while the training of the hybrid
quantum-classical GAN is conducted using the mini-batch stochastic gradient
descent (SGD) optimization on a classic computer. The hybrid quantum-classical
GAN is implemented using a two-qubit system with different discriminator
network structures. The hybrid GAN realized using a five-stage discriminator
network, comprises 63 quantum gates and 31 trainable parameters, and achieves
the Kullback-Leibler (KL) and the Jensen-Shannon (JS) divergence scores of
0.39 and 0.52, respectively, for similarity between the real and generated
data distributions.

###### Index Terms:

Generative adversarial network (GAN), hybrid quantum-classical model, noisy
intermediate-scale quantum (NISQ), quantum circuit, quantum computing, quantum
machine learning, quantum neural network (QNN), variational quantum algorithm
(VQA).

##  I Introduction

Quantum computing can potentially lead to an unparalleled boost in
computational power by using prominent features of quantum physics including
superposition, entanglement, interference, and parallelism. This computational
advantage can lead to revolutions in many emerging technologies which are
hindered by current computing limitations in the software and hardware levels.
The current quest for a practical quantum computer, when successful, can
provide significant benefits to several applications including machine
learning [1, 2, 3, 4, 5, 6], autonomous driving [7], healthcare and drug
discovery [8], cryptography and secure communications [9, 10], teleportation
[11], and internet [12].

Since the conception of quantum computing in 1980s [13], this field has
experienced several landmark developments to prove its promising capabilities
and attract recent interests. The most notable inventions in the algorithm
level include the Shor’s algorithm for prime number factorization and discrete
logarithm on a quantum computer [14], the Grover’s algorithm for efficient
search in unstructured large databases [15], the Deutsch–Jozsa algorithm for
classification of a binary function as constant or balanced [16], and the HHL
algorithm for solving linear systems of equations [17].

Quantum computers can outperform classic computers by the virtue of using
quantum algorithms [18]. Quantum algorithms are traditionally developed for
long-term fault-tolerant quantum computers with a large number of nearly
perfect qubits (e.g., over 1 million). The quality of such algorithms is
evaluated by their asymptotic computational complexity, i.e., how the quantum
algorithm can perform a given computational task faster than a classic
algorithm. The impressive speed advantage predicted by quantum algorithms,
e.g., quadratic speedup for Grover’s search algorithm,
$\mathcal{O}(\sqrt{N})$, and exponential speedup for quantum support vector
machine (SVM), $\mathcal{O}(\log{N})$, has been a driving force in the recent
extensive efforts on quantum computers [1].

The near-term quantum computers, aka Noisy Intermediate-Scale Quantum (NISQ)
computers [19], are realized using imperfect and limited number of qubits
(e.g., 10–100). The quantum circuits realized using these noisy qubits should
have a limited depth to avoid the loss of quantum state by the quantum
decoherence. These quantum computers cannot provide computational resources
required to leverage the fault-tolerant quantum algorithms and, as a result,
can outperform classic computers only in a few computational tasks [1, 19].
The near-term quantum computers are realized to demonstrate quantum advantages
for some specific computational tasks [20, 21]. A quantum algorithm should
account for the inherent limitations of the NISQ computers, e.g., limited
number of qubits, decoherence of qubits, limited depth of quantum circuits,
and poor connectivity of qubits, to be able to achieve a quantum advantage.
Variational quantum algorithms (VQAs) have emerged as one of the, if not the,
most effective approaches in the near-term quantum computing era [22, 23, 24].
Quantum machine learning can significantly benefit from the VQAs which can
also be interpreted as quantum neural networks (QNNs) [3, 4, 1, 2, 5, 6]. The
quantum circuit parameters can be trained by an optimizer using a predefined
loss function running on a classic computer. Nevertheless, there are several
challenges in trainability, efficiency, and accuracy of the VQAs which should
be addressed through innovative solutions [25, 24].

Most of quantum machine learning models are inspired by a classic model.
Generative adversarial network (GAN), proposed by Goodfellow in 2014 [26], is
a powerful tool for classical machine learning, in which a generator model
captures the data distribution and a discriminator model maximizes the
probability of assigning the correct true/fake label to data. Quantum GAN was
proposed in 2018 for accelerating the classical GAN [27, 28]. It is shown that
in a fully quantum implementation, i.e., when the generator and discriminator
are realized on a quantum processor and the data is represented on high-
dimensional spaces, the Quantum GAN can achieve an exponential advantage over
the classic GAN [28].

This pioneering work on Quantum GAN were followed by a number of other
developments presented in the literature [29, 30, 31, 32, 33]. In [29], the
efficient loading of statistical data into quantum states is achieved using a
hybrid quantum-classical GAN. In [30], a hybrid quantum-classical architecture
is proposed to model continuous classical probability distributions. An
experimental implementation of the Quantum GAN using a programmable
superconducting processor is presented in [31], in which the generator and
discriminator are realized as multi-qubit QNNs, and the generator could
replicate an arbitrary mixed state with 99.9% fidelity. In another
experimental Quantum GAN, also implemented on a superconducting quantum
processor [32], an average fidelity of 98.8% is achieved for both of the pure
and mixed quantum states. A Quantum GAN architecture is proposed in [33] which
improves convergence of the minimax optimization problem by performing
entangling operations between the generator output and true quantum data.
These developments showcase some potentials of the Quantum GAN as a promising
near-term quantum algorithm, while still there are many open challenges to the
efficient realization, training, and application of the GAN in the quantum
domain.

In this article, we present a hybrid quantum-classical GAN for the near-term
quantum processors. The generator network comprises a quantum encoding circuit
and a variational quantum ansatz. The discriminator network is realized using
a modular design approach which enables control on the depth of quantum
circuits to mitigate impacts of the imperfect low-fidelity qubits in the near-
term quantum processors.

The article is structured as follows. In Section II, architecture of the
hybrid quantum-classical GAN, the gradient evaluation for quantum circuits,
and the Barren Plateaus issue are presented. The quantum neural architecture
search approach is discussed in Section III. In Section IV, training of the
variational quantum ansatzes in the hybrid GAN is presented. In Section V,
results of the implemented hybrid GAN are presented and discussed. Finally,
concluding remarks are summarized in Section VI.

##  II Hybrid Quantum-Classical GAN

###  II-A Hybrid GAN Architecture

Figure 1: The hybrid quantum-classical GAN architecture. The generator network
encodes the random noise into unitary operators $U_{0}(z_{i})$ which combined
with the parameterized unitary $U_{G}({\bm{\theta_{G}}})$ and the measurement
synthesize the generated data, $G(\bm{z})$. The generated data along with the
real data are fed into the discriminator network which embeds them into the
parameterized unitary $U_{D}(\bm{x},\bm{\theta_{D}})$ and after the
measurement performs the real/fake data classification. The classic processor
computes the loss functions $\mathcal{L}_{\text{D}}(\bm{\theta_{D}})$ and
$\mathcal{L}_{\text{G}}(\bm{\theta_{G}})$, and use their optimization results
to update the parameters $\bm{\theta_{G}}$ and $\bm{\theta_{D}}$.

The proposed hybrid quantum-classical GAN architecture is shown in Fig. 1. The
generator QNN is composed of a quantum encoding circuit and a variational
quantum ansatz. The encoding quantum circuit transforms the input classic data
into quantum states by using a specific algorithm. The encoding is realized
using a unitary quantum operator which can also be regarded as a feature map
that maps the input data to the Hilbert space of the quantum system. This
feature map serves similar to a kernel in classic machine learning. The
encoding circuit structure can have a significant impact on the generator QNN
behavior and should not be overlooked as a trivial operation. The variational
quantum ansatz is controlled by the vector parameter $\bm{\theta_{G}}$ which
is trained on a classic computer. The discriminator QNN is realized as a
variational quantum ansatz controlled by the vector parameter
$\bm{\theta_{D}}$. The generator is trained using a randomized input noise and
based on its success in fooling the discriminator. The discriminator is
trained using a given dataset and the output of generator until it reaches an
acceptable accuracy.

The generator and discriminator QNNs are trained using a zero-sum game. The
loss function for the GAN is defined as

$\displaystyle\mathcal{L}_{\text{GAN}}(\bm{\theta_{D}},\bm{\theta_{G}})=-\operatorname{\mathbb{E}}_{x}\left[\log(D(\bm{x},\bm{\theta_{D}}))\right]-$
(1)
$\displaystyle\operatorname{\mathbb{E}}_{z}\left[\log(1-D(G(\bm{z},\bm{\theta_{G}}),\bm{\theta_{D}}))\right]$

where $\bm{x}\sim p_{data}(\bm{x})$ is the real data, $\bm{z}\sim
p_{z}(\bm{z})$ is the noise, $D(\bm{x},\bm{\theta_{D}})$ denotes the
discriminator network, and $G(\bm{z},\bm{\theta_{G}})$ denotes the generator
network. The GAN ideally should solve the minimax game, i.e., the generator
tries to minimize the loss function while the discriminator tries to maximize
it. In practice, the two networks are trained using separate loss functions
[26] that should be minimized through iterative optimization

$\mathcal{L}_{\text{D}}(\bm{\theta_{D}})=-\operatorname{\mathbb{E}}_{x}\left[\log(D(\bm{x})\right]-\operatorname{\mathbb{E}}_{z}\left[\log(1-D(G(\bm{z})))\right],$
(2)
$\mathcal{L}_{\text{G}}(\bm{\theta_{G}})=-\operatorname{\mathbb{E}}_{z}\left[\log(D(G(\bm{z})))\right],$
(3)

where the dependency of the discriminator and generator functions on the
training parameters are not shown for simplicity. We will discuss the details
and practical considerations for the realization and training of the two
networks.

###  II-B Structure of Quantum Neural Networks

A promising approach to realize the QNNs is using VAQs. A VQA is composed of
an ansatz which can be realized as a parametric quantum circuit, an input
training dataset, and an optimizer which find the optimum values of the
ansatz’s quantum circuit parameters to minimize a defined cost function. The
optimizer usually operates on a classic computer which permits the use of vast
knowledge developed on classical machine learning. The ansatz structure, as
the core of the VQA, is generally selected based on features of the quantum
processor and the specific given task.

The ansatz can be described by a general unitary function
$U(\bm{x},\bm{\theta})$, which is conventionally considered as the product of
two separate unitary functions $U(\bm{\theta})W(\bm{x})$. The parameter-
dependent unitary $U(\bm{\theta})$ is defined as the product of cascaded
unitary functions

$U(\bm{\theta})=U(\theta_{1},...,\theta_{L})=\prod_{k=1}^{L}U_{k}(\theta_{k}),$
(4)

where $U_{k}(\theta_{k})$, the unitary function of the layer k, is
conventionally defined by an exponential function as

$U_{k}(\theta_{k})=e^{-jH_{k}\theta_{k}}.$ (5)

Here, $H_{k}$ is a Hermitian operator, $\theta_{k}$ is the element $k$ of the
training vector $\bm{\theta}$, and L is the number of layers in the ansatz
[22]. The unitary operator (5) can be interpreted as consecutive parametric
rotations with an orientation determined by the Hermitian $H_{k}$. This is
usually selected as one of the Pauli’s operators,
$H_{k}\in\\{\sigma_{x},\sigma_{y},\sigma_{z}\\}$, or their linear
superposition $\sum_{i}c_{i}\sigma_{i}$. The data-dependent unitary function
$W(\bm{x})$ can be similarly modeled as

$W(\bm{x})=\prod_{i=1}^{N}e^{-jG_{i}x_{i}},$ (6)

where $G_{i}$ is a constant and N is the length of dataset. The quantum state
prepared by (4) is achieved by

$\ket{\psi(\bm{x},\bm{\theta})}=U(\bm{x},\bm{\theta})\ket{\psi_{0}},$ (7)

where $\ket{\psi_{0}}$ is an initial quantum state. This quantum state can be
used to define a quantum model.

Classical optimization problems in the VQAs are generally in the NP-hard
complexity class [34], and, therefore, should be solved using specifically
developed methods, e.g., adapted stochastic gradient descent (SGD) [35] or
meta-learning [36, 37]. Major limitations of the VQAs are related to their
trainability, efficiency, and accuracy. Trainability of the VQAs is limited by
the Barren plateaus phenomenon (Section II-D), where gradient of the cost
function can become exponentially vanishing for a range of training parameters
[38]. Efficiency of the VQAs is evaluated by the number of measurements
required to estimate expectation values in the cost function. Generally, the
efficiency is dependent on the computational task of the VQA. Accuracy of the
VQAs is mostly impacted by hardware noise which is a notorious feature of the
NISQ processors. Noise slows down the training process, degrades accuracy of
the algorithm by impacting final value of the cost function, and can lead to
the noise-induced barren plateaus [39]. These practical challenges should be
considered for efficient architecture development and training of the VQAs.

Conventionally the VQAs are realized using parameterized quantum circuits
where the parameters specify the rotation angles for the quantum gates. These
angles are trained to minimize a specified loss function defined for a given
computational task. The loss function is dependent on the system inputs
$x_{k}$, circuit observables denoted by $O_{k}$, and trainable parameterized
unitary circuit $U(\bm{\theta})$

$\mathcal{L}(\bm{\theta})=f({x_{k}},{O_{k}},U(\bm{\theta})).$ (8)

The ansatz parameters are optimized using a classic optimizer to minimize the
cost function

$\bm{\theta^{*}}=\underset{\bm{\theta}}{\arg\min}\,\mathcal{L}(\bm{\theta}).$
(9)

The choice of ansatz architecture is an important consideration for QNN
operation. There are some generic quantum circuit architectures which have
performed well on a variety of computational problems and conventionally are
used in other applications [22, 40]. These ansatzes have a fixed architecture
and their trainable parameters are usually rotation angles. These algorithms
are relatively easy to implement and are hardware efficient, as they enable
control of the circuit complexity. We implement the generator QNN using this
approach. On the other hand, the quantum circuit architecture can also be
modified to find optimal architecture for the given task. We use this quantum
neural architecture search approach to realize the discriminator QNN.

The number of layers is an important design parameter of a QNN. Unfortunately,
there is no well-defined rule for finding the optimum number of layers. In a
fault-tolerant quantum computer, a deep QNN comprising large number of layers,
as allowed by the processor computational power, can provide higher accuracy.
However, in the NISQ computers performance of the quantum algorithm can
degrade by the decoherence of qubits, especially if the QNN includes many
layers. Therefore, in this work we use a modular design approach to control
depth of QNNs. This can mitigate the impacts of noise and barren plateaus, and
improve trainability of the QNNs.

###  II-C Gradient Evaluation

The cost function in VQAs is derived using hybrid quantum-classical processing
which should be minimized through a classical optimization approach. It is
useful to derive exact gradients of quantum circuits with respect to the gate
parameters. Using the parameter shift rule, gradients of a quantum circuit can
be estimated using the same architecture that realizes the original circuit

$\nabla_{\theta}f(x,\theta)=k[f(x,\theta+\Delta\theta)-f(x,\theta-\Delta\theta)],$
(10)

where $\Delta\theta$ denotes parameter shift and $k$ is a constant [41]. This
reduces the computational resources required to evaluate gradient of quantum
circuits.

A quantum rotation gate with a single-variable rotation $\theta$ can be
written in the form $G(\theta)=e^{-jh\theta}$, where $h$ is a parameter
representing the behavior of the gate. It is straightforward to show that the
first-order derivative of this function can be derived as

$\frac{\partial
G(\theta)}{\partial\theta}=k\left(G\left(\theta+\frac{\pi}{2}\right)-\left(\theta-\frac{\pi}{2}\right)\right).$
(11)

This leads to the conclusion that gradient of a quantum circuit composed of
rotation gates can be derived from the same quantum circuit evaluated at the
shifted angles $\theta\pm\frac{\pi}{2}$. This result can be extended to a
quantum circuit which its Hermitian operator has two distinct eigenvalues [42,
41]. For a quantum circuit with a measurement operator $\hat{O}$ and the
quantum state $\ket{\psi(\bm{\theta})}$, as defined in (7), the first-order
derivative of the output quantum state
$\braket{\psi(\bm{\theta})}{\hat{O}}{\psi(\bm{\theta})}$ with respect to the
element $\theta_{i}$ of the vector
$\bm{\theta}=\\{\theta_{1},...,\theta_{i},...,\theta_{n}\\}$ can be derived as

$\begin{split}\frac{\partial\braket{\psi(\bm{\theta})}{\hat{O}}{\psi(\bm{\theta})}}{\partial\theta_{i}}=\frac{1}{2}\left(\braket{\psi(\bm{\theta_{i}^{+}})}{\hat{O}}{\psi(\bm{\theta_{i}^{+}})}-\right.\\\
\left.\braket{\psi(\bm{\theta_{i}^{-}})}{\hat{O}}{\psi(\bm{\theta_{i}^{-}})}\right),\end{split}$
(12)

where

$\bm{\theta_{i}^{\pm}}=\\{\theta_{1},...,\theta_{i}\pm\frac{\pi}{2},...,\theta_{n}\\}.$
(13)

All of the angular rotation gates used in this paper feature Hermitian
operators with two distinct eigenvalues. Therefore, the gradient calculation
approach can be applied. It is noted that this method requires the output to
be calculated twice for each trainable parameter. On the other hand, it
doesn’t need any ancila qubit as in other methods [43]. In the hybrid GAN
algorithm, there is a large number of trainable parameters in the generator
and discriminator QNNs and, as a result, the use of parameter shift rule can
obviate the need for using many ancila qubits.

###  II-D Barren Plateaus

Barren plateaus issue is one of the challenges in training process of hybrid
quantum-classical algorithms where a parameterized quantum circuit is
optimized by a classical optimization loop. This results in exponentially
vanishing gradients over a wide landscape of parameters in QNNs [38, 44, 45,
37, 46]. Mechanisms of the barren plateaus are not completely understood and
its behaviors are still under investigation. In [38], it is shown that deep
quantum circuits with random initialization are especially prone to the barren
plateaus. Furthermore, the number of qubits plays an important role and for
sufficiently large number of qubits there is a high chance that the QNN
training end up to a barren plateau.

A number of strategies have been proposed to mitigate the effects of barren
plateaus in the training of QNNs. In [45], it is proposed to randomly
initialize the parameters of the first circuit block $U_{k}({\theta}_{k,1})$
and add a subsequent block whose parameters are set such that the unitary
evaluates to $U_{k}({\theta}_{k,2})=U_{k}({\theta}_{k,1})^{\dagger}$. This
means that each circuit block and therefore the whole circuit will initially
evaluate to the identity, i.e.,
$U_{k}({\theta}_{k,1})U_{k}({\theta}_{k,1})^{\dagger}=1$. This technique can
be effective in reducing the effects of barren plateaus, but it can alter the
quantum circuit structure depending on the initial choice of the ansatz, which
could degrade the generalization of the quantum classifier. Other approaches
including the use of structured initial guesses and the segment-by-segment
pretraining can also mitigate this issue [38].

In the hybrid quantum-classical GAN proposed in this paper, there are at least
two features which reduce the barren plateaus effect. First, the modular
structure of the QNNs with a primarily advantage of controlling their depth to
improve fidelity of the quantum circuits realized using noisy qubits, can also
reduce the gradient complexity and the barren plateaus. Second, the modular
design approach used to find optimal QNN structures leads to a trainable
encoding scheme (Section III-B) which can help to identify the network
architectures with the barren plateaus problem and modify them to resolve the
issue.

###  II-E Discriminator Network

The discriminator QNN of the hybrid quantum-classical GAN architecture is
composed of a trainable encoding circuit and separate layers of a
parameterized circuit ansatz. Details of the encoding circuit are discussed in
Section III. The discriminator network is used to realize a quantum
variational classifier. The expectation value of a single qubit in the
discriminator QNN is used to compute the neural network output. The output of
the discriminator network is a real number between $0$ and $1$ indicating the
probability of an input being a real data sample. The Z-basis expectation
value measured at the output of the discriminator network is given by
$\braket{\psi}{\sigma_{z}}{\psi}$, where $\sigma_{z}$ is the Pauli-Z matrix.
Assuming $\ket{\psi}=\alpha\ket{0}+\beta\ket{1}$, where $\alpha$ and $\beta$
are complex numbers satisfying $|\alpha|^{2}+|\beta|^{2}=1$, it can be shown
that

$\braket{\psi}{\sigma_{z}}{\psi}=|\alpha|^{2}-|\beta|^{2}.$ (14)

This quantity changes from $-1$ for $\ket{\psi}=\ket{1}$ to $1$ for
$\ket{\psi}=\ket{0}$. We can scale it to achieve a number between $0$ and $1$
at output of the discriminator network

$D=\frac{1}{2}\left(1+\braket{\psi}{\sigma_{z}}{\psi}\right).$ (15)

The loss function for the discriminator network is defined in (2). The loss
can be minimized using the minibatch stochastic gradient descent (SGD). This
requires the gradient of the loss function
$\mathcal{L}_{\text{D}}(\bm{\theta_{D}})$ to be evaluated with respect to the
vector parameter $\bm{\theta_{D}}$. Using (2), the derivative of the loss
function with respect to the component $\theta_{D}^{i}$ of the vector can be
derived as

$\frac{\partial\mathcal{L}_{\text{D}}(\bm{\theta_{D}})}{\partial\theta_{D}^{i}}=\frac{\partial\mathcal{L}_{\text{D}}}{\partial
D}\frac{\partial
D}{\partial\braket{\psi}{\sigma_{z}}{\psi}}\frac{\partial\braket{\psi}{\sigma_{z}}{\psi}}{\partial\theta_{D}^{i}}.$
(16)

There are two terms in the discriminator loss function (2) which we denote
them as $\mathcal{L}_{\text{D1}}$ and $\mathcal{L}_{\text{D2}}$. The first
derivative term of (16) can be derived using (2) as

$\frac{\partial\mathcal{L}_{\text{D1}}}{\partial
D}=-\frac{1}{D(\bm{x},\bm{\theta_{D}})}$ (17)
$\frac{\partial\mathcal{L}_{\text{D2}}}{\partial
D}=\frac{1}{1-D(G(\bm{z}),\bm{\theta_{D}})}.$ (18)

The second derivative term using (15) is given by

$\frac{\partial D}{\partial\braket{\psi}{\sigma_{z}}{\psi}}=\frac{1}{2}.$ (19)

The third derivative term can be calculated using the parameter shift rule,
(12) and (13), as

$\frac{\partial\braket{\psi}{\sigma_{z}}{\psi}}{\partial\theta_{D}^{i}}=\\\
\frac{1}{2}\left(\braket{\psi(\bm{\theta_{D}}^{i+})}{\sigma_{z}}{\psi(\bm{\theta_{D}}^{i+})}-\braket{\psi(\bm{\theta_{D}}^{i-})}{\sigma_{z}}{\psi(\bm{\theta_{D}}^{i-})}\right),$
(20)

where

$\bm{\theta_{D}^{i\pm}}=\\{\theta_{D}^{1},...,\theta_{D}^{i}\pm\frac{\pi}{2},...,\theta_{D}^{n}\\}.$
(21)

Comparing (20) with (15) indicates that the third derivative term can be
related to the discriminator output as the difference between its value
evaluated at $\bm{\theta_{D}^{i+}}$ and $\bm{\theta_{D}^{i-}}$. Therefore,
using (16)–(21), the derivative of the two terms of the loss function can be
derived as

$\frac{\partial\mathcal{L}_{\text{D1}}(\bm{\theta_{D}})}{\partial\theta_{D}^{i}}=-\frac{1}{2}\frac{D(\bm{x},\bm{\theta_{D}^{i+}})-D(\bm{x},\bm{\theta_{D}^{i-}})}{D(\bm{x},\bm{\theta_{D}})}$
(22)
$\frac{\partial\mathcal{L}_{\text{D2}}(\bm{\theta_{D}})}{\partial\theta_{D}^{i}}=\frac{1}{2}\frac{D(G(\bm{z}),\bm{\theta_{D}^{i+}})-D(G(\bm{z}),\bm{\theta_{D}^{i-}})}{1-D(G(\bm{z}),\bm{\theta_{D}})}$
(23)

This process can be performed for all elements of the vector parameter
$\bm{\theta_{D}}$ to derive gradient of the discriminator loss function as

$\bm{\nabla}\mathcal{L}_{\text{D}}=\sum_{i=1}^{n}{\frac{\partial\mathcal{L}_{\text{D}}(\bm{\theta_{D}})}{\partial\theta_{D}^{i}}\hat{u}_{D}^{i}},$
(24)

where $\hat{u}_{D}^{i}$ is the unit vector in the direction of parameter
$\theta_{D}^{i}$.

###  II-F Generator Network

The generator QNN of the hybrid quantum-classical GAN architecture is composed
of a quantum encoding circuit and a parameterized circuit ansatz. A fixed
encoding scheme is used in the generator network unlike the discriminator
network which included a trainable encoding circuit. Details of this approach
are presented in Section III. Similar to the discriminator network, the
Pauli-Z operator is used as the basis for measurement of the expectation
values of output qubits in the generator network, i.e.,
$\braket{\psi}{\sigma_{z}}{\psi}$. The expectation values can be normalized
using (15) to constraint output of the generator network between $0$ and $1$.

The loss function for the generator network is defined in (3). The network is
trained using the minibatch SGD and the loss associated with each batch is
derived by averaging across all data samples in that batch. Using (3), the
derivative of the loss function $\mathcal{L}_{\text{G}}(\bm{\theta_{G}})$ with
respect to the component $\theta_{G}^{i}$ of the vector $\bm{\theta_{G}}$ can
be derived as

$\frac{\partial\mathcal{L}_{\text{G}}(\bm{\theta_{G}})}{\partial\theta_{G}^{i}}=\frac{\partial\mathcal{L}_{\text{G}}}{\partial
D}\frac{\partial D}{\partial G}\frac{\partial G}{\partial\theta_{G}^{i}}.$
(25)

The first term can be directly calculated as

$\frac{\partial\mathcal{L}_{\text{G}}}{\partial
D}=-\frac{1}{D(G(\bm{z}),\bm{\theta_{D}})}.$ (26)

For the second term, we note that the output of the discriminator network is
related to the generator network function as
$D=D(G(\bm{z},\bm{\theta_{G}}),\bm{\theta_{D}})$, where $\bm{\theta_{D}}$ is
treated as a constant when the generator network is evaluated. The general
form of the parameter shift rule, defined by (10), can be applied provided
that

$\frac{\partial D}{\partial G}=k_{G}\left(D(G+\Delta G)-D(G-\Delta G)\right),$
(27)

where $k_{G}$ and $\Delta G$ are two properly selected parameters.
$G(\bm{z},\bm{\theta_{G}})$ is controlled by the vector parameter
$\bm{\theta_{G}}$ and, therefore, $k_{G}$ and $\Delta G$ should also be
generally dependent on it. These parameters cannot be explicitly determined
without a complete information about the $G(\bm{z},\bm{\theta_{G}})$ function.
A solution is to initialize their value based on (12) and (13), i.e.,
$k_{G}^{(1)}=\frac{1}{2}$ and $\Delta G^{(1)}=\frac{\pi}{2}$, and then
optimize them during the overall SGD process.

Furthermore, third term in (25) can be derived using the parameter shift rule,
(12) and (13), as

$\frac{\partial
G}{\partial\theta_{G}^{i}}=\frac{1}{2}\left(G(\bm{z},\bm{\theta_{G}^{i+}})-G(\bm{z},\bm{\theta_{G}^{i-}})\right),$
(28)

where

$\bm{\theta_{G}^{i\pm}}=\\{\theta_{G}^{1},...,\theta_{G}^{i}\pm\frac{\pi}{2},...,\theta_{G}^{n}\\}.$
(29)

The gradient of the generator loss function can be derived by running this
process for all elements of the vector parameter $\bm{\theta_{G}}$ as

$\bm{\nabla}\mathcal{L}_{\text{G}}=\sum_{i=1}^{n}{\frac{\partial\mathcal{L}_{\text{G}}(\bm{\theta_{G}})}{\partial\theta_{G}^{i}}\hat{u}_{G}^{i}},$
(30)

where $\hat{u}_{G}^{i}$ is the unit vector in the direction of parameter
$\theta_{G}^{i}$.

##  III Data Encoding

###  III-A Fundamentals

Data representation is a critical aspect for performance of quantum machine
learning. Classical data must first be transformed into quantum data before it
can be processed by quantum or hybrid quantum-classical algorithms. The data
encoding can be realized using different schemes, including basis encoding,
angle encoding, and amplitude encoding [47, 48, 49]. In the NISQ computers,
trainability and robustness of an algorithm are dependent on the encoding
scheme.

The encoding is conventionally realized using certain quantum circuits with a
fixed structure (Section III-B). In quantum machine learning, this approach
prepares the data for training of the QNN independent of the trainable
parameters of the network. We use this approach for the generator network.
However, in the discriminator network, we use a trainable encoding scheme
which improves the ultimate accuracy (Section III-C).

###  III-B Fixed Encoding Schemes

The data encoding entails mapping the classic data $\bm{x}$ to a high-
dimensional quantum Hilbert space using a quantum feature map
$\bm{x}\rightarrow\ket{\psi(\bm{x})}$ [48, 49, 50]. We evaluate different
encoding approaches for the hybrid quantum-classical GAN application on the
NISQ computers111Three fundamental encoding methods are investigated in this
paper..

####  III-B1 Basis Encoding

In the basis encoding, the classical data is converted to the binary
representation $\bm{x}\in\\{0,1\\}^{\otimes N}$ and then is encoded as the
basis of a quantum state

$\ket{\bm{x}}=\frac{1}{\sqrt{N}}\sum_{i=1}^{N}\ket{x_{i}}.$ (31)

The number of qubits is the same as the number of bits in the classical data
representation, $Q=\log_{2}{N}$. The basis encoding transforms the data
samples into quantum space where qubits can store multiple data samples using
the quantum superposition. However, the realization of basis encoding requires
additional auxiliary qubits [49]. This is particularly undesirable for the
NISQ computers as the excessive qubits can degrade the fidelity of quantum
algorithms.

####  III-B2 Angle Encoding

In the angle encoding, the classic data $\bm{x}=[x_{1},...,x_{N}]^{T}$ is
embedded into the angle of qubits as

$\ket{\bm{x}}=\bigotimes_{i=1}^{N}\cos(x_{i})\ket{0}+\sin(x_{i})\ket{1}.$ (32)

The realization of this approach requires the same number of qubits as the
number of data samples, $Q=N$ qubits. It is therefore less qubit efficient
compared to the basis and amplitude encoding methods. On the other hand, the
angle encoding can be implemented using a constant depth quantum circuit,
e.g., single-qubit rotation gates, e.g., RX, RY, RZ, and is therefore amenable
to the NISQ computers.

In the angle encoding, unlike the basis and amplitude encoding methods, the
data features are consecutively encoded into the qubits. This increases the
data loading time by a factor of $N$. It can be resolved by using $N$ parallel
quantum gates. The basic angle encoding defined by (32) can be modified to the
dense angle encoding [47] where two data features are encoded per qubit

$\ket{\bm{x}}=\bigotimes_{i=1}^{N/2}\cos(\pi x_{2i-1})\ket{0}+e^{j2\pi
x_{2i}}\sin(\pi x_{2i-1})\ket{1}.$ (33)

This methods needs $Q=\frac{1}{2}N$ qubits and improves the data loading
speed. However, a more complicated quantum circuit is required to implement
the encoding.

A subtle important point is that the angle encoding performs nonlinear
operations on the data through the sine and cosine functions. This feature map
can provide powerful quantum advantage in quantum machine learning, e.g.,
separate the data such that simplify the QNN circuit architecture and improve
its performance.

####  III-B3 Amplitude Encoding

The amplitude encoding embeds the classic data into the amplitudes of a
quantum state

$\ket{\bm{x}}=\frac{1}{||\bm{x}||}\sum_{i=1}^{N}x_{i}\ket{i},$ (34)

where $||\bm{x}||=\sqrt{\sum_{i}\left|x_{i}\right|^{2}}$ denotes the Euclidean
norm of $\bm{x}$. The number of data features $N$ is assumed to be a power of
two, $N=2^{n}$, and if necessary, this can be achieved by zero padding. This
encoding method requires $Q=\log_{2}{N}$ qubits. Quantum circuits used to
realize the amplitude encoding do not have a constant depth [51]. Therefore,
the amplitude encoding suffers the circuit implementation complexity and a
higher computational cost compared to the angle encoding. These considerations
make the amplitude encoding less favorable for the NISQ computers.

####  III-B4 Encoding Circuit Implementation

For each of the presented data encoding methods, there are many quantum
circuits which can be used to realize that encoding. The circuits can feature
different number of qubits, auxiliary qubits, quantum gates, and the circuit
depth. The problem of finding the optimal encoding scheme for a given
computational task still has not been explored in the literature. The encoding
circuit can be selected based on some criteria including the number of
required qubits and auxiliary qubits, computation cost, trainability and
robustness to noise other imperfections in the quantum computer hardware.

The generator network of the GAN should provide a broad diversity of output
synthetic quantum data to be fed to the discriminator network. There is no
certain desired output data distribution to be used as the basis for
optimization of the input encoding circuit. Therefore, we select a fixed
encoding quantum circuit followed by a parameterized circuit ansatz as the
generator network (Section IV-A). The angle encoding is realized using
multiple parallel rotation gates.

###  III-C Trainable Encoding Schemes

The fixed encoding schemes treat the encoding task merely as a classical-to-
quantum data transformation for subsequent processing by quantum circuits. The
data encoding is performed completely independent of the trainable
parameterized quantum circuits. We can envision a different avenue by directly
embedding the classical data into the quantum circuit as their control
parameters. This allows the data to be encoded using hardware-efficient
quantum circuits which are conjectured to be hard to simulate classically for
data encoding [50, 51, 52]. Furthermore, the nonlinear operations which can be
realized using encoding circuits, e.g., the angle encoding discussed in
Section III-B, can be included in different layers of the quantum circuit. The
interleaving of the rotation gates conditioned by the input data with the
variational rotation gates creates a trainable encoding circuit which can be
trained based on the given input data and expected output. It is shown that
this approach can reduce complexity of the required parameterized quantum
circuit or, in some cases, the trainable encoding circuit can accomplish the
certain task without using any additional circuit ansatz [51]. The trainable
encoding schemes can provide unique properties which call for future research.

In the developed hybrid quantum-classical GAN in this paper, we have
implemented the discriminator network using the trainable encoding approach.
Two trainable encoding circuits and an ansatz circuit are used as the possible
building blocks of the discriminator network. The discriminator network
architecture is selected by evaluating multiple possible architectures
achieved through different combinations of the encoding and ansatz circuits
(Section IV-B).

##  IV QNN Architectures

###  IV-A Generator QNN

The generator QNN architecture is shown in Fig. 2 which comprises a fixed
encoding quantum circuit followed by a parameterized circuit ansatz. The angle
encoding is realized using parallel RY gates with scaled input data features
$R_{y}(\pi x_{i})$ to control the range of rotation angle. The RY gate,
defined as $R_{y}(\theta)=\exp{(-j\frac{\theta}{2}\sigma_{y})}$, performs the
rotation about the Y axis. For example, $R_{y}(\pi x_{i})$ transforms the
initial qubit state $\ket{0}$ to
$\ket{\psi_{i}}=\cos(\frac{\pi}{2}x_{i})\ket{0}+\sin{(\frac{\pi}{2}x_{i})}\ket{1}$.

The variational ansatz circuit is realized using parameterized RY and
entangling RXX gates. The RXX gate is defined as
$R_{xx}(\theta)=\exp{(-j\frac{\theta}{2}\sigma_{x}\otimes\sigma_{x})}$, with
the maximum entanglement at $\theta=\frac{\pi}{2}$ and the identity matrix (no
entanglement) at $\theta=0$. The generator QNN includes a total of 11
trainable parameters $\theta_{i}$.

Figure 2: Architecture of the generator QNN. The data encoding is realized
using the RY gates with inputs $x_{i}$ and the variational ansatz circuit
includes the trainable parameters $\theta_{i}$.

###  IV-B Discriminator QNN

The discriminator QNN is realized using a combination of trainable encoding
circuits and a parameterized ansatz circuit. We consider two trainable
encoding circuits and the ansatz circuit shown in Fig. 3 as the possible
building blocks of the discriminator network.

In the first encoding circuit, $\rm E_{1}$ in Fig. 3, the first layer
comprises the Hadamard gates which transform the input qubits state to
superposition of the basis states with equal probabilities. The second layer
includes the RX gates with $\pi$-scaled input data features $x_{1}$ and
$x_{2}$. The RX gate, given by
$R_{x}(\theta)=\exp{(-j\frac{\theta}{2}\sigma_{x})}$, performs rotation about
the X axis. The third layer is a two-qubit RYY gate which creates entanglement
between its input qubits. The gate is defined as
$R_{yy}(\theta)=\exp{(-j\frac{\theta}{2}\sigma_{y}\otimes\sigma_{y})}$,
providing the maximum entanglement at $\theta=\frac{\pi}{2}$ and the identity
matrix at $\theta=0$. The next layers are consecutive RX and RZ gates with
scaled input data features $x_{1}$ and $x_{2}$ operating on one of the qubits
from the previous gate. The RZ gate, given by
$R_{z}(\theta)=\exp{(-j\frac{\theta}{2}\sigma_{z})}$, applies rotation about
the Z axis. The next layer is a parameterized RXX entangling gate and the last
layer is realized using the RZ gates.

The second encoding circuit, $\rm E_{2}$ in Fig. 3, has a same architecture as
the first encoding circuit except for the RXX gate being replaced with an RYY
gate. This modifies properties of the entanglement generated between the two
qubits.

The ansatz circuit, $\rm A$ in Fig. 3, is realized using five layers including
six trainable quantum gates. The circuit architecture is selected such that
include the fixed Hadamard gates, trainable single-qubit rotation gates RX and
RZ, and trainable two-qubit entangling gates RXX and RYY.

Figure 3: Trainable encoding circuits ($\rm E_{1}$ and $\rm E_{2}$) and
parameterized ansatz circuit ($\rm A$) for the realization of discriminator
network. The data features embedded in the circuits are shown by $x_{i}$ and
the trainable parameters of the quantum gates are denoted by $\theta_{i}$.

The discriminator QNN has been trained using the two-moon dataset which is
well-suited to the evaluation of quantum machine learning algorithms on the
NISQ computers [53, 51]. This is a two-feature dataset with a crescent shape
decision boundary. The dataset samples are normalized to the range 0 to 1. We
have explored an extensive number of QNN architectures realized using
different combinations of the encoding and ansatz circuits of Fig. 3. The
networks are evaluated based on their training time and accuracy. Five
representative networks considered as candidates for the discriminator QNN are
shown in Fig. 4. This modular design approach enables control on trade-offs
between accuracy of circuit complexity of the QNNs which is particularly
important for the NISQ processors.

Figure 4: Five quantum network architectures considered as candidates for the
realization of discriminator QNN. Details of the encoding and ansatz quantum
circuits $\rm E_{1}$, $\rm E_{2}$, and $\rm A$ are shown in Fig. 3.

The discriminator loss during training using the two-moon dataset for
different network candidates is shown in Fig. 5. The networks 1 and 2, which
are comprised of only trainable encoding circuits, achieve the lowest loss
levels (0.14 and 0.18, respectively). This validates our intuition about the
power of trainable encoding schemes discussed in Section III-C. Furthermore,
it is noted that the network 1 converges to the final loss level faster than
the network 2. The two networks differ in one of their entangling layers (Fig.
3), but this leads to different behaviors in their training dynamics. This
conclusion highlights the importance of using proper quantum gates to create
the entanglement.

The networks 3, 4, and 5 which comprise the ansatz circuit as well as one of
the trainable encoding circuits achieve higher loss levels, in spite of using
more trainable quantum gates. The network 4 reaches a loss of 0.35 after only
about 20 training epochs and fluctuates around this loss level upon further
training. This can be an indicator of the barren plateaus which prevent
efficient training of the network. It is concluded that adding more trainable
gates to the network architecture not only necessarily improves its accuracy,
but also can degrade the accuracy.

Figure 5: The discriminator network training loss for different architectures:
(a) up to 14 epochs, (b) up to 300 epochs.

In Fig. 6, output of the discriminator network trained using the two-moon
dataset shown. The network is realized using multiple stages of the trainable
encoding circuit shown in Fig. 3(a). Increasing the number of stages improves
the effectiveness of the boundaries separating the two classes of data
samples. The five-stage discriminator network as a quantum classifier can
efficiently separate data samples of the two classes with accuracy of 100% for
the class 0 samples and 99% for the class 1 samples.

Figure 6: The discriminator network output realized using multiple stages of
the trainable encoding circuit $\rm E_{1}$ (Fig. 3) and trained using the two-
moon dataset. (a) single-stage network, (b) four-stage network, (c) five-stage
network.

##  V Implementation Results of Hybrid GAN

The quantum circuits implementation and simulations are performed using the
IBM’s Qiskit open-source software development kit (SDK) which provides access
to prototype superconducting quantum processors through cloud-based quantum
computing services. The training procedure for the hybrid quantum-classical
GAN is outlined in Table I. The discriminator and generator networks are
trained iteratively using the mini-batch SGD algorithm with a learning rate of
0.01 and the mini-batch size of 10.

TABLE I:

Training Procedure of the Hybrid Quantum-Classical GAN
---
Algorithm: Minibatch Stochastic Gradient Descent
Trainable Parameters: $\bm{\theta_{D}}$ and $\bm{\theta_{G}}$
Hyperparameters: Learning rates $\alpha_{D}$, $\alpha_{G}$ and batch size $m$
for number of iterations:
for minibatch steps:
Discriminator
\- Sample subset of length $m$ from dataset.
\- Record $m$ generated samples.
\- Combine sampled with generated samples and assign
correct class labels.
\- Compute loss and discriminator parameter gradients
across all minibatch samples.
\- Update discriminator trainable parameters: θ_D^(k+1) = θ_D^(k) \- α_D 1m
∑_i = 1^m ∇ L_D,i
Generator
\- Set discriminator for generator training to updated
discriminator model
\- Generate $m$ minibatch samples.
\- Compute loss and generator parameter gradients across
all minibatch samples.
\- Update discriminator trainable parameters: θ_G^(k+1) = θ_G^(k) \- α_G 1m
∑_i = 1^m ∇ L_G,i

.

###  V-A Uniform Data Distribution

The real (train) and generated data distributions before training the hybrid
GAN are shown in Fig. 7(a). The generated data samples are achieved using the
randomly initiated generator network. The generated data sampled are bounded
between 0 and 1. The real data samples are uniformly distributed between 0.4
and 0.6. As expected, there is a very low similarity between the two random
distributions. In Fig. 7(b), the real and generated data distributions after
only 60 training epochs of the hybrid GAN are shown. The distribution of the
generated data has been significantly changed toward the distribution of the
real data. This confirms successful training of the hybrid GAN. The Inception
Score is a performance metric proposed for classical GAN [54] which partly
measures diversity of generated data. However, it is difficult to apply this
metric to the hybrid GAN due to the need for large number of data samples
(typically 30,000) [54].

In Fig. 8, loss of the discriminator and generator networks for 300 training
epochs of the hybrid GAN is shown. The generator loss is high in the beginning
of training as a result of random initialization. As the training proceeds,
the discriminator loss increases as the discriminator network is trained to
recognize the real data from the generator data. Ultimately, the discriminator
and generator loss reach a steady state. In this condition, the generator is
effectively able to fool the discriminator, while the discriminator identifies
about half of the data samples as the real data and the another half as the
fake data.

The class boundaries of the discriminator network and separated data samples
by the trained hybrid GAN are shown in Fig 9. The hybrid GAN can effectively
separate the real and generated data samples with the boundary close to 0.5.

Figure 7: Real and generated data distributions for the hybrid GAN trained
using a uniform data distribution. (a) before training the hybrid GAN, (b)
after training the hybrid GAN. Figure 8: Loss of the discriminator and
generator networks for 300 training epochs of the hybrid GAN. Figure 9: Class
boundaries of the discriminator and separated data samples by the hybrid GAN.

###  V-B Nonuniform Data Distribution

We also evaluate performance of the hybrid GAN using training data samples
with a nonuniform distribution. The training data distribution and output data
distribution of the generator with random initial states are shown in Fig.
10(a). There is a very low similarity between the distributions. The real and
generated data distributions after training the hybrid GAN are shown in Fig.
10(b). The generated data distribution has significantly changed toward the
real data distribution. We evaluate similarity between the real and generated
data distributions using the Kullback-Leibler (KL) and the Jensen–Shannon (JS)
divergence scores

$KL(p_{d}||p_{g})=\sum_{i}p_{d}(x_{i})\log\left(\frac{p_{d}(x_{i})}{p_{g}(x_{i})}\right)$
(35)
$JS(p_{d}||p_{g})=\frac{1}{2}KL\left(p_{d}\Big{|}\Big{|}\frac{p_{d}+p_{g}}{2}\right)+\frac{1}{2}KL\left(p_{g}\Big{|}\Big{|}\frac{p_{d}+p_{g}}{2}\right)$
(36)

where $p_{d}(\bm{x})$ is the probability density of real data $\bm{x}$ and
$p_{g}(\bm{x})$ is the posterior probability density of generated data
$G(\bm{z})$. In the optimum condition $p_{d}(\bm{x})=p_{g}(\bm{x})$, the KL
and JS scores will be zero. For the data distributions in Fig. 10, the KL
score is 1.71 before training and 0.39 after training the hybrid GAN. The JS
score decreases from 2.63 before training to 0.52 after training. These
results validate successful operation of the hybrid GAN for the nonuniform
data distribution.

For the nonuniform training data distribution, unlike the uniform
distribution, the discriminator network features different certainty in
separating the data samples as real/fake across the range of samples. This
mitigates a training failure in the hybrid GAN namely the mode collapse, which
will be discussed in Section V-C.

Figure 10: Real and generated data distributions for the hybrid GAN trained
using a nonuniform data distribution. (a) before training the hybrid GAN, (b)
after training the hybrid GAN.

###  V-C Training Challenges of Hybrid GAN

The training process of the hybrid GAN has been quite challenging and has
encountered multiple issues including convergence failure, slow training, and
mode collapse.

####  V-C1 Convergence Failure

Convergence of the GAN, in either classical or quantum domain, is difficult as
a result of the simultaneous training of the generator and discriminator
networks in a zero-sum game. In every training epoch that parameters of one of
the models are updated, the optimization problem for the other model is
changed. This means that an improvement in one model can lead to deterioration
of the other model. This trend can be observed in Fig. 8 epochs 1 to 100 where
the initial improvements in the generator loss lead to increasing loss of the
discriminator. The vanishing gradient problem in the GAN can be due to an
over-trained discriminator which rejects most of the generator samples (rather
than half of the samples). This issue can be prevented by avoiding over-
training of the discriminator network [26, 54]. If the GAN training is
successful, the two networks reach a state of equilibrium between the two
competing loss criteria. This phase of the training can be noted in Fig. 8
epochs 100 to 200. Afterward, losses of the generator and discriminator
networks are plateaued, indicating that the training process has converged.

####  V-C2 Slow Training

The barren plateaus as a general problem in the training of QNNs was discussed
in Section II-D. The barren plateaus is a vanishing gradients issue which can
extremely slow down or stop the progress of training process. It can be
mitigated through modified initial state of the quantum circuits and, if not
successful, changing the quantum circuits architecture. However, a major
challenge is that it cannot be predicted if a certain initial state or a
network architecture will encounter this issue before the network is trained
for a sufficient number of iterations which itself is also unknown. As a
result, the development and training of the QNNs usually entail several trials
and revisions of the network architecture.

####  V-C3 Mode Collapse

The convergence of training process is not a sufficient condition to guarantee
successful realization of the GAN. Another important issue is the mode
collapse which refers to the condition that the generator learns to produce
only a limited range of samples from the real data distribution. We have
encountered the mode collapse during training of the hybrid GAN. In Fig. 11,
distributions of the real and generated data samples are shown in the case of
hybrid GAN with mode collapse failure. The generated data samples are
concentrated around a limited range of samples (close to 0.45), while for most
of the real data samples there is no corresponding generated data samples. We
have resolved this issue by using different quantum circuits to realize the
generator QNN.

Furthermore, we have noted that the mode collapse occurs more frequently when
the GAN is trained using a uniform distribution. This is a result of the equal
probability of the data samples which the discriminator network classifies
them as the real data. For the nonuniform training data distribution, however,
the certainty of the discriminator in real/fake data classification is
different across the data samples.

In the classic GANs, some modified methods are developed to extend the range
of generated data samples, including Wasserstein GAN [55] and Unrolled GAN
[56]. It is an opportunity for future research to evaluate effectiveness of
such approaches in the hybrid quantum-classical GAN.

Figure 11:  Distributions of the real and generated data samples for the
hybrid GAN with mode collapse failure.

##  VI Conclusion

We presented a hybrid quantum-classical generative adversarial network (GAN).
The generator quantum neural network (QNN) is realized using a fixed encoding
circuit followed by a parameterized quantum circuit. The discriminator QNN is
implemented using a trainable encoding circuit through a modular design
approach which enables embedding of classical data into a quantum circuit
without using explicit encoding and ansatz circuits. It is shown that gradient
of the discriminator and generator loss functions can be calculated using the
same quantum circuits which have realized the discriminator and generator
QNNs. The developed hybrid quantum-classical GAN is trained successfully using
uniform and nonuniform data distributions. Using the nonuniform distribution
for training data, the mode collapse failure, which GANs are prone to, can be
mitigated. The proposed approach for the realization of hybrid quantum-
classical GAN can open up a research direction for the implementation of more
advanced GANs on the near-term quantum processors.

## References

  * [1] J. Biamonte, P. Wittek, N. Pancotting, P. Rebentrost, N. Wieber, and S. Lloyd, “Quantum machine learning,” _Nature_ , vol. 549, pp. 195–202, Sep 2017\.
  * [2] M. Schuld, I. Sinayskiy, and F. Petruccione, “An introdudution to quantum machine learning,” _Contemporary Physics_ , vol. 56, pp. 172–185, 2014.
  * [3] E. Farhi and H. Neven, “Classification with quantum neural networks on near term processors,” _arXiv preprint arXiv:1802.06002_ , 2018.
  * [4] M. Schuld, I. Sinayskiy, and F. Petruccione, “The quest for a quantum neural network,” _Quantum Information Processing_ , vol. 13, no. 11, pp. 2567–2586, 2014.
  * [5] A. Abbas, D. Sutter, C. Zoufal, A. Lucchi, A. Figalli, and S. Woerner, “The power of quantum neural networks,” _Nature Computational Science_ , vol. 1, no. 6, pp. 403–409, 2021.
  * [6] K. Beer, D. Bondarenko, T. Farrelly, T. J. Osborne1, R. Salzmann, D. Scheiermann, and R. Wolf, “Training deep quantum neural networks,” _Nature Communications_ , vol. 808, no. 11, pp. 1–6, 2021.
  * [7] A. Luckow, J. Klepsch, and J. Pichlmeier, “Quantum computing: Towards industry reference problems,” _Digitale Welt_ , vol. 5, no. 2, pp. 38–45, mar 2021\. [Online]. Available: https://doi.org/10.1007%2Fs42354-021-0335-7
  * [8] Y. Cao, J. Romero, and A. Aspuru-Guzik, “Potential of quantum computing for drug discovery,” _IBM J. Res. Dev._ , vol. 62, no. 6, nov 2018. [Online]. Available: https://doi.org/10.1147/JRD.2018.2888987
  * [9] N. Gisin, G. Ribordy, W. Tittel, and H. Zbinden, “Quantum cryptography,” _Reviews of modern physics_ , vol. 74, no. 1, p. 145, 2002.
  * [10] D. Bernstein and T. Lange, “Post-quantum cryptography,” _Nature_ , vol. 549, pp. 188–194, 2017.
  * [11] J. Ren, P. Xu, and H. Yong, “Ground-to-satellite quantum teleportation,” _Nature_ , vol. 549, pp. 70–73, Sep 2017.
  * [12] H. J. Kimble, “The quantum internet,” _Nature_ , vol. 453, pp. 1023–1030, 2008.
  * [13] R. P. Feynman, “Simulating physics with computers,” _International Journal of Theoretical Physics_ , vol. 21, pp. 467–488, 1982.
  * [14] P. Shor, “Algorithms for quantum computation: discrete logarithms and factoring,” in _Proceedings 35th Annual Symposium on Foundations of Computer Science_ , 1994, pp. 124–134.
  * [15] L. K. Grover, “A fast quantum mechanical algorithm for database search,” in _Proceedings of the Twenty-Eighth Annual ACM Symposium on Theory of Computing_ , ser. STOC ’96. Association for Computing Machinery, 1996, p. 212–219.
  * [16] D. Deutsch and R. Jozsa, “Rapid solution of problems by quantum computation,” _Proceedings of the Royal Society of London A_ , vol. 439, no. 1907, pp. 553–558, Dec 1992.
  * [17] A. W. Harrow, A. Hassidim, and S. Lloyd, “Quantum algorithm for linear systems of equations,” _Phys. Rev. Lett._ , vol. 103, p. 150502, Oct 2009. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.103.150502
  * [18] A. Montanaro, “Quantum algorithms: an overview,” _npj Quantum Inf_ , vol. 2, no. 15023, 2016.
  * [19] J. Preskill, “Quantum computing in the nisq era and beyond,” _Quantum_ , vol. 2, p. 79, 2018.
  * [20] F. Arute, K. Arya, R. Babbush, D. Bacon, J. C. Bardin, R. Barends, R. Biswas, S. Boixo, F. G. Brandao, D. A. Buell _et al._ , “Quantum supremacy using a programmable superconducting processor,” _Nature_ , vol. 574, no. 7779, pp. 505–510, 2019.
  * [21] L. Madsen, F. Laudenbach, M. Askarani, and et al, “Quantum computational advantage with a programmable photonic processor,” _Nature_ , vol. 606, pp. 75–81, 2022.
  * [22] M. Cerezo, A. Arrasmith, R. Babbush, S. C. Benjamin, S. Endo, K. Fujii, J. R. McClean, K. Mitarai, X. Yuan, L. Cincio _et al._ , “Variational quantum algorithms,” _Nature Reviews Physics_ , vol. 3, no. 9, pp. 625–644, 2021\.
  * [23] F. Tacchino, S. Mangini, P. K. Barkoutsos, C. Macchiavello, D. Gerace, I. Tavernelli, and D. Bajoni, “Variational learning for quantum artificial neural networks,” _IEEE Transactions on Quantum Engineering_ , vol. 2, pp. 1–10, 2021.
  * [24] M. Cerezo, G. Verdon, H. Y. Huang, L. Cincio, and P. J. Coles, “Challenges and opportunities in quantum machine learning,” _Nature Computational Science_ , vol. 2, pp. 567–576, 2022.
  * [25] M. Caro, H. Y. Huang, M. Cerezo, and et al., “Generalization in quantum machine learning from few training data,” _Nature Communications_ , vol. 13, no. 4919, pp. 1–11, 2022.
  * [26] I. J. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio, “Generative adversarial nets,” _Advances in neural information processing systems_ , vol. 27, 2014.
  * [27] P.-L. Dallaire-Demers and N. Killoran, “Quantum generative adversarial networks,” _Phys. Rev. A_ , vol. 98, p. 012324, Jul 2018. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevA.98.012324
  * [28] S. Lloyd and C. Weedbrook, “Quantum generative adversarial learning,” _Physical review letters_ , vol. 121, no. 4, p. 040502, 2018.
  * [29] C. Zoufal, A. Lucchi, and S. Woerner, “Quantum generative adversarial networks for learning and loading random distributions,” _npj Quantum Information_ , vol. 5, no. 1, pp. 1–9, 2019.
  * [30] J. Romero and A. Aspuru-Guzik, “Variational quantum generators: Generative adversarial quantum machine learning for continuous distributions,” _Advanced Quantum Technologies_ , vol. 4, no. 1, p. 2000003, 2021.
  * [31] K. Huang, Z.-A. Wang, C. Song, K. Xu, H. Li, Z. Wang, Q. Guo, Z. Song, Z.-B. Liu, D. Zheng _et al._ , “Quantum generative adversarial networks with multiple superconducting qubits,” _npj Quantum Information_ , vol. 7, no. 1, pp. 1–5, 2021.
  * [32] L. Hu, S.-H. Wu, W. Cai, Y. Ma, X. Mu, Y. Xu, H. Wang, Y. Song, D.-L. Deng, C.-L. Zou, and L. Sun, “Quantum generative adversarial learning in a superconducting quantum circuit,” _Science Advances_ , vol. 5, no. 1, p. eaav2761, 2019. [Online]. Available: https://www.science.org/doi/abs/10.1126/sciadv.aav2761
  * [33] M. Y. Niu, A. Zlokapa, M. Broughton, S. Boixo, M. Mohseni, V. Smelyanskyi, and H. Neven, “Entangling quantum generative adversarial networks,” _Physical Review Letters_ , vol. 128, no. 22, p. 220505, 2022.
  * [34] L. Bittel and M. Kliesch, “Training variational quantum algorithms is np-hard,” _Phys. Rev. Lett._ , vol. 127, p. 120502, Sep 2021. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.127.120502
  * [35] R. Sweke, F. Wilde, J. Meyer, M. Schuld, P. K. Fährmann, B. Meynard-Piganeau, and J. Eisert, “Stochastic gradient descent for hybrid quantum-classical optimization,” _Quantum_ , vol. 4, p. 314, 2020.
  * [36] T. Hospedales, A. Antoniou, P. Micaelli, and A. Storkey, “Meta-learning in neural networks: A survey,” 2020. [Online]. Available: https://arxiv.org/abs/2004.05439
  * [37] G. Verdon, M. Broughton, J. R. McClean, K. J. Sung, R. Babbush, Z. Jiang, H. Neven, and M. Mohseni, “Learning to learn with quantum neural networks via classical neural networks,” _arXiv preprint arXiv:1907.05415_ , 2019\.
  * [38] J. R. McClean, S. Boixo, V. N. Smelyanskiy, R. Babbush, and H. Neven, “Barren plateaus in quantum neural network training landscapes,” _Nature communications_ , vol. 9, no. 1, pp. 1–6, 2018.
  * [39] S. Wang, E. Fontana, M. Cerezo, S. K. Kunal, A. Sone, L. Cincio, and P. J. Coles, “Noise-induced barren plateaus in variational quantum algorithms,” _Nature Communications_ , vol. 6961, no. 121, pp. 1–6, 2021.
  * [40] R. Zhao and S. Wang, “A review of quantum neural networks: methods, models, dilemma,” _arXiv preprint arXiv:2109.01840_ , 2021.
  * [41] M. Schuld, V. Bergholm, C. Gogolin, J. Izaac, and N. Killoran, “Evaluating analytic gradients on quantum hardware,” _Physical Review A_ , vol. 99, no. 3, p. 032331, 2019.
  * [42] K. Mitarai, M. Negoro, M. Kitagawa, and K. Fujii, “Quantum circuit learning,” _Physical Review A_ , vol. 98, no. 3, p. 032309, 2018.
  * [43] A. F. Izmaylov, R. A. Lang, and T.-C. Yen, “Analytic gradients in variational quantum algorithms: Algebraic extensions of the parameter-shift rule to general unitary transformations,” _Physical Review A_ , vol. 104, no. 6, p. 062443, 2021.
  * [44] M. Cerezo, A. Sone, T. Volkoff, L. Cincio, and P. J. Coles, “Cost function dependent barren plateaus in shallow parametrized quantum circuits,” _Nature communications_ , vol. 12, no. 1, pp. 1–12, 2021.
  * [45] E. Grant, L. Wossnig, M. Ostaszewski, and M. Benedetti, “An initialization strategy for addressing barren plateaus in parametrized quantum circuits,” _Quantum_ , vol. 3, p. 214, Dec. 2019. [Online]. Available: https://doi.org/10.22331/q-2019-12-09-214
  * [46] S. Hadfield, Z. Wang, B. O’gorman, E. G. Rieffel, D. Venturelli, and R. Biswas, “From the quantum approximate optimization algorithm to a quantum alternating operator ansatz,” _Algorithms_ , vol. 12, no. 2, p. 34, 2019\.
  * [47] R. LaRose and B. Coyle, “Robust data encodings for quantum classifiers,” _Phys. Rev. A_ , vol. 102, p. 032420, Sep 2020. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevA.102.032420
  * [48] M. Schuld and N. Killoran, “Quantum machine learning in feature hilbert spaces,” _Physical review letters_ , vol. 122, no. 4, p. 040504, 2019.
  * [49] J. A. Cortese and T. M. Braje, “Loading classical data into a quantum computer,” _arXiv preprint arXiv:1803.01958_ , 2018.
  * [50] V. Havlìček, A. D. Còrcoles, K. Temme, A. W. Harrow, A. Kandala, J. M. Chow, and J. M. Gambetta, “Supervised learning with quantum-enhanced feature spaces,” _Nature_ , vol. 567, no. 7747, pp. 209–212, 2019.
  * [51] S. Lloyd, M. Schuld, A. Ijaz, J. Izaac, and N. Killoran, “Quantum embeddings for machine learning,” _arXiv preprint arXiv:2001.03622_ , 2020.
  * [52] M. Rötteler, “Quantum algorithms for highly non-linear boolean functions,” in _Proceedings of the twenty-first annual ACM-SIAM symposium on Discrete algorithms_. SIAM, 2010, pp. 448–457.
  * [53] M. Schuld, A. Bocharov, K. M. Svore, and N. Wiebe, “Circuit-centric quantum classifiers,” _Physical Review A_ , vol. 101, no. 3, p. 032308, 2020.
  * [54] T. Salimans, I. Goodfellow, W. Zaremba, V. Cheung, A. Radford, and X. Chen, “Improved techniques for training gans,” _Advances in neural information processing systems_ , vol. 29, pp. 2234–2242, 2016.
  * [55] M. Arjovsky, S. Chintala, and L. Bottou, “Wasserstein generative adversarial networks,” in _International conference on machine learning_. PMLR, 2017, pp. 214–223.
  * [56] L. Metz, B. Poole, D. Pfau, and J. Sohl-Dickstein, “Unrolled generative adversarial networks,” _arXiv preprint arXiv:1611.02163_ , 2016.