# Towards a scalable discrete quantum generative adversarial neural network

Smit Chaudhary  Menten AI, San Francisco, CA 94111, USA  Delft University of
Technology, Delft, The Netherlands  Patrick Huembeli  Menten AI, San
Francisco, CA 94111, USA  Ian MacCormack  Menten AI, San Francisco, CA 94111,
USA  Taylor L. Patti  NVIDIA, Santa Clara, CA 95051, USA  Jean Kossaifi
NVIDIA, Santa Clara, CA 95051, USA  Alexey Galda  Menten AI, San Francisco, CA
94111, USA

###### Abstract

We introduce a fully quantum generative adversarial network intended for use
with binary data. The architecture incorporates several features found in
other classical and quantum machine learning models, which up to this point
had not been used in conjunction. In particular, we incorporate noise
reuploading in the generator, auxiliary qubits in the discriminator to enhance
expressivity, and a direct connection between the generator and discriminator
circuits, obviating the need to access the generator’s probability
distribution. We show that, as separate components, the generator and
discriminator perform as desired. We empirically demonstrate the expressive
power of our model on both synthetic data as well as low energy states of an
Ising model. Our demonstrations suggest that the model is not only capable of
reproducing discrete training data, but also of potentially generalizing from
it.

##  I Introduction

Unsupervised and semi-supervised machine learning models have been successful
in recent years at learning from and generating complex sets of data, ranging
from images Xie  _et al._ (2017); Yu  _et al._ (2022); Ramesh  _et al._
(2021), to audio Vasquez and Lewis (2019), to time series data Ismail Fawaz
_et al._ (2019), and more. These models typically involve training on a set of
data whose essential features are distilled into a more compact form, from
which new samples that share the qualitative features of the training data can
be generated. Architectures for such generation include variational
autoencoders, generative adversarial networks (GANs), and language models like
transformers Goodfellow  _et al._ (2014). In this paper, we focus on GANs.
Generative adversarial models such as the style GAN Karras  _et al._ (2019,
2020, 2021) demonstrate state of the art image generation capabilities. GANs
also may be particularly well-suited as an architecture for unsupervised
quantum machine learning, which we discuss in more detail below. Specifically,
we introduce a quantum GAN architecture for learning from discrete datasets,
and show that this architecture has properties that suggest its scalability to
larger system sizes.

GANs come in a variety of forms, but all consist of two basic components: a
generator (G), which attempts to generate new samples from the distribution of
training data, and a discriminator (D) that attempts to distinguish the fake
data from $G$ from the real training data. During training, the two components
(which usually take the form of neural networks) compete in an adversarial
minmax game in which convergence is reached when the discriminator can no
longer distinguish between the real data and the generator’s forgeries. The
optimization is expressed generically in the following form:

$\displaystyle\min_{G}\max_{D}[\langle\log\left(D(x)\right)\rangle_{x\sim
p_{data}(x)}$ (1)
$\displaystyle-\langle\log\left(1-D(G(z))\right)\rangle_{z\sim p_{z}(z)}],$

where $p_{data}(x)$ is the training data distribution, and $p_{z}(z)$ is a
random distribution (often a multivariate Gaussian distribution, called the
prior), which the generator learns to map to samples that resemble the data,
$x$. This function is derived from the Jensen-Shannon divergence Goodfellow
_et al._ (2014), and quantifies the extent to which the data distribution and
the distribution of samples from the generator overlap. The first term is
maximized when $D$ correctly assigns labels to all ‘real’ and ‘fake’
(generated) data, while the second one is minimized when $G$ produces samples
that $D$ classifies as real data (the functions, $D$ and $G$ have a
probabilistic interpretation here). We update $D$ to maximize the former and
$G$ to minimize the latter, in an alternating, adversarial optimization. At
the end of a successful training run, $D$ should misclassify samples from $G$
half the time.

Since a GAN requires sampling fake data from a probability distribution,
$p(z)$, it is natural to wonder if a parameterized quantum circuit would be
well-suited as a generator. After all, a wave function naturally encodes a
potentially very intricate probability distribution over basis states, and the
measurement process naturally corresponds to taking a sample from this
distribution in a very efficient way. Indeed, sufficiently large quantum
circuits can very easily encode probability distributions that cannot be
efficiently sampled on a classical computer Du  _et al._ (2020). This suggests
the possibility of a more expressive _quantum_ generator, which could produce
a more intricate array of samples than, for example, a classical neural
network with a Gaussian prior distribution.

In this paper, we take advantage of this increased generative capability by
combining a quantum generator with a quantum discriminator into a fully
quantum GAN (QGAN), which we specifically apply to discrete data sets encoded
as binary strings. We first review recent work on partially and fully-quantum
GAN architectures. We then introduce the separate components of our QGAN
architecture, contrasting them with previous architectures and demonstrating
their capabilities as independent components. We then explain how the full
QGAN is trained. We demonstrate the full QGAN by training it on the low energy
states of a classical Ising model and showing that the average energy of the
states sampled from the generator is lower than that of a random sample, which
serves as evidence of generalization. Finally, we conclude with a discussion
about the scalability of the QGAN and future work.

##  II Previous work on GANs and QGANs

The recent emergence of quantum machine learning Schuld and Petruccione (2021)
has lead to the proposal of various hybrid architectures, including quantum
generative adversarial networks (QGANs) Dallaire-Demers and Killoran (2018);
Zoufal  _et al._ (2019); Zeng  _et al._ (2019); Situ  _et al._ (2020); Huang
_et al._ (2021); Stein  _et al._ (2021); Beer and Müller (2021); Niu  _et al._
(2022); Borras  _et al._ (2022); Chang  _et al._ (2022). Compared to other
probabilistic models, GANs are especially well suited for implementation on
quantum devices because they do not require exhaustive sampling during
training. Even more importantly, they do not require access to the output
probability distribution of the generator. These attributes render them a
promising candidate for a scalable generative quantum model. For a QGAN, we
replace the classical functions $G$ and $D$ from the previous section with
parameterized quantum circuits $U_{G}(\theta_{G})$ and $U_{D}(\theta_{D})$.

Previous works on QGANs have explored different architectures, benchmarked on
both binary and continuous data. In Zoufal  _et al._ (2019); Stein  _et al._
(2021); Huang  _et al._ (2021); Rudolph  _et al._ (2022), the authors focus on
continuous data, obtained by measuring expectation values at the output of the
quantum generator. As we will later see, their architectures cannot be ported
directly to our binary data. Furthermore, in Zoufal  _et al._ (2019); Rudolph
_et al._ (2022); Borras  _et al._ (2022); Chang  _et al._ (2022) as well as to
a lesser extent in Huang  _et al._ (2021), the authors use a classical
discriminator. In Beer and Müller (2021), the authors focus on learning
1-qubit quantum states. QGANs for binary data have been studied in Zeng  _et
al._ (2019); Situ  _et al._ (2020); Borras  _et al._ (2022). In these schemes
the binary samples are obtained via single-shot measurements of the
generator’s output. Both proposals use a classical discriminator. Since single
shot samples are not as readily differentiable as expectation values, the
binary generator has to be trained via the log-likelihood of its output
probability distribution. This renders the method computationally intractable,
as it scales exponentially in the number of qubits, requiring the estimation
of $\mathcal{O}(2^{N})$ output probabilities for $N$ qubits.

For continuous data, the output of the generator circuit is obtained by
measuring expectation values of arbitrary $n$-qubit operators. A common choice
are Pauli-$Z$ operators measured on each qubit. If such a continuous valued
quantum generator is employed alongside a classical discriminator, the
expectation values are used as the input to the discriminator. Since
expectation values are differentiable, the training of the quantum-classical
hybrid circuit can be performed via gradient backpropagation Rumelhart  _et
al._ (1988).

In contrast, with a quantum discriminator, the generator and the discriminator
form a single quantum circuit where the output state of the generator is
directly fed into the discriminator. As a result, no measurements are required
at the output of the generator and only a single qubit measurement is required
at the output of the discriminator to obtain the label ‘fake’ or ‘real’.

In other words, using a classical discriminator with a discrete quantum
generator somewhat defeats the purpose of a Quantum GAN. One of the advantages
of using a GAN is that the output probabilities of the generator $p_{G}(x)$ do
not have to be measured, which is particularly important when $p_{G}(x)$
corresponds to the amplitudes of a very large-dimensional wave function. For a
batch of discrete samples $x\sim p_{G}(x)$ and a classical discriminator
function $y=f_{D}(x)$, the average output of the discriminator with respect to
a batch of samples is $\langle y\rangle=\frac{1}{M}\sum_{x\sim
p_{G}(x)}f_{D}(x)$, where $M$ is the number of samples $x$. To take the
gradient of $\langle y\rangle$ with respect to the parameters $\theta_{G}$ of
$p_{G}$ one has to employ the log-likelihood ‘trick’, i.e.

$\displaystyle\nabla_{\theta_{G}}\langle y\rangle=\frac{1}{M}\sum_{x\sim
p_{G}(x)}\nabla_{\theta_{G}}\log(p_{G}(x))f_{D}(x).$ (2)

Measuring the probabilities $p_{G}(x)$ and their derivatives would require an
exponential amount of measurements. Thus, employing a classical discriminator
with a quantum generator for discrete data is not a scalable approach.

To our knowledge, none of the proposed QGAN architectures for discrete data
use a quantum discriminator, relying instead on measuring the sample
probabilities $p_{G}(x)$. However, there is good reason to believe that
generative quantum models are well-suited to the task of learning and
generalizing from distributions of discrete data Alcazar  _et al._ (2021);
Gili  _et al._ (2022, 2022a); Banchi  _et al._ (2021). This juxtaposition
motivates the central question of this work: can discrete quantum GANs be
constructed with a quantum generator and a quantum discriminator and trained
on the discriminator labels alone? Furthermore, the aim of this work is to
better understand the capabilities of QGANs to learn binary data
distributions. To test the components of our QGAN architecture, we use a
synthetic “bars and stripes dataset”, which provides a simple and easily
visualizable check as to whether the generator and discriminator are
functioning properly. We then demonstrate the QGAN by training it on a subset
of the low energy states of classical Ising Hamiltonians. Hamiltonians of this
sort are particularly relevant, as they are used to encode quadratic
unconstrained binary optimization (QUBO) problems of the sort solved by the
quantum approximate optimization algorithm (QAOA). As such optimization
problems are vital to a wide variety of fields, if the QGAN can meaningfully
supplement algorithms like QAOA by providing additional low energy solutions,
it would impact numerous practical applications.

##  III Our QGAN Architecture

We here introduce the components of our QGAN architecture that distinguish it
from other proposed QGANs. Before explaining the details of our generator and
discriminator, we first note that we use a Wasserstein-type loss Arjovsky  _et
al._ (2017) to train our GAN, rather than the standard GAN loss given in Eq.
I. Generically, the Wasserstein loss replaces non-linear activations at the
end of the discriminator with linear ones:

$\displaystyle\min_{G}\max_{D}\quad\langle D(x)\rangle_{x\sim
p_{data}(x)}-\langle D(G(z))\rangle_{z\sim p(z)}.$ (3)

Wasserstein-type loss functions makes use of the earth movers (EM) distance
metric instead of other popular probability distances used to learn
distributions. This allows for much more stable training, and mitigate issues
such as the vanishing gradient that are encountered with the standard GAN loss
function. Furthermore, the measurement expectation values can be directly used
in our loss function. In our case the EM distance is applied to the classical
expectation values and, therefore, should not be confused with the quantum EM
from Kiani  _et al._ (2021).

###  III.1 Training Data

To train a generative model, we require a set of training data points
$\mathcal{D}=\\{x^{(k)}\\}_{k=1}^{N_{data}}$ that are sampled from the data
distribution $x^{(k)}\sim p_{data}(x)$, which constitutes the ground truth
that the GAN should learn.

####  III.1.1 Bars and Stripes

In this manuscript, we focus on two datasets that we want the QGAN to
reproduce. The first one is the so-called ‘Bars and Stripes’ (B&S) dataset,
which was also used in Benedetti  _et al._ (2019). It consists of binary
square matrices, each with either its columns or rows set to $1$ or $0$. We
focus on the $2\times 2$ B&S dataset with 4 pixels that consists of
$N_{data}=6$ images to be learned. All other binary configurations of the
$2^{4}$ dimensional state space are considered noise. In this simple case of
B&S, the dataset $\mathcal{D}$ contains all the training data and the data
distribution $p_{data}(x)=1/6$ is uniform. We will refer to the training data
by their ‘image index’ which are $0,3,5,10,12$ and $15$. This comes from the
fact that the binary representation of e.g. $3$ is `0011` which is a ‘bar’ if
it is reshaped to a 2x2 image.

####  III.1.2 Ising Data

The second dataset consists of low energy states of classical Ising-like
Hamiltonians. Specifically, we consider the Hamiltonian

$H=\sum_{i,j=1}^{N}J_{ij}Z_{i}Z_{j}+\sum_{i=1}^{N}h_{i}Z_{i}.$ (4)

This dataset is inspired by the fact that many real-world optimization
problems can be formulated as Ising Hamiltonians Lucas (2014), with some of
the more prominent applications including protein design and drug discovery
Mulligan  _et al._ (2020), the travelling salesman Jain (2021) and portfolio
optimization in finance Herman  _et al._ (2022).

We here consider the simplest case of Eq. 4: constant, nearest-neighbor
interactions, zero magnetic field, and open boundary conditions, producing the
Hamiltonian

$H_{NN}=\sum_{i=1}^{N-1}Z_{i}Z_{i+1}.$ (5)

The dataset $\mathcal{D}$ consists of uniformly drawn low energy states of
$H_{NN}$.

Ultimately, the QGAN should not merely learn the training data, it should also
generalize from the learned data. For example if the QGAN is trained on a
subset of the low energy states of the above Hamiltonian, it should learn to
generate low energy states that are not in the training dataset. Successful
generalization is applicable to the more practical task of enhancing the
solutions to QUBO-like problems, which take the form of the above Hamiltonian.
Such diversity of solutions is often considered as crucial as finding the
ground state of the Hamiltonian, particularly in drug discovery Dean and Lewis
(1999); Gorse  _et al._ (1999); Galloway  _et al._ (2010).

###  III.2 The quantum discriminator

(a)  Figure 1: The quantum circuit architecture of the discriminator. It
consists of a layer-wise structure where the first layer is an encoding layer.
I.e. it prepares the state $\ket{x^{(k)}}$ from a binary string $x^{(k)}$. The
encoding is followed by Layers of parameterized single qubit rotations and CZ
gates. The label of the discriminator is obtained by measuring the 1st qubit
of the circuit. (a)  Figure 2: Discriminator on B&S data: The discriminator
predictions $y_{pred}$ after training on the B&S dataset with their real
labels. The x-axis represents the indices of the different images of the B&S
dataset. In this figure, the ‘image indices’ are ordered for better
readability. $0$ to $5$ represent the training data. The rest of the indices
represent states that are not part of B&S.

For the training of a QGAN it is crucial to obtain a good gradient signal from
the discriminator. Therefore, we first verify that the quantum discriminator
is able to distinguish the training data from any outside data.

To construct a supervised classification task for the discriminator, we take
the set of binary strings $\\{x^{(k)}\\}$ with $x^{(k)}=(b_{1},\dots,b_{N})$
and $b_{i}\in\\{0,1\\}$ and add labels $y^{(k)}\in\\{0,1\\}$. These labels
represent if a data point $x^{(k)}$ is part of the data distribution
$p_{data}(x)$ or not. The aim of this task is to see if the discriminator is
able to predict the correct label for a given binary input after the training.

Fig. 1 shows the parameterized quantum circuit architecture that we use for
the discriminator. To encode the classical data into a quantum state we use
basis encoding Schuld and Petruccione (2018) which consists of layer of single
qubit rotations which we denote $U_{E}(x)=\otimes_{i}^{N}R_{x}(b_{i}\pi)$.
This layer maps $x^{(k)}\rightarrow\ket{x^{(k)}}$. The trainable,
parameterized part of the circuit consists of a layerwise structure of single
qubit rotations
$R(\boldsymbol{\omega}_{i})=R_{z}(\gamma_{i})R_{y}(\beta_{i})R_{z}(\alpha_{i})$
applied to each qubit, followed by controlled $Z$ gates. The single qubit
rotations are parameterized by the rotation angles $\alpha,~{}\beta$ and
$\gamma$. The trainable part of the discriminator $U_{D}(\theta_{D})$ consists
of $l$ layers $L(\boldsymbol{\theta}_{i})$, where $l$ is referred to as the
depth of the circuit. The variable $\theta_{D}$ denotes all the variational
rotational angles of the discriminator circuit that are optimized over the
course of training.

Finally, to obtain a label prediction $y_{pred}^{(k)}$ from the quantum
discriminator, we prepare the state $U_{D}(\theta_{D})\ket{x^{(k)}}$ and
estimate the expectation value of an observable $\braket{\mathcal{O}}$,
interpreting this value as the predicted label. Note that this method of
retrieving the discriminator label is especially suitable for quantum
circuits, as the expectation value of a single operator can be estimated
efficiently, with a relatively small number of shots.

For the task at hand, i.e. distinguishing between training data and ‘noise’,
we require a simple binary discriminator. Therefore, it is sufficient to
measure a single qubit in an arbitrary basis. In this work, we measure the
first qubit of the discriminator in the Pauli $Z$ direction. We then
renormalize the measurement outcome as

$\displaystyle y_{pred}=\frac{1}{2}\left(\braket{Z_{1}}+1\right),$ (6)

such that the label can later be interpreted as the probability of the input
sample $x^{(k)}$ being real (i.e. that it is part of the training dataset)
during training.

In the supervised setting, the discriminator circuit is trained to minimize
the loss function $\frac{1}{M}\sum_{k}(y_{pred}^{(k)}-y^{(k)})^{2}$, where $M$
is the number of input label tuples $(x^{(k)},y^{(k)})$. We optimize the
parameters of the quantum circuit by minimizing the loss function via gradient
descent.

Fig. 2 displays the performance of the discriminator on the B&S data. It
identifies the the B&S data points (labeled $y=0$) and the noise data points
(labeled $y=1$) with high accuracy.

Fig. 3 shows the predictions of the discriminator for the Ising dataset. In a
realistic scenario for the training of a QGAN one would provide a small set of
low energy states as a training dataset and the discriminator needs to
distinguish them from arbitrary noise samples. I.e. we benchmark the
discriminator on a strongly imbalanced dataset. The dataset contains all
$2^{N}$ energies eigenvalues of a classical Ising model with $N=8$. We split
the dataset into $20$ low energy states ($y=0$) and the rest high energy
states ($y=1$). The training without any auxiliary qubits (Fig. 3 (left
panel)) converges to a solution, where the predicted labels almost can’t be
distinguished. If we add $N_{A}=4$ auxiliary qubits the discriminator is able
to label the data with higher accuracy (right panel).

This highlights an important implication of how the input data is partitioned
into low and high energy states. Namely, note that a projective measurement
necessarily divides the entire Hilbert space into 2 equal parts. For our $N=8$
spin Ising system, the discriminator necessarily divides the $256$ states into
$128$ low energy states and $128$ high energy states. This comes from the fact
that for the $2^{N}$ states, measuring $Z$ on qubit 1 would give +1 and -1 an
equal number of times. The measurement divides the $N$ qubit system into two
equal parts, which further means that the $N$ spin Ising data is also divided
accordingly, because of the unitary mapping of the binary Ising states to
discriminator states. However, it is completely reasonable to want an unequal
division of the Ising states, so that the discriminator can distinguish, for
example, the lowest $k$ of states from the remaining $2^{N}-k$. To achieve
this, we add auxiliary qubits to the discriminator circuits. These auxiliaries
are initialized as $\ket{0}$, rather than according to the input data.
Otherwise, the circuit architecture in Fig. 1 remains the same, save now with
$N+N_{A}$ qubits, where $N_{A}$ is the number of auxiliary qubits.

(a)  (b)

Figure 3: Discriminator on imbalanced data: Discriminator predictions vs. real
labels for the Ising data on $N=8$ spins for imbalanced datasets that contains
all $2^{N}=256$ states without auxiliary qubits (left) and with $N_{A}=4$
auxiliary qubits (right). The x-axis represents the index of the states
ordered by energy.

In Appendix A we show that the discriminator is able to achieve much higher
accuracy without auxiliary qubits if the dataset is balanced or also if it
discriminates a set of states that is much smaller than the whole Hilbert
space.

###  III.3 The generator

Since classical neural networks are fully deterministic, a classical GAN
requires a noise vector $z$ as an input to obtain different samples $x=G(z)$.
As quantum circuits are by design probabilistic and the output quantum state
of the generator $|\psi_{G}\rangle=\sum c_{i}|x_{i}\rangle$ can be designed
such that $p(x)=\braket{x}{\psi_{G}}$ is exactly $p_{data}(x)$. One could
therefore conclude that noise inputs to the quantum generator are unnecessary.
However, as we illustrate here, noise is also crucial for the training of
binary generators, and that intrinsic quantum randomness alone is insufficient
to successfully train the quantum generator. We emphasize that, while in
theory the generator itself could be designed to represent the entire data
probability distribution $p_{data}(x)$, in practice we do not observe the
adversarial training converging to the correct distribution without a noise
input. To better understand the influence of noise on training and prescribe
the generator’s quantum circuit architecture, we start with two simple toy
models.

First we show how the training converges if the generator state depends on a
classical noise input $|\psi_{G}\rangle\rightarrow|\psi_{G}(z)\rangle$. As a
simple model of such a noise conditioned state we choose a fully connected
neural network (for more details see Section V) that has a noise vector $z$ as
an input and a $2^{N}$ dimensional vector $|\psi_{G}(z)\rangle$ as an output.
That is, we interpret the output of the neural network $(c_{1}(z),\dots
c_{2^{N}}(z))$ as the amplitudes of the generator state $|\psi_{G}\rangle=\sum
c_{i}(z)|x_{i}\rangle$. This simple model allows us to have a highly non-
linear connection between the noise and the resulting quantum state and as a
result the training losses converge to the correct values. Fig. 4 shows the
resulting loss and the output distribution of the generator $p_{G}(x)$ of the
QGAN with a noise dependent generator state. The loss curves and the
histograms are averaged over 20 different random initializations. The error
bars in the histograms show the variance.

(a)  (b)

Figure 4: Quantum generator toy model with noise: Output distribution (left)
and loss during training (right) of the generator quantum state
$|\psi_{G}(z)\rangle$ with a classical noise source $z$ trained together with
the discriminator circuit $U_{D}(\theta_{D})$. The training converges as
expected for a GAN and the generator learns the data. Both figures are
averaged over $20$ different random initializations. The error bars in the
histogram show the variance of the probabilities. The variance of the
probabilities is small and barely visible which means that the $20$ training
runs converge to very similar output distributions $p_{G}(x)$. The shaded
region in the right panel shows the standard deviation.

For the optimization without noise we represent the output state of the
generator $|\psi_{G}\rangle=\sum c_{i}|x_{i}\rangle$ directly with $2^{N}$
trainable parameters $c_{i}$. In principle, this should allow us to train a
generator capable of expressing the data distribution $p_{data}(x)$ and we can
see if such a ‘perfect’ classical state ansatz can be trained with the quantum
discriminator $U_{D}(\theta_{D})$ from last section. We assume
$c_{i}\in\mathbb{R}$ without loss of generality.

To train the QGAN we perform the optimization described in Eq. 3. To estimate
the expected label of the real data $\braket{D(x)}_{x\sim p_{data}}$, we
prepare the state $\ket{\psi_{D}^{(k)}}=U_{D}(\theta_{D})\ket{x^{(k)}}$ and
take the average over the measured expectation values
$\frac{1}{|\mathcal{B}|}\sum_{k}\bra{\psi_{D}^{(k)}}Z\ket{\psi_{D}^{(k)}}$,
where $\mathcal{B}$ is random batch drawn from the training data
$\mathcal{D}$. The expected label of the fake data $\langle
D(G(z))\rangle_{z\sim p(z)}$ can be estimated by preparing the state
$\ket{\psi_{D}^{fake}}=U_{D}(\theta_{D})\ket{\psi_{G}}$.

Fig. 5 shows the loss during the training and the output distribution of the
generator after training $p_{G}(x)$.

(a)  (b)

Figure 5: Quantum generator toy model without noise: Output distribution
(left) and loss during training (right) of the generator quantum state
$|\psi_{G}\rangle=\sum c_{i}|x_{i}\rangle$ without classical noise input
trained together with the discriminator circuit $U_{D}(\theta_{D})$. The loss
gets stuck very fast and the generator does not learn the training data which
can be seen in the big variance of the probabilities. They manifest that the
training suffers from mode collapse, where some some training data is not
learned at all. An example of a single run can be found in Fig.10 in the
Appendix. Both figures are averaged over 20 different random initializations.
The error bars in the histogram show the variance of the probabilities. The
standard deviation in the right panel is barely visible.

The loss of the QGAN gets stuck in a local minima after a short amount of
training. For the Wasserstein loss, the generator loss is expected to go to
$loss_{G}=\langle D(G(z))\rangle_{z\sim p(z)}=-0.5$, indicating that the
discriminator is unable to distinguish between the fake and real data.
Likewise, the discriminator loss is expected to converge to
$loss_{D}=\braket{D(x)}_{x\sim p_{data}}-\langle D(G(z))\rangle_{z\sim
p(z)}=0$, as the correct and incorrect classification of data should occur
with equal frequency. Even though the loss gets stuck in local minima, the
distributions $p_{G}(x)$ and $p_{data}(x)$ are similar, but the generator
tends to omit certain training samples completely and assigns too high
probabilities for other training examples. This phenomenon is also called a
mode collapse Goodfellow  _et al._ (2014).

These toy models show that noise is a crucial ingredient to build a discrete
quantum generator and that in theory it is possible to create a state
$|\psi_{G}(z)\rangle$ that encodes all the training data. Since representing
the generator state as a $2^{N}$ dimensional vector is not scalable, the toy
model will be replaced with a parameterized quantum circuit. Therefore, we are
looking for an appropriate circuit ansatz that maps
$f:z\rightarrow|\psi_{G}(z)\rangle$. In the next section we discuss how such a
quantum circuit could look like.

###  III.4 Complete quantum GAN

The output state of the quantum generator is given by circuit
$|\psi_{G}(z)\rangle=U_{G}(\theta_{G},z)|0\rangle^{\otimes N}$, where
$\theta_{G}$ are the trainable parameters of the generator and $z$ is a noise
vector coming from a classical source of noise, e.g. a uniform distribution
$p_{z}$. The output state of the discriminator is given by a unitary
$U_{D}(\theta_{D})$ acting on the output state of the generator
$|\psi_{D}(z)\rangle=U_{D}(\theta_{D})|\psi_{G}(z)\rangle$. The label for a
‘fake’ input is given by

$\displaystyle
y_{\text{fake}}(z)=\frac{1}{2}\left(\langle\psi_{D}(z)|Z|\psi_{D}(z)\rangle+1\right).$
(7)

The label for the ‘real’ data can be obtain the same way as described in
section III.2

$\displaystyle y_{\text{real}}(x^{(k)})=\frac{1}{2}\left(\langle
x^{(k)}|U_{D}(\theta_{D})^{{\dagger}}Z~{}U_{D}(\theta_{D})|x^{(k)}\rangle+1\right).$
(8)

To evaluate a batch of classical data $\mathcal{B}=\\{x^{(k)}\\}_{k=1}^{M}$ we
take the average over single predictions
$\frac{1}{M}\sum_{k}y_{\text{real}}(x^{(k)})$. Another possibility would be to
prepare a superposition state
$|\psi_{\text{data}}\rangle=\frac{1}{\sqrt{M}}\sum_{k=1}^{M}|x^{(k)}\rangle$
and use this as an input state for the discriminator. In this work we focus on
the former and leave the latter for further future investigation.

Previous research has shown that the so called data-reuploading circuits are
universal function approximators, at least for classification tasks Pérez-
Salinas  _et al._ (2020); Schuld  _et al._ (2021). Originally this
architecture was introduced as a quantum analog to a classical neural network
Pérez-Salinas  _et al._ (2020). Therefore, it is a promising candidate to
replace the classical neural network from the previous section to adopt the
non-linear function that maps noise to the output state of the generator.

Data reuploading refers to a quantum circuit structure, where parameterized
unitaries $U(\theta_{i})$ are alternated with a data dependent unitary $U(x)$.
In a layerwise structure the final circuit $U(\theta,x)$ consists of an
alternating pattern of $U(\theta_{i})$ and $U(x)$. In our case we do not
upload data to the circuit but random noise $z$ which we refer to as noise
reuploading. Therefore the generator circuit will have the form
$U_{G}(\theta_{G},z)=\prod_{i}U(\theta_{i})U(z)$

(a)  (b)

Figure 6: Quantum generator with noise reuploading: Output distribution (left)
and loss during training (right) of the generator quantum circuit with data
reuploading $U_{G}(\theta_{G},z)$ trained together with the discriminator
circuit $U_{D}(\theta_{D})$. The training converges as expected for a GAN and
the generator learns the data. Both figures are averaged over 20 different
random initializations. The error bars in the histogram show the variance of
the probabilities. The shaded region in the right panel shows the standard
deviation.

Fig. 6 shows the training loss and the resulting output distribution of the
generator for the data-reuploading circuit architecture.

Another straight-forward way to add a source of classical noise to a
parameterized part of the generator quantum circuit $U_{G}(\theta_{G})$ is to
start from an initial state
$|z\rangle=\otimes_{i}^{N}R_{\alpha}(z_{i})|0\rangle^{\otimes N}$, with
$R_{\alpha}$ an arbitrary single qubit rotation. The output state of the
generator is $|\psi(z)\rangle=U_{G}(\theta_{G})|z\rangle$. In the appendix C
we show the training of such a circuit and that applying a unitary on the
noise vector shows worse performance than the reuploading architecture. A
likely conjecture is that the linear transformation that is applied to the
noise vector $|z\rangle$ via the unitary $U_{G}$ does not provide a
sufficiently non-linear correlation between noise and the output state
$|\psi_{G}(z)\rangle$.

##  IV Training QGAN on Ising Data

In this section, we discuss training the fully quantum GAN on a low-energy
subset of states from the Ising model Hamiltonian of Eq. 5. A central
motivation for our use of QGANs in this context is their potential to
generalize, i.e., to generate low energy states that are not in the training
dataset. As discussed above, such generalization would have practical
implications for enhancing the solutions to QUBO-like problems, due to their
similarity with the above Hamiltonian.

In this section we train the QGAN on low energy Ising states from a Ising
chain of length $N=6$ which has $2^{6}=64$ total energy eigenstates. As the
Ising model Hamiltonian is constrained to a single basis, all of its
eigenstates are product states. As training data, we randomly select a subset
of $8$ states from the bottom quartile of the energy spectrum. The
discriminator is given no information besides these states from which it
learns. The loss curves of $G$ and $D$ depicted in Fig. 7 result from training
a QGAN of the previously described architecture with $20$ layers in both $G$
and $D$ and $N_{A}=4$ auxiliary qubits in $D$.

Figure 7: Loss functions for $G$ and $D$ trained on 8 low energy states of 5.
$D$ and $G$ both consist of $l=20$ layers, and $D$ has $N_{A}=4$ auxiliary
qubits. The loss curves are averaged over 20 different random initialization.
The shaded region in the right panel shows the standard deviation.

To check the performance of the GAN, we draw samples from the trained
generator. A histogram of the resultant states, ordered by energy, is
displayed in Fig. 8. While the average energy of the training states is
$-3.0$, the states produced by the generator have an average energy of $-2.6$,
indicating that the generator is able to produce states that are below the
mean energy of the spectrum ($0$). Since a significant proportion of the
states sampled from the fully trained G were repeats of the training data
(which is to be expected) we remove the training states from the samples
generated by $G$ and the average energy is still negative, at $-0.34$. This
quantifies what is visible from the histogram in Fig. 8. The high energy
states to the right are sampled with much lower probability. This suggests
that even with a limited number of training samples, $G$ is potentially
capable of generalizing and producing novel low energy states at a higher rate
than would be expected by chance.

Figure 8: Samples from $G$ trained on 8 low energy states of 5. We draw $10k$
samples from $100$ different noise instances to obtain the histogram of the
samples. The x-axis represents the indices of the states ordered by energy.
This histogram represents the ouput distribution of the generator for a single
training run. Different random parameter initializations lead to similar
results.

Though in this example the generator was able to produce novel low energy
states, the discriminator does not explicitly know that it is training to
learn low energy states, and thus may be learning other patterns common to the
training set not strictly related to energy, which the generator then learns
to reproduce. This problem is somewhat ameliorated by the fact that the $8$
training samples were drawn randomly from a band of the energy spectrum, so
that we don’t actually teach the generator to produce, say, states of a
particular parity. This test serves as a proof-of-concept of using the QGAN to
generalize from low energy Ising states. To more rigorously test this
capability, larger system sizes and more complicated Ising Hamiltonians should
be used, and the required circuit depth and hyperparameters should be studied.
We leave these tests for future work. Furthermore, the QGAN tends to converge
to a distribution that has zero probabilities for certain states, even those
these pertain to the training dataset (index 9 and 14 in Fig. 8). While
clearly some variety of mode collapse, the precise cause of the phenomenon
requires further investigation.

##  V Methods

The numerical simulations in this work are performed with pennylane Bergholm
_et al._ (2018), jax Bradbury  _et al._ (2018), TensorLy-Quantum Patti  _et
al._ (2021a) and numpy Harris  _et al._ (2020). The code to reproduce this
work can be found under Huembeli  _et al._ (2022). Throughout this work we
used a Wasserstein protocol where the parameters of the discriminator are
updated 5 times more frequently than those of the generator. This variable is
referred to as `n_critic = 5` in the GitLab repository Huembeli  _et al._
(2022). The learning rates for both, the generator and the discriminator are
`lrG = lrD = 0.01`. The ADAM optimizer with $\beta_{1}=0.9$ and
$\beta_{2}=0.999$ is used for all parameter updates Kingma and Ba (2014).

Circuit Architecture for B&S training: The discriminators in Figs. 6, 5 and 4
are all with `depth_D = 20` and $0$ auxiliary qubits. The neural network that
is used for Fig. 4 has an input dimension of $8$, $8$ hidden nodes and $2^{4}$
output dimensions. The activation functions are ReLU for the hidden nodes and
Tanh for the last layer. The generator for Fig. 6 has `depth_D = 40`.

Circuit Architecture for Ising data: The discriminator circuit for the
training in Figs. 8 and 7 has `depth_D = 40` and `depth_G = 20`.

##  VI Discussion and Outlook

Variational quantum circuits with a hardware efficient architecture are a
suitable choice to learn discrete data in a generative adversarial setting. To
our knowledge, previous work focused on QGANs with classical discriminators,
which require access to the generator’s output distribution. This poses a
major limitation for the scalability to higher dimensional binary data. We
show that a fully coherent quantum architecture is capable of learning
discrete data in an adversarial setting and, therefore, does not suffer from
this limitation. Furthermore, we show that adding classical noise to the
quantum generator is crucial for it to be trained in the adversarial setting.
To add noise to the circuit we use the data reuploading architecture. Finally,
we benchmark our QGAN architecture on the B&S dataset and on low energy Ising
states and demonstrate that it successfully learns the training data and and
achieves aspects of generalization.

With respect to our main goal, the sampling of unknown low energy states from
a given Ising Hamiltonian, various open questions remain. For example an in-
depth study of QGANs’ generalization capability, similar to that done for Born
machines Gili  _et al._ (2022b) should be performed. Furthermore, even though
our ansatz does not require access to the generator’s output distribution
$p_{G}$, its scalability might still be limited by many factors. First, for
the given hardware efficient circuit ansatz, barren plateaus will make the
training for a large number of qubits impossible McClean  _et al._ (2018);
Patti  _et al._ (2021b); Cerezo  _et al._ (2021). As a result, it may be
preferable to find a more barren plateau-resistant ansatz for the
discriminator — for example quantum convolutional neural networks Cong  _et
al._ (2019); Pesah  _et al._ (2021) or general dissipative QNNs Sharma  _et
al._ (2022). Second, it is not clear yet how the required depth of the quantum
circuit scales with the size of the input data and the number of qubits. The
worst case scenario is $\mathcal{O}(4^{N})$ Shende  _et al._ (2004); Rakyta
and Zimborás (2022), which would become intractable at scale. Thus, it is be
necessary to analyze the scaling of our algorithm’s requisite circuit depth
and performance with respect to qubit count and data complexity.

In summary, we test our fully-quantum QGAN architecture on a data sets derived
from the low-energy states of Ising models with constant, nearest neighbor
interactions and no magnetic field. Though the QGAN performed well in our
investigations, most QUBO problems encountered in industry sport more
complicated Hamiltonians with more intricate connectivity graphs. For
instance, these may involve all-to-all coupling with varying magnitude. As a
result, it may become important to provide information about the connectivity
of the problem to the QGAN as the Hamiltonian grows more complex, as it will
become more difficult for the QGAN to infer information about the energy
spectrum from a few training states alone. In classical ML this can be
accomplished with a conditional GAN Mirza and Osindero (2014). Augmenting our
QGAN architecture by conditioning on Hamiltonian information would serve as an
interesting and useful extension of this work.

## References

  * Xie  _et al._ (2017) S. Xie, R. Girshick, P. Dollár, Z. Tu, and K. He, in  _Proceedings of the IEEE conference on computer vision and pattern recognition_ (2017) pp. 1492–1500.
  * Yu  _et al._ (2022) J. Yu, Z. Wang, V. Vasudevan, L. Yeung, M. Seyedhosseini, and Y. Wu, arXiv:2205.01917 (2022), arXiv:2205.01917 .
  * Ramesh  _et al._ (2021) A. Ramesh, M. Pavlov, G. Goh, S. Gray, C. Voss, A. Radford, M. Chen, and I. Sutskever, in  _International Conference on Machine Learning_ (PMLR, 2021) pp. 8821–8831.
  * Vasquez and Lewis (2019) S. Vasquez and M. Lewis, arXiv preprint arXiv:1906.01083 (2019), arXiv:2205.01917 .
  * Ismail Fawaz  _et al._ (2019) H. Ismail Fawaz, G. Forestier, J. Weber, L. Idoumghar, and P.-A. Muller, Data mining and knowledge discovery 33, 917 (2019).
  * Goodfellow  _et al._ (2014) I. J. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. C. Courville, and Y. Bengio, in  _NIPS_ (2014) arXiv:1406.2661 .
  * Karras  _et al._ (2019) T. Karras, S. Laine, and T. Aila, in  _Proceedings of the IEEE/CVF conference on computer vision and pattern recognition_ (2019) pp. 4401–4410, arXiv:1812.04948 .
  * Karras  _et al._ (2020) T. Karras, S. Laine, M. Aittala, J. Hellsten, J. Lehtinen, and T. Aila, in  _Proceedings of the IEEE/CVF conference on computer vision and pattern recognition_ (2020) pp. 8110–8119, arXiv:1912.04958 .
  * Karras  _et al._ (2021) T. Karras, M. Aittala, S. Laine, E. Härkönen, J. Hellsten, J. Lehtinen, and T. Aila, Advances in Neural Information Processing Systems 34, 852 (2021), arXiv:2106.12423 .
  * Du  _et al._ (2020) Y. Du, M.-H. Hsieh, T. Liu, and D. Tao, Phys. Rev. Research 2, 033125 (2020).
  * Schuld and Petruccione (2021) M. Schuld and F. Petruccione,  _Machine learning with quantum computers_ (Springer, 2021).
  * Dallaire-Demers and Killoran (2018) P.-L. Dallaire-Demers and N. Killoran, Physical Review A 98, 012324 (2018), arXiv:1804.08641 .
  * Zoufal  _et al._ (2019) C. Zoufal, A. Lucchi, and S. Woerner, npj Quantum Information 5, 1 (2019), arXiv:1904.00043 .
  * Zeng  _et al._ (2019) J. Zeng, Y. Wu, J.-G. Liu, L. Wang, and J. Hu, Physical Review A 99, 052306 (2019), arXiv:1808.03425 .
  * Situ  _et al._ (2020) H. Situ, Z. He, Y. Wang, L. Li, and S. Zheng, Information Sciences 538, 193 (2020), arXiv:1807.01235 .
  * Huang  _et al._ (2021) H.-L. Huang, Y. Du, M. Gong, Y. Zhao, Y. Wu, C. Wang, S. Li, F. Liang, J. Lin, Y. Xu, _et al._ , Physical Review Applied 16, 024051 (2021), arXiv:2010.06201 .
  * Stein  _et al._ (2021) S. A. Stein, B. Baheri, D. Chen, Y. Mao, Q. Guan, A. Li, B. Fang, and S. Xu, in  _2021 IEEE International Conference on Quantum Computing and Engineering (QCE)_ (IEEE, 2021) pp. 71–81, arXiv:2010.09036 .
  * Beer and Müller (2021) K. Beer and G. Müller, arXiv: 2112.06088 (2021), arXiv:2112.06088 .
  * Niu  _et al._ (2022) M. Y. Niu, A. Zlokapa, M. Broughton, S. Boixo, M. Mohseni, V. Smelyanskyi, and H. Neven, Physical Review Letters 128, 220505 (2022), arXiv:2105.00080 .
  * Borras  _et al._ (2022) K. Borras, S. Y. Chang, L. Funcke, M. Grossi, T. Hartung, K. Jansen, D. Kruecker, S. Kühn, F. Rehm, C. Tüysüz, _et al._ , arXiv:2203.01007 (2022), arXiv:2203.01007 .
  * Chang  _et al._ (2022) S. Y. Chang, E. Agnew, E. F. Combarro, M. Grossi, S. Herbert, and S. Vallecorsa, arXiv:2205.15003 (2022), arXiv:2205.15003 .
  * Rudolph  _et al._ (2022) M. S. Rudolph, N. B. Toussaint, A. Katabarwa, S. Johri, B. Peropadre, and A. Perdomo-Ortiz, Physical Review X 12, 031010 (2022), arXiv:2012.03924 .
  * Rumelhart  _et al._ (1988) D. E. Rumelhart, G. E. Hinton, and R. J. Williams, “Learning representations by back-propagating errors,” in  _Neurocomputing: Foundations of Research_ (MIT Press, Cambridge, MA, USA, 1988) p. 696–699.
  * Alcazar  _et al._ (2021) J. Alcazar, M. Ghazi Vakili, C. B. Kalayci, and A. Perdomo-Ortiz, arXiv e-prints (2021), arXiv:2101.06250 .
  * Gili  _et al._ (2022) K. Gili, M. Hibat-Allah, M. Mauri, C. Ballance, and A. Perdomo-Ortiz, arXiv e-prints (2022), arXiv:2207.13645 .
  * Gili  _et al._ (2022a) K. Gili, M. Mauri, and A. Perdomo-Ortiz, arXiv:2201.08770 (2022a), arXiv:2201.08770 .
  * Banchi  _et al._ (2021) L. Banchi, J. Pereira, and S. Pirandola, PRX Quantum 2, 040321 (2021), arXiv:2102.08991 .
  * Arjovsky  _et al._ (2017) M. Arjovsky, S. Chintala, and L. Bottou, in  _International conference on machine learning_ (PMLR, 2017) pp. 214–223, arXiv:1701.07875 .
  * Kiani  _et al._ (2021) B. T. Kiani, G. De Palma, M. Marvian, Z.-W. Liu, and S. Lloyd, arXiv:2101.03037 (2021), arXiv:2101.03037 .
  * Benedetti  _et al._ (2019) M. Benedetti, D. Garcia-Pintos, O. Perdomo, V. Leyton-Ortega, Y. Nam, and A. Perdomo-Ortiz, npj Quantum Information 5, 1 (2019), arXiv:1801.07686 .
  * Lucas (2014) A. Lucas, Frontiers in physics , 5 (2014), arXiv:1302.5843 .
  * Mulligan  _et al._ (2020) V. K. Mulligan, H. Melo, H. I. Merritt, S. Slocum, B. D. Weitzner, A. M. Watkins, P. D. Renfrew, C. Pelissier, P. S. Arora, and R. Bonneau, BioRxiv , 752485 (2020).
  * Jain (2021) S. Jain, Frontiers in Physics , 646 (2021).
  * Herman  _et al._ (2022) D. Herman, C. Googin, X. Liu, A. Galda, I. Safro, Y. Sun, M. Pistoia, and Y. Alexeev, arXiv:2201.02773 (2022), arXiv:2201.02773 .
  * Dean and Lewis (1999) P. M. Dean and R. A. Lewis,  _Molecular diversity in drug design_ (Springer, 1999).
  * Gorse  _et al._ (1999) D. Gorse, A. Rees, M. Kaczorek, and R. Lahana, Drug Discovery Today 4, 257 (1999).
  * Galloway  _et al._ (2010) W. R. Galloway, A. Isidro-Llobet, and D. R. Spring, Nature communications 1, 1 (2010).
  * Schuld and Petruccione (2018) M. Schuld and F. Petruccione,  _Supervised Learning with Quantum Computers_, Quantum Science and Technology (Springer International Publishing, 2018).
  * Pérez-Salinas  _et al._ (2020) A. Pérez-Salinas, A. Cervera-Lierta, E. Gil-Fuster, and J. I. Latorre, Quantum 4, 226 (2020), arXiv:1907.02085 .
  * Schuld  _et al._ (2021) M. Schuld, R. Sweke, and J. J. Meyer, Physical Review A 103, 032430 (2021), arXiv:2008.08605 .
  * Bergholm  _et al._ (2018) V. Bergholm, J. Izaac, M. Schuld, C. Gogolin, M. S. Alam, S. Ahmed, J. M. Arrazola, C. Blank, A. Delgado, S. Jahangiri, _et al._ , arXiv:1811.04968 (2018), arXiv:rXiv:1811.04968 .
  * Bradbury  _et al._ (2018) J. Bradbury, R. Frostig, P. Hawkins, M. J. Johnson, C. Leary, D. Maclaurin, G. Necula, A. Paszke, J. VanderPlas, S. Wanderman-Milne, and Q. Zhang, “JAX: composable transformations of Python+NumPy programs,”  (2018).
  * Patti  _et al._ (2021a) T. L. Patti, J. Kossaifi, S. F. Yelin, and A. Anandkumar, arXiv:2112.10239 (2021a), arXiv:2112.10239 .
  * Harris  _et al._ (2020) C. R. Harris, K. J. Millman, S. J. van der Walt, R. Gommers, P. Virtanen, D. Cournapeau, E. Wieser, J. Taylor, S. Berg, N. J. Smith, R. Kern, M. Picus, S. Hoyer, M. H. van Kerkwijk, M. Brett, A. Haldane, J. F. del Río, M. Wiebe, P. Peterson, P. Gérard-Marchant, K. Sheppard, T. Reddy, W. Weckesser, H. Abbasi, C. Gohlke, and T. E. Oliphant, Nature 585, 357 (2020).
  * Huembeli  _et al._ (2022) P. Huembeli, S. Chaudhary, and I. MacCormack, “GitLab: Towards a scalable discrete quantum generative adversarial neural network,”  (2022).
  * Kingma and Ba (2014) D. P. Kingma and J. Ba, arXiv:1412.6980 (2014), arXiv:1412.6980 .
  * Gili  _et al._ (2022b) K. Gili, M. Hibat-Allah, M. Mauri, C. Ballance, and A. Perdomo-Ortiz, arXiv:2207.13645 (2022b), arXiv:2207.13645 .
  * McClean  _et al._ (2018) J. R. McClean, S. Boixo, V. N. Smelyanskiy, R. Babbush, and H. Neven, Nature communications 9, 1 (2018).
  * Patti  _et al._ (2021b) T. L. Patti, K. Najafi, X. Gao, and S. F. Yelin, Physical Review Research 3, 033090 (2021b), arXiv:2012.12658 .
  * Cerezo  _et al._ (2021) M. Cerezo, A. Sone, T. Volkoff, L. Cincio, and P. J. Coles, Nature communications 12, 1 (2021), arXiv:2001.00550 .
  * Cong  _et al._ (2019) I. Cong, S. Choi, and M. D. Lukin, Nature Physics 15, 1273 (2019), arXiv:1810.03787 [quant-ph] .
  * Pesah  _et al._ (2021) A. Pesah, M. Cerezo, S. Wang, T. Volkoff, A. T. Sornborger, and P. J. Coles, Physical Review X 11, 041011 (2021), arXiv:2011.02966 .
  * Sharma  _et al._ (2022) K. Sharma, M. Cerezo, L. Cincio, and P. J. Coles, Physical Review Letters 128, 180505 (2022), arXiv:2005.12458 .
  * Shende  _et al._ (2004) V. V. Shende, I. L. Markov, and S. S. Bullock, Physical Review A 69, 062321 (2004), arXiv:quant-ph/0308033 .
  * Rakyta and Zimborás (2022) P. Rakyta and Z. Zimborás, Quantum 6, 710 (2022), arXiv:2109.06770 .
  * Mirza and Osindero (2014) M. Mirza and S. Osindero, arXiv:1411.1784 (2014), arXiv:1411.1784 .

##  Appendix A Discriminator with balanced data

Fig. 9 shows the discriminator’s performance on the Ising dataset with $N=8$
spins and no auxiliary qubits. In the top panel, we compare the predicted and
the real labels for a balanced dataset, where the whole state space of $2^{N}$
states is split into 2 equally sized sets of low energy ($y=0$) and high
energy ($y=1$) states. One can see that the discriminator struggles to
correctly classify some of the intermediate energy states but shows high
accuracy in the low and high energy region.

(a)  (b)

Figure 9: Discriminator balanced and reduced data: Discriminator predictions
vs. real labels for the Ising data on $N=8$ spins for a balanced dataset that
contains all $2^{N}=256$ states (left) and an imbalanced dataset that only
consists of $80$ states with 20 low energy and 60 high energy states (right).

Fig. 9 (bottom) shows a scenario where $N=8$, but we only train the
discriminator on a dataset of $20$ low energy states and it needs to
distinguish them from $60$ random high energy states. To train a QGAN the
discriminator will have to distinguish the training dataset, i.e. the low
energy states, from some randomly sampled high energy states. If we assume
that during the training of the QGAN we do not sample the whole space of
$2^{N}$ states but only $60$ the discriminator shows high prediction accuracy
even without auxiliary qubits.

##  Appendix B Toy model without noise: Single run

In Fig. 5 the output distribution of the generator are averaged over $20$
training runs for different random initializations. The average distribution
itself seems to be close to the data distribution, but the variance of the
probabilities is far bigger than for the toy model with noise for example. We
here show in Fig. 10 the output distribution of a single training run. One can
see that the images 3 and 5 have very low probabilities and others have too
high probabilities. This is a so-called data collapse. Since it is dependent
on the initialization which of the data collapses, the average distribution
over many training runs seems to be close to the actual data distribution.

Figure 10: Quantum generator toy model without noise (without averaging):
Output distribution of the generator quantum state $|\psi_{G}\rangle=\sum
c_{i}|x_{i}\rangle$ without classical noise input, trained together with the
discriminator circuit $U_{D}(\theta_{D})$. As shown in Fig 5, the loss gets
stuck very fast and the generator does not learn the training distribution.
This figure shows the output distribution after a single training run without
averaging. The training gets stuck and the images of the B&S dataset with
index 3 and 5 are barely learned, while others have too high frequency. This
phenomenon is known as mode collapse.

##  Appendix C Linear noise model

Fig. 11 shows the training of a fully quantum GAN without data reuploading but
with a noise model where the generator state reads
$U_{G}(\theta_{G})U(z)\ket{0}^{\otimes N}$. Even though the output
distribution of the generator comes close to the one with data reuploading, it
seems like the QGAN does not converge to the correct distribution and
consequently samples the images that are not in the training set too high and
the rest too low. Furthermore, the loss curves do not converge to the correct
Wasserstein GAN losses. This behaviour can be reproduced for most choices of
noise and circuit depth. See also our Gitlab repository Huembeli  _et al._
(2022).

(a)  (b)

Figure 11: Quantum generator with linear noise input: Output distribution
(left) and loss during training (right) of the generator quantum circuit with
a noise state as an input $U_{G}(\theta_{G})\ket{z}$ trained together with the
discriminator circuit $U_{D}(\theta_{D})$. The training does not converge as
reliably as with the reuploading circuit but the output distribution of the
generator comes close to the training data. Remarkably, the loss functions are
not converging to the expected Nash equilibrium. ``loss_G— should converge to
$-0.5$, not to $0$ and ``loss_D— to $0$. Both figures are averaged over 20
different random initializations. The error bars in the histogram show the
variance of the probabilities. The shaded region in the right panel shows the
standard deviation.