Quantum generative adversarial network training method and device, equipment and storage medium

By constructing the loss function of Ruili divergence relationship and alternately training the generator and discriminator, the problem of barren plateau phenomenon in QGANs training is solved, and the training effect and efficiency are improved.

CN119647526APending Publication Date: 2025-03-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411751954.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

Quantum generational adversarial networks (QGANs) are prone to falling into barren plateau during training, resulting in training failure and inefficiency.

Method used

By constructing the Ruili divergence relationship between the real quantum state data and the fake quantum state data output by the generator, a first loss function is constructed to reduce the gap between the generator output and the real data, and a second loss function of the discriminator is constructed to maximize the discriminator's probability of discriminator results. The training of the generator and discriminator is performed alternately until the training cutoff condition is reached.

Benefits of technology

It effectively avoids QGANs falling into barren plateaus, ensures continuous update of network parameters, and improves the training effect and efficiency of QGANs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119647526A_ABST
    Figure CN119647526A_ABST
Patent Text Reader

Abstract

The invention relates to a training method and device of a quantum generative adversarial network, equipment and a storage medium. The method comprises the steps that the Rayleigh divergence relation between real quantum state data and forged quantum state data output by a generator is constructed, a first loss function is constructed based on the Rayleigh divergence relation, and the first loss function is used for enabling the difference between the forged quantum state data output by the generator and the real quantum state data to be minimum; constructing a second loss function of the discriminator, wherein the second loss function is used for maximizing the probability that the discriminator outputs a false first discrimination result and a true second discrimination result; and alternately executing the first training of the generator and the second training of the discriminator until a training cut-off condition is reached, and completing the training of the quantum generative adversarial network. By adopting the method, the quantum generative adversarial network can be prevented from falling into a barren plateau phenomenon, so that the training effect of the quantum generative adversarial network is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of model training technology, and in particular to a training method, device, equipment, and storage medium for a quantum generative adversarial network. Background Art

[0002] The quantum generative model is a model that uses quantum computing technology to generate quantum state samples that conform to a specific distribution. With the continuous advancement of quantum computing technology, people have begun to explore how to use the characteristics of quantum computing to solve problems that are difficult to solve with traditional computers. Generative models are one of the important research directions. The most famous generative model is Generative Adversarial Networks (GANs).

[0003] Furthermore, Quantum Generative Adversarial Networks (QGANs) combine the advantages of quantum computing and GANs, aiming to improve the performance of GANs by using the characteristics of quantum computing. Compared with traditional GANs, QGANs show exponential advantages when the quantum state is in high-dimensional space. However, QGANs with quantum neural network structure often face the problem of barren plateau during training, which may lead to training failure.

[0004] Therefore, how to avoid QGANs from falling into the barren plateau phenomenon and improve the training effect of QGANs network has become one of the focuses of current research. Summary of the invention

[0005] Based on this, it is necessary to provide a quantum generative adversarial network training method, device, equipment, and storage medium that can prevent QGANs from falling into a barren plateau phenomenon and improve the training effect of the QGANS network in response to the above-mentioned technical problems.

[0006] In a first aspect, the present application provides a training method for a quantum generative adversarial network, wherein the quantum generative adversarial network includes a generator and a discriminator, and both the generator and the discriminator are composed of quantum circuits;

[0007] The method comprises:

[0008] Constructing a Rayleigh divergence relationship between real quantum state data and forged quantum state data output by the generator, and constructing a first loss function based on the Rayleigh divergence relationship, wherein the first loss function is used to minimize the gap between the forged quantum state data output by the generator and the real quantum state data;

[0009] Constructing a second loss function of the discriminator, the second loss function is used to maximize the probability that the discriminator outputs a first discrimination result as false and outputs a second discrimination result as true, wherein the first discrimination result is a discrimination result for forged quantum state data, and the second discrimination result is a discrimination result for real quantum state data;

[0010] The first training of the generator and the second training of the discriminator are performed alternately until the training cutoff condition is reached, thereby completing the training of the quantum generative adversarial network; wherein the first training process includes maintaining the parameters of the discriminator unchanged and training the generator based on the first loss function; the second training process includes maintaining the parameters of the generator unchanged and training the discriminator based on the second loss function.

[0011] In one embodiment, constructing the Rayleigh divergence relationship between the real quantum state data and the forged quantum state data output by the generator includes:

[0012] Constructing a first matrix between the parameter set of the generator, the real quantum state data and the forged quantum state data output by the generator;

[0013] The trace number of the first matrix is ​​obtained, and the Rayleigh divergence relationship is constructed based on a logarithmic operation form of the trace number.

[0014] In one embodiment, the step of constructing a second loss function of the discriminator includes:

[0015] The discriminator is used to perform state conversion on the forged quantum state data output by the generator to obtain the first quantum state data;

[0016] The discriminator is used to perform state conversion on the real quantum state data to obtain the second quantum state data;

[0017] constructing a second matrix about the first quantum state data and a third matrix about the second quantum state data;

[0018] The second loss function is constructed based on the trace number of the second matrix and the trace number of the third matrix.

[0019] In one embodiment, the training of the generator based on the first loss function includes:

[0020] Solving the first loss function during training, and updating the generator parameter set according to the solution result;

[0021] The training of the discriminator based on the second loss function comprises:

[0022] The second loss function is solved during the training process, and the discriminator parameter set is updated according to the solution result.

[0023] In one embodiment, solving the first loss function includes:

[0024] Inputting first data having a quantum state into a generator, and obtaining first forged data having a quantum state output by the generator;

[0025] The first forged data and the first real data in a quantum state are input into the first loss function and the first loss function is solved.

[0026] In one embodiment, the training cutoff condition includes a training cutoff condition for a generator and a training cutoff condition for a discriminator; the training cutoff condition for the generator includes that the forged quantum state data output by the trained generator is judged to be true by the discriminator; the training cutoff condition for the discriminator includes that the probability that the trained discriminator outputs the same judgment result is a first preset probability.

[0027] In one embodiment, updating the generator parameter set according to the solution result includes:

[0028] When the solution result corresponding to the i+1th training does not meet the training cutoff condition of the generator, the generator parameter set obtained after the i+1th training is determined according to the learning rate of the generator corresponding to the i-th training and the generator parameter set obtained by the i-th training; where i is a natural number greater than zero;

[0029] The updating of the discriminator parameter set according to the solution result comprises:

[0030] When the solution result after the j+1th training does not meet the training cutoff condition of the discriminator, the discriminator parameter set obtained after the j+1th training is determined according to the learning rate of the discriminator corresponding to the jth training and the discriminator parameter set obtained by the jth training; wherein j is a natural number greater than zero.

[0031] In a second aspect, the present application also provides a training device for a quantum generative adversarial network, wherein the quantum generative adversarial network includes a generator and a discriminator, both of which are composed of quantum circuits; including:

[0032] A processing module, used to construct a Rayleigh divergence relationship between real quantum state data and forged quantum state data output by the generator;

[0033] The processing module is further used to construct a first loss function based on the Rayleigh divergence relationship, wherein the first loss function is used to minimize the gap between the forged quantum state data output by the generator and the real quantum state data;

[0034] The processing module is further used to construct a second loss function of the discriminator, wherein the second loss function is used to maximize the probability that the discriminator outputs a first discrimination result as false and outputs a second discrimination result as true, wherein the first discrimination result is a discrimination result for forged quantum state data, and the second discrimination result is a discrimination result for real quantum state data;

[0035] A training module is used to alternately perform a first training of a generator and a second training of a discriminator until a cutoff condition is reached, thereby completing the training of the quantum generative adversarial network; wherein the first training process includes maintaining the parameters of the discriminator unchanged and training the generator based on the first loss function; and the second training process includes maintaining the parameters of the generator unchanged and training the discriminator based on the second loss function.

[0036] In a third aspect, the present application further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0037] Constructing a Rayleigh divergence relationship between real quantum state data and forged quantum state data output by the generator, and constructing a first loss function based on the Rayleigh divergence relationship, wherein the first loss function is used to minimize the gap between the forged quantum state data output by the generator and the real quantum state data;

[0038] Constructing a second loss function of the discriminator, the second loss function is used to maximize the probability that the discriminator outputs a first discrimination result as false and outputs a second discrimination result as true, wherein the first discrimination result is a discrimination result for forged quantum state data, and the second discrimination result is a discrimination result for real quantum state data;

[0039] The first training of the generator and the second training of the discriminator are performed alternately until the training cutoff condition is reached, thereby completing the training of the quantum generative adversarial network; wherein the first training process includes maintaining the parameters of the discriminator unchanged and training the generator based on the first loss function; the second training process includes maintaining the parameters of the generator unchanged and training the discriminator based on the second loss function.

[0040] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0041] Constructing a Rayleigh divergence relationship between real quantum state data and forged quantum state data output by the generator, and constructing a first loss function based on the Rayleigh divergence relationship, wherein the first loss function is used to minimize the gap between the forged quantum state data output by the generator and the real quantum state data;

[0042] Constructing a second loss function of the discriminator, the second loss function is used to maximize the probability that the discriminator outputs a first discrimination result as false and outputs a second discrimination result as true, wherein the first discrimination result is a discrimination result for forged quantum state data, and the second discrimination result is a discrimination result for real quantum state data;

[0043] The first training of the generator and the second training of the discriminator are performed alternately until the training cutoff condition is reached, thereby completing the training of the quantum generative adversarial network; wherein the first training process includes maintaining the parameters of the discriminator unchanged and training the generator based on the first loss function; the second training process includes maintaining the parameters of the generator unchanged and training the discriminator based on the second loss function.

[0044] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0045] Constructing a Rayleigh divergence relationship between real quantum state data and forged quantum state data output by the generator, and constructing a first loss function based on the Rayleigh divergence relationship, wherein the first loss function is used to minimize the gap between the forged quantum state data output by the generator and the real quantum state data;

[0046] Constructing a second loss function of the discriminator, the second loss function is used to maximize the probability that the discriminator outputs a first discrimination result as false and outputs a second discrimination result as true, wherein the first discrimination result is a discrimination result for forged quantum state data, and the second discrimination result is a discrimination result for real quantum state data;

[0047] The first training of the generator and the second training of the discriminator are performed alternately until the training cutoff condition is reached, thereby completing the training of the quantum generative adversarial network; wherein the first training process includes maintaining the parameters of the discriminator unchanged and training the generator based on the first loss function; the second training process includes maintaining the parameters of the generator unchanged and training the discriminator based on the second loss function.

[0048] The training method, device, equipment, and storage medium of the above-mentioned quantum generative adversarial network can be formalized to represent the training of the reconstructed quantum generative adversarial network as optimizing the first loss function and optimizing the second loss function. In the training process of the quantum generative adversarial network, the traditional training method is prone to the phenomenon of barren plateaus because both the generator and the discriminator are constructed based on quantum neural networks, which makes it impossible to continue to update the training parameters, and ultimately causes the training time of the quantum generative adversarial network to be infinitely extended, and no effective results can be obtained. The method provided in this embodiment uses the loss function corresponding to the Renyi divergence to train the reconstructed quantum generative adversarial network, that is, the training process of the reconstructed quantum generative adversarial network can be simply regarded as optimizing the loss function of the Renyi divergence, so that the reconstructed quantum generative adversarial network avoids the phenomenon of barren plateaus, and the parameters of the reconstructed quantum generative adversarial network can be continuously updated, thereby improving the training effect of the quantum generative adversarial network. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 A diagram of an application environment for a training method for a quantum generative adversarial network in one embodiment;

[0051] Figure 2 A schematic diagram of a flow chart of a training method for a quantum generative adversarial network in one embodiment;

[0052] Figure 3 A schematic diagram of a quantum generative adversarial network in one embodiment;

[0053] Figure 4 A schematic diagram of a quantum circuit in a quantum generative adversarial network in another embodiment;

[0054] Figure 5 A structural block diagram of a training device for a quantum generative adversarial network in one embodiment;

[0055] Figure 6 FIG. 4 is a diagram showing the internal structure of an electronic device in one embodiment. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0057] The training method of quantum generative adversarial network provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.

[0058] In an exemplary embodiment, Figure 2 As shown, a training method for a quantum generative adversarial network is provided for training a quantum generative adversarial network. The quantum generative adversarial network described in this embodiment is a quantum generative adversarial network generated by transforming the traditional quantum generative adversarial network (Quantum Generative Adversarial Networks, referred to as QGANs) by applying quantum Renyi divergence, that is, a Re-QGANS network. The Re-QGANS network can be understood as a reconstructed quantum generative adversarial network.

[0059] The Re-QGANS network consists of a generator and a discriminator. Figure 3 The schematic diagram of the generator and discriminator is shown in Figure 1. The generator in the Re-QGANS network is used to output forged quantum state data based on the input quantum state data. The discriminator in the Re-QGANS network is used to identify the input quantum state data and output the result as true or false. Figure 3 As shown, when the Re-QGANS network is used, the generator outputs forged quantum state data to the discriminator.

[0060] Both the generator and the discriminator are composed of quantum circuits. Figure 4 The schematic diagram of the quantum circuit shown in FIG. 1 includes module 1 and module 2. Module 1 includes several Pauli revolving gate, each Pauli revolving gate is a single-qubit revolving gate. Module 2 contains several random revolving gates , Mainly from the collection Randomly select from Representative layer, is the index of the qubit. A two-qubit entanglement gate. Figure 4 The figure shows the quantum circuit structure of the first-layer generator or the first-layer discriminator of the Re-QGANS network. Assume that the depth of the QGANS network is Layer, remaining The layer is a quantum circuit through the repeating module 2 This was constructed again.

[0061] This method is applied to Figure 1 The server 104 in the example is used as an example to illustrate, including the following steps 201 to 203. Among them:

[0062] Step 201, constructing a Rayleigh divergence relationship between real quantum state data and forged quantum state data output by a generator, and constructing a first loss function based on the Rayleigh divergence relationship, wherein the first loss function is used to minimize the gap between the forged quantum state data output by the generator and the real quantum state data.

[0063] Among them, Renyi divergence mainly describes the relationship between two distributions. For two discrete probability distributions and distribution , the Renyi divergence gives a quantitative way of measuring the difference between two probability distributions.

[0064] Since both the generator and the discriminator are composed of quantum circuits, After sampling the real data sample, encode the real data sample into a quantum state , to obtain the real quantum state data.

[0065] From the distribution The noise data is sampled and input into the generator, which outputs forged sample data based on the noise data. Since both the generator and the discriminator are composed of quantum circuits, the noise data needs to be encoded into a quantum state. . Encode the forged sample data into a quantum state to obtain the forged quantum state data .

[0066] In order to avoid the phenomenon of barren plateau, the first loss function of the generator is constructed using the quantum maximum Renyi divergence in the quantum Re-QGANS network. The first loss function can also be understood as the loss function of the generator. Specifically, the Renyi divergence relationship between the real quantum state data and the forged quantum state data output by the generator is first constructed, and then the first loss function is constructed based on the Renyi divergence relationship. The first loss function is used to minimize the gap between the forged quantum state data output by the generator and the real quantum state data. Assume that the Renyi divergence relationship is expressed as , where represents the information entropy parameter. Assume , since the goal of the generator is to make the generated forged quantum state data as Closer to real quantum state data , then the first loss function is , where Represents a set of parameters for a generator.

[0067] Step 202, construct a second loss function of the discriminator, the second loss function is used to maximize the probability that the discriminator outputs a first discrimination result as false and outputs a second discrimination result as true, wherein the first discrimination result is a discrimination result for forged quantum state data, and the second discrimination result is a discrimination result for real quantum state data.

[0068] The goal of the discriminator is to distinguish the forged quantum state data generated by the generator. and real quantum state data , so the optimization problem of the loss function of the discriminator can be transformed into the forged quantum state data for the input When , the output of the discriminator is false ( ), for input is real quantum state data When , the discriminator output is true ( ) is maximized.

[0069] Assume that the quantum state data is forged and real quantum state data They are all randomly selected with a probability of 1 / 2. After passing through the discriminator, the quantum state data is forged Convert to , real quantum state data Convert to The second loss function can be expressed as , where represents the unitary operation represented by the quantum circuit, represents the parameter set of the discriminator, Represents the trace (trace number) of the matrix.

[0070] It can be seen that the second loss function is used to maximize the probability that the discriminator outputs the first discrimination result as false and outputs the second discrimination result as true. The first discrimination result is the discrimination result for forged quantum state data. The second discrimination result is the discrimination result for real quantum state data.

[0071] Step 203, alternately performing the first training of the generator and the second training of the discriminator until the training cutoff condition is reached, thereby completing the training of the quantum generative adversarial network; wherein the first training process includes maintaining the parameters of the discriminator unchanged and training the generator based on the first loss function; the second training process includes maintaining the parameters of the generator unchanged and training the discriminator based on the second loss function.

[0072] In the first training process, the parameters of the discriminator are kept unchanged, and the generator is trained based on the first loss function. From the above description, it can be seen that the training process of the generator is actually transformed into an optimization process of the first loss function.

[0073] In the second training process, the parameters of the generator are kept unchanged, and the discriminator is trained based on the second loss function. From the above description, it can be seen that the training process of the discriminator is actually transformed into an optimization process of the second loss function.

[0074] The first training and the second training are adversarial training for the generator and the discriminator. Through adversarial training, the generator gradually learns to generate more and more realistic fake data, while the discriminator gradually improves its ability to distinguish between real data and fake data. The two networks compete and promote each other during the training process, and finally reach a balance. In the equilibrium state, the generator can produce high-quality, realistic fake data, while the discriminator can accurately distinguish between real data and fake data.

[0075] The first training of the generator and the second training of the discriminator are continuously and alternately performed to continuously optimize the first loss function and the second loss function until the training cutoff condition is reached, and the training of the Re-QGANS network is completed. The training cutoff condition is, for example, reaching an equilibrium state as mentioned above, such as Nash equilibrium. The training cutoff condition includes the training cutoff condition of the generator and the training cutoff condition of the discriminator.

[0076] Optionally, after the training of the Re-QGANS network is completed, the training results may be tested. If the test result is not satisfactory, step 201 to step 203 may be performed again.

[0077] Optionally, in the Re-QGANS network, both the generator and the discriminator are composed of quantum circuits, which can be parameterized quantum circuits (PQCs). A variational quantum circuit is a quantum circuit composed of quantum gates with parameters. The quantum gates in the quantum circuit are composed of parameter sets. and Before training the Re-QGANS network, the parameters of all quantum circuits are randomly initialized.

[0078] From the above, it can be seen that the method provided in this embodiment can be formalized to express the training of the Re-QGANS network as optimizing the first loss function and optimizing the second loss function. In the training process of the QGANs network, the traditional training method is prone to the phenomenon of barren plateaus, because both the generator and the discriminator are constructed based on the quantum neural network QGANs, which makes it impossible to continue to update the training parameters, and ultimately causes the training time of the QGANs network to be infinitely extended, and no effective results can be obtained. The method provided in this embodiment uses the loss function corresponding to the Renyi divergence to train the Re-QGANS network, that is, the training process of the Re-QGANs network can be simply regarded as optimizing the loss function of the Renyi divergence, so that the Re-QGANS network avoids the phenomenon of barren plateaus, and the parameters of the Re-QGANS network can be continuously updated, thereby improving the training effect of the QGANS network.

[0079] In an exemplary embodiment, step 201 constructs the Rayleigh divergence relationship between the real quantum state data and the forged quantum state data output by the generator, including step 1 to step 2. Among them:

[0080] Step 1: construct a first matrix between the parameter set of the generator, the real quantum state data and the fake quantum state data output by the generator.

[0081] Among them, the first matrix can be expressed as ,in represents the rotation angle parameter of the revolving gate of the generator quantum circuit, represents the forged quantum state data, Represents real quantum state data.

[0082] Step 2: Obtain the trace number of the first matrix, and construct the Rayleigh divergence relationship based on the logarithmic operation form of the trace number.

[0083] The trace number of the first matrix can be expressed as The logarithmic form of the trace number can be expressed as The constructed Rayleigh divergence relation can be expressed as .

[0084] In this embodiment, by constructing the Renyi divergence relationship between the real quantum state data and the forged quantum state data, it is convenient to use the loss function corresponding to the Renyi divergence to train the Re-QGANS network later. That is, the training process of Re-QGANs can be simply regarded as optimizing the loss function of the Renyi divergence, so that the Re-QGANS network avoids the phenomenon of barren plateau, and the parameters of the Re-QGANS network can be continuously updated, thereby improving the training effect of the QGANS network.

[0085] In an exemplary embodiment, step 202 of constructing the second loss function of the discriminator includes steps 1 to 4.

[0086] Step 1: Use a discriminator to perform state conversion on the forged quantum state data output by the generator to obtain the first quantum state data.

[0087] As described above, forging quantum state data After the state conversion is performed by the discriminator, the first quantum state data is obtained .

[0088] Step 2: Use a discriminator to perform state conversion on the real quantum state data to obtain second quantum state data.

[0089] As described above, the real quantum state data After the state conversion is performed by the discriminator, the second quantum state data is obtained ,

[0090] Step three, construct a second matrix about the first quantum state data and a third matrix about the second quantum state data.

[0091] The second matrix can be expressed as ,in Represents the unitary operation represented by the generator quantum circuit.

[0092] The third matrix can be expressed as ,in Represents the unitary operation represented by the generator quantum circuit.

[0093] Step 4: construct the second loss function based on the trace number of the second matrix and the trace number of the third matrix.

[0094] The trace number of the second matrix can be expressed as , the trace number of the third matrix can be expressed as The constructed second loss function is expressed as .

[0095] In an exemplary embodiment, step 203 trains the generator based on the first loss function, including step one.

[0096] Step 1: solve the first loss function during training and update the generator parameter set according to the solution result.

[0097] The first loss function can be Each time the first loss function is solved, a parameter set of the generator can be obtained , when the training cutoff condition of the generator is not reached, it is necessary to update the last solution result according to the latest solution result of the first loss function, that is, to update the parameter set of the generator according to the solution result.

[0098] Optionally, the training cutoff condition of the generator includes that the forged quantum state data output by the trained generator is judged as true by the discriminator. That is to say, when the forged quantum state data output by the generator is judged as false by the discriminator, it is still necessary to update the parameter set of the generator until the forged quantum state data output by the generator when it has the target parameter set is recognized as true by the discriminator.

[0099] Optionally, updating the parameters of the generator according to the solution result includes: when the solution result corresponding to the i+1th training does not meet the training cutoff condition of the generator, determining the generator parameter set obtained after the i+1th training according to the learning rate of the generator corresponding to the i-th training and the generator parameter set obtained by the i-th training, wherein i is a natural number greater than zero.

[0100] For example, using the formula Determine the generator parameter set obtained after the i+1th training. represents the generator parameter set obtained from the i-th training, represents the generator parameter set obtained from the i+1th training, represents the learning rate of the generator corresponding to the i-th training, represents the learning rate of each iteration of the generator circuit, Represents the value of the loss function of the generated circuit at this iteration.

[0101] Step 203 of training the discriminator based on the second loss function includes step 2.

[0102] Step 2: Solve the second loss function during training and update the discriminator parameter set according to the solution result.

[0103] The second loss function can be Solving the second loss function once can obtain a parameter set of the discriminator When the training cutoff condition of the discriminator is not reached, it is necessary to update the last solution result according to the latest solution result of the second loss function, that is, to update the parameter set of the discriminator according to the solution result.

[0104] Optionally, the training cutoff condition of the discriminator includes that the probability that the trained discriminator outputs the same discrimination result is a first preset probability. For example, the probability that the discriminator outputs true is one-half, and the probability that the discriminator outputs false is one-half. The first preset probability can also be set to other values ​​according to actual needs, which is not limited in this embodiment. Then, when the probability that the discriminator outputs the same discrimination result is not equal to the first preset probability, it is still necessary to update the parameter set of the discriminator until the probability that the discriminator outputs the same discrimination result when it has the target parameter set is the first preset probability.

[0105] Optionally, updating the discriminator parameter set according to the solution result includes: when the solution result corresponding to the j+1th training does not meet the training cutoff condition of the discriminator, determining the discriminator parameter set obtained after the j+1th training according to the learning rate of the discriminator corresponding to the jth training and the discriminator parameter set obtained by the jth training, wherein j is a natural number greater than zero.

[0106] For example, using the formula Determine the discriminator parameter set obtained after the j+1th training. represents the discriminator parameter set obtained after the jth training, represents the discriminator parameter set obtained after the j+1th training, represents the learning rate of the discriminator corresponding to the jth training, represents the iterative learning rate of the discriminator circuit, Represents the value of the loss function of this iteration of the discriminator circuit.

[0107] The method provided in this embodiment continuously updates the parameter set of the generator by solving the solution of the first loss function, and finally makes the training of the generator reach the training cutoff condition of the generator, and achieves the training purpose of the generator. In addition, by solving the solution of the second loss function, the parameter set of the discriminator is continuously updated, and finally makes the training of the discriminator reach the training cutoff condition of the discriminator, and achieves the training purpose of the discriminator. That is, the training process of Re-QGANs can be simply regarded as the process of solving and optimizing the first loss function and the process of solving and optimizing the second loss function, so that the Re-QGANS network avoids the phenomenon of barren plateau, and the parameters of the Re-QGANS network can be continuously updated, thereby improving the training effect of the QGANS network.

[0108] In an exemplary embodiment, for ease of understanding, the training method of the quantum generative adversarial network is described in more detail below based on the experimental results of the training method. The experiment can be conducted on a quantum experimental simulation platform, such as the Paddle Quantum quantum experimental simulation platform. The Paddle Quantum quantum experimental simulation platform supports the construction and training of quantum neural networks, and provides an easy-to-use quantum machine learning development kit and cutting-edge quantum application tool sets such as quantum optimization and quantum chemistry.

[0109] In the experiment, the quantum Gibbs state was selected as the training target of the Re-QGANS network. The quantum Gibbs state has important applications in many-body physics, quantum simulation, and quantum machine learning, but the currently popular QGANS network cannot directly generate the quantum Gibbs state, so this training target is very meaningful.

[0110] For a given The Hamiltonian of qubits , the Gibbs state is defined as ,in is the inverse parameter temperature of the system. Hamiltonian is randomly generated by the built-in function of Paddle Quantum. Here, the inverse temperature parameter Set to fixed , and then use 2-qubit, 3-qubit, and 4-qubit Gibbs states as the target state (i.e., the target's real quantum state data) to train the Re-QGANs network. In particular, in the above three different qubit cases, the overall network structure of the generator and discriminator of the Re-QGANs network consists of a 4-qubit circuit with hidden qubits, and the number of hidden qubits is the same as the number of qubits in the target Gibbs state.

[0111] The structure of the generator and discriminator network of Re-QGANs network is as follows Figure 4 shown.

[0112] For the 2-qubit Gibbs state as the target state to train the Re-QGANs network, the steps are as follows:

[0113] Step 1: Initialization.

[0114] In the quantum Re-QGANs network, both the generator and the discriminator are composed of variational quantum circuits, and the parameter sets of the quantum gates are respectively (the set of parameters for the generator) and (the parameter set of the discriminator) is parameterized. All parameters are randomly initialized before training, and the input and output of the quantum circuit are quantum states. In the embodiment here, the initial trainable parameters in the quantum circuit are randomly selected from a Gaussian distribution. The noise data is encoded as quantum state data , the target's true quantum state data is encoded as quantum state data .

[0115] Step 2: Train the generator.

[0116] In order to avoid the phenomenon of barren plateaus in the generator network, the generator uses the quantum maximum Renyi divergence to construct the first loss function of the generator. In the embodiment here, for generating a 2-qubit Gibbs state, the input quantum state of the generator is , and after Figure 4 The quantum circuits in the . Figure 4 As can be seen from the figure, the overall circuit is a quantum circuit containing 4 qubits. In the first layer of the network structure of the generator and the discriminator, it can be divided into two modules as a whole. Module 1 contains 4 The Pauli revolving door, which is a single-qubit revolving door, and , where represents a quantum gate that rotates around the Y axis by an angle of θ, which is a variable. represents the Pauli-Y matrix. Module 2 contains several random revolving doors , where the random revolving door Mainly from the collection Randomly selected from Representative layer, is the index of the qubit. A two-qubit entanglement gate.

[0117] Step 3: Train the discriminator.

[0118] The goal of the discriminator is to distinguish the forged quantum state data generated by the generator. and real quantum state data , so the optimization problem of the second loss function of the discriminator can be transformed into an input pair When input, the output judgment result is false ( ),right When input, the output judgment result is true ( ) is maximized. In the embodiments herein, and are randomly selected with a probability of 1 / 2. After passing through the discriminator, the states are converted to and The discriminator is Figure 4 The four layers of quantum circuits in the training are trained. The quantum circuits in the first layer are as follows Figure 4 As shown in the quantum circuit in the figure, the remaining three layers are formed by repeating Figure 4 Module 2 in is built three times.

[0119] Step 4: adversarial training.

[0120] The training process in the generator and the discriminator is transformed into the optimization process of the loss function (i.e. the solution process mentioned above). The gradient descent method is used to solve the solutions of these two optimization problems in the training, and the two optimization processes are compared to set the generator parameter set Update and set the discriminator parameter set Update. About generator parameter sets Update and discriminator parameter set For updates, please refer to the above description and will not be repeated here.

[0121] Step 5: Convergence.

[0122] The training of the generator and the discriminator is continuously performed to optimize the first loss function and the second loss function respectively until a stable state is reached. Ideally, the generator will learn to generate realistic samples, and the discriminator will gradually be unable to distinguish between the generated data and the target data, thereby achieving a Nash equilibrium. In the embodiment herein, the experimental results show that for generating a target Gibbs state of 2 qubits, the quantum Re-QGANs network requires about 30 iterations, and for generating a target Gibbs state of 3 qubits, and generating a target Gibbs state of 4 qubits, the quantum Re-QGANs network requires about 40 iterations, which shows the effectiveness of the quantum Re-QGANs network.

[0123] Step six: Result evaluation.

[0124] Ultimately, the generator can be used to generate realistic data samples, and the discriminator can accurately distinguish between real and generated samples. In the embodiments herein, the experimental results show that the average fidelity of the quantum Gibbs state generated by the generator of the quantum Re-QGANs network after about 40 iterations is as high as 99.8%. And within about 50 iterations, the quantum Gibbs state generated by the generator of the quantum Re-QGANs network achieved an average fidelity of 99.99%. Compared with the traditional QGANS network, the fidelity of the Gibbs state generated by the traditional QGANS network does not exceed 50%, that is, the target state cannot be generated.

[0125] This example conducts three groups of simulation experiments with different numbers of qubits, namely 2-qubit, 3-qubit and 4-qubit Gibbs states, and obtains the average value after performing dozens of experiments in each group. The experiment shows that the quantum Re-QGANs network based on Renyi divergence can effectively generate Gibbs states with an average fidelity of up to 99.8%, while the fidelity of the Gibbs states generated by the QGANS network does not exceed 50%, which proves the effectiveness of the quantum Re-QGANs method based on Renyi divergence.

[0126] Therefore, the Renyi divergence-based quantum ReQGANs network is an effective way to generate Gibbs states. And in the future, it will be very inspiring to solve other problems through quantum ReQGANs networks, such as providing some new ideas in the variational QGANs algorithm.

[0127] It should be understood that, although the steps in the flowcharts of the embodiments described above are shown in sequence according to the instructions of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.

[0128] Based on the same inventive concept, the embodiment of the present application also provides a quantum generative adversarial network training device for implementing the above-mentioned quantum generative adversarial network training method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in the embodiments of one or more quantum generative adversarial network training devices provided below can refer to the limitations of the quantum generative adversarial network training method above, and will not be repeated here.

[0129] In an exemplary embodiment, Figure 5 As shown, a training device 50 for a quantum generative adversarial network is provided, comprising: a processing module 51 and a training module 52, wherein:

[0130] The processing module 51 is used to construct the Rayleigh divergence relationship between the real quantum state data and the forged quantum state data output by the generator.

[0131] The processing module 51 is also used to construct a first loss function based on the Rayleigh divergence relationship, and the first loss function is used to minimize the gap between the forged quantum state data output by the generator and the real quantum state data.

[0132] The processing module 51 is also used to construct a second loss function of the discriminator, which is used to maximize the probability that the discriminator outputs a first discrimination result as false and outputs a second discrimination result as true, wherein the first discrimination result is a discrimination result for forged quantum state data, and the second discrimination result is a discrimination result for real quantum state data.

[0133] The training module 52 is used to alternately perform a first training of the generator and a second training of the discriminator until a cutoff condition is reached, thereby completing the training of the quantum generative adversarial network; wherein the first training process includes maintaining the parameters of the discriminator unchanged and training the generator based on the first loss function; and the second training process includes maintaining the parameters of the generator unchanged and training the discriminator based on the second loss function.

[0134] Optionally, the processing module 51 is used to construct a first matrix between the parameter set of the generator, the real quantum state data and the forged quantum state data output by the generator; obtain the trace number of the first matrix, and construct the Rayleigh divergence relationship based on the logarithmic operation form of the trace number.

[0135] Optionally, the processing module 51 is used to use a discriminator to perform state conversion on the forged quantum state data output by the generator to obtain first quantum state data; use a discriminator to perform state conversion on the real quantum state data to obtain second quantum state data; construct a second matrix about the first quantum state data and a third matrix about the second quantum state data; construct the second loss function based on the trace number of the second matrix and the trace number of the third matrix.

[0136] Optionally, the training module 52 is used to solve the first loss function during the training process and update the generator parameter set according to the solution result; solve the second loss function during the training process and update the discriminator parameter set according to the solution result.

[0137] Optionally, the training module 52 is used to input first data with a quantum state into a generator, and obtain first forged data with a quantum state output by the generator; input the first forged data and the first real data with a quantum state into the first loss function and solve the first loss function.

[0138] Optionally, the training cutoff condition includes a training cutoff condition for the generator and a training cutoff condition for the discriminator; the training cutoff condition for the generator includes that the forged quantum state data output by the trained generator is judged to be true by the discriminator; the training cutoff condition for the discriminator includes that the probability that the trained discriminator outputs the same judgment result is a first preset probability.

[0139] Optionally, the training module 52 is used to determine the generator parameter set obtained after the i+1th training according to the learning rate of the generator corresponding to the i-th training and the generator parameter set obtained by the i-th training when the corresponding solution result after the i+1th training does not meet the training cutoff condition of the generator, wherein i is a natural number greater than zero; when the corresponding solution result after the j+1th training does not meet the training cutoff condition of the discriminator, determine the discriminator parameter set obtained after the j+1th training according to the learning rate of the discriminator corresponding to the j-th training and the discriminator parameter set obtained by the j-th training; wherein j is a natural number greater than zero.

[0140] Each module in the training device of the quantum generative adversarial network can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in an electronic device in the form of hardware, or can be stored in a memory in an electronic device in the form of software, so that the processor can call and execute the operations corresponding to each module.

[0141] In an exemplary embodiment, an electronic device is provided. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The electronic device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the electronic device is used to store data. The input / output interface of the electronic device is used to exchange information between the processor and an external device. The communication interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a training method for a quantum generative adversarial network is implemented.

[0142] Those skilled in the art will understand that Figure 6The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0143] In an exemplary embodiment, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, a training method for a quantum generative adversarial network provided in any of the above embodiments is implemented.

[0144] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, a training method for a quantum generative adversarial network as provided in any of the above embodiments is implemented.

[0145] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements a training method for a quantum generative adversarial network as provided in any of the above embodiments.

[0146] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a quantum state processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0147] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0148] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A training method for a quantum generative adversarial network, characterized in that: The quantum generative adversarial network includes a generator and a discriminator, both of which are composed of quantum circuits; The method comprises: Constructing a Rayleigh divergence relationship between real quantum state data and forged quantum state data output by the generator, and constructing a first loss function based on the Rayleigh divergence relationship, wherein the first loss function is used to minimize the gap between the forged quantum state data output by the generator and the real quantum state data; Constructing a second loss function of the discriminator, the second loss function is used to maximize the probability that the discriminator outputs a first discrimination result as false and outputs a second discrimination result as true, wherein the first discrimination result is a discrimination result for forged quantum state data, and the second discrimination result is a discrimination result for real quantum state data; The first training of the generator and the second training of the discriminator are performed alternately until the training cutoff condition is reached, thereby completing the training of the quantum generative adversarial network; wherein the first training process includes maintaining the parameters of the discriminator unchanged and training the generator based on the first loss function; the second training process includes maintaining the parameters of the generator unchanged and training the discriminator based on the second loss function.

2. The method according to claim 1, characterized in that The constructing of the Rayleigh divergence relationship between the real quantum state data and the forged quantum state data output by the generator includes: Constructing a first matrix between the parameter set of the generator, the real quantum state data and the forged quantum state data output by the generator; The trace number of the first matrix is ​​obtained, and the Rayleigh divergence relationship is constructed based on a logarithmic operation form of the trace number.

3. The method according to claim 1, characterized in that The second loss function of constructing the discriminator includes: The discriminator is used to perform state conversion on the forged quantum state data output by the generator to obtain the first quantum state data; The discriminator is used to perform state conversion on the real quantum state data to obtain the second quantum state data; constructing a second matrix about the first quantum state data and a third matrix about the second quantum state data; The second loss function is constructed based on the trace number of the second matrix and the trace number of the third matrix.

4. The method according to claim 1, characterized in that The training of the generator based on the first loss function includes: Solving the first loss function during training, and updating the generator parameter set according to the solution result; The training of the discriminator based on the second loss function comprises: The second loss function is solved during the training process, and the discriminator parameter set is updated according to the solution result.

5. The method according to claim 4, characterized in that The solving the first loss function comprises: Inputting first data having a quantum state into a generator, and obtaining first forged data having a quantum state output by the generator; The first forged data and the first real data in a quantum state are input into the first loss function and the first loss function is solved.

6. The method according to claim 4, characterized in that The training cutoff condition includes a training cutoff condition for the generator and a training cutoff condition for the discriminator; The training cutoff condition of the generator includes that the forged quantum state data output by the trained generator is judged as true by the discriminator; The training cutoff condition of the discriminator includes that the probability that the trained discriminator outputs the same discrimination result is a first preset probability.

7. The method according to claim 6, characterized in that The updating of the generator parameter set according to the solution result includes: When the solution result corresponding to the i+1th training does not meet the training cutoff condition of the generator, the generator parameter set obtained after the i+1th training is determined according to the learning rate of the generator corresponding to the i-th training and the generator parameter set obtained by the i-th training; where i is a natural number greater than zero; The updating of the discriminator parameter set according to the solution result comprises: When the solution result after the j+1th training does not meet the training cutoff condition of the discriminator, the discriminator parameter set obtained after the j+1th training is determined according to the learning rate of the discriminator corresponding to the jth training and the discriminator parameter set obtained by the jth training; wherein j is a natural number greater than zero.

8. A training device for a quantum generative adversarial network, characterized in that: The quantum generative adversarial network includes a generator and a discriminator, both of which are composed of quantum circuits; The device comprises: A processing module, used to construct a Rayleigh divergence relationship between real quantum state data and forged quantum state data output by the generator; The processing module is further used to construct a first loss function based on the Rayleigh divergence relationship, wherein the first loss function is used to minimize the gap between the forged quantum state data output by the generator and the real quantum state data; The processing module is further used to construct a second loss function of the discriminator, wherein the second loss function is used to maximize the probability that the discriminator outputs a first discrimination result as false and outputs a second discrimination result as true, wherein the first discrimination result is a discrimination result for forged quantum state data, and the second discrimination result is a discrimination result for real quantum state data; A training module is used to alternately perform a first training of a generator and a second training of a discriminator until a cutoff condition is reached, thereby completing the training of the quantum generative adversarial network; wherein the first training process includes maintaining the parameters of the discriminator unchanged and training the generator based on the first loss function; and the second training process includes maintaining the parameters of the generator unchanged and training the discriminator based on the second loss function.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Training method and device of generative adversarial network and storage medium

    CN120455430A

  • A physically information-driven hybrid quantum-classical kernel regression thermodynamic observables method

    CN122509023A

  • A physically information-driven hybrid quantum-classical kernel regression thermodynamic observables method

    CN122509023B