Model training method, device, equipment and storage medium for quantum state generation
By introducing quantum computing technology into the generative model, using quantum neural networks and measuring features to optimize the parameters of the generative model, the problem of combining artificial intelligence and quantum computing in the existing technology is solved, and efficient quantum state data generation is achieved.
Patent Information
- Application Number
- CN202311607403.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-28
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2043-11-28
AI Technical Summary
It is difficult for the existing technology to effectively combine artificial intelligence and quantum computing to improve the training efficiency of generative models and the quality of data generation.
By inputting the quantum state sample data into the quantum neural network of the encoding model, measuring it in multiple directions, obtaining the measurement characteristics, and determining the target embedding characteristics based on the measurement characteristics, adjusting the parameters of the generation model to generate the quantum state output data.
The training efficiency and data generation quality of the generative model are improved, and more accurate and efficient quantum state data generation is achieved.
Smart Images

Figure CN117610670B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to artificial intelligence (AIGC) and quantum computing technology, and can be applied to automatic writing, speech synthesis, and image generation scenarios. More specifically, the present disclosure provides a training method for generating a model, a data generation method, a device, an electronic device, and a storage medium. Background Art
[0002] With the development of artificial intelligence and quantum computing technology, quantum computing technology can be introduced into artificial intelligence tasks to improve the execution efficiency of artificial intelligence tasks; artificial intelligence technology can also be used to expand the application scenarios of quantum computing. Summary of the invention
[0003] The present disclosure provides a training method for generating a model, a data generation method, an apparatus, a device, and a storage medium.
[0004] According to one aspect of the present disclosure, a training method for a generative model is provided, the method comprising: inputting quantum state sample data into a quantum neural network of a coding model to obtain an output result; measuring the output result along multiple directions to obtain measurement features, wherein the measurement features correspond to the measurement results of multiple directions of the output result; obtaining an initial feature based on the measurement features; determining a target embedded feature corresponding to the initial feature from multiple embedded features to be adjusted; obtaining parameter data based on the target embedded feature; generating quantum state output data using a quantum neural network of a first generative model based on the parameter data; and adjusting the parameters of the first generative model and multiple embedded features to be adjusted based on the quantum state sample data and the quantum state output data.
[0005] According to another aspect of the present disclosure, a data generation method is provided, the method comprising: obtaining a target feature based on input data to be processed; determining a target embedding feature corresponding to the target feature from a plurality of adjusted embedding features; obtaining parameter data based on the target embedding feature; generating quantum state output data using a quantum neural network of a first generation model based on the parameter data; determining target data based on the quantum output data, wherein the first generation model is trained using a method as provided in the present disclosure.
[0006] According to another aspect of the present disclosure, a training device for a generation model is provided, the device comprising: a first acquisition module, used to input quantum state sample data into a quantum neural network of a coding model to obtain an output result; a measurement module, used to measure the output result along multiple directions to obtain measurement features, wherein the measurement features correspond to the measurement results of multiple directions of the output result; a second acquisition module, used to obtain an initial feature based on the measurement features; a first determination module, used to determine a target embedded feature corresponding to the initial feature from multiple embedded features to be adjusted; a third acquisition module, used to obtain parameter data based on the target embedded feature; a first generation module, used to generate quantum state output data using the quantum neural network of a first generation model based on the parameter data; and an adjustment module, used to adjust the parameters of the first generation model and multiple embedded features to be adjusted based on the quantum state sample data and the quantum state output data.
[0007] According to another aspect of the present disclosure, a data generating device is provided, which includes: a fifth obtaining module, used to obtain a target feature according to input data to be processed; a second determining module, used to determine a target embedding feature corresponding to the target feature from a plurality of adjusted embedding features; a sixth obtaining module, used to obtain parameter data according to the target embedding feature; a second generating module, used to generate quantum state output data according to the parameter data using a quantum neural network of a first generating model; and a second determining module, used to determine the target data according to the quantum output data, wherein the first generating model is trained using the device provided by the present disclosure.
[0008] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method provided according to the present disclosure.
[0009] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided. The computer instructions are used to cause a computer to execute the method provided according to the present disclosure.
[0010] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method provided according to the present disclosure is implemented.
[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0013] Figure 1 is a schematic flow chart of a training method for a generative model according to an embodiment of the present disclosure;
[0014] Figure 2 is a schematic diagram of a coding model according to an embodiment of the present disclosure;
[0015] Figure 3 is a schematic diagram of a first generative model and a second generative model according to an embodiment of the present disclosure;
[0016] Figure 4 is a flow chart of a data generation method according to another embodiment of the present disclosure;
[0017] Figure 5 is a schematic diagram of a data generation method according to an embodiment of the present disclosure;
[0018] Figure 6 is a block diagram of a training device for generating a model according to an embodiment of the present disclosure;
[0019] Figure 7 is a block diagram of a data generating device according to an embodiment of the present disclosure; and
[0020] Figure 8 is a block diagram of an electronic device to which a training method for generating a model and / or a data generating method can be applied according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0022] Generative AI represents a new machine learning method that can transform machines from passive information processing devices to creative devices that can generate new content. By utilizing a large amount of existing text, image, audio and other data, generative AI technology can learn and generate new content that is similar to the original data. Typical applications of this technology include automatic writing, speech synthesis, image generation and other scenarios. Generative AI has great potential in content creation scenarios.
[0023] Quantum computing is an emerging computing method that uses the principles of quantum mechanics to perform calculations, which can be more efficient than traditional computers. Quantum computing uses quantum bits (qubits) as the basic unit of calculation. Quantum bits can be in a superposition state of 0 and 1 at the same time to achieve parallel computing. In addition, entangled states can be formed between quantum bits, allowing quantum computing to process and store more complex information.
[0024] Generative AI and quantum computing are both important research directions, but relatively few studies have combined the two. For example, there are relatively few ways to use quantum computing to generate new content.
[0025] By taking advantage of quantum computing, we can better handle and solve some complex optimization problems, thus providing more accurate and efficient algorithm support for generative artificial intelligence technology. In addition, generative artificial intelligence technology can also bring new applications to the field of quantum computing. For example, based on generative artificial intelligence technology, we can generate the ground state of Hamiltonian or generate quantum states that meet some specific requirements.
[0026] Based on this, the present disclosure provides a training method for generating a model, which will be described below.
[0027] Figure 1 is a flowchart of a training method for generating a model according to an embodiment of the present disclosure.
[0028] like Figure 1 As shown, the method 100 may include operations S110 to S170.
[0029] In operation S110, the quantum state sample data is input into the quantum neural network of the encoding model to obtain an output result.
[0030] In the disclosed embodiment, the quantum state sample data may correspond to data having a target style. Multiple quantum state sample data may correspond to data having the same target style.
[0031] In the disclosed embodiment, the quantum neural network of the coding model may correspond to one or more quantum bits. The quantum neural network of the coding model may include multiple quantum coding layers. The quantum coding layer may include a single-bit rotating gate for each of the multiple quantum bits. For example, after the quantum state sample data is processed by multiple quantum coding layers, at least one output result may be obtained.
[0032] In operation S120, the output result is measured along multiple directions to obtain measurement features.
[0033] In the embodiment of the present disclosure, the output result can be measured along at least two directions of the Pauli Z direction, Pauli X direction, Pauli Y direction, Pauli ZZ direction, Pauli XX direction, Pauli YY direction, etc. to obtain measurement results in at least two directions.
[0034] In the embodiments of the present disclosure, the measurement feature may be one or more. The measurement feature corresponds to the measurement results of multiple directions of the output result. For example, the measurement results of multiple directions of the same output result may be used as the measurement feature, or the measurement results of different directions of different output results may be used as the measurement feature, and the present disclosure does not limit this.
[0035] In operation S130, initial features are obtained according to the measured features.
[0036] In the disclosed embodiment, the initial feature may be one or more. The initial feature may be obtained in various ways. For example, the measured feature is converted into the initial feature according to a preset mapping relationship. For another example, the measured feature may be processed by a fully connected network to obtain the initial feature. If there are multiple measured features and the number of dimensions of the multiple measured features is the same, the initial feature may also be multiple, and the number of dimensions of the multiple initial features may also be the same.
[0037] In operation S140, a target embedding feature corresponding to the initial feature is determined from the plurality of embedding features to be adjusted.
[0038] In the disclosed embodiment, a discrete latent variable space conforming to a Gaussian distribution may be predefined as an embedding space. The embedding space may include a plurality of embedded features to be adjusted. The number of dimensions of the embedded features to be adjusted may be consistent with the number of dimensions of the initial features. It is understood that the embedded features, the measured features, and the initial features may be vectors.
[0039] In the disclosed embodiment, the embedded feature to be adjusted that has the highest similarity to the initial feature may be used as the embedded feature to be adjusted corresponding to the initial feature. At least one target embedded feature corresponding to at least one initial feature may be determined.
[0040] In operation S150, parameter data is obtained according to the target embedding feature.
[0041] In the embodiments of the present disclosure, the parameter data may be one or more. The parameter data may be obtained in various ways. For example, the sample measurement result may be converted into the parameter data according to a preset mapping relationship. For another example, the sample measurement result may be processed using a fully connected network to obtain the parameter data.
[0042] In operation S160, quantum state output data is generated using a quantum neural network of a first generation model according to the parameter data.
[0043] In the embodiment of the present disclosure, the first generation model may include a quantum neural network. The quantum neural network may correspond to a certain number of quantum bits. The number of parameter data may be an integer multiple of the number of quantum bits. The number of quantum bits of the quantum neural network of the first generation model may be the same as or different from the number of quantum bits of the encoding model, and the present disclosure does not limit this.
[0044] In the disclosed embodiment, the quantum neural network of the first generation model includes multiple quantum decoding layers. For example, taking multiple quantum bits configured with the same number of quantum logic gates as an example, the first quantum logic gate of each of the multiple quantum bits can constitute a quantum decoding layer. The second quantum logic gate of each of the multiple quantum bits can constitute a quantum decoding layer. The last quantum logic gate of each of the multiple quantum bits can constitute another quantum decoding layer. It can be understood that multiple quantum bits can also be configured with different numbers of quantum logic gates, and the present disclosure does not limit this.
[0045] In the disclosed embodiment, the parameter data can be used to adjust the parameters of the quantum decoding layer to obtain an adjusted quantum neural network. Any quantum state data can be input into the adjusted quantum neural network to generate quantum state output data.
[0046] In operation S170, parameters of the first generation model and a plurality of embedded features to be adjusted are adjusted according to the quantum state sample data and the quantum state output data.
[0047] In the disclosed embodiment, the parameters of the quantum neural network of the first generation model can be adjusted according to the difference between the quantum state sample data and the quantum state output data. For example, the parameters of the quantum decoding layer to be trained can be adjusted to train the first generation model.
[0048] Through the disclosed embodiments, the output of the quantum neural network of the encoding model is measured in multiple directions, and the effective information of the quantum state sample data can be fully obtained. The corresponding discrete embedded features obtained based on the measurement results in multiple directions enable the trained first generation model to be efficiently decoded, improve the model training efficiency and data generation efficiency, and improve the user experience.
[0049] In addition, through the embodiments of the present disclosure, the quantum neural network of the trained generative model can realize the simulation of quantum computing. Based on the parameters of the quantum neural network of the trained generative model, the data generation efficiency and accuracy of the quantum computing device can be improved.
[0050] It can be understood that the above text describes the training method of the present disclosure in combination with the first generation model and the encoding model, and the encoding model will be further described below.
[0051] In some embodiments, the encoding model may include a quantum neural network and a fully connected network. Figure 2 Provide explanation.
[0052] Figure 2 is a schematic diagram of a coding model according to an embodiment of the present disclosure.
[0053] like Figure 2 As shown, the encoding model may include a quantum neural network QNN21 and a fully connected network NN21.
[0054] In the embodiment of the present disclosure, the quantum neural network of the encoding model may be a quantum neural network of N quantum bits. N may be an integer greater than 1. Figure 2 As shown, the quantum neural network QNN21 can be, for example, a 4-qubit quantum neural network. The 4 qubits corresponding to the quantum neural network QNN21 can include a first qubit, a second qubit, a third qubit, and a fourth qubit. The first qubit can be configured with a single-bit rotating gate R y (θ 1,1 ), single bit revolving door R z (θ 1,5 ), single bit revolving door R y (θ 1,9 ) and single bit revolving door R z (θ 1,13 ). The second qubit can be configured with a single-bit rotating gate R y (θ 1,2 ), single bit revolving door R z (θ 1,6 ), single bit revolving door R y (θ 1,10 ) and single bit revolving door R z (θ 1,14 ). The third qubit can configure a single-bit rotating gate R y (θ 1,3 ), single bit revolving door R z (θ 1,7 ), single bit revolving door R y (θ 1,11 ) and single bit revolving door R z (θ 1,15 ). The fourth qubit can be configured with a single-bit rotating gate R y (θ 1,4 ), single bit revolving door R z (θ 1,8 ), single bit revolving door R y (θ 1,12 ) and single bit revolving door R z (θ 1,16). A controlled NOT gate (CNOT) can be configured between two single-bit rotation gates of any quantum bit. It can be understood that N can also be other integers, and the present disclosure is not limited to this.
[0055] In the disclosed embodiment, the quantum neural network of the coding model may include multiple quantum coding layers. The quantum coding layer may include a single-bit rotation gate for each of the multiple quantum bits. Figure 2 As shown, the quantum coding layer E21 may include a single-bit rotation gate R of the first quantum bit. y (θ 1,1 ), the single-bit rotating gate R of the second qubit y (θ 1,2 ), the single-bit rotating gate R of the third qubit y (θ 1,3 ), the fourth qubit single-bit rotating gate R y (θ 1,4 ). The quantum coding layer E22 may include a single-bit rotation gate R of the first quantum bit. y (θ 1,5 ), the single-bit rotating gate R of the second qubit y (θ 1,6 ), the single-bit rotating gate R of the third qubit y (θ 1,7 ), the fourth qubit single-bit rotating gate R y (θ 1,8 ). The quantum coding layer E23 may include a single-bit rotation gate R of the first quantum bit. y (θ 1,9 ), the single-bit rotating gate R of the second qubit y (θ 1,10 ), the single-bit rotating gate R of the third qubit y (θ 1,11 ), the fourth qubit single-bit rotating gate R y (θ 1,12 ). The quantum coding layer E24 may include a single-bit rotation gate R of the first quantum bit. y (θ 1,13 ), the single-bit rotating gate R of the second qubit y (θ 1,14 ), the single-bit rotating gate R of the third qubit y (θ 1,15 ), the fourth qubit single-bit rotating gate R y (θ 1,16 ).
[0056] It can be understood that, in addition to the first quantum coding layer E21, the controlled NOT gates of the quantum coding layer and the multiple quantum bits can implement various processing (such as convolution processing). For example, the quantum coding layer E22 can implement convolution processing in combination with multiple controlled NOT gates between the quantum coding layer E21 and the quantum coding layer E22.
[0057] In some embodiments, the quantum state sample data is input into the quantum neural network of the encoding model to obtain an output result. For example, the quantum state sample data can be a vector. Figure 2 As shown, the quantum state sample data |x> can be a 16×1 vector. Taking the quantum state sample data obtained based on the image sample data as an example, a 4×4 image can be stretched into a 16×1 initial vector, and encoded into a quantum state to obtain the quantum state sample data |x>. The quantum state sample data is input into the quantum neural network of the encoding model to obtain N output results.
[0058] In some embodiments, the output results are measured along multiple directions to obtain measurement features. Taking N=4 as an example, 4 output results are measured in 6 directions respectively to obtain 24 measurement results. Based on the 24 measurement results, 4 measurement features can be obtained.
[0059] In the disclosed embodiment, the measurement feature corresponds to the measurement results of multiple directions of the output result. Each measurement feature may include 6 measurement results. Figure 2 As shown, the measurement feature Mf21 may include 6 measurement results. The 6 directions may include the above-mentioned Pauli Z direction, Pauli X direction, Pauli Y direction, Pauli ZZ direction, Pauli XX direction, Pauli YY direction, etc. Through the embodiment of the present disclosure, multiple direction measurement results corresponding to the quantum sample data are obtained, and more comprehensive information can be obtained from the quantum state sample data, and the simple reconstruction of the quantum state sample data is avoided, which is conducive to the generation of the quantum state.
[0060] In some embodiments, the initial features are obtained based on the measured features. For example, the above four measured features can be input into the fully connected network NN21. The weight matrix corresponding to the fully connected network NN21 can be a 6×6 matrix. The fully connected network NN21 can map multiple measured features to multiple initial features respectively. Figure 2 As shown, the fully connected network NN21 can map the measured feature Mf21 to the initial feature f21.
[0061] It can be understood that the encoding model is described above, and the multiple embedded features to be adjusted and the first generation model are further described below.
[0062] Figure 3is a schematic diagram of a first generation model and a second generation model according to an embodiment of the present disclosure.
[0063] like Figure 3 As shown, by inputting the quantum state sample data |x> into the quantum neural network QNN31 of the encoding model E30, four measurement features including the measurement feature Mf31 can be obtained. By inputting multiple measurement features into the fully connected network NN31 of the encoding model E30, four initial features including the initial feature f31 can be obtained. It can be understood that the description of the encoding model E30 is the same or similar to the above-mentioned encoding model E20, and the present disclosure will not repeat them here. Figure 3 Some methods of determining target embedded features corresponding to initial features are described.
[0064] In some embodiments, determining the target embedded feature corresponding to the initial feature may include: determining the target embedded feature corresponding to the initial feature according to the distance between the initial feature and a plurality of embedded features to be adjusted.
[0065] In the disclosed embodiment, the distance may be various distances between different features. For example, the distance may be Euclidean distance, cosine distance, etc. For another example, the distance may be Euclidean distance. Through the disclosed embodiment, using Euclidean distance, the corresponding embedded features can be accurately determined from the embedding space, which helps to improve the training efficiency and also helps to achieve the rapid generation of quantum state data in the subsequent implementation.
[0066] In the disclosed embodiment, multiple distances between multiple embedded features to be adjusted and the initial features can be determined. The embedded feature to be adjusted with the smallest distance from the initial feature can be used as the target embedded feature. Figure 3 As shown, among the multiple embedded features to be adjusted in the embedding space ES30, the distance between the embedded feature em31 to be adjusted and the initial feature f31 is the smallest, and the embedded feature em31 to be adjusted can be used as the target embedded feature corresponding to the initial feature f31. When the initial features are 4, the embedded features to be adjusted can be 5 to 64. The embedding space ES60 can include 64 embedded features to be adjusted. Through the embodiment of the present disclosure, the continuous distribution of initial features is converted into discrete distribution of target embedded features, which helps to accurately generate quantum state data and also improves training efficiency.
[0067] like Figure 3 As shown, for the three initial features other than the initial feature f31, three target embedding features can be determined from the embedding space ES30. It can be understood that the method of determining the three target embedding features of the three initial features other than the initial feature f31 is the same or similar to the method of determining the target embedding features of the initial feature f31, and the present disclosure will not repeat them here.
[0068] It can be understood that some methods of determining target embedding features are described above, and the first generation model will be further described below.
[0069] like Figure 3 As shown, the first generation model G31 may include a quantum neural network QNN32 and a fully connected network NN32. The fully connected network NN32 will be described below.
[0070] In some embodiments, according to the target embedding feature, obtaining parameter data may include: inputting the target embedding feature into a fully connected network of the first generation model to obtain parameter data. For example, four embedding features to be adjusted including the embedding feature to be adjusted em31 may be input into the fully connected network NN32 to obtain 24 parameter data. The 24 parameter data may form four parameter vectors. Each parameter vector includes 6 parameter data.
[0071] It can be understood that the fully connected network of the first generation model is described above, and the quantum neural network of the first generation model will be described below.
[0072] In the embodiment of the present disclosure, the quantum neural network of the first generation model corresponds to at least one quantum bit. For example, the at least one quantum bit may be I, and I may be an integer greater than or equal to 1. Figure 3 As shown, the quantum neural network QNN32 may correspond to 4 qubits. The 4 qubits may include a fifth qubit, a sixth qubit, a seventh qubit, and an eighth qubit. It is understood that the number of qubits of the quantum neural network of the first generation model may be the same as or different from the number of qubits of the quantum neural network of the encoding model, and the present disclosure does not limit this.
[0073] In some embodiments, generating quantum state output data using a quantum neural network of a first generation model according to parameter data may include: adjusting the quantum neural network of the first generation model using the parameter data to obtain an adjusted quantum neural network.
[0074] In the disclosed embodiment, the target quantum decoding layer of the quantum neural network of the first generation model is adjusted using parameter data to obtain an adjusted quantum neural network. Through the disclosed embodiment, the parameters of the decoding layer after the quantum decoding layer to be trained are adjusted using parameter data, the information of the quantum state sample data can be fully utilized, the accuracy of the quantum neural network can be improved, and the style of the quantum state sample data can be more accurately and efficiently added to the quantum state output data so that the generation model can generate quantum state data similar to the style of the quantum state sample data.
[0075] In the embodiment of the present disclosure, the quantum neural network of the first generation model may include multiple quantum decoding layers. The multiple quantum decoding layers may include a quantum decoding layer to be trained. The quantum decoding layer may include a single-bit rotation gate of at least one quantum bit. For example, the multiple quantum decoding layers may include quantum decoding layers D31 to D311. Quantum decoding layer D32, quantum decoding layer D34, quantum decoding layer D36, quantum decoding layer D38, and quantum decoding layer D310 may respectively include a single-bit rotation gate R of the fifth quantum bit. y , the single-bit revolving gate R of the sixth qubit y , the single-bit revolving gate R of the seventh qubit y , the single-bit rotating gate R of the eighth qubit y The quantum decoding layer D32, the quantum decoding layer D34, the quantum decoding layer D36, the quantum decoding layer D38 and the quantum decoding layer D310 can be respectively used as quantum decoding layers to be trained.
[0076] In the embodiment of the present disclosure, the target quantum decoding layer may come from at least one quantum decoding layer after the quantum decoding layer to be trained. The input of the quantum decoding layer after the quantum decoding layer to be trained may be determined according to the output of the quantum decoding layer to be trained. Figure 3 As shown, quantum decoding layer D33 is the post-quantum decoding layer of quantum decoding layer D32, and can be used as the target quantum decoding layer. Quantum decoding layer D35 is the post-quantum decoding layer of quantum decoding layer D34, and can be used as the target quantum decoding layer. Quantum decoding layer D37 is the post-quantum decoding layer of quantum decoding layer D36, and can be used as the target quantum decoding layer. Quantum decoding layer D39 is the post-quantum decoding layer of quantum decoding layer D38, and can be used as the target quantum decoding layer. Quantum decoding layer D311 is the post-quantum decoding layer of quantum decoding layer D310, and can be used as the target quantum decoding layer.
[0077] In some embodiments, adjusting the target quantum decoding layer in the quantum neural network of the first generation model using the parameter data may include: adjusting the rotation angle of a single-bit rotation gate of a quantum bit in the target quantum decoding layer using the parameter data.
[0078] In some embodiments, according to the parameter data, a parameter feature can be obtained. The parameter feature can include 1 parameter data. For example, according to the above 24 parameter data, parameter features y31 to y36 can be obtained. Each parameter feature can include 4 parameter data.
[0079] In some embodiments, the parameter characteristics can be used to adjust the target quantum decoding layer to obtain an adjusted quantum neural network.
[0080] In the disclosed embodiment, the parameter feature may include a first parameter feature and a second parameter feature. For example, parameter feature y31 may be used as the first parameter feature. Parameter features y32 to y36 may be used as the second parameter features, respectively. The four parameter data in parameter feature y32 may be used to adjust the rotation angles of the single-bit rotation gates of the four qubits in the quantum decoding layer D33, respectively. Thus, the adjusted quantum decoding layer D33 may include the single-bit rotation gates R of the four qubits, respectively. y (y). The four parameter data in the parameter feature y33 can be used to adjust the rotation angle of the single-bit rotation gate of each of the four quantum bits in the quantum decoding layer D35. The four parameter data in the parameter feature y34 can be used to adjust the rotation angle of the single-bit rotation gate of each of the four quantum bits in the quantum decoding layer D37. The four parameter data in the parameter feature y35 can be used to adjust the rotation angle of the single-bit rotation gate of each of the four quantum bits in the quantum decoding layer D39. The four parameter data in the parameter feature y36 can be used to adjust the rotation angle of the single-bit rotation gate of each of the four quantum bits in the quantum decoding layer D311. Through the embodiment of the present disclosure, the target quantum decoding layer comes from the subsequent quantum decoding layer of the quantum decoding layer to be trained. Therefore, compared with adjusting the previous quantum decoding layer of the quantum decoding layer to be trained using parameter data, adjusting the target quantum decoding layer using parameter data can make full use of the effective information of the quantum state sample data, and can also fully improve the accuracy of the generation model, which is helpful to generate quantum state output data that is more similar to the style of the quantum state sample data. It is understood that in addition to using the parameter data as the rotation angle of the single-bit revolving door, the rotation angle can also be adjusted in other ways. For example, the parameter data and the current rotation angle of the corresponding single-bit revolving door can be used to perform various operations (such as addition, etc.) to adjust the rotation angle.
[0081] It can be understood that the second parameter feature is used to adjust the subsequent quantum decoding layer of the quantum decoding layer to be trained. However, the present disclosure is not limited thereto, and the previous quantum decoding layer of the quantum decoding layer to be trained may also be adjusted, which will be explained below.
[0082] In the embodiment of the present disclosure, the multiple quantum decoding layers also include a quantum decoding layer before the quantum decoding layer to be trained. There may be one or more quantum decoding layers before the quantum decoding layer to be trained. The input of the quantum decoding layer to be trained may be determined according to the previous quantum decoding layer of the quantum decoding layer to be trained. Figure 3 As shown, the quantum decoding layer D31 may be a previous quantum decoding layer of the quantum decoding layer D32.
[0083] In the embodiment of the present disclosure, adjusting the target quantum decoding layer using the parameter feature may also include: adjusting the quantum decoding layer before the quantum decoding layer to be trained using the first parameter feature. Figure 3As shown, the quantum decoding layer D31 can be the previous quantum decoding layer of the quantum decoding layer D32. The four parameter data in the parameter feature y31 can be used to adjust the rotation angles of the single-bit rotation gates of the four quantum bits in the quantum decoding layer D31. Thus, the adjusted quantum decoding layer D31 can include the single-bit rotation gates R of the four quantum bits. y (y).
[0084] Through the embodiments of the present disclosure, the target quantum decoding layer comes from the subsequent quantum decoding layer of the quantum decoding layer to be trained. When the target quantum decoding layer is adjusted using parameter data, the previous quantum decoding layer of the quantum decoding layer to be trained is also adjusted using parameter data. This can further utilize the effective information of the quantum state sample data, help reduce the training complexity, and further improve the accuracy of the generated model, which helps to quickly and efficiently generate quantum state output data that is more similar to the style of the quantum state sample data.
[0085] It can be understood that when the first parameter feature and the second parameter feature are used to adjust the previous and subsequent quantum decoding layers of the quantum decoding layer to be trained, different single-bit rotary gates of the same quantum bit overload different information from the quantum state sample data. For example, multiple single-bit rotary gates of each quantum bit are respectively loaded with different information from parameter features y31 to parameter features y36. Thus, the effective information of the quantum state sample data can be further utilized.
[0086] It can be understood that the above describes some methods of adjusting the target quantum decoding layer, and the following describes some methods of generating quantum state output data.
[0087] In some embodiments, using the adjusted quantum neural network to generate quantum state output data includes: inputting quantum state initial data into the adjusted quantum neural network to obtain quantum state output data.
[0088] In the disclosed embodiment, the quantum state initial data may be any quantum state data. For example, the quantum state initial data may be zero state |0>. The zero state |0> may be input into the adjusted quantum neural network QNN32 to obtain the quantum state output data Quantum state output data It may also be a vector of 16×1. Through the embodiments of the present disclosure, the resource overhead required for generating quantum state output data can be reduced.
[0089] It can be understood that the above describes some methods for generating quantum state output data, and the following describes some methods for training the first generation model.
[0090] In some embodiments, adjusting the parameters of the first generation model and multiple embedded features to be adjusted according to the quantum state sample data and the quantum state output data includes: according to the quantum state sample data and the quantum state output data, the parameters of the first generation model, the parameters of the encoding model and multiple embedded features to be adjusted can be adjusted.
[0091] In an embodiment of the present disclosure, training a generation model and a coding model based on quantum state sample data and quantum state output data includes: based on the quantum state sample data and quantum state output data, the loss can be determined.
[0092] In the disclosed embodiment, determining the loss according to the quantum state sample data and the quantum state output data may include: determining the reconstruction loss according to the quantum state sample data and the quantum state output data. For example, the reconstruction loss may be determined according to the fidelity between the quantum state sample data and the quantum state output data. The reconstruction loss recons_loss may be determined by the following formula:
[0093]
[0094] Can represent quantum state sample data |x> and quantum state output data Through the embodiments of the present disclosure, the information of the sample data can be fully utilized, which helps to efficiently train the generation model and improve the training efficiency of the generation model.
[0095] In the disclosed embodiment, determining the loss based on the quantum state sample data and the quantum state output data may further include: determining a similarity sub-loss based on the target embedded features and the initial features.
[0096] In the disclosed embodiment, the distance between the initial feature and the target embedded feature corresponding to the initial feature may be determined. In the case where there is at least one initial feature and at least one target embedded feature, at least one distance may be determined. For example, the distance may be a Euclidean distance. Four Euclidean distances between four target embedded features and four initial features may be determined.
[0097] In the embodiment of the present disclosure, a similarity sub-loss may be determined based on the distance. A similarity sub-loss may be determined based on the at least one distance mentioned above. For example, a similarity sub-loss may be determined based on the sum of four Euclidean distances. A similarity sub-loss may be determined by the following formula:
[0098]
[0099] f i It can be the above initial feature, such as the above initial feature f31. iIt can be the above-mentioned target embedding feature corresponding to the initial feature, for example, the embedding feature to be adjusted em31 corresponding to the initial feature f31. β can be a hyperparameter. Through the embodiment of the present disclosure, constraints on the embedding feature to be adjusted can be added, which helps to efficiently adjust the embedding feature to improve the training efficiency of the generated model.
[0100] In the embodiment of the present disclosure, determining the loss according to the quantum state sample data and the quantum state output data may further include: determining the loss according to at least one of a reconstruction sub-loss and a similarity sub-loss.
[0101] For example, the loss can be determined by the following formula:
[0102] loss=recons_loss+sim_loss (Formula 3)
[0103] In the disclosed embodiment, the parameters of the generation model and the encoding model can be adjusted according to the loss. For example, the parameters of each quantum encoding layer in the quantum neural network QNN31 (rotation angle θ 1,1 To rotation angle θ 1,16 ), you can also adjust the parameters of the fully connected network NN31 and the fully connected network NN32, you can also adjust the parameters of the quantum coding layer to be trained in the quantum neural network QNN32 (multiple single-bit revolving gates R y of rotation angle).
[0104] It can be understood that some methods of training the first generation model and the encoding model are described above. Next, the generation model and the encoding model can be trained multiple times using different quantum state sample data in the quantum state sample data set until the preset termination condition is met. The preset termination condition may include the above-mentioned loss convergence or the number of training times being greater than or equal to the preset training times threshold. Different quantum state sample data in the quantum state sample data set may have the same or similar style. Some methods of training the second generation model will be described below.
[0105] In some embodiments, the above method may further include: inputting the initial sample features into the second generation model to obtain the initial generation features. The second generation model is trained according to the initial sample features and the initial generation features. It is understood that the second generation model may be trained during the training of the first generation model; or the second generation model may be trained after the training of the first generation model is completed, and the present disclosure does not limit this.
[0106] In the disclosed embodiment, the initial sample feature is obtained based on the quantum state sample feature. The initial sample feature may be one or more. The initial generation feature may also be one or more. For example, if the second generation model is trained in the process of training the first generation model, the above-mentioned multiple initial features including the initial feature f31 may be used as multiple initial sample features. The above-mentioned multiple initial features including the initial feature f31 are input into the second generation model G32, and multiple initial generation features including the initial generation feature f31' can be obtained. According to the multiple differences between the multiple initial sample features and the multiple initial generation features, the second generation model G32 can be trained.
[0107] For another example, if the second generation model is trained after the training of the first generation model is completed, the quantum state sample data |x> can be input into the quantum neural network QNN31 of the trained encoding model E30 to obtain 4 output results. The 4 output results are measured in 6 directions to obtain 24 measurement results. Four measurement features can be obtained based on the 24 measurement results. The 4 measurement features are input into the fully connected network NN31 of the trained encoding model E30 to obtain 4 initial features as 4 initial sample features. These 4 initial sample features can be input into the second generation model to obtain another 4 initial generation features. Based on the difference between the 4 initial sample features and the 4 initial generation features, the second generation model G32 can be trained.
[0108] It can be understood that the second generation model may include a diffusion unit and a generation unit. The diffusion unit input is the initial sample feature. The diffusion unit is used to gradually add noise to the initial sample feature, and multiple noisy initial sample features are input to the generation unit. The generation unit performs a quasi-expansion. The parameters of the generation unit can be gradually adjusted until the generation unit can output the initial generation feature that is closest to the original unnoised initial sample feature. Through the embodiment of the present disclosure, the data distribution characteristics of the initial sample feature (greater than or equal to -1 and less than or equal to 1) can be fully utilized, and can be input into the diffusion model without normalization. The diffusion model can also make full use of the implicit information of the measurement results to accurately and efficiently generate sample generation results.
[0109] It is understandable that the above Figure 3 The method of training the coding model, the first generation model, the second generation model, and the multiple embedded features to be adjusted is described. When adjusting the multiple embedded features to be adjusted, the loss determined by the above formula three can be used to directly adjust them. However, the present disclosure is not limited to this, and another method of adjusting the multiple embedded features to be adjusted and the coding model will be described below in conjunction with relevant embodiments.
[0110] In some other embodiments, determining the loss according to at least one of the reconstruction sub-loss and the similarity sub-loss may include: determining a first processed sub-loss according to the first processing parameter and the similarity sub-loss. Determining the first loss according to the first processed sub-loss and the reconstruction sub-loss. For example, the first processing parameter may be multiplied by the similarity sub-loss to obtain the first processed sub-loss.
[0111] In some other embodiments, adjusting the parameters of the first generation model, the parameters of the encoding model, and the plurality of embedded features to be adjusted may include: adjusting the target embedded features using the first loss. For example, when the target embedded features are adjusted using the first loss, the parameters of the encoding model may not be adjusted using the first loss. In addition, the parameters of the first generation model may also be adjusted using the first loss.
[0112] Next, in some other embodiments, determining the loss according to at least one of the reconstruction sub-loss and the similarity sub-loss may further include: determining a second processed sub-loss according to a second processing parameter and the similarity sub-loss. Determining the second loss according to the second processed sub-loss and the reconstruction sub-loss. The second processing parameter is less than the first processing parameter. For example, the second processing parameter may be multiplied by the similarity sub-loss to obtain the second processed sub-loss.
[0113] In some other embodiments, adjusting the parameters of the first generation model, the parameters of the encoding model, and the plurality of embedded features to be adjusted may include: adjusting the parameters of the encoding model using the second loss to adjust the initial features. For example, when the encoding model is adjusted using the second loss, the parameters of the target embedded features may not be adjusted using the second loss. In addition, the parameters of the second generation model may also be adjusted using the second loss.
[0114] For another example, when the first loss and the second loss are used to adjust the embedding features and the encoding model respectively, the loss loss' used in the training process can be expressed as the following formula:
[0115]
[0116] sg() is a gradient fixing function, which is used to indicate that the corresponding feature is fixed. For example, sg(f i ) represents a fixed initial feature. sg(em i ) represents a fixed embedded feature to be adjusted. λ may be a first processing parameter, and γ may be a second processing parameter. γ may be, for example, Understandably, That is the first loss mentioned above. That is, the second loss mentioned above. Through the disclosed embodiment, the first processing parameter is greater than the second processing parameter, that is, the adjustment force of the embedded feature is greater than the adjustment force of the initial feature output by the encoding model. As a result, the embedded feature can be continuously close to the initial feature, and the initial feature can be continuously close to the embedded feature, realizing two-way adjustment, which helps to accelerate the convergence of the model and also helps to make the embedded feature closer to the initial feature, thereby making the embedded feature more able to reflect the style of the quantum state sample data.
[0117] It can be understood that the above description uses the example that the quantum state sample data is obtained based on the image sample data to illustrate the present disclosure. However, the present disclosure is not limited thereto. The quantum state sample data can be obtained based on the second training sample data, and the second training sample data comes from the second training sample set. The second training sample data includes at least one of the image sample data, the text sample data, and the audio sample data.
[0118] For example, when the training sample data includes text sample data, multiple characters of the text sample data may be converted into tokens to obtain multiple tokens, and the multiple tokens may be encoded into quantum states to obtain quantum state sample data.
[0119] For another example, when the training sample data includes audio sample data, multiple phonemes of the audio sample data may be encoded into quantum states to obtain quantum state sample data.
[0120] It can be understood that the above is an example of quantum state sample data obtained based on image, text and audio sample data to illustrate the present disclosure. In some embodiments, the quantum state sample data may include Hamiltonian ground state sample data, and the Hamiltonian ground state sample data corresponds to the ground state of a chemical molecule. For example, the above-mentioned encoding model E30, the first generation model G31 and the second generation model G32 trained with Hamiltonian ground state sample data can also be used. After the training is completed, the Hamiltonian ground state output data can be generated using the first generation model G31 and the second generation model G32. The chemical molecule can be, for example, a hydrogen molecule (H2).
[0121] It can be understood that after the training of the first generation model and the second generation model is completed, the first generation model and the second generation model can be used to generate data, which will be explained below.
[0122] Figure 4 is a flowchart of a data generating method according to another embodiment of the present disclosure.
[0123] like Figure 4 As shown, the method 400 may include operations S410 to S450.
[0124] In operation S410, target features are obtained according to input data to be processed.
[0125] In the embodiment of the present disclosure, the input data to be processed may come from a standard normal distribution. The input data to be processed may be one or more.
[0126] In the embodiments of the present disclosure, various methods can be used to convert the input data to be processed into target features. The target features can be one or more.
[0127] In operation S420, a target embedding feature corresponding to the target feature is determined from among the plurality of adjusted embedding features.
[0128] In the embodiment of the present disclosure, the plurality of adjusted embedded features can be obtained by adjusting the plurality of embedded features to be adjusted using the method 100 described above.
[0129] In operation S430, parameter data is obtained according to the target embedding feature.
[0130] In the embodiment of the present disclosure, the parameter data may be one or more. For example, the target embedding feature may be converted into the parameter data based on a preset mapping relationship. For another example, the target embedding feature may be fully connected to obtain the parameter data.
[0131] In operation S440, quantum state output data is generated using a quantum neural network of a first generation model according to the parameter data.
[0132] In the disclosed embodiment, the target quantum decoding layer of the quantum neural network of the first generation model can be adjusted using parameter data to obtain an adjusted quantum neural network. The target quantum decoding layer can be a quantum decoding layer after the trained quantum decoding layer. For example, after the training of the above-mentioned quantum decoding layer D32 is completed, the quantum decoding layer D32 can be used as a trained quantum decoding layer.
[0133] In the embodiment of the present disclosure, the first generation model and the second generation model may be trained according to the above method 100.
[0134] In operation S450, target data is determined according to the quantum output data.
[0135] In the disclosed embodiment, the target data includes at least one of target image data, target text data and target audio data. For example, the quantum state output data can be converted into target data. The target data can be, for example, target image data.
[0136] In the embodiment of the present disclosure, obtaining the target feature according to the input data to be processed includes: inputting the input data to be processed into the second generation model to obtain the target feature. The second generation model can be trained according to the above method 100, for example. Figure 5 Further explanation of the data generation method
[0137] Figure 5 is a schematic diagram of a data generation method according to an embodiment of the present disclosure.
[0138] like Figure 5 As shown, the first generation model G51 and the second generation model G52 can be used to generate data. It can be understood that the description of the first generation model G51 and the second generation model G52 is the same or similar to the first generation model G31 and the second generation model G32 mentioned above, and the present disclosure will not repeat them here.
[0139] In some embodiments, the target feature can be obtained based on the input data to be processed. For example, the input data set z50 to be processed can be randomly obtained from the standard normal distribution. The input data set z50 to be processed can include multiple input data to be processed. The multiple input data to be processed of the input data set z50 to be processed are input into the second generation model G52, and 4 target features including the target feature ft51' can be obtained. Each target feature can include 6 feature values.
[0140] In some embodiments, a target embedding feature corresponding to the target feature can be determined from a plurality of adjusted embedding features. For example, four target embedding features corresponding to four target features including the target feature ft51' can be determined from a plurality of adjusted embedding features of the adjusted embedding space ES50'. For example, the Euclidean distance between the target feature ft51' and the adjusted embedding feature em51' is the smallest. Thus, the adjusted embedding feature em51' can be used as the target embedding feature corresponding to the target feature ft51'.
[0141] In some embodiments, parameter data may be obtained based on the target embedding features. For example, multiple target embedding features including the adjusted embedding features em51' may be input into the fully connected network NN52 of the first generative model G51 to obtain 24 parameter data.
[0142] In the embodiment of the present disclosure, a parameter feature can be obtained according to the parameter data. The parameter feature can be at least one. The parameter feature can include a first parameter feature and a second parameter feature. For example, the parameter feature can include parameter features y31 to y36. The parameter feature y31 can be used as the first parameter feature. The parameter features y31 to y36 can be used as five second parameter features.
[0143] In some embodiments, according to the parameters, the quantum neural network of the first generation model is used to generate quantum state output data. For example, the quantum neural network QNN51 may include quantum decoding layers D51 to D511. The quantum decoding layer D51 may be adjusted using parameter feature y51. Multiple target quantum decoding layers may also be adjusted using parameter feature y52, parameter feature y53, parameter feature y54, parameter feature y55, and parameter feature y56. Multiple target quantum decoding layers may include quantum decoding layer D53, quantum decoding layer D55, quantum decoding layer D57, quantum decoding layer D59, and quantum decoding layer D511. Thus, the adjusted quantum neural network QNN52 may be obtained. The adjusted quantum neural network QNN52 may also include multiple trained quantum decoding layers. Multiple trained quantum decoding layers may include quantum decoding layer D52, quantum decoding layer D54, quantum decoding layer D56, quantum decoding layer D58, and quantum decoding layer D510. It can be understood that the method of adjusting the quantum decoding layer D51 using the parameter feature y51 is the same or similar to the method of adjusting the quantum decoding layer D31 using the above-mentioned parameter feature y31, and the present disclosure will not repeat it here. The method of adjusting multiple target quantum decoding layers using parameter features y52 to y56 is the same or similar to the method of adjusting multiple target quantum decoding layers using the above-mentioned parameter features y32 to y36, and the present disclosure will not repeat it here.
[0144] Next, the initial quantum state data can be input into the adjusted quantum neural network to obtain the quantum state output data. For example, the zero state |0> can be input into the adjusted quantum neural network QNN52 to obtain the quantum state output data Can output data based on quantum state Get the target data.
[0145] Figure 6 is a block diagram of a training device for generating a model according to an embodiment of the present disclosure.
[0146] like Figure 6 As shown, the apparatus 600 may include a first obtaining module 610 , a measuring module 620 , a second obtaining module 630 , a first determining module 640 , a third obtaining module 650 , a first generating module 660 and an adjusting module 670 .
[0147] The first obtaining module 610 is used to input the quantum state sample data into the quantum neural network of the encoding model to obtain an output result.
[0148] The measurement module 620 is used to measure the output results along multiple directions to obtain measurement features. The measurement features correspond to the measurement results of multiple directions of any output result.
[0149] The second obtaining module 630 is used to obtain initial features according to the measured features.
[0150] The first determination module 640 is used to determine a target embedding feature corresponding to the initial feature from a plurality of embedding features to be adjusted.
[0151] The third acquisition module 650 is used to obtain parameter data according to the target embedding feature.
[0152] The first generating module 660 is used to generate quantum state output data using a quantum neural network of a first generating model according to parameter data.
[0153] The adjustment module 670 is used to adjust the parameters of the first generation model and multiple embedded features to be adjusted according to the quantum state sample data and the quantum state output data.
[0154] In some embodiments, the second acquisition module includes: a first acquisition submodule, used to input the measured features into a fully connected network of the encoding model to obtain initial features.
[0155] In some embodiments, the first determination module includes: a first determination submodule, configured to determine a target embedded feature corresponding to the initial feature based on a distance between the initial feature and a plurality of embedded features to be adjusted.
[0156] In some embodiments, the third acquisition module includes: a second acquisition sub-module, used to input the target embedding feature into the fully connected network of the first generation model to obtain parameter data.
[0157] In some embodiments, the first generation module includes: a first adjustment submodule, which is used to adjust the quantum neural network of the first generation model using parameter data to obtain an adjusted quantum neural network. A first generation submodule, which is used to generate quantum state output data using the adjusted quantum neural network.
[0158] In some embodiments, the first adjustment submodule includes: a first adjustment unit, configured to adjust a target quantum decoding layer of a quantum neural network of a first generation model using parameter data to obtain an adjusted quantum neural network. The quantum neural network of the first generation model includes a plurality of quantum decoding layers, the plurality of quantum decoding layers include a quantum decoding layer to be trained, and the target quantum decoding layer comes from a quantum decoding layer after the quantum decoding layer to be trained.
[0159] In some embodiments, the quantum neural network of the first generation model corresponds to at least one quantum bit, and the quantum decoding layer includes a single-bit rotation gate of at least one quantum bit. The first adjustment unit includes: a first adjustment subunit, which is used to adjust the rotation angle of the single-bit rotation gate of the quantum bit in the target quantum decoding layer using parameter data.
[0160] In some embodiments, the quantum neural network of the first generation model corresponds to I quantum bits, where I is an integer greater than or equal to 1. The first adjustment submodule includes: a first acquisition unit, configured to obtain parameter features according to parameter data. The parameter features include I parameter data. A second adjustment unit, configured to adjust the target quantum decoding layer using the parameter features.
[0161] In some embodiments, the parameter feature includes a first parameter feature and a second parameter feature. The second adjustment unit includes: a second adjustment subunit, used to adjust the quantum decoding layer before the quantum decoding layer to be trained using the first parameter feature. A third adjustment subunit, used to adjust the target quantum decoding layer using the second parameter feature.
[0162] In some embodiments, the first generating submodule includes: a second obtaining unit, used to input the quantum state initial data into the adjusted quantum neural network to obtain quantum state output data.
[0163] In some embodiments, the method further comprises: a fourth acquisition module, which is used to input the initial sample features into the second generation model to obtain the initial generation features. The initial sample features are obtained based on the quantum state sample features. A training module is used to train the second generation model based on the initial sample features and the initial generation features.
[0164] In some embodiments, the adjustment module includes: a second adjustment submodule, which is used to adjust the parameters of the first generation model, the parameters of the encoding model, and multiple embedded features to be adjusted according to the quantum state sample data and the quantum state output data.
[0165] In some embodiments, the adjustment module includes: a second determination submodule, configured to determine the loss according to the quantum state sample data and the quantum state output data; and a third adjustment submodule, configured to adjust the parameters of the first generation model and the plurality of embedded features to be adjusted according to the loss.
[0166] In some embodiments, the second determination submodule includes: a first determination unit, configured to determine a reconstruction sub-loss according to the quantum state sample data and the quantum state output data; a second determination unit, configured to determine a similarity sub-loss according to the target embedding feature and the initial feature; and a third determination unit, configured to determine a loss according to at least one of the reconstruction sub-loss and the similarity sub-loss.
[0167] In some embodiments, the second determining unit includes: a first determining subunit, configured to determine a distance between an initial feature and a target embedded feature corresponding to the initial feature; and a second determining subunit, configured to determine a similarity sub-loss according to the distance.
[0168] In some embodiments, the third determination unit includes: a third determination subunit, configured to determine the first processed sub-loss according to the first processing parameter and the similarity sub-loss. A fourth determination subunit, configured to determine the second processed sub-loss according to the second processing parameter and the similarity sub-loss. The second processing parameter is less than the first processing parameter. A fifth determination subunit, configured to determine the first loss according to the first processed sub-loss and the reconstruction sub-loss. A sixth determination subunit, configured to determine the second loss according to the second processed sub-loss and the reconstruction sub-loss.
[0169] In some embodiments, the third adjustment submodule includes at least one of the following: a third adjustment subunit, configured to adjust the parameters of the first generation model and the target embedding features according to the first loss. A fourth adjustment subunit, configured to adjust the parameters of the first generation model and the parameters of the encoding model according to the second loss.
[0170] In some embodiments, the quantum state sample data is obtained based on training sample data, and the training sample data includes at least one of image sample data, text sample data, and audio sample data.
[0171] Figure 7 is a block diagram of a data generating device according to another embodiment of the present disclosure.
[0172] like Figure 7 As shown, the apparatus 700 may include a fifth obtaining module 710 , a second determining module 720 , a sixth obtaining module 730 , a second generating module 740 and a second determining module 750 .
[0173] The fifth obtaining module 710 is used to obtain target features according to the input data to be processed.
[0174] The second determination module 720 is configured to determine a target embedding feature corresponding to the target feature from among the plurality of adjusted embedding features.
[0175] The sixth obtaining module 730 is used to obtain parameter data according to the target embedding features.
[0176] The second generation module 740 is used to generate quantum state output data using the quantum neural network of the first generation model according to the parameter data.
[0177] The second determination module 750 is used to determine the target data according to the quantum output data. The first generation model is trained by the above-mentioned device 600.
[0178] In some embodiments, the fifth acquisition module is further used to: input the input data to be processed into the second generation model to obtain the target features.
[0179] In some embodiments, the target data includes at least one of target image data, target text data, and target audio data.
[0180] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0181] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0182] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0183] like Figure 8 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0184] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0185] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the training method and / or data generation method for generating a model. For example, in some embodiments, the training method and / or data generation method for generating a model may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the training method and / or data generation method for generating a model described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute a training method and / or a data generation method for generating a model in any other suitable manner (eg, by means of firmware).
[0186] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0187] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0188] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0189] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) display or an LCD (liquid crystal display)) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0190] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0191] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0192] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0193] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A training method for generating a model, comprising: Input the quantum state sample data into the quantum neural network of the encoding model to obtain the output result; Measuring the output result along multiple directions to obtain measurement features, wherein the measurement features correspond to the measurement results of the output result in multiple directions; According to the measured features, initial features are obtained; Determining a target embedding feature corresponding to the initial feature from a plurality of embedding features to be adjusted; Obtain parameter data according to the target embedding feature; Using the parameter data to adjust the quantum neural network of the first generation model to obtain an adjusted quantum neural network; Using the adjusted quantum neural network, generating quantum state output data; According to the quantum state sample data and the quantum state output data, the parameters of the first generation model and the plurality of embedded features to be adjusted are adjusted.
2. The method according to claim 1, wherein: The obtaining the initial feature according to the measured feature comprises: The measured features are input into a fully connected network of an encoding model to obtain the initial features.
3. The method according to claim 1, wherein: The determining of the target embedding feature corresponding to the initial feature comprises: According to the distances between the initial feature and a plurality of the embedded features to be adjusted, the target embedded feature corresponding to the initial feature is determined.
4. The method according to claim 1, wherein: The obtaining of parameter data according to the target embedding feature comprises: The target embedding feature is input into a fully connected network of the first generation model to obtain the parameter data.
5. The method according to claim 1, wherein: The step of adjusting the quantum neural network of the first generation model by using the parameter data to obtain an adjusted quantum neural network comprises: The target quantum decoding layer of the quantum neural network of the first generation model is adjusted using the parameter data to obtain the adjusted quantum neural network, wherein the quantum neural network of the first generation model includes multiple quantum decoding layers, the multiple quantum decoding layers include a quantum decoding layer to be trained, and the target quantum decoding layer is a quantum decoding layer after the quantum decoding layer to be trained.
6. The method according to claim 5, wherein: The quantum neural network of the first generation model corresponds to at least one quantum bit, and the quantum decoding layer includes at least one single-bit rotation gate of the quantum bit. The target quantum decoding layer of the quantum neural network of the first generation model adjusted by the parameter data includes: The parameter data is used to adjust the rotation angle of the single-bit rotation gate of the quantum bit in the target quantum decoding layer.
7. The method according to claim 5, wherein: The quantum neural network of the first generation model corresponds to I quantum bits, where I is an integer greater than or equal to 1. The target quantum decoding layer of the quantum neural network of the first generation model adjusted by the parameter data includes: Obtaining a parameter feature according to at least one of the parameter data, wherein the parameter feature includes I parameter data; The target quantum decoding layer is adjusted using the parameter characteristics.
8. The method according to claim 7, wherein: The parameter characteristics include a first parameter characteristic and a second parameter characteristic; The adjusting the target quantum decoding layer by using the parameter characteristics comprises: Using the first parameter feature, adjusting the quantum decoding layer before the quantum decoding layer to be trained; The target quantum decoding layer is adjusted using the second parameter characteristic.
9. The method according to claim 1, wherein: The step of generating quantum state output data by using the adjusted quantum neural network comprises: The quantum state initial data is input into the adjusted quantum neural network to obtain the quantum state output data.
10. The method according to claim 1, further comprising: Inputting the initial sample feature into the second generation model to obtain the initial generation feature, wherein the initial sample feature is obtained according to the quantum state sample feature; The second generation model is trained according to the initial sample features and the initial generation features.
11. The method according to claim 1, wherein: The adjusting the parameters of the first generation model and the plurality of embedded features to be adjusted according to the quantum state sample data and the quantum state output data comprises: According to the quantum state sample data and the quantum state output data, the parameters of the first generation model, the parameters of the encoding model and the plurality of embedded features to be adjusted are adjusted.
12. The method according to claim 1, wherein: The adjusting the parameters of the first generation model and the plurality of embedded features to be adjusted according to the quantum state sample data and the quantum state output data comprises: Determining a loss based on the quantum state sample data and the quantum state output data; According to the loss, the parameters of the first generation model and the plurality of embedded features to be adjusted are adjusted.
13. The method according to claim 12, wherein: The determining of the loss according to the quantum state sample data and the quantum state output data comprises: Determine a reconstruction sub-loss according to the quantum state sample data and the quantum state output data; Determining a similarity sub-loss according to the target embedding feature and the initial feature; The loss is determined according to at least one of the reconstruction sub-loss and the similarity sub-loss.
14. The method according to claim 13, wherein: The determining of the similarity sub-loss according to the target embedding feature and the initial feature comprises: Determining a distance between the initial feature and the target embedded feature corresponding to the initial feature; The similarity sub-loss is determined according to the distance.
15. The method according to claim 14, wherein: The determining the loss according to at least one of the reconstruction sub-loss and the similarity sub-loss comprises: Determining a first processed sub-loss according to the first processing parameter and the similar sub-loss; determining a second processed sub-loss according to a second processing parameter and the similar sub-loss, wherein the second processing parameter is less than the first processing parameter; Determine a first loss according to the first processed sub-loss and the reconstructed sub-loss; A second loss is determined according to the second processed sub-loss and the reconstruction sub-loss.
16. The method according to claim 15, wherein: The adjusting the parameters of the first generation model and the plurality of embedding features to be adjusted according to the loss comprises at least one of the following: According to the first loss, adjusting parameters of the first generative model and the target embedding features; According to the second loss, parameters of the first generation model and parameters of the encoding model are adjusted.
17. The method according to claim 1, wherein: The quantum state sample data is obtained based on training sample data, and the training sample data includes at least one of image sample data, text sample data and audio sample data.
18. A data generation method, comprising: Obtain target features according to the input data to be processed; Determining a target embedding feature corresponding to the target feature from the plurality of adjusted embedding features; Obtain parameter data according to the target embedding feature; Generate quantum state output data using a quantum neural network of a first generation model according to the parameter data; According to the quantum state output data, target data is determined, Wherein, the first generation model is trained using the method described in any one of claims 1 to 17.
19. The method according to claim 18, wherein: The step of obtaining target features according to the input data to be processed includes: The input data to be processed is input into the second generation model to obtain the target feature.
20. The method according to claim 18, wherein: The target data includes at least one of target image data, target text data and target audio data.
21. A training device for generating a model, comprising: The first acquisition module is used to input the quantum state sample data into the quantum neural network of the encoding model to obtain the output result; A measurement module, configured to measure the output result in multiple directions to obtain a measurement feature, wherein the measurement feature corresponds to the measurement results of multiple directions of any of the output results; A second acquisition module, used to obtain initial features according to the measured features; A first determination module is used to determine a target embedding feature corresponding to the initial feature from a plurality of embedding features to be adjusted; A third acquisition module is used to obtain parameter data according to the target embedding feature; A first adjustment submodule, configured to adjust the quantum neural network of the first generation model using the parameter data to obtain an adjusted quantum neural network; A first generating submodule, used to generate quantum state output data using the adjusted quantum neural network; An adjustment module is used to adjust the parameters of the first generation model and the multiple embedded features to be adjusted according to the quantum state sample data and the quantum state output data.
22. A data generating device, comprising: A fifth acquisition module, used for obtaining target features according to the input data to be processed; A second determination module is used to determine a target embedding feature corresponding to the target feature from the plurality of adjusted embedding features; A sixth acquisition module, used to obtain parameter data according to the target embedding feature; A second generation module is used to generate quantum state output data using the quantum neural network of the first generation model according to the parameter data; The second determination module is used to determine the target data according to the quantum state output data. Wherein, the first generation model is trained using the device as described in claim 21.
23. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 20.
24. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 20.
25. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 20.
Citation Information
Patent Citations
Quantum state data processing model training method and device, electronic equipment and medium
CN113361717A
Quantum image generation model training method, image generation method and related device
CN115170906A