Structure-adaptive quantum classical mixed graph Transformer model and application thereof
By introducing a structurally adaptive quantum classic hybrid graph Transformer model in quantum machine learning, combining quantum computing and graph neural networks, the problems of unsatisfactory training effects, high line resource consumption, and susceptible to noise interference in graph classification problems are solved, and efficient graph classification and strong anti-noise ability are achieved.
Patent Information
- Application Number
- CN202510519629.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-05-23
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing quantum machine learning algorithms have problems such as unsatisfactory training results, high line resources consumption, and susceptible to noise interference in the graph classification problem.
A structurally adaptive quantum classic hybrid graph Transformer model is proposed. By combining quantum computing with graph neural networks, the graph attention mechanism is realized, and a structural adaptive scheme is introduced to optimize the model structure and reduce line complexity and noise interference.
In terms of graph classification, the recognition accuracy of the model is improved by about 10%, the line resource consumption is reduced by about 85%, and the accuracy loss caused by noise is reduced by 4%, while maintaining the recognition accuracy similar to that of the classic graph attention network.
Smart Images

Figure CN120031077A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the intersection of quantum computing and artificial intelligence, and particularly relates to a structure-adaptive quantum-classical hybrid graph Transformer model and its application. Background Art
[0002] In today's highly information-based era, machine learning technology has important research and application value. However, most of the current machine learning algorithms are based on classical computing models and are limited by the computing speed and storage capacity of classical computers. Quantum computing has huge theoretical advantages in computing speed and the ability to process large-scale data, so combining quantum computing with machine learning has gradually become a major research hotspot.
[0003] However, quantum technology is still in its early stages of development, and current quantum computing devices are often limited by quantum decoherence and error rates. In order to overcome these technical problems, variational quantum algorithms have been proposed. This is a class of algorithms that can run in a quantum-classical hybrid framework, which can adapt to the actual performance of quantum hardware while reducing the impact of quantum dissipation and decoherence, and is suitable for current noisy medium-scale quantum devices.
[0004] Even so, when combining quantum computing with machine learning and applying variational quantum algorithms to actual machine learning tasks, there are still problems such as slow line parameter convergence, high line complexity, and the introduction of excessive noise interference leading to inaccurate final calculation results.
[0005] Therefore, in order to solve the practicality and reliability problems of quantum machine learning algorithms, it is urgent to realize a quantum-classical hybrid model based on variational quantum algorithms that has low complexity, high noise resistance, expressibility and trainability. Summary of the invention
[0006] Technical problem: In order to overcome the deficiencies in the prior art, the present invention provides a structurally adaptive quantum classical hybrid graph Transformer model and its application for the common graph classification problems in machine learning tasks, so as to solve the problems of unsatisfactory training effect, high line resource consumption, and susceptibility to noise interference in quantum machine learning when solving graph classification problems.
[0007] Technical solution: To solve the above technical problems, the present invention combines quantum computing with graph neural networks and implements graph attention mechanisms on quantum circuits to enhance the model's ability to handle graph classification tasks. To alleviate the barren plateau problem of static models in large-scale data applications, the present invention introduces a structural adaptive solution to optimize the model structure.
[0008] The structure-adaptive quantum-classical hybrid graph Transformer model described in the present invention comprises the following steps: (1) Construct the encoding layer: Use quantum gates to encode the input graph into a quantum state containing all its information; (2) Constructing the connection layer: Using auxiliary qubits to represent global nodes and establish potential connections between nodes in the graph; (3) Constructing the quantum circuit structure search space: limiting the scope of the quantum circuit structure search in step (4); (4) Constructing the training layer: Use a structure adaptation scheme based on quantum circuit structure search to find the optimal training layer parameter-containing quantum circuit structure and train its parameters to obtain a complete model.
[0009] Preferably, the number of nodes in the input graph is n, and the node numbers are 0, 1, ,n-1, then in step (1), the steps to encode the input graph into a quantum state are as follows: (11) Establish a quantum circuit containing n+1 quantum bits, denoted as ; (12) All qubits are changed from the default state Initialize to superposition state ; (13) For each edge in the graph, let the nodes at both ends be numbered i and j. Then in the quantum bit A two-bit quantum gate is established between them: if the graph is a weighted graph, a CP gate is established; if the graph is an unweighted graph, a CZ gate is established; (14) If the graph is a weighted graph, the set of all edge weights in the graph is Custom Mapping Map edge weights to parameters of the CP gate; if the graph is an unweighted graph, skip this step.
[0010] Preferably, in step (2), the method of establishing potential connections between nodes in the graph through auxiliary quantum bits is: As control bit, As the target bit, CX gates are established respectively. That is, the auxiliary quantum bit representing the global node.
[0011] Preferably, in step (3), the search range of the quantum circuit structure is limited as follows: (31) The quantum circuit to be searched is a layered structure, and each circuit layer consists of a single-bit layer and a CX layer; (32) The single-bit layer consists of single-slot RY and RZ gates. In the same single-bit layer, there can be at most one RY gate or RZ gate on each quantum bit. (33) The CX layer consists of single-slot CX gates, and any two CX gates in the same CX layer do not act on the same qubit; (34) The CX gate can only act on two adjacent qubits in one direction. Suppose the control bit is , , then the target bit must be .
[0012] Preferably, the composability and exchangeability between quantum gates in adjacent circuit layers are taken into consideration, and cross-layer constraints are designed according to the quantum gate exchange law to prohibit the occurrence of composable and offset quantum gates.
[0013] Preferably, in step (4), the structural adaptation scheme used is a gradient-cost multi-objective alternating (GCMA) search framework. The search framework uses a multi-objective genetic algorithm to maximize the gradient amplitude while minimizing the cost function value, and alternately iteratively optimizes the quantum circuit structure and parameters to ultimately obtain a set of optimal solutions. The training layer is constructed according to the quantum circuit structure and parameter-containing quantum gate parameters of the optimal solution, and the coding layer, connection layer, and training layer are connected in sequence to obtain a complete quantum circuit of the model.
[0014] The present invention also provides an application of the model in a graph classification problem, including: (a) Importing input graph information into the model through the encoding layer; (b) Observe the output of the model quantum circuit and obtain the probability distribution of the observation results; (c) Convert the observed probability distribution into the probability that the input image belongs to each image classification category to complete the image classification.
[0015] Beneficial effects: The recognition accuracy of the structure-adaptive quantum-classical hybrid graph Transformer model provided by the present invention on the same graph classification problem is not significantly different from that of the classical graph attention network GAT; compared with the fixed-structure fully connected quantum network FATA that does not adopt a structure-adaptive solution, the model provided by the present invention has more obvious advantages in recognition accuracy, line resource consumption and noise resistance on complex graph classification problems, among which the recognition accuracy is improved by about 10%, the line resource consumption is reduced by about 85%, and the accuracy loss caused by noise is reduced by 4%. This model achieves low line resource consumption and strong noise resistance while ensuring that the recognition accuracy is similar to that of the classical graph attention network, which is a relatively efficient solution under the current technical background. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A schematic diagram of the process of constructing the model quantum circuit of the present invention; Figure 2 A schematic diagram of the structure of an input graph in an embodiment of the present invention; Figure 3 A schematic diagram of quantum circuits of the coding layer and the connection layer in an embodiment of the present invention; Figure 4 This is a schematic diagram of a training layer quantum circuit in an embodiment of the present invention; Figure 5 A schematic diagram of the structure of an illegal quantum circuit that does not meet the cross-layer constraint condition in an embodiment of the present invention; Figure 6 Flow chart of the GCMA search framework in an embodiment of the present invention. DETAILED DESCRIPTION
[0017] The present invention will be further described below in conjunction with the accompanying drawings.
[0018] like Figure 1 The figure shows a schematic diagram of the quantum circuit construction process of a structure-adaptive quantum-classical hybrid graph Transformer model, which includes the following steps: (1) Construct the encoding layer: Use quantum gates to encode the input graph into a quantum state containing all its information; (2) Constructing the connection layer: Using auxiliary qubits to represent global nodes and establish potential connections between nodes in the graph; (3) Constructing the quantum circuit structure search space: limiting the scope of the quantum circuit structure search in step (4); (4) Constructing the training layer: Use a structure adaptation scheme based on quantum circuit structure search to find the optimal training layer parameter-containing quantum circuit structure and train its parameters to obtain a complete model.
[0019] Assume that the structure of the input graph is Figure 2 As shown, there are 4 nodes in total, so the construction process of the encoding layer and the connection layer in step (1) and step (2) is as follows: A) Create a quantum circuit with 5 qubits, each qubit is in the default state ; B) Use H gates on each qubit to bring them from their default state Initialize to superposition state ; C) In Establish a CP gate between Figure 2 The weighted edges between nodes 0 and 1, nodes 1 and 2, and nodes 1 and 3; D) Custom edge weights The mapping relationship between the CP gate parameter p and the CP gate parameter is used to set the CP gate parameter; As an example, The CP gate parameter between , The CP gate parameter between ; E) As control bit, As the target bit, a CX gate is established respectively.
[0020] According to the above steps, we can get Figure 3 The coding layer and connection layer quantum circuits are shown.
[0021] In step (3), according to the restriction conditions, the structural diagram of the parameter-containing subcircuit of the training layer is as follows: Figure 4 The specific content of the cross-layer constraint is as follows: a) If ; b) If ; c) If .
[0022] in, Indicates For control bits, CX gate for the target bit; represents the RY and RZ gates acting on the quantum bit q; Indicates the lth line layer.
[0023] Constraint a) does not allow two consecutive CX gates with the same control bit and target bit; constraints b) and c) do not allow single-bit quantum gates that can be fused on the same quantum bit. According to the above cross-layer constraints, Figure 4 The training layer parameter subcircuit structure shown in Figure 5 The line substructures shown are all illegal structures. Figure 5 c and e do not satisfy constraint a); Figure 5 a does not satisfy constraint b); Figure 5 b and d do not satisfy constraint c).
[0024] In step (4), the process of the GCMA search framework is as follows: Figure 6 shown.
[0025] In each iteration, GCMA first randomly selects a parameterized subcircuit structure from the search space as an individual and adds it to the population. , until the number of individuals reaches the population capacity (In practice, it is usually ) For all randomly selected line structures U, GCMA maintains a unique set of parameters , as the parameters of the line structure. These parameters are obtained when U is first drawn. Initialization is achieved by uniform sampling.
[0026] In the population After the supplementation is completed, the cost function value of all line structures U in the population is calculated and its gradient , and find the non-dominated solution set that maximizes the gradient magnitude while minimizing the cost function value The solution set contains all the line structures , satisfying the fact that there is no line structure in the population At the same time, the inequality Established. All the solutions that do not exist in the non-dominated solution set The line structure will be eliminated and removed from the population .
[0027] Finally, for the non-dominated solution set Each line structure in Train once. Training uses gradient descent with variable learning rate to update parameters , , where the dynamic learning rate Determined by the following method: Assuming that the last training When the learning rate is ,but ,in , n is satisfied The smallest natural number of is a constant, usually set to around 0.9.
[0028] After the number of iterations reaches the preset threshold, GCMA continues to use the above method to eliminate and train parameter-containing subcircuit structures, but at the beginning of each iteration, it no longer randomly selects circuit structures from the search space to supplement the population. .then, The number of individuals in the molecule continues to decrease due to elimination. When all parameters of the remaining circuit structures in converge, the search and training terminate. Among these searched circuits, the ones with the highest accuracy on the validation set are used as the training layers of the model.
[0029] The structure-adaptive quantum-classical hybrid graph Transformer model proposed in this invention can be widely used in quantum machine learning, graph data processing and other fields. The following are the implementation steps for using it to solve the graph classification problem: 1. Import the input graph information into the model through the encoding layer According to the construction steps of the coding layer of the model, the coding layer quantum circuit corresponding to the input graph information is determined to realize the import of the input graph information into the model.
[0030] 2. Observe the output of the model quantum circuit and obtain the probability distribution of the observation results Assume that the complete quantum circuit of the model contains qubits, then observing its output gives quantum state And the corresponding Probability of occurrence .
[0031] 3. Convert the probability distribution of the observation results into the probability that the input image belongs to each image classification category to complete the image classification Assuming there are L types of graph classification categories, then for all The quantum states are assigned labels 1, 2, ,L. The labels should be distributed as evenly as possible, and the distribution method of labels when using the model must be consistent with that when training the model. For the i-th image classification category, the probability of occurrence of all quantum states assigned to label i is added together to obtain the probability that the input image belongs to the i-th image classification category. Among them, the category with the highest probability is regarded as the actual category to which the input image belongs.
Claims
1. A structure-adaptive quantum-classical hybrid graph Transformer model, characterized in that: The specific implementation method includes the following steps: (1) Construct the coding layer: Use quantum gates to set the number of nodes to n, and the node numbers to 0, 1, ,n-1 input graph is encoded into a quantum state containing all its information; (2) Constructing the connection layer: Using auxiliary qubits to represent global nodes and establish potential connections between nodes in the graph; (3) Constructing the quantum circuit structure search space: limiting the scope of the quantum circuit structure search in step (4); (4) Constructing the training layer: Use a structure adaptation scheme based on quantum circuit structure search to find the optimal training layer parameter-containing quantum circuit structure and train its parameters to obtain a complete model.
2. The structure-adaptive quantum-classical hybrid graph Transformer model according to claim 1, characterized in that: In step (1), the steps to encode the input graph into a quantum state are as follows: (11) Establish a quantum circuit containing n+1 quantum bits, denoted as ; (12) All qubits are changed from the default state Initialize to superposition state ; (13) For each edge in the graph, let the nodes at both ends be numbered i and j. Then in the quantum bit A two-bit quantum gate is established between them: if it is a weighted graph, a CP gate is established; if it is an unweighted graph, a CZ gate is established; (14) If it is a weighted graph, the set of all edge weights in the graph is Custom Mapping Map edge weights to parameters of CP gates.
3. The structure-adaptive quantum-classical hybrid graph Transformer model according to claim 2, characterized in that: In step (2), the method of establishing potential connections between nodes in the graph through auxiliary quantum bits is: As control bit, As the target bit, CX gates are established respectively; among them, quantum bit That is, the auxiliary quantum bit representing the global node.
4. The structure-adaptive quantum-classical hybrid graph Transformer model according to claim 1, characterized in that: In step (3), the search range of quantum circuit structure is limited as follows: (31) The quantum circuit to be searched is a layered structure, and each circuit layer consists of a single-bit layer and a CX layer; (32) The single-bit layer consists of single-slot RY and RZ gates. In the same single-bit layer, there can be at most one RY gate or RZ gate on each quantum bit. (33) The CX layer consists of single-slot CX gates, and any two CX gates in the same CX layer do not act on the same qubit; (34) The CX gate can only act on two adjacent qubits in one direction. Suppose the control bit is , , then the target bit must be ; (35) Design cross-layer constraints based on the commutativity law of quantum gates to prohibit the emergence of mergible and offset quantum gates.
5. The structure-adaptive quantum-classical hybrid graph Transformer model according to claim 4, characterized in that: The cross-layer constraints in step (35) include: It is forbidden to have two CX gates with the same control bit and target bit that can cancel each other; It is forbidden to have any combination of RY / RZ gates acting on the same qubit that can be merged with each other.
6. The structure-adaptive quantum-classical hybrid graph Transformer model according to claim 1, characterized in that: In step (4), the GCMA search framework is used to iteratively optimize the circuit structure and parameters with the goal of maximizing the gradient amplitude and minimizing the cost function to obtain the complete model; The GCMA framework includes: Initialize the population and screen the non-dominated solution set through a multi-objective genetic algorithm; The dynamic learning rate gradient descent method is used to update the parameters, and the learning rate is adjusted according to the golden ratio; Finally, the line with the highest accuracy in the validation set is selected as the training layer.
7. An application of the model described in any one of claims 1 to 6 in a graph classification method, characterized in that: include: (a) Importing input graph information into the model through the encoding layer; (b) Observe the output of the model quantum circuit and obtain the probability distribution of the observation results; (c) Convert the observed probability distribution into the probability that the input image belongs to each image classification category to complete the image classification.
Citation Information
Patent Citations
Quantum circuit optimization method based on genetic algorithm
CN113222165A
Quantum circuit depth-oriented compilation optimization method and device
CN113918168A
Evolutionary quantum neural network architecture search method based on quantum simulator
CN114676837A
Convolution and self-attention fused multi-target neural architecture search method
CN116258165A
Method for corresponding classical data set to quantum physics system based on Hamiltonian
CN117634631A