Quantum Residual Attention Neural Network and Its Applications, Material Design Method
By applying quantum residual attention neural network in materials science, using the parallelism and noise characteristics of quantum computing, the existing algorithms are solved in the problem of overfitting and slow training under small samples, achieving high accuracy and fast training effects.
Patent Information
- Application Number
- CN202411772610.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2044-12-04
AI Technical Summary
Existing machine learning algorithms are prone to overfitting in materials science due to scarce data and small training samples, resulting in low prediction accuracy and long training cycles.
A quantum residual attention neural network is proposed, and the generalization and training speed of the model is improved through the parallelism and noise characteristics of quantum computing using technologies such as quantum logic gates and quantum residual attention layers.
Under the condition of a small number of training samples, the quantum residual attention neural network can maintain a high accuracy rate and significantly shorten the training time, improving the efficiency of material performance prediction.
Smart Images

Figure CN119601151B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of quantum computing, and relates to a novel quantum residual attention neural network and its application, and also relates to a material design method based on the quantum residual attention neural network. Background Art
[0002] In the traditional new material development process, the trial-and-error method is adopted, and the experimental steps are cumbersome. The limitations of long cycle and high cost make it difficult to accelerate the development of materials. As an alternative, the rise of machine learning technology has become a powerful tool for discovering new materials.
[0003] Machine learning is based on a material database and can quickly realize the prediction of materials, which is expected to accelerate the design of new materials and shorten the development cycle of materials. Since it can learn behaviors and trends from existing data without understanding the underlying physical mechanisms, it has begun to play an important role in materials science.
[0004] Currently, in the technology of predicting material properties using machine learning, neural networks are mainly used to extract data features, and then the prediction performance of the model is obtained through regression algorithms. However, since the composition-property data of materials itself needs to be obtained through experimental characterization, the amount of data is relatively scarce and precious. Therefore, under the condition of a small number of training samples, the current machine learning algorithm model is prone to overfitting, resulting in a low prediction accuracy of the model. In addition, for machine learning algorithms based on neural networks, the training cycle is often long and many iterations are required to converge. Summary of the Invention
[0005] The purpose of the present invention is to provide a quantum residual attention neural network aiming at the problems existing in the prior art, which has good generalization and can still maintain a high accuracy under the condition of a small number of training samples.
[0006] Another purpose of the present invention is to provide the application of the above-mentioned quantum residual attention neural network in material design.
[0007] The third purpose of the present invention is to provide a material design method based on the above-mentioned quantum residual attention neural network.
[0008] To achieve the above purposes, the present invention adopts the following technical solutions.
[0009] The present invention provides a quantum residual attention neural network, which includes:
[0010] A quantum embedding layer based on quantum logic gates, which is used to encode input data into an initial quantum state;
[0011] A variational quantum circuit is used to combine the action of an auxiliary quantum state on an initial quantum state to achieve the evolution of the quantum state and extract the characteristics of the quantum state; the variational quantum circuit includes a main quantum circuit where the initial quantum state is located and an auxiliary quantum circuit where the auxiliary quantum state is located; a number of quantum residual attention layers are arranged on the variational quantum circuit, and a quantum pooling layer is located between two adjacent quantum residual attention layers; each quantum residual attention layer takes the initial quantum state and the auxiliary quantum state as inputs, or the output quantum state of the quantum pooling layer and the auxiliary quantum state acted on by the previous quantum residual attention layer as inputs; the quantum pooling layer takes the output quantum state on the main quantum circuit of the previous quantum residual attention layer as an input;
[0012] For the quantum residual attention layer, the input quantum state is alternately operated through the RX rotation gate and the RY rotation gate;
[0013] For the quantum pooling layer, any two input quantum states are alternately operated through the RZ rotation gate and the CX controlled-NOT gate;
[0014] A quantum measurement layer is used to perform measurement through the Pauli Z gate according to the quantum state characteristics output by the variational quantum circuit to obtain output data.
[0015] For the above-mentioned quantum residual attention neural network, the quantum embedding layer acts on φ or or the ground state through the quantum logic gate U
[0016] or
[0017]
[0018] to obtain the encoded input initial quantum state |φ(x)>, where n represents the number of quantum bits required to encode the input data; the specific representation is as follows: φ The quantum logic gate U
[0019] (x) includes at least one of the RX rotation gate, the RY rotation gate, the RZ rotation gate, etc.
[0020] For the above-mentioned quantum residual attention neural network, the variational quantum circuit is composed of a number of quantum bits corresponding to the input data and quantum bits corresponding to the auxiliary quantum state, and each quantum bit corresponds to a quantum circuit. L The final quantum state obtained through the variational quantum circuit is |α
[0021] (x)>, and the specific representation is as follows: L (x)> = U θ |φ(x)>|γ>;
[0022] where |γ> is an auxiliary quantum state, which is |0> or |1>;
[0023] U θ represents a variational quantum circuit with variational parameters θ:
[0024]
[0025] U αL represents the last layer of the quantum residual attention layer; U αi and U βi represent the i-th layer of the quantum residual attention layer and the i-th layer of the quantum pooling layer respectively, represents the ceiling operation, and n represents the number of input data.
[0026] In the above-mentioned quantum residual attention neural network, in the quantum residual attention layer, the matrix form of the RX rotation gate is:
[0027]
[0028] where θ represents the rotation angle around the X axis.
[0029] The matrix form of the RY rotation gate is:
[0030]
[0031] where θ represents the rotation angle around the Y axis.
[0032] For the input quantum state on the main quantum circuit, the quantum residual attention layer includes one layer of RX rotation gate operation and several layers of RY rotation gate operations; before the RY rotation gate operation, a CX controlled-NOT gate is set, and the control bit and the target bit of the CX controlled-NOT gate are located on adjacent quantum circuits respectively; after the last layer of RY rotation gate operation, a CX controlled-NOT gate is also set, the control bit of the CX controlled-NOT gate is located on the quantum circuit where the auxiliary quantum state is located, and the target bit is located on the quantum circuit where the input quantum state is located;
[0033] For the auxiliary quantum state, the quantum residual attention layer includes one layer of H gate operation, several layers of CRY controlled rotation gate operations and H gate operations; the control bit of the CRY controlled rotation gate operation is the quantum state of the adjacent quantum circuit, and the target bit is the auxiliary quantum state.
[0034] Furthermore, for the input quantum state, the quantum residual attention layer also performs an H gate operation on the output of the last two quantum circuits.
[0035] For the CX controlled-NOT gate, if the control bit is in the |1> state, the X gate is executed on the target bit. If the control bit is in the |0> state, no operation is performed on the target bit. The X gate operator acting on the basis state can flip the basis state. It can change the basis state |0> to |1> and the basis state |1> to |0>. The matrix form of the CX controlled-NOT gate is as follows:
[0036]
[0037] For the H gate, i.e., the Hadamard gate, the matrix form is as follows: It can change the basis state |0> to (|0> + |1>).
[0038] For the CRY controlled rotation gate, if the control bit is in the |1> state, the RY rotation gate operation is executed on the target bit. If the control bit is in the |0> state, no operation is performed on the target bit.
[0039] In the above quantum residual attention neural network, in the quantum pooling layer, for the quantum state on the first quantum circuit among any two quantum circuits, the RZ(-π / 2) rotation gate is first applied, and the operation result is used as the control bit of the CX controlled-NOT gate to perform the X gate operation on the quantum state on the second quantum circuit; then, the RZ rotation gate operations are respectively performed on the quantum states of the first quantum circuit and the second quantum circuit. The result of the RZ rotation gate operation on the quantum state of the second quantum circuit is used as the control bit of the CX controlled-NOT gate to perform the X gate operation on the quantum state of the first quantum circuit; then, the RY rotation gate operation is performed on the quantum state of the first quantum circuit again.
[0040] The matrix form of the RZ rotation gate is as follows:
[0041]
[0042] where θ represents the rotation angle around the Z axis.
[0043] In the above quantum residual attention neural network, the output data obtained by the quantum measurement layer is represented as follows:
[0044]
[0045] where h l represents the output data of the quantum measurement layer, |α L (x)> represents the final quantum state, represents the Pauli-Z gate.
[0046] The matrix form of the Pauli-Z gate is as follows:
[0047]
[0048] The above-mentioned quantum residual attention neural network, wherein the variational quantum circuit outputs at least two quantum state features; the quantum measurement layer measures all the quantum state features through the Pauli Z gate to obtain more than two output data.
[0049] The above-mentioned quantum residual attention neural network further includes an output layer for processing more than two output data to obtain the final prediction data. The output layer uses a fully connected layer.
[0050] The loss function used in the above-mentioned quantum residual attention neural network is the mean square error loss function.
[0051] The present invention also provides an application of the above-mentioned quantum residual attention neural network in material design.
[0052] The present invention also provides a material design method, which includes the following steps:
[0053] S1 Obtain material composition data;
[0054] S2 Perform dimensionality reduction processing on the material composition data to obtain the dimensionality-reduced material composition feature data;
[0055] S3 Input the material composition feature data into the quantum residual attention neural network to obtain material property prediction data.
[0056] In the above step S2, principal component analysis is performed on the material composition data, and the constructed principal components are used as the dimensionality-reduced material composition feature data.
[0057] The above step S3 includes the following sub-steps:
[0058] S31 Encode the material composition feature data into an initial quantum state through a quantum embedding layer based on quantum logic gates;
[0059] S32 Perform quantum state evolution operations on the initial quantum state through a variational quantum circuit to extract quantum state features;
[0060] S33 Measure the extracted quantum state features through a quantum measurement layer to obtain material property output data.
[0061] The above step S3 further includes:
[0062] S34 Process the material property output data through a fully connected layer to obtain the final material property prediction data.
[0063] Compared with the prior art, the present invention has the following beneficial effects:
[0064] 1) Based on quantum algorithms, the present invention proposes a novel quantum residual attention neural network. By leveraging the quantum noise and quantum parallel computing characteristics inherent in quantum computers, the generalization ability of the neural network is enhanced, enabling it to achieve a high accuracy rate with a small number of training samples.
[0065] 2) The quantum residual attention neural network provided by the present invention is mainly implemented based on a variety of quantum gate operations. By adopting the characteristics of quantum computing parallelism, the convergence speed of algorithm training is increased, saving training time.
[0066] 3) The present invention also combines a classical fully connected layer. The result of quantum measurement is output to a single regression value through linear combination, and then the material property data is obtained through inverse normalization.
[0067] 4) The quantum residual attention neural network provided by the present invention can be applied to the field of material design.
[0068] 5) Applying the quantum residual attention neural network provided by the present invention to material design can effectively predict the properties of new materials. Description of the Drawings
[0069] Figure 1 It is a schematic diagram of the structure of the quantum residual attention neural network provided in Embodiment 1 of the present invention;
[0070] Figure 2 It is a schematic diagram of the process flow of the material design method provided in Embodiment 2 of the present invention;
[0071] Figure 3 It is a schematic diagram of the material property prediction process. Detailed Embodiments
[0072] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.
[0073] Embodiment 1
[0074] This embodiment provides a quantum residual attention neural network, as Figure 1 shown, which includes: a quantum embedding layer based on quantum logic gates, a variational quantum circuit, a quantum measurement layer, and an output layer.
[0075] (1) Quantum Embedding Layer
[0076] The quantum embedding layer based on quantum logic gates is used to encode the input data into an initial quantum state.
[0077] The quantum embedding layer acts on the φ ground state through the quantum logic gate U (x) to obtain the encoded initial quantum state |φ(x)> of the input. Here, n represents the number of qubits required to encode the input data. Specifically, it is expressed as follows:
[0078]
[0079] The quantum logic gate U φ (x) includes at least one of the RX rotation gate, RY rotation gate, RZ rotation gate, etc.
[0080] In this embodiment, using the angular encoding technique (see Stoudenmire, E., Schwab, D. J.: Supervised learning with tensor networks. Advances in neural information processing systems 29(2016)), n classical input data {x1, x2,..., x n} are encoded into a quantum state using n qubits, and the embedded rotation angles are restricted to the range [0, π).
[0081] For example, when there are 4 classical input data and they are all real numbers, n = 4. Using the angular encoding technique, the classical input data is encoded into the initial quantum state |φ(x)> through the quantum logic gate U φ (x) (here composed of 4 RY rotation gates), corresponding to 4 qubits.
[0082] (2) Variational quantum circuit
[0083] The variational quantum circuit is used to act on the initial quantum state in combination with the auxiliary quantum state to realize the evolution of the quantum state and extract the characteristics of the quantum state.
[0084] The variational quantum circuit is composed of several qubits corresponding to the initial quantum state (where n represents the corresponding number of qubits) and qubits corresponding to the auxiliary quantum state. The auxiliary qubits are used to generate quantum entanglement in the variational quantum circuit, thereby providing an attention mechanism; the initial quantum state corresponding to the auxiliary qubits is |0>. Each qubit corresponds to a quantum circuit. Therefore, the variational quantum circuit includes the main quantum circuit where the initial quantum state is located (constituting the main network) and the auxiliary quantum circuit where the auxiliary quantum state is located.
[0085] A variational quantum circuit is provided with a number of quantum residual attention layers, and quantum pooling layers located between two adjacent quantum residual attention layers. In this embodiment, the variational quantum circuit is provided with two quantum residual attention layers (i.e., the first quantum residual attention layer and the second quantum residual attention layer), and a quantum pooling layer located between the two quantum residual attention layers. The first quantum residual attention layer takes an initial quantum state and an auxiliary quantum state as inputs; the second quantum residual attention layer takes the output quantum state of the quantum pooling layer and the auxiliary quantum state acted on by the first quantum residual attention layer as inputs. The quantum pooling layer takes the output quantum state on the main quantum circuit of the first quantum residual attention layer as an input.
[0086] For the above-mentioned quantum residual attention layer, the input quantum state on the main quantum circuit is alternately operated by an RX rotation gate and a RY rotation gate. Through the alternating action of the RX rotation gate and the RY rotation gate, classical real numbers are mapped to a wider complex domain space. Through the quantum entanglement effect generated by a series of interactions between an auxiliary qubit and the main network, a residual attention mechanism is provided for the neural network, enhancing the expression ability of the neural network. At the same time, it also provides technical support for improving the generalization and parallel acceleration computing ability of the neural network.
[0087] The matrix form of the RX rotation gate is:
[0088]
[0089] where θ represents the rotation angle around the X-axis.
[0090] The matrix form of the RY rotation gate is:
[0091]
[0092] where θ represents the rotation angle around the Y-axis.
[0093] For the input quantum state on the main quantum circuit (e.g., |q1> - |q4>), the quantum residual attention layer includes a layer of RX rotation gate operations (e.g., Rx(θ[0]) - Rx(θ[3])), and several layers of RY rotation gate operations (e.g., Ry(θ[5]) - Ry(θ[8]), where R represents the number of layers of the RY rotation gate). Before the RY rotation gate operation, a CX controlled-NOT gate is set, and the control bit and the target bit of the CX controlled-NOT gate are located on adjacent quantum circuits respectively (e.g., the quantum state after the operation of |q1> by Rx(θ[0]) serves as the control bit and acts on the target bit after the operation of |q2> by Rx(θ[1]); after the last layer of RY rotation gate operation, a CX controlled-NOT gate is also set, the control bit of the CX controlled-NOT gate is located on the quantum circuit where the auxiliary quantum state is located, and the target bit is located on the quantum circuit where the input quantum state is located. And for the last two quantum circuits of the quantum residual attention layer (e.g., the quantum circuits where |q3> - |q4> are located here), the corresponding output also needs to perform an H gate operation.
[0094] For the auxiliary quantum state, the quantum residual attention layer includes a layer of H gate operation, several layers of CRY controlled rotation gate operations (e.g., Ry(θ[4]), where R represents the number of layers of the CRY controlled rotation gate), and an H gate operation. The control bit of the CRY controlled rotation gate operation is the quantum state of the adjacent quantum circuit (e.g., the quantum state obtained after the operation of |q4> by the CX controlled-NOT gate), and the target bit is the auxiliary quantum state.
[0095] For the CX controlled-NOT gate, if the control bit is in the |1> state, the X gate is executed on the target bit; if the control bit is in the |0> state, no operation is performed on the target bit. The X gate operator acts on the ground state and can flip the ground state. It can change the ground state |0> to |1> and the ground state |1> to |0>. The matrix form of the CX controlled-NOT gate is:
[0096]
[0097] For the H gate, i.e., the Hadamard gate, the matrix form is: It can change the ground state |0> to (|0> + |1>).
[0098] For the CRY controlled rotation gate, if the control bit is in the |1> state, the RY rotation gate operation is executed on the target bit; if the control bit is in the |0> state, no operation is performed on the target bit.
[0099] The above-mentioned quantum pooling layer performs alternating operations on any two input quantum states through the RZ rotation gate and the CX controlled-NOT gate. The quantum pooling layer can combine the information of two qubits into one qubit (e.g., reduce the dimension of n qubits to n / 2 qubits), thereby reducing the subsequent calculation amount and improving the performance of the quantum circuit.
[0100] In a specific implementation, for the quantum states on the first quantum circuit among any two quantum circuits (e.g., |q i >), first perform the RZ(-π / 2) rotation gate, and use the operation result as the control bit of the CX controlled-NOT gate to perform the X gate operation on the quantum state on the second quantum circuit (e.g., |q1>); then perform the RZ rotation gate operation on the quantum states of the first quantum circuit and the second quantum circuit respectively (e.g., Rz(θ[1]) and Rz(θ[0])), and the result of the RZ rotation gate operation on the quantum state of the second quantum circuit is used as the control bit of the CX controlled-NOT gate to perform the X gate operation on the quantum state of the first quantum circuit; then perform the RY rotation gate operation on the quantum state of the first quantum circuit again (e.g., Ry(θ[2])).
[0101] In this embodiment, the input data is 4. After passing through the first quantum residual attention layer, there are four output quantum states. The four output quantum states are input into the quantum pooling layer, and after being processed by the quantum pooling layer, there are two effective output quantum states; the two effective output quantum states and the auxiliary quantum state acted on by the first quantum residual attention layer are input into the second quantum residual attention layer to obtain two final quantum states.
[0102] The matrix form of the RZ rotation gate is as follows:
[0103]
[0104] where θ represents the rotation angle around the Z axis.
[0105] The final quantum state obtained through the variational quantum circuit is |α L (x)>, which is specifically expressed as follows:
[0106] |α L (x)> = U θ |φ(x)>|γ> (6);
[0107] where |γ> is the auxiliary quantum state, and here the bit is |0>;
[0108] U θ represents the variational quantum circuit with variational parameters θ:
[0109]
[0110] U αL represents the last layer of the quantum residual attention layer; U αi 、U βi respectively represent the i-th layer of the quantum residual attention layer and the i-th layer of the quantum pooling layer, represents the ceiling operation, and n represents the number of input data.
[0111] In this embodiment, U θ = U α2 U β1 U α1 .
[0112] (3) Quantum measurement layer
[0113] The quantum measurement layer is used to obtain output data through measurement by the Pauli-Z gate based on the quantum state characteristics output by the variational quantum circuit.
[0114] The output data obtained by the quantum measurement layer is represented as follows:
[0115]
[0116] where h l represents the output data of the quantum measurement layer, and |α L (x)> represents the final quantum state. represents the Pauli-Z gate.
[0117] The matrix form of the Pauli-Z gate is:
[0118]
[0119] In this embodiment, the variational quantum circuit outputs two quantum state characteristics; the quantum measurement layer measures all the quantum state characteristics through the Pauli-Z gate to obtain two output data, namely h1 and h2.
[0120] (4) Output layer
[0121] The output layer is composed of a fully connected neural network and is used to process the two output data h1 and h2 to obtain the final prediction data
[0122] For the above quantum residual attention neural network, the loss function used is the mean square error loss function, which is expressed as:
[0123]
[0124] To evaluate the performance of the quantum residual attention neural network, widely used evaluation metrics are introduced to comprehensively evaluate the performance of the algorithm, including the accuracy and complexity evaluation systems. The evaluation metrics for algorithm accuracy usually use the root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R 2 ) to evaluate the regression effect, and the formulas for these metrics are defined as:
[0125]
[0126] where y O , respectively represent the actual value, predicted value of the j-th sample, and the average value of the actual values of all samples, where m represents the number of samples. RMSE can evaluate the degree of data variation. The smaller the RMSE, the better the accuracy of the fitting function in predicting data. MAE reflects the error situation of the predicted value. The smaller the MAE, the better the fitting effect. R 2 measures the overall fitting degree of the regression function, and its value range is [0,1]. Generally speaking, R 2 the larger it is, the better the model fitting effect.
[0127] Example 2
[0128] This example provides a material design method, which includes the following steps:
[0129] S1 Obtain material composition data.
[0130] Here, mainly obtain the chemical elements constituting the material and the molar percentages of each chemical element.
[0131] S2 Perform dimensionality reduction processing on the material composition data to obtain the dimensionality-reduced material composition feature data.
[0132] In this example, principal component analysis (PCA) is used to perform principal component analysis on the material composition data, and the first four principal components are extracted to form the dimensionality-reduced material composition feature data. This can be achieved by using conventional means already disclosed in the art (see Kurita, T.: Principal component analysis (pca). Computer vision: a reference guide, 1-4 (2019)).
[0133] S3 Input the material composition feature data into a quantum residual attention neural network to obtain material property prediction data.
[0134] This step includes the following sub-steps:
[0135] S31 Encode the material composition feature data into an initial quantum state through a quantum embedding layer based on quantum logic gates;
[0136] S32 Perform quantum state evolution operations on the initial quantum state through a variational quantum circuit to extract quantum state features;
[0137] S33 Measure the extracted quantum state features through a quantum measurement layer to obtain material property output data;
[0138] S34 Process the material property output data through a fully connected layer to obtain the final material property prediction data.
[0139] Application Example
[0140] In this application example, the quantum residual attention neural network provided in Embodiment 1 is used.
[0141] In this application example, 12 elements (including Co (cobalt), Cr (chromium), Fe (iron), Ni (nickel), Ti (titanium), Nb (niobium), Mo (molybdenum), W (tungsten), Cu (copper), Al (aluminum), Si (silicon), B (boron)) are used to form high-entropy alloys with 600 material components and corresponding performance labels, such as melting point, according to the ratio. The material design method provided by the present invention is explained in detail based on these 600 material components and corresponding performance labels.
[0142] In this application example, first, based on the 600 material component data X0 (each row represents an alloy material, and each column corresponds to the molar percentage of each element in a material component), the dimensionality reduction of 12 elements is performed by the principal component analysis (PCA) method to obtain the first four principal components. The specific steps are as follows:
[0143] (1) Standardize the data.
[0144] PCA is very sensitive to the dimension of features. Therefore, before performing PCA, it is usually necessary to standardize the data. The column standardization formula for the k-th element is:
[0145]
[0146] where X b,c , represents the sample vector of the k-th element before and after standardization; μ c represents the mean of the molar percentages of the k-th element of all samples; σ c represents the standard deviation of the molar percentages of the k-th element of all samples.
[0147] Through the above formula, the standardized material component sample is expressed as
[0148] (2) Construct the covariance matrix C of 600 material components. N represents the number of alloy materials in
[0149] (3) Perform eigenvalue decomposition on the covariance matrix to obtain eigenvalues λ and eigenvectors P.
[0150] (4) Arrange the eigenvalues in descending order, select the first 4 principal components; select the corresponding 4 eigenvectors to form the eigenvector matrix P'.
[0151] (5) Transform into the new space constructed by 4 eigenvectors, that is, obtain
[0152] One of the main component data is shown in Table 1.
[0153] Table 1 Results of principal component analysis
[0154] Principal Component 1 Principal Component 2 Principal Component 3 Principal Component 4 0.555940 -0.182522 0.665081 -0.056903
[0155] After dimensionality reduction of 600 material components, the material composition characteristic data of 600 materials are obtained.
[0156] At the same time, the melting points of 600 materials are normalized, which helps in the following aspects:
[0157] (1) Accelerate convergence: If the numerical range of the melting point is very large (for example, the difference between 2000 °C and 300 °C), the gradient of the neural network may be very large, which may lead to unstable training. Normalization can compress the output range, making the model training more stable.
[0158] (2) Numerical scale consistency: Normalization can make the output be in a similar numerical scale, which helps the optimization process.
[0159] The formula for normalization is generally:
[0160]
[0161] y0 represents the original melting point value, y xyz 、y xi{ represent the maximum and minimum values of the melting point data respectively, and y represents the normalized melting point; for example, if the melting point range is between 300 °C and 3000 °C, after normalization, 300 °C will be converted to 0 and 3000 °C will be converted to 1.
[0162] The dimensionality-reduced material composition characteristic data and the normalized melting point form a data pair (X, y), X = {x1, x2, x3, x4}. And it is divided into a training set and a test set according to the ratio of 8:2.
[0163] The quantum residual attention neural network provided by the embodiment is trained using the training set, the mean square error loss function is used, and the variational parameters are optimized using the loss value through the gradient descent algorithm until the loss value tends to be stable and unchanged.
[0164] Then the test set data is input into the trained quantum residual attention neural network for testing, and the root mean square error (RMSE), mean absolute error (MAE) and coefficient of determination (R 2)To evaluate the regression effect. If the effect is not good, the quantum residual attention neural network can be adjusted by adjusting the gate operation, the number of layers of the quantum residual attention layer and the quantum pooling layer, etc., or the input data dimension (i.e., the number of principal components) can be adjusted to further train the quantum residual attention neural network until it has an excellent evaluation regression effect.
[0165] After training is completed, the output of the network will be a normalized value within the range of [0, 1]. To convert this output value back to the true melting point value, it needs to be denormalized. The denormalization formula is:
[0166]
[0167] This will restore the normalized output value to the actual melting point range.
[0168] For example, input the dimension-reduced input data of the material components in Table 2 into the trained quantum residual attention neural network, and the obtained normalized value is Using denormalization processing, the predicted melting point is 2595 °C.
[0169] Table 2 Material Components and Melting Points
[0170] Co Cr Fe Ni Ti Nb Mo W Cu Al Si B Melting Point (°C) 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.05 0.05 0.05 0.05 2650
[0171] Compare the regression effect evaluation of the QRANN of the present invention with that of the commonly used multi-layer perceptron (MLP) (as shown in Table 3). The proposed scheme of the present invention can have higher prediction accuracy. Moreover, the QRANN of the present invention converges after only 30 iterations, while the currently commonly used MLP requires 400 iterations to converge. Thus, it can be seen that the quantum residual attention neural network provided by the present invention not only has excellent prediction effects, but also has a fast training convergence speed, effectively saving training time.
[0172] Table 3 Evaluation of Material Property Prediction Results (The best data is shown in bold)
[0173] Network <![CDATA[R 2 > RMSE MAE Number of Iterations QRANN 0.99±0.002 0.105±0.012 0.083±0.011 30 MLP 0.977±0.006 0.158±0.019 0.107±0.003 400
[0174] The present invention belongs to the field of quantum artificial intelligence computing. The quantum neural network computing process is realized through variational quantum circuits. Utilizing the quantum noise characteristics of the quantum computer itself improves the generalization of the model, and it is particularly suitable for improving the model accuracy in small-sample training. In addition, the parallelism characteristic of quantum computing is fully utilized to achieve the purpose of accelerating model training and improving the model convergence speed.
[0175] Those of ordinary skill in the art will realize that the embodiments herein are provided to assist the reader in understanding the principles of the present invention, and it should be understood that the scope of protection of the present invention is not limited to such specific statements and embodiments. Those of ordinary skill in the art can make various other specific deformations and combinations that do not depart from the essence of the present invention based on the technical revelations disclosed in the present invention, and these deformations and combinations are still within the scope of protection of the present invention.
Claims
1. A quantum residual attention neural network, characterized in that: include: A quantum embedding layer based on quantum logic gates to encode input data into the initial quantum state; A variational quantum circuit is used to combine the auxiliary quantum state to act on the initial quantum state, realize the evolution of the quantum state, and extract the characteristics of the quantum state; the variational quantum circuit includes a trunk quantum circuit where the initial quantum state is located and an auxiliary quantum circuit where the auxiliary quantum state is located; the variational quantum circuit is provided with a plurality of quantum residual attention layers, and a quantum pooling layer located between two adjacent quantum residual attention layers; Each quantum residual attention layer takes the initial quantum state and the auxiliary quantum state as input, or the output quantum state of the quantum pooling layer and the auxiliary quantum state acted upon by the previous quantum residual attention layer as input; the quantum pooling layer takes the output quantum state on the main quantum circuit of the previous quantum residual attention layer as input; The final quantum state obtained through the variational quantum circuit is , specifically expressed as follows: ; in, represents the auxiliary quantum state, or ; represents the initial quantum state; Represents a variational parameter The variational quantum circuit of ; represents the last quantum residual attention layer; , They represent the i-th quantum residual attention layer and the i-th quantum pooling layer respectively. , Indicates rounding up operation, n indicates the number of input data; The quantum residual attention layer performs alternating operations on the input quantum state through the RX rotation gate and the RY rotation gate; The quantum pooling layer performs alternating operations on any two input quantum states through the RZ rotation gate and the CX control NOT gate; specifically, the quantum pooling layer first performs Rotating gate, the operation result is used as the control bit of CX control NOT gate, and the quantum state on the second quantum circuit is subjected to X gate operation; then the quantum states of the first quantum circuit and the second quantum circuit are subjected to RZ rotating gate operation respectively, and the result of the RZ rotating gate operation on the quantum state on the second quantum circuit is used as the control bit of CX control NOT gate, and the quantum state on the first quantum circuit is subjected to X gate operation; then the quantum state on the first quantum circuit is subjected to RY rotating gate operation again; The quantum measurement layer is used to obtain output data by measuring the quantum state characteristics of the variational quantum circuit output through the Pauli Z gate.
2. The quantum residual attention neural network according to claim 1, characterized in that The quantum embedding layer is implemented through quantum logic gates Effect on or On the ground state, the encoded initial quantum state is obtained , n represents the number of qubits required to encode the input data; the specific expression is as follows: ;or ; The quantum logic gate It includes at least one of the RX revolving door, RY revolving door and RZ revolving door.
3. The quantum residual attention neural network according to claim 1, characterized in that In the quantum residual attention layer, the matrix form of the RX revolving gate is: ; Where θ represents the rotation angle around the X axis; The matrix form of the RY revolving door is: ; Here, θ represents the rotation angle around the Y axis.
4. The quantum residual attention neural network according to claim 3, characterized in that For the input quantum state on the trunk quantum circuit, the quantum residual attention layer includes one layer of RX revolving gate operation and several layers of RY revolving gate operation; before the RY revolving gate operation, a CX control NOT gate is set, and the control bit and target bit of the CX control NOT gate are respectively located on adjacent quantum circuits; after the last layer of RY revolving gate operation, a CX control NOT gate is also set, and the control bit of the CX control NOT gate is located on the quantum circuit where the auxiliary quantum state is located, and the target bit is located on the quantum circuit where the input quantum state is located; For the auxiliary quantum state, the quantum residual attention layer includes a layer of H gate operation, several layers of CRY controlled rotating gate operation and H gate operation; the control bit of the CRY controlled rotating gate operation is the quantum state of the adjacent quantum circuit, and the target bit is the auxiliary quantum state.
5. The quantum residual attention neural network according to claim 4, characterized in that For the control NOT gate CX, if the control bit is If the control bit is state, the target bit does not perform any operation; the matrix form of the control NOT gate CX is: 。 6. The quantum residual attention neural network according to claim 1, characterized in that In the quantum pooling layer, the matrix form of the RZ revolving gate is: ; Here, θ represents the rotation angle around the Z axis.
7. The quantum residual attention neural network according to claim 1, characterized in that The variational quantum circuit outputs at least two quantum state characteristics; the quantum measurement layer measures all quantum state characteristics through the Pauli Z gate to obtain more than two output data; The quantum residual attention neural network also includes an output layer, which is used to process more than two output data to obtain final prediction data.
8. Application of the quantum residual attention neural network described in any one of claims 1 to 7 in material design.
9. A material design method, characterized in that: The following steps are involved: S1 obtains material composition data; S2 performs dimensionality reduction processing on the material composition data to obtain the material composition characteristic data after dimensionality reduction; S3 inputs the material composition characteristic data into the quantum residual attention neural network described in any one of claims 1 to 7 to obtain material performance prediction data.
Citation Information
Patent Citations
Meteorological data prediction method and device, storage medium and electronic device
CN116011682A
Image multi-classification method based on hybrid quantum neural network, electronic equipment and storage medium
CN118823483A