Research ArticlePHYSICS

Quantum generative adversarial learning in a superconducting quantum circuit

See allHide authors and affiliations

Science Advances  25 Jan 2019:
Vol. 5, no. 1, eaav2761
DOI: 10.1126/sciadv.aav2761


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.


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 (36), 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.


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.

Fig. 1 The QGAN.

(A) The basic components of the QGAN, including a black box quantum process for the quantum true data σ, the generator (G) that produces an ensemble of pure quantum states (ρ), and the discriminator (D) that performs projective measurements M. (B) The process of the QGAN with the quantum states and the measurement basis on a Bloch sphere, where {|g〉, |e〉} are the ground and excited state of a qubit. D and G play the adversarial game alternatively, in which D optimizes the measurement strategy to discriminate ρ from σ, while G optimizes the generation strategy to fool D.

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 Embedded Image, 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 Embedded Image (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 (1823). 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, Embedded Image 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 ρ(r0, θ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 Embedded Image. When approaching the Nash equilibrium, Embedded Image, and then, Embedded Image. 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 < Rj for the jth round: Rj = 0.055 − 0.01j when j ≤ 3, and Rj = 0.02 when j > 3. These two adversarial learning procedures can be repeated many rounds until either the total count of steps cstep reaches a preset limit cB or the optimized d in D’s round is smaller than a preset bound dB.

Fig. 2 The experimental protocol of the QGAN algorithm.

(A) The experiment starts with a state σ as the quantum true data and a randomly generated state ρ(r0, θ0, ϕ0) from the generator. Then, the discriminator (D) and generator (G) optimize their strategies to compete against each other alternatively and repetitively. The stop condition of the game is either D fails to distinguish ρ from σ (the measurement output difference d < dB, a preset bound) or the step count cstep reaches the limit cB. (B) Procedure of optimizing D and G using the gradient descent method. The initial measurement axis M(β0, γ0) for D is randomly chosen. The parameters β and γ are updated in the process of optimizing D, while r, θ, and ϕ are updated in the process of optimizing G. The measurement and control of the quantum system are realized through field programmable gate arrays (FPGAs), while the estimations of the gradients are performed on a classical computer.

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 MI 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.

Fig. 3 Tracking of the QGAN.

(A to C) Experimental results for selecting σ = |g〉〈g| as the quantum true data. (A) The snapshots of the system at the particular steps indicated by the black vertical arrows in (B) (from left to right in the same order), in the Bloch sphere representation. (B) The tracking of pσ, pρ, d, and F during the quantum adversarial learning process. The gray shadow regions are the processes of optimizing D, while the rests are those for optimizing G. The horizontal color arrows indicate the vertical axis that each curve with the same color corresponds to. Since the convergence condition dB for the case of pure states is small (see the Supplementary Materials) and there is inevitable measurement imprecision, the optimized M is difficult to obtain or could even be randomized in certain trials. In this particular trial, M ends up nearly antiparallel with both ρ and σ, resulting in trMσ ≈ trMρ ≈ 0 and d ≈ 0. (C) The measured state tomography of the experimental σe and final pf with a state fidelity F = 0.991, demonstrating a successful QGAN that G can fool D by generating quantum data highly similar to the true data. (D to F) Typical experimental results for σ in an arbitrary mixed state with each panel being the counterpart of (A) to (C), respectively.

To characterize the adversarial learning process, we introduce the state fidelity Embedded Image 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 Fe, ρ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 (cstep) 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 cstep steps. The average cstep 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 cstep 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.

Fig. 4 Statistics of the QGAN performance.

(A) The cumulative probability of the total step count to finish the adversarial learning process. The QGAN is implemented for two different cases, with a pure (|g〉〈g|) and an arbitrary mixed state as the quantum true data, respectively. The count limit cB for these two cases is 500 and 300, respectively. The obtained average cstep for these two types of adversarial learning process is 243 and 170, respectively. Exp., experimental; sim., simulation. (B) The cumulative probability of final state fidelity F. The average fidelities for the pure state and the mixed state are both 98.8%. For comparison, the noiseless numerical simulations of the adversarial learning process are also performed 100 times, and their distributions are shown as solid lines.


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 log2m-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 (2628). 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(m2); 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 (3236). 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.


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 T1 = 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 T1 = 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 T1 = 44 ns is to readout the transmon qubit with the help of a phase-sensitive Josephson bifurcation amplifier (3941) 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 2n = 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 np + 1 steps for np parameters, with np = 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 material for this article is available at

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 dB 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.


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.

Stay Connected to Science Advances

Navigate This Article