## Abstract

Generative adversarial learning is one of the most exciting recent breakthroughs in machine learning. It has shown splendid performance in a variety of challenging tasks such as image and video generation. More recently, a quantum version of generative adversarial learning has been theoretically proposed and shown to have the potential of exhibiting an exponential advantage over its classical counterpart. Here, we report the first proof-of-principle experimental demonstration of quantum generative adversarial learning in a superconducting quantum circuit. We demonstrate that, after several rounds of adversarial learning, a quantum-state generator can be trained to replicate the statistics of the quantum data output from a quantum channel simulator, with a high fidelity (98.8% on average) so that the discriminator cannot distinguish between the true and the generated data. Our results pave the way for experimentally exploring the intriguing long-sought-after quantum advantages in machine learning tasks with noisy intermediate–scale quantum devices.

## INTRODUCTION

Machine learning (*1*), or more broadly artificial intelligence (*2*), represents an important area with general practical applications where near-term quantum devices may offer a substantial speedup over classical ones. With this vision, an intriguing interdisciplinary field of quantum machine learning/artificial intelligence has emerged and attracted tremendous attention in recent years (*3*, *4*). A number of quantum algorithms that promise exponential speedups have been theoretically proposed (*3*–*6*), and some were demonstrated in proof-of-principle experiments (*7*, *8*). Yet, in most of these previous scenarios, the input datasets considered are typically classical. As a result, certain costly processes or techniques, such as quantum random access memories (*9*), are required to first map the classical data to quantum wave functions so as to be processed by quantum devices, rendering the potential speedups nullified (*10*).

Here, we experimentally demonstrate a quantum version of generative adversarial network (QGAN) (*11*, *12*), where both input and output datasets are quantum from the beginning. In classical machine learning, a GAN (*13*, *14*) contains two major components, a generator (G) and a discriminator (D) (*13*). They are trained through an adversarial learning procedure: In each learning round, D optimizes her strategies to identify the fake data produced by G, while G updates his strategies to fool D. Under reasonable assumptions, such an adversarial game will end up at a Nash equilibrium point, where G produces data that match the statistics of the true data and D can no longer distinguish the fake data with a probability larger than ^{1}/_{2}. In the quantum setting considered here, G consists of a superconducting circuit, which can generate an ensemble of quantum states with certain probability distribution, while D is composed of a quantum apparatus that carries out projective measurements. The arbitrary input quantum data are generated by a quantum channel simulator.

## RESULTS

### The QGAN algorithm

Figure 1A shows the schematic of the QGAN scheme. The black box provides the quantum true data, which are described by a density matrix σ of a quantum system, while both the internal physical structure and the quantum process do not need to be known. G can generate arbitrary quantum states (ρ) by producing an ensemble of pure quantum states, i.e., a pure state from a set is randomly selected with certain probability to mimic the quantum true data. D performs quantum measurements (M) on the true and the generated (fake) data and attempts to distinguish them by the statistics of the measurement outcomes *p*_{ρ} = trMρ and *p*_{σ} = trMσ. In the QGAN, the measurement outcomes are public to both G and D. According to *p*_{ρ,σ}, D and G compete against each other by adaptively adjusting their strategies alternatively to distinguish ρ from σ and to fool D, respectively. σ and ρ are two distinct interpretations of mixed quantum states: One is the output of a physical process in which an initial pure state might be entangled with some degrees of freedom of the environment; the other is an ensemble of pure states. Our QGAN scheme can also be explained as a game trying to distinguish between these two interpretations.

A visualized illustration of the general procedure of the QGAN is depicted in Fig. 1B by presenting σ, ρ, and M of a qubit system in the Bloch sphere (note that we use the same notation M to represent both the projective measurement and its corresponding axis). D and G play the game alternatively. D starts first, and in her turn, M is optimized to maximize the difference of the measurement outcome *d* = *p*_{ρ} − *p*_{σ}. In an ideal case, D’s turn ends up with , corresponding to the normalized trace distance (*15*), and M converges to be parallel with ρ − σ in the Bloch sphere representation (Fig. 1B). For G’s turn, ρ is optimized to minimize *d* and, thus, approaches a cross section such that ρ − σ is perpendicular to M (Fig. 1B). As a result, the trace distance between the fake and the true data reduces progressively in each round, and the game eventually approaches the unique Nash equilibrium with *d* = 0 and (*11*).

### Experimental implementation

We realize the QGAN learning algorithm (*11*) in a superconducting quantum electrodynamics architecture (*16*, *17*). Our experimental device consists of a superconducting transmon qubit dispersively coupled to a bosonic microwave mode (*18*–*23*). The quantum state of the transmon qubit serves as either ρ or σ alternatively in the algorithm. The bosonic mode facilitates the creation of the quantum true data σ in an arbitrary state through a quantum channel simulator, which requires adaptive control of both the transmon qubit and the bosonic mode. The detailed descriptions of the experimental device and apparatus are provided in the Supplementary Materials and (*24*, *25*). G generates the state ρ(*r*, θ, φ) of the transmon by randomly preparing a pure state in the set {*U*(θ, φ)|*g*〉, *U*(π − θ, φ + π)|*g*〉} with the corresponding probabilities {*r*, 1 − *r*}. Here, is the unitary operation on the transmon qubit, with σ_{x} and σ_{z} being the Pauli matrices. D performs the measurements by applying a unitary prerotating operation with the axis angles (β, γ) on the transmon and detecting the population of the ground state |*g*〉, which leads to M = *U*^{†}(β, γ)|*g*〉〈*g*|*U*(β, γ).

The protocol of our experimental QGAN algorithm is illustrated in Fig. 2A. The experiment starts with a randomly generated state ρ(*r*_{0}, θ_{0}, φ_{0}) by G, a randomly picked measurement axis M(β_{0}, γ_{0}) by D, and the quantum true data σ from a fixed quantum channel simulator. In each round of experiment, D plays the adversarial game first with ρ fixed, followed by G’s turn with M fixed. In all runs, *d* is obtained by averaging *n* = 5000 repetitive measurements on the true and the fake data, respectively. The gradient ∂*d*/∂ξ for the control parameter ξ ∈ {*r*, θ, φ, β, γ} is critical for the QGAN. These gradients are approximately obtained by measuring *d* with respect to ξ and ξ + δ(δ ≪ 1) and calculating the differential numerically on a classical computer. According to the principle of gradient descent, the parameters are updated to maximize *d* (minimize *d* with *d* > 0) for D’s (G’s) turn, as explained in Fig. 2B (see the Supplementary Materials for the strategy). Here, each determination of *d* is counted as one step, and the total number of steps quantifies the consumption of time and copies of data. In practical experiments, the projective detection outcomes follow a binomial statistic and show a standard deviation (sd) of *d* as . When approaching the Nash equilibrium, , and then, . Therefore, the measurement precision of *d* will limit the convergence of the game. In our experiments, D’s turn ends when the differences of *d* in the last three steps are less than 0.02. The G’s turn ends when *d* < *R*_{j} for the *j*th round: *R*_{j} = 0.055 − 0.01*j* when *j* ≤ 3, and *R*_{j} = 0.02 when *j* > 3. These two adversarial learning procedures can be repeated many rounds until either the total count of steps *c*_{step} reaches a preset limit *c*_{B} or the optimized *d* in D’s round is smaller than a preset bound *d*_{B}.

### The QGAN performance

Figure 3 (A to C) shows the typical results for the experimental QGAN with σ = |*g*〉〈*g*| of the transmon qubit, the highest purity state that can be achieved in the experiment, as an example for the quantum true data. Since a quantum channel simulator can generate an arbitrary quantum state (*25*), the QGAN experiments by taking an arbitrary mixed state of the transmon as the true data is also studied, and the results are depicted in Fig. 3 (D to F). During the QGAN, the trajectory of control parameters are recorded (Fig. 3, B and E) instead of characterizing the exact experimental ρ and M. As shown in Fig. 3 (A and D), the snapshots of the quantum states and measurement axis at the particular steps indicated by the arrows in Fig. 3 (B and E, respectively; from left to right in the same order) are plotted on the Bloch sphere. Here, σ_{I}, ρ_{I}, and M_{I} are the ideal results derived on the basis of the calibrated control parameters. As expected, D adaptively adjusts M to be parallel with ρ_{I} − σ_{I}, while G learns from the measurement outcomes to generate quantum data to fool D, and the generated quantum data gradually converges to the plane that contains the quantum true data and is perpendicular to M. As a result, *d* oscillates in D’s and G’s turns due to the adversarial process and eventually approaches 0, which indicates that, ultimately, D fails to discriminate ρ from σ and G achieves his goal of replicating the statistics of the quantum true data.

To characterize the adversarial learning process, we introduce the state fidelity in the adversarial process to quantify the indistinguishability between the true and the generated data. As plotted in Fig. 3 (B and E), *F* approaches 1 after about 220 and 120 steps, respectively. The final generated quantum state ρ_{f} after the adversarial game and the experimental input state σ_{e} are measured using state tomography (Fig. 3, C and F), and fidelities as large as *F*(σ_{e}, ρ_{f}) = 99.1% are achieved for both the pure- and mixed-state cases. These high fidelities verify that the unique Nash equilibrium, in which a quantum G can replicate the statistics of the quantum true date, can be efficiently achieved in a quantum experimental realization of GAN. Although we calibrate the system parameters to infer the ideal σ_{I} and ρ_{I} during the adversarial process, it is not necessary for the QGAN. Our experimental protocol can reach its equilibrium without requiring the knowledge about the exact data generated by G or the measurement axis chosen by D and thus promises a double-blind quantum machine learning process just as its classical counterparts.

By taking the total steps (*c*_{step}) and the fidelity of the final generated state (*F*) as the figures of merit, the statistics of our QGAN performance is lastly studied with 100 random adversarial learning processes. We study both cases with the same pure and arbitrary mixed states as the quantum true data as in Fig. 3 but with different random ρ and M at the beginning, all showing similar behaviors as those in Fig. 3. Figure 4A plots the cumulative probability of the total steps, i.e., the probability to finish the QGAN experiment within *c*_{step} steps. The average *c*_{step} for these two types of adversarial learning process are 243 and 170, respectively. Figure 4B shows the cumulative probability of state fidelity *F* with the average fidelities for both the pure and the mixed quantum data of 98.8%. Comparing to the noiseless numerical simulation results, the experimental average *c*_{step} is about twice larger, and the average *F* is about 1% lower. These differences are mainly attributed to the decoherence processes of the qubit, the finite measurement precision of *d*, and the nonideal measured gradients. Further studies about the effects of the experimental imperfections are provided in the Supplementary Materials.

## DISCUSSION

The QGAN algorithm demonstrated in our experiments can be directly extended to a quantum system with higher dimensions. In our superconducting architecture, the bosonic mode actually provides a quantum system with infinite dimensions, which can be encoded as a multilevel system. On the basis of the same adaptive technique used in our current experiment, an arbitrary quantum state of a photonic qudit with *m* levels (equivalent to a log_{2}*m*-qubit system) can be generated and manipulated with the assistance of the transmon qubit (*25*). Then, our experiment can be straightforwardly extended to this photonic qudit that serves as either the quantum true or generated data. Another possible extension of our current experiment is to explore a more complicated architecture with multiple bosonic modes coupled to multiple transmon qubits (*26*–*28*). Both the quantum true and generated data can be stored in these bosonic modes.

For an *m*-dimensional system, the number of the QGAN parameters scales as *O*(*m*^{2}); therefore, our algorithm is still feasible for experiments with reasonable time and quantum resource consumptions. For instance, our numerical simulations (see the Supplementary Materials) indicate that the QGAN algorithm for two- and three-qubit systems could converge to a final state fidelity larger than 0.95 with roughly thousands of steps on average. In the current experiment, the gradient is estimated numerically via a classical mean. As envisioned in (*12*), the gradient can also be obtained through a quantum circuit with higher efficiency if more quantum resources are available. We note that, although quantum-state tomography is applied in our experiment to characterize the performance, it is not necessary for the QGAN algorithm. In the case of a quantum system with a large number of qubits, a better and more efficient way of assessing the QGAN performance would be desired.

In conclusion, we have demonstrated the feasibility of quantum generative adversarial learning with a superconducting quantum circuit in which the input data, the G, and the D are all quantum mechanical. Our results show that the G can learn the patterns of the input quantum data and produce quantum states with high fidelity that are not distinguishable by the D. Since our QGAN experiment requires neither a quantum random accessing memory nor a universal quantum computing device or any fine-tuning parameters (thus robust to experimental imperfections), it carries over to the noisy intermediate–scale quantum (NISQ) devices (*29*) widely expected to be available in the near future. An experimental demonstration of the QGAN with NISQ devices promises to showcase the quantum advantages over classical GAN—a possible approach to realizing quantum supremacy (*30*, *31*) with practical applications. Yet, an unambiguous experimental demonstration of quantum supremacy in this context may still require substantial technology advancements. Our results might also have far-reaching consequences in solving quantum many-body problems with the QGAN algorithm, given the recent rapid progress in related directions (*32*–*36*). In addition, the hybrid quantum-classical architecture demonstrated in this work can be straightforwardly extended to the optimal control (*37*) and self-guided quantum tomography (*38*), and we also anticipate their applications in other quantum machine learning/artificial intelligence algorithms.

## MATERIALS AND METHODS

Our experimental device consists of a superconducting transmon qubit dispersively coupled to two microwave cavities (*18*, *19*). The transmon qubit has an energy relaxation time *T*_{1} = 30 μs and a pure dephasing time *T*_{φ} = 120 μs, and its quantum state serves as either ρ or σ alternatively during the QGAN algorithm. The long-lived cavity has a photon lifetime *T*_{1} = 143 μs and serves as an ancillary photonic qubit to facilitate the creation of the quantum true data σ in an arbitrary state through a quantum channel simulator (*25*). In (*25*), we showed that an arbitrary quantum state of the photonic qubit can be generated deterministically, which can be mapped back onto the transmon qubit for the initial σ. The other short-lived cavity with *T*_{1} = 44 ns is to readout the transmon qubit with the help of a phase-sensitive Josephson bifurcation amplifier (*39*–*41*) for a high-fidelity single-shot measurement. In each experiment, the qubit is initialized to the ground state |*g*〉. The operations on the transmon qubit and the ancillary photonic qubit are realized through numerically optimized pulse sequences with the gradient ascent pulse engineering method (*42*, *43*) based on carefully calibrated system parameters and are implemented by field programmable gate arrays (FPGAs) with customized logic. The details of the FPGAs and the experimental apparatus can be found in *24*.

In our experiments, one step consists of 2*n* = 10, 000 measurements of the quantum states (both ρ and σ) for calculating *d*, which is selected as the loss function for the QGAN optimization. During the turns of D and G, the gradients of *d* were estimated with respect to each optimization parameter. Each update of the parameters requires *n*_{p} + 1 steps for *n*_{p} parameters, with *n*_{p} = 2 and 3 for D and G, respectively. State tomography was performed after the QGAN algorithm to characterize the true data σ and the generated ρ based on the recorded parameters in the quantum channel simulator and the QGAN algorithm. Note that we did not repeat the QGAN process to obtain the tomography to save time.

## SUPPLEMENTARY MATERIALS

Supplementary material for this article is available at http://advances.sciencemag.org/cgi/content/full/5/1/eaav2761/DC1

Section S1. Tracking of ρ − σ and M during the QGAN process

Section S2. Comparisons between the experimental and the numerical simulation results

Section S3. Algorithm and numerical results

Fig. S1. Tracking of ρ − σ and M and the comparison between experiments and numerical simulations based on the recorded parameters ξ in the QGAN process as shown in Fig. 3.

Fig. S2. Statistics of the QGAN performance based on numerical simulations.

Fig. S3. Influence of δ and sd in the QGAN performance and count of steps when the QGAN converges to the same *d*_{B} for different γ and *p*.

Fig. S4. Performance of the QGAN algorithm for multipartite quantum systems with the quantum true data being a random mixed state.

Fig. S5. Performance of the QGAN algorithm with Greenberger-Horne-Zeilinger and W states as the quantum true data.

This is an open-access article distributed under the terms of the Creative Commons Attribution-NonCommercial license, which permits use, distribution, and reproduction in any medium, so long as the resultant use is **not** for commercial advantage and provided the original work is properly cited.

## REFERENCES AND NOTES

**Acknowledgments:**We thank N. Ofek and Y. Liu for valuable suggestions on FPGA programming. L.S. also thanks R. Vijay and co-workers for help on the parametric amplifier measurements.

**Funding:**L.S. acknowledges the support from National Key Research and Development Program of China grant no. 2017YFA0304303 and National Natural Science Foundation of China grant no. 11474177. C.-L.Z. is supported by Anhui Initiative in Quantum Information Technologies (AHY130000). D.-L.D. acknowledges the start-up fund from Tsinghua University.

**Author contributions:**L.H. performed the experiment and analyzed the data with the support from W.C. and Y.M. S.-H.W., D.-L.D., and C.-L.Z. provided theoretical supports. L.H. and X.M. fabricated devices with the assistance of Y.X., H.W., and Y.S. C.-L.Z. proposed the experiment. L.S. supervised the experiment. D.-L.D., C.-L.Z., and L.S. wrote the manuscript with feedback from all authors.

**Competing interests:**The authors declare that they have no competing interests.

**Data and materials availability:**All data needed to evaluate the conclusions in the paper are present in the paper and/or the Supplementary Materials. Additional data related to this paper may be requested from the authors.

- Copyright © 2019 The Authors, some rights reserved; exclusive licensee American Association for the Advancement of Science. No claim to original U.S. Government Works. Distributed under a Creative Commons Attribution NonCommercial License 4.0 (CC BY-NC).