Graph neural training method and device based on graph structure level knowledge mutual distillation
Through the graph structure level knowledge mutual distillation method, the problem of time-consuming and labor-intensive and performance mismatch in graph neural network training is solved, the comprehensive transfer of graph knowledge and classification performance improvement are achieved, and it is suitable for a variety of graph neural network applications.
Patent Information
- Application Number
- CN202410493003.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-23
- Publication Date
- 2024-08-30
AI Technical Summary
Traditional knowledge distillation methods have problems such as time-consuming and labor-intensive training of graph neural networks, mismatch in performance capabilities between teacher models and student models, and neglect of subgraph structure distillation, resulting in low training efficiency and limited classification accuracy.
Using the method of mutual distillation of knowledge at the graph structure level, the mutual distillation of knowledge at the node level and the graph structure level is realized by building a parallel graph neural network. The two graph neural networks are used as teachers and students of each other to dynamically manage the differences in node feature connection structures. Calculate the loss function and conduct gradient backpropagation training to ensure the mutual transfer of graph structure-level knowledge.
It improves the text classification performance of graph neural networks, avoids the phased training and teacher model dependence in traditional methods, achieves comprehensive transfer of graph knowledge, and is suitable for a variety of graph neural network application scenarios.
Smart Images

Figure CN118569303A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of graph neural networks, knowledge distillation and knowledge classification, and in particular to a graph neural network training method and device based on graph structure-level knowledge mutual distillation. Background Art
[0002] With the advent of the information age and big data, text information is generated all the time on the Internet. This text information is distributed in all walks of life. Quickly and accurately mining valuable information from these real-time massive texts has a wide range of practical significance and application scenarios. For example, in the field of e-commerce, merchants can quickly identify users' preferences for products through user comments on products, and then design corresponding sales strategies to increase product sales; in social media, false information can be quickly and accurately identified.
[0003] Therefore, the text classification task is a widely used and important task in natural language processing. It divides the text into predefined categories according to the content and other features of the text according to specific classification system standards, which can greatly improve the efficiency of text processing and text mining. It has a wide range of application scenarios, such as sentiment classification, topic classification, and false information detection.
[0004] In order to better process graph-structured data, traditional graph neural networks (GNNs) proposed a training paradigm for graph neural networks based on neighbor node feature aggregation by aggregating feature information of neighbor nodes, such as GraphSAGE, GAT, GCN, etc. In order to further improve the performance of graph neural networks, some researchers have applied the knowledge distillation method to graph neural network training. In the past, the basic idea of these methods was to extract knowledge from the deeper teacher GNN model to optimize the shallower student GNN model. However, these methods have the following three problems:
[0005] 1) Traditional knowledge distillation methods often require the preparation of a well-trained teacher network model (usually a large model) before the training of the student model, which is usually very time-consuming and laborious. In the face of today's massive knowledge databases, training large teacher network models is even impossible due to cost reasons.
[0006] 2) Even if an excellent teacher model is trained, it does not guarantee that a better student model will be trained, because the models and performance capabilities between the teacher network and the student network do not match, that is, it is difficult for the student model to imitate the output of an overly powerful teacher model.
[0007] 3) Traditional graph neural network training methods based on knowledge distillation ignore the distillation of subgraph structures, that is, the connection relationship between each node and its neighbors constitutes a small subgraph. The subgraph connection information of the teacher network and the student network includes: the structural differences in the output graph data of the teacher and student networks caused by distance loss and angle loss. Few algorithms mention this difference, and the structural difference of graph data, that is, the neighbor relationship between data nodes is very important, which directly affects the training of the feature mapping relationship of graph nodes, thereby affecting the classification accuracy. Summary of the invention
[0008] In view of the defects of the prior art, the present invention aims to propose a text classification graph neural network training method with mutual distillation of graph structure-level knowledge, which can manage the differences in the feature connection structures of text entity nodes of two parallel graph neural networks in real time and dynamically during the graph neural network training, and use the two graph neural networks as teachers and students to maintain the neighbor relationship and cluster the relationship of similar samples, and apply it to the graph neural network training to further improve the text classification performance of the graph neural network.
[0009] In order to achieve the above-mentioned object of the invention, the present invention implements the following technical solutions:
[0010] A graph neural network training method based on graph structure-level knowledge mutual distillation, comprising:
[0011] Construct a graph neural network training architecture that includes a parallel first and second graph neural networks;
[0012] Implementing the selection of one-to-one corresponding layers of the first and second graph neural networks;
[0013] Constructing a learner, respectively constructing a node-level knowledge mutual distillation learner and a graph structure-level knowledge mutual distillation learner for the first and second graph neural networks, wherein the graph structure-level knowledge mutual distillation learner is based on a node connection subgraph structure and a node aggregation graph structure, wherein the node connection subgraph structure is based on a small subgraph for each node and neighbor connection relationship, and the node aggregation graph structure is based on a plurality of edge-interconnected nodes aggregating into a super node;
[0014] Perform graph neural network training for graph structure-level knowledge mutual distillation. During the graph neural network training process, the first and second graph neural networks serve as teacher networks and student networks for each other. For the selected layers of the first and second graph neural networks that correspond to each other, node-level knowledge mutual distillation and graph structure-level knowledge mutual distillation are implemented. A graph structure-level knowledge mutual distillation loss function is constructed to obtain a trained graph neural network that is applied to the scenario to be applied, specifically including the following processing:
[0015] a. Select a batch of training graph data for the application scenario as training samples, input them into the graph neural network with graph structure-level knowledge mutual distillation, and complete the graph neural network training with graph structure-level knowledge mutual distillation for a batch of data,
[0016] b. Obtain the node outputs of all input data in the layers selected by each graph neural network;
[0017] c. Traverse all nodes in the one-to-one corresponding layer in sequence, calculate the migration direction of each node-level knowledge mutual distillation, and calculate the node-level knowledge mutual distillation loss; traverse all nodes in the one-to-one corresponding layer in sequence, calculate the subgraph structure similarity of all nodes, and perform subgraph structure-level knowledge mutual distillation;
[0018] d. Calculate the total training loss function of the first and second graph neural networks and the cross entropy loss of each node;
[0019]
[0020]
[0021] Among them, L agg represents the consistency metric loss, L struct Represents the structural loss of the super node, represent, They represent the mutual distillation losses of the first graph neural network → the second graph neural network and the second graph neural network → the first graph neural network, respectively. Represents the graph structure-level knowledge mutual distillation loss from the first graph neural network entity node to the second graph neural network, They represent the graph structure-level knowledge mutual distillation loss from the entity nodes of the second graph neural network to the entity nodes of the first graph neural network, The network node representing the first graph neural network is the teacher node, The network node representing the second graph neural network is the teacher node, Represents the cross entropy loss function of all entity nodes of the first graph neural network, Represents the cross entropy loss function of all entity nodes of the first graph neural network;
[0022] Use L 1 , L 2 Calculate the gradient of the loss function of the first graph neural network and the second graph neural network, and perform gradient backpropagation training;
[0023] f..Combining the graph structure-level knowledge mutual distillation loss, the node-level knowledge mutual distillation loss, and the cross entropy loss of each node, obtain the total loss of the first and second graph neural networks to be trained, and use the loss function gradient descent method to train the graph neural network once;
[0024] g. Randomly select new training graph data again, repeat processes a to f, and iterate back and forth until the entire network loss function converges to a minimum value, completing the graph neural network training.
[0025] A graph neural network training device based on graph structure-level knowledge mutual distillation, comprising:
[0026] A training architecture building module for a graph neural network training architecture based on graph structure-level knowledge mutual distillation including a parallel first and second graph neural networks;
[0027] A learner construction module, used to construct a node-level knowledge mutual distillation learner and a graph structure-level knowledge mutual distillation learner for the first and second graph neural networks, respectively, wherein the graph structure-level knowledge mutual distillation learner further includes a graph structure-level knowledge mutual distillation learner based on a node connection subgraph structure and a node aggregation graph structure;
[0028] A selection module, used to select the one-to-one corresponding layers of the first and second graph neural networks;
[0029] The graph neural network training module is used to perform graph neural network training for graph structure-level knowledge mutual distillation. During the graph neural network training process, the first and second graph neural networks serve as teacher networks and student networks respectively, and node-level knowledge mutual distillation and graph structure-level knowledge mutual distillation are implemented for the one-to-one corresponding layers of the selected first and second graph neural networks; a graph structure-level knowledge mutual distillation loss function is constructed to obtain a trained graph neural network for application in the scenario to be applied.
[0030] The beneficial effects and advantages of the present invention are:
[0031] 1. It not only realizes the mutual distillation of node-level knowledge between two graph neural networks, but also realizes the use of graph structure-level knowledge mutual distillation learners of two graph neural networks to train graph neural networks, thereby fully realizing the mutual transfer of graph knowledge and improving the classification performance of graph neural networks;
[0032] 2. It avoids the defect of phased training in the traditional knowledge distillation graph neural network training process, that is, the teacher network and the student network are trained separately; at the same time, it also avoids the requirement of training an excellent teacher network in the traditional knowledge distillation method. During the training process, the two networks are trained and optimized together, avoiding the problem of mismatch between the performance capabilities of the teacher model and the student model;
[0033] 3. It can be widely used in various types of graph neural networks to realize various application scenarios with graph neural networks as the core, such as: email text classification, web page classification, news classification, etc.; BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A flowchart of a graph neural network training method based on graph structure-level knowledge mutual distillation of the present invention
[0035] Figure 2 Schematic diagram of the working process of node-level knowledge mutual distillation learner; (a) Schematic diagram of the first and second graph neural networks; (b) Schematic diagram of the node-level knowledge mutual distillation learning process;
[0036] Figure 3 This is a module diagram of a graph neural training device based on graph structure-level knowledge distillation according to the present invention. DETAILED DESCRIPTION
[0037] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0038] Embodiment 1:
[0039] The present invention constructs a graph neural network training architecture for graph structure-level knowledge mutual distillation, which includes two parallel graph neural networks. A node-level knowledge mutual distillation learner and a graph structure-level knowledge mutual distillation learner are constructed for the first and second graph neural networks respectively. The one-to-one corresponding layers of the two graph neural networks are selected to perform node-level knowledge mutual distillation learning and graph structure mutual distillation learning, and to perform knowledge node distillation learning and graph structure-level knowledge mutual distillation learning.
[0040] Given a knowledge graph ζ = {E, R, T}, where E represents the set of all entities in the knowledge graph, R represents the combination of all relations in the knowledge graph, and T represents the set of all triples.
[0041] Each triple T = {h, r, t} consists of a head entity h, a relation r, and a tail entity t, so the set of triples can be expressed as T = {(h, r, t) | h, t∈E, r∈R}. For a certain entity, the set of its several triples often implies the rich structure and semantic features of this entity. In actual classification applications, multiple triples are used to describe the entity. For classification tasks, each entity contains a category label for classifying the entity. The category label set can be expressed as Y = {y1, y2,······, y K}, K represents the total number of label categories.
[0042] The graph neural network is a deep structure composed of multiple layers stacked on top of each other. The present invention has l layers, and each layer processes the input knowledge graph and updates the head entity, tail entity and their relationship features.
[0043] The specific embodiments of the present invention are as follows:
[0044] Step 1: Build a graph neural network training architecture containing any two parallel graph neural networks. The expression of the graph data input of the graph neural network in this step is as follows:
[0045]
[0046]
[0047]
[0048] Among them, l represents the lth layer of the graph neural network, The l-th layer features representing the head entity, The features of the l+1th layer of the graph neural network representing the tail entity, The features of the lth layer of the graph neural network representing the tail entity, Represents the relationship feature between the head entity and the tail entity, N h represents the set of neighbors of the head entity, that is, the set that has a connection relationship with the head entity, W r represents the graph neural network feature mapping matrix, which is a random matrix that can be trained and initialized to random values. r′ represents the relationship in the immediate neighbor set, t′ represents the tail entity in the immediate neighbor set, φ(·) represents the graph neural network feature mapping function, and δ(·) represents the neighbor relationship value between the entity and each neighbor entity in the immediate neighbor set of its relationship.
[0049] Step 2: Select the one-to-one corresponding layers of the first and second graph neural networks. The layer selection process of the graph neural network is as follows: if the first graph neural network and the second graph neural network have the same number of layers, select all layers to perform mutual update of the node features of the graph neural network in the one-to-one corresponding layers. If the first graph neural network and the second graph neural network have different number of layers, extract them in proportion, realize the one-to-one correspondence of the graph neural network layers, and then perform mutual update of the node features of the graph neural network. For example, the first graph neural network has m layers and the second graph neural network has n layers. The last layer must be mutually updated with the node features of the graph neural network, so this layer does not need to be selected. For the remaining layers, it is assumed that the first and second graph neural networks select h layers respectively for mutual update of the network node features. Therefore, the first graph neural network extracts 1 layer as the anchor layer every delta=m / h, and the second graph neural network extracts 1 layer as the anchor layer every beta=n / h. The selected anchor layers perform mutual update of the network node features according to the corresponding relationship. This selection is performed in the initialization stage of training and is performed only once. The training process performs mutual update of the node features of the graph neural network according to the initially selected layers.
[0050] like Figure 2As shown, for the one-to-one corresponding layers selected by the first and second graph neural networks, the feature outputs of each entity in the knowledge graph are obtained. However, the features of each entity node after being processed by the first and second graph neural network aggregation processes are of varying quality. For example, a certain node will obtain a good classification result after being processed by the first graph neural network aggregation process.
[0051] Step 3: construct a learner, and construct a node-level knowledge mutual distillation learner and a graph structure-level knowledge mutual distillation learner for the first and second graph neural networks respectively, wherein the graph structure-level knowledge mutual distillation learner further includes a graph structure-level knowledge mutual distillation learner based on a node connection subgraph structure and a node aggregation graph structure; node-level knowledge mutual distillation and graph structure mutual distillation are performed between the two graph neural networks, wherein the node connection subgraph structure is based on which each node and its neighbor connection relationship constitutes a small subgraph, and the node aggregation graph structure is based on which multiple nodes with edge interconnections are aggregated into a super node;
[0052] 3.1. Construct a node-level knowledge mutual distillation learner. After the two graph neural networks established in step 1 are used to update the entity features of the knowledge graph, first dynamically determine which neural network outputs better node features, so as to realize the graph neural network knowledge mutual distillation at the node level. The process is as follows:
[0053] For the one-to-one corresponding layers selected from the first and second graph neural networks, traverse the entity node feature outputs of the layer, and calculate the cross entropy between the node features and the node true value labels for all entity node features;
[0054] Traverse all entity nodes. For each entity node, the node with a small cross entropy loss value is defined as the teacher node. Conversely, the node with a large cross entropy loss value is defined as the student node. The graph neural network containing the student node is the student network, and the graph neural network containing the teacher node is the teacher network.
[0055] The teacher node is used to realize the knowledge transfer of the student node. The expression is as follows:
[0056]
[0057]
[0058] in, The network node representing the first graph neural network is the teacher node, which realizes the knowledge transfer from the first graph neural network to the second graph neural network. KL(·) represents the calculation of the KL divergence of two vectors. i represents the feature of the i-th entity node. The network node representing the second graph neural network is the teacher node, which realizes the knowledge transfer from the second graph neural network to the first graph neural network. represents the feature output of the ith node of the lth layer of the first graph neural network, represents the feature output of the i-th node in the l-th layer of the second graph neural network, L CE (·) represents the cross entropy loss.
[0059] Perform node-level knowledge mutual distillation to achieve mutual update of node features of two graph neural networks. First, select the layers corresponding to the two graph neural networks and perform mutual update of node features of the graph neural networks between layers.
[0060] 3.2. Construct a graph-level knowledge mutual distillation learner. The process is as follows:
[0061] For the one-to-one corresponding layers selected from the first and second graph neural networks, all entity nodes of the layer are traversed, the subgraph structural similarity of all entity nodes is calculated, and subgraph structure-level knowledge mutual distillation is performed. The direction of graph structure-level knowledge mutual distillation is consistent with the direction of node-level knowledge mutual distillation, that is, when performing knowledge distillation, knowledge mutual distillation of node features and knowledge mutual distillation of node graph structure are performed simultaneously for a head node. The distillation direction depends on the cross entropy loss value of the corresponding node features.
[0062] For a knowledge graph entity, the entity connected to it is the tail entity, and the connection relationship is recorded as r. Each knowledge graph entity is usually connected to multiple tail entities to form a graph structure relationship. This graph structure also contains knowledge.
[0063] The graph structure-level knowledge mutual distillation learner in this step includes two graph structures: 1) node-connected subgraph structure, and 2) node aggregation graph structure.
[0064] 3.2.1. Knowledge mutual distillation graph learning based on node connection subgraph structure. The process is as follows:
[0065] Calculate the graph structure relationship between each knowledge graph entity node and its tail node respectively. The expression is as follows:
[0066]
[0067]
[0068] Similarly,
[0069]
[0070] Among them, N h Represents the set of neighboring nodes connected to the head node, including multiple head and tail entity triplets. Represents the head node feature of the lth layer of the first graph neural network, Represents the features of the tail node connected to the head node of the lth layer of the first graph neural network, represents the connection relationship vector, ψ 1 represents the structural coefficient of the head node h of the first graph neural network, ψ 2 represents the structural coefficient of the head node h of the second graph neural network, W r Represents the graph neural network feature mapping matrix, which is a random matrix that can be trained and initialized to random values. 1 , g 2 represents the node aggregation relationship function of the first graph neural network and the second graph neural network, and σ represents the nonlinear mapping function.
[0071] All entity nodes of the selected layer are subjected to subgraph structure-level knowledge mutual distillation, and a graph structure-level knowledge mutual distillation loss function is constructed. The specific formula is as follows:
[0072]
[0073]
[0074] Among them, KL(·) represents the calculation of KL divergence, Represents the graph structure-level knowledge mutual distillation loss from the first graph neural network entity node to the second graph neural network. Similarly, Represents the graph structure-level knowledge mutual distillation loss from the entity nodes of the second graph neural network to the entity nodes of the first graph neural network.
[0075] All nodes of graph structure-level knowledge distillation are traversed in turn, and the sum of subgraph structure distillation losses in two different directions, 1→2 (teacher network→student network) and 2→1 (student network→teacher network), is calculated. The graph learning method based on the node-connected subgraph structure can learn the fine-grained subgraph structure features at the node level.
[0076] 3.2. Knowledge mutual distillation graph learning based on node aggregation graph structure. The process is as follows:
[0077] For complex networks, the macroscopic subgraph structure is also very important. Based on this, we propose graph learning based on node aggregation and splitting graph structure: first, aggregate or split nodes with higher importance into super nodes to simplify the complexity of the graph, and then use formulas (6) to (8) in 4.1 to calculate the graph structure relationship between the entity node and its tail node of each knowledge graph node aggregated or split into a super node, and perform subgraph structure-level knowledge mutual distillation on all entity nodes of each knowledge graph node aggregated or split into a super node in the selected layer, and construct a graph structure-level knowledge mutual distillation loss function, refer to formulas (9) to (10). This achieves more effective graph structure representation and feature extraction, and improves the accuracy and efficiency of network analysis.
[0078] Step 4: Perform graph neural network training for graph structure-level knowledge mutual distillation. The process is as follows:
[0079] The graph structure dataset of the application scenario is used as a training sample to perform graph neural network training for graph structure-level knowledge mutual distillation. During the graph neural network training process, the first and second graph neural networks serve as a teacher network and a student network to each other, and node-level knowledge mutual distillation and graph structure-level knowledge mutual distillation are implemented for the one-to-one corresponding layers of the selected first and second graph neural networks; a graph structure-level knowledge mutual distillation loss function is constructed to obtain a trained graph neural network for application in the application scenario.
[0080] The relevant concepts involved in the technical solution of the present invention are introduced as follows:
[0081] 1) Node importance evaluation: For each node, in each iteration of training, whether the correct classification result can be obtained by using its features for classification, and the result is stored in the node verification memory, which only stores the classification results of each node in the last H times.
[0082] 2) Evaluate the importance of each node and calculate its importance score. The present invention reads the number of correct classifications of each node in the node verification memory as the node importance evaluation standard, sets a threshold M, and when a node is correctly classified > M times, it is proved that the node is an important node.
[0083] 3) Node aggregation: Statistics on the interconnection of important nodes. If a node is an important node and its neighbor is also an important node, then the area connected by multiple important nodes is called an important area. The present invention sets the number of nodes in the important area to N. When there are more than N important nodes interconnected, it is called an important area.
[0084] 4) Construct super nodes for important areas and aggregate the nodes in important areas into super nodes. For example, multiple nodes with edge interconnections can be aggregated into a representative node, called a super node. There are many ways to aggregate, such as averaging the features of all important regional nodes, randomly sampling R nodes in the region to find features, etc.
[0085] 5) Adjust the edges of the supernode: After the supernode is established, the original graph structure changes, and the edges connected to the supernode are adjusted. All the edges originally connected to the important regional nodes are connected to the supernode, that is, all the nodes around the important regional node are connected to the supernode.
[0086] 6) For each training, when the first graph neural network constructs a super node, the second graph neural network will also construct a super node according to the corresponding node aggregation method, and learn from the super nodes and super node structure of the first graph neural network. Similarly, when the second graph neural network constructs a super node, the first graph neural network will also construct a super node according to the corresponding node aggregation method, and learn from the super nodes and super node structure of the second graph neural network.
[0087] The two loss functions used in the present invention include aggregate consistency metric loss and mutual distillation loss.
[0088] Consistency metric loss L agg : Measures the consistency of the original node features within the super node to ensure that the aggregation does not lose too much information. The expression is as follows:
[0089]
[0090] Among them, S represents the geometry of the super node, F s Represents the characteristics of the super node, F v Represents the characteristics of the original node inside the super node.
[0091] Inter-distillation loss L distill :Promote knowledge exchange between two graph neural networks, especially in the structure and characteristics of super nodes, the expression is as follows:
[0092]
[0093] in, They represent the characteristics of the corresponding super nodes in the two networks respectively. and They represent the KL losses of super node features in two different directions: 1→2 and 2→1.
[0094] For the structural loss of super nodes, considering that there are two graph neural networks (GNN1 and GNN2) learning from each other, this loss function is used to promote the consistency between the corresponding super nodes in the two networks, thereby ensuring that the overall graph structure within the two super nodes remains consistent. The calculation process of the structural loss of the super node is as follows:
[0095] First, the node connection relationship is dynamically adjusted: for GNN1 and GNN2, within the super node, if a node is evaluated as a non-important node in the node importance evaluation stage, the node is disconnected from all other connected nodes, otherwise the connection relationship remains unchanged;
[0096] Next, after the connection relationship is dynamically adjusted, the adjacency matrix inside each super node in GNN1 and GNN2 is calculated, and the structural loss L of the super node is struct , the expression is as follows:
[0097] L struct =||A GNN1 -A GNN2 || F (13)
[0098] Among them, A GNN1 , A GNN2 Represents the adjacency matrix inside each super node in GNN1 and GNN2, respectively, ||.|| F Represents the Frobenius norm.
[0099] 7) Node split feature loss. The present invention also defines a split strategy for important or complex super nodes, thereby achieving macroscopic structural loss measurement between super nodes. The process of super node mutual learning is as follows:
[0100] 7.1) First, count the size of the super nodes of GNN1 and GNN2. When the size of the super nodes in GNN1 or GNN2 exceeds Q, split the super nodes. For example, split a super node into two parts, and then re-aggregate into two new super nodes. Repeat this process until the number of nodes in the split super node is less than T, then stop splitting;
[0101] 7.2) If the super nodes in GNN1 are split, GNN2 will also be split and combined in the corresponding way, so that GNN1 and GNN2 have the same super node combination; conversely, if the super nodes in GNN2 are split, GNN1 will also be split and combined in the corresponding way, so that GNN1 and GNN2 have the same super node combination.
[0102] The above is the process of super nodes learning from each other. 7.1) and 7.2) are independent processes.
[0103] 8) The purpose of splitting super nodes is to refine the representation of the graph so that it can capture complex structural information more accurately.
[0104] The present invention designs a mutual distillation loss based on node splitting features. Considering the mutual learning of two graph neural networks (GNN1 and GNN2), the mutual distillation loss of splitting super nodes should be included. The expression is as follows:
[0105]
[0106] D represents the set of all nodes after splitting. and Represents the features of the corresponding super nodes after splitting in GNN1 and GNN2. split Represents the node splitting feature loss.
[0107] Summary:
[0108] For the training of the first and second graph neural networks, the total loss function is recorded as:
[0109]
[0110]
[0111] Use L 1 , L 2 The loss function gradients of the first graph neural network and the second graph neural network are calculated, and gradient backpropagation training is performed. Represents the cross entropy loss function of all entity nodes of the first graph neural network.
[0112] As above, the process of training the graph neural network for graph structure-level knowledge mutual distillation of a batch of data is completed. The overall training process of the present invention is summarized again:
[0113] S1. Build a graph neural network training architecture based on graph structure-level knowledge mutual distillation, including the first and second graph neural networks;
[0114] S2, the one-to-one corresponding layers selected by the first and second graph neural networks, performing node-level knowledge mutual distillation and graph structure-level knowledge mutual distillation at the selected layers;
[0115] S3. Select a batch of training graph data, input it into the graph structure-level knowledge mutual distillation graph neural network, and obtain the node outputs of all input data in the layers selected by each graph neural network;
[0116] S4. For the one-to-one corresponding graph neural network layer, traverse all nodes in turn, calculate the migration direction of each node-level knowledge mutual distillation, and calculate the node-level knowledge mutual distillation loss;
[0117] S5. For the one-to-one corresponding graph neural network layer, traverse all nodes in turn, calculate the subgraph structure similarity of all nodes, and perform subgraph structure-level knowledge mutual distillation. The direction of distillation is consistent with the direction of node-level knowledge mutual distillation, that is, when performing knowledge distillation, for a head node, the knowledge distillation of node features and the knowledge mutual distillation of node graph structure are performed simultaneously. The distillation direction depends on the cross entropy loss value of the corresponding node features;
[0118] S6. Calculate the node-level knowledge mutual distillation loss, graph structure-level knowledge mutual distillation loss, and cross entropy loss of each node using formula (15) and formula (16);
[0119] S7. Combine the graph structure-level knowledge mutual distillation loss, the node-level knowledge mutual distillation loss, and the cross entropy loss of each node to obtain the total loss of the first and second graph neural networks to be trained, and use the loss function gradient descent method to train the graph neural network once;
[0120] S8. Randomly select new training graph data again, repeat steps 3 to 7, and iterate back and forth until the entire network loss function converges to a minimum value, completing the graph neural network training and saving the trained network parameters of all layers.
[0121] Use the trained graph neural network to extract knowledge and output better classification results for entity nodes.
[0122] In summary, the present invention realizes the fine-grained update of graph structure features; during the network training process, the two graph neural networks learn from each other, each taking its own strengths, and using the graph neural network nodes with strong capabilities and high precision to guide the other party's training, and the discriminative knowledge is mutually transferred between the two graph neural models and optimized together; the proposed training method realizes the end-to-end graph neural network training method. The process of graph neural network training for graph structure-level knowledge mutual distillation in the present invention is unique due to the uniqueness of the training mode adopted, and the present invention protects its training process: the same knowledge graph input is processed simultaneously by each graph neural network, and each graph neural network provides a different perspective for the same input data. In order to realize graph structure-level knowledge mutual distillation, the two graph neural networks serve as teacher networks and student networks for each other, and perform knowledge mutual distillation to provide each other with different perspective information.
[0123] Finally, it should be noted that the above content is only used to illustrate the technical solution of the present invention, rather than to limit the protection scope of the present invention. Any simple modification or equivalent substitution of the above technical solution does not deviate from the essence of the technical solution of the present invention and the scope of protection of the claims.
Claims
1. A graph neural network training method based on graph structure-level knowledge mutual distillation, It is characterized in that include: Construct a graph neural network training architecture that includes a parallel first and second graph neural networks; Implementing the selection of one-to-one corresponding layers of the first and second graph neural networks; Constructing a learner, respectively constructing a node-level knowledge mutual distillation learner and a graph structure-level knowledge mutual distillation learner for the first and second graph neural networks, wherein the graph structure-level knowledge mutual distillation learner is based on a node connection subgraph structure and a node aggregation graph structure, wherein the node connection subgraph structure is based on a small subgraph for each node and neighbor connection relationship, and the node aggregation graph structure is based on a plurality of edge-interconnected nodes aggregating into a super node; Perform graph neural network training for graph structure-level knowledge mutual distillation. During the graph neural network training process, the first and second graph neural networks serve as teacher networks and student networks for each other. For the selected layers of the first and second graph neural networks that correspond to each other, node-level knowledge mutual distillation and graph structure-level knowledge mutual distillation are implemented. A graph structure-level knowledge mutual distillation loss function is constructed to obtain a trained graph neural network that is applied to the scenario to be applied, specifically including the following processing: a. Select a batch of training graph data for the application scenario as training samples, input them into the graph neural network for graph structure-level knowledge mutual distillation, and complete the graph neural network training for graph structure-level knowledge mutual distillation of a batch of data, b. Obtain the node outputs of all input data in the layers selected by each graph neural network; c. Traverse all nodes in the one-to-one corresponding layer in turn, calculate the migration direction of each node-level knowledge mutual distillation, and calculate the node-level knowledge mutual distillation loss; Traverse all nodes in the one-to-one corresponding layer in turn, calculate the subgraph structural similarity of all nodes, and perform subgraph structure-level knowledge mutual distillation; d. Calculate the total training loss function of the first and second graph neural networks and the cross entropy loss of each node; f..Combining the graph structure-level knowledge mutual distillation loss, the node-level knowledge mutual distillation loss, and the cross entropy loss of each node, the total loss of the first and second graph neural networks to be trained is obtained, and the expression is as follows: Among them, L agg represents the consistency metric loss, L struct Represents the structural loss of the super node, represent, They represent the mutual distillation losses of the first graph neural network → the second graph neural network and the second graph neural network → the first graph neural network, respectively. Represents the graph structure-level knowledge mutual distillation loss from the first graph neural network entity node to the second graph neural network, They represent the graph structure-level knowledge mutual distillation loss from the entity nodes of the second graph neural network to the entity nodes of the first graph neural network, The network node representing the first graph neural network is the teacher node, The network node representing the second graph neural network is the teacher node, Represents the cross entropy loss function of all entity nodes of the first graph neural network, Represents the cross entropy loss function of all entity nodes of the first graph neural network; Use L 1 , L 2 Calculate the loss function gradient of the first graph neural network and the second graph neural network, and use the loss function gradient descent method to train the graph neural network once; g. Randomly select new training graph data again, repeat processes a to f, and iterate back and forth until the entire network loss function converges to a minimum value, completing the graph neural network training.
2. According to claim 1, a graph neural network training method based on graph structure-level knowledge mutual distillation, It is characterized in that If the first graph neural network and the second graph neural network have the same number of layers, all layers are selected to perform mutual update of the graph neural network node features in one-to-one corresponding layers; if the first graph neural network and the second graph neural network have different numbers of layers, one-to-one correspondence of the graph neural network layers is achieved after proportional layer extraction.
3. According to claim 1, a graph neural network training method based on graph structure-level knowledge mutual distillation, It is characterized in that For each entity node, the node with a small cross entropy loss value is defined as the teacher node, otherwise, the node with a large cross entropy loss value is defined as the student node. The graph neural network containing the student node is the student network, and the graph neural network containing the teacher node is the teacher network.
4. According to claim 1, a graph neural network training method based on graph structure level knowledge mutual distillation, It is characterized in that in, The knowledge transfer of the teacher node to the student node is realized by the following expression: in, The network node representing the first graph neural network is the teacher node, which realizes the knowledge transfer from the first graph neural network to the second graph neural network. KL(·) represents the calculation of the KL divergence of two vectors. i represents the feature of the i-th entity node. The network node representing the second graph neural network is the teacher node, which realizes the knowledge transfer from the second graph neural network to the first graph neural network. represents the feature output of the ith node of the lth layer of the first graph neural network, represents the feature output of the i-th node in the l-th layer of the second graph neural network, L CE (·) represents the cross entropy loss.
5. According to claim 1, a graph neural network training method based on graph structure level knowledge mutual distillation, It is characterized in that The specific formula of the graph structure level knowledge mutual distillation loss function is as follows: Among them, KL(·) represents the calculation of KL divergence, Represents the graph structure-level knowledge mutual distillation loss from the first graph neural network entity node to the second graph neural network. Similarly, Represents the graph structure-level knowledge mutual distillation loss from the entity nodes of the second graph neural network to the entity nodes of the first graph neural network.
6. A graph neural network training method based on graph structure-level knowledge mutual distillation according to claim 1, It is characterized in that in, The loss function of graph structure-level knowledge mutual distillation is as follows: Among them, KL(·) represents the calculation of KL divergence, Represents the graph structure-level knowledge mutual distillation loss from the first graph neural network entity node to the second graph neural network, Represents the graph structure-level knowledge mutual distillation loss from the entity nodes of the second graph neural network to the entity nodes of the first graph neural network.
7. According to claim 1, a graph neural network training method based on graph structure level knowledge mutual distillation, It is characterized in that in, Consistency metric loss L agg The expression is as follows: Among them, S represents the geometry of the super node, F s Represents the characteristics of the super node, F v Represents the characteristics of the original node inside the super node.
8. According to claim 1, a graph neural network training method based on graph structure level knowledge mutual distillation, It is characterized in that in, Inter-distillation loss L distill The expression is as follows: in, Represent the characteristics of the corresponding super nodes in the two networks, and They represent the KL losses of super node features in two different directions: 1→2 and 2→1.
9. According to claim 1, a graph neural network training method based on graph structure-level knowledge mutual distillation, It is characterized in that in, The structural loss L of the super node struct , the expression is as follows: L struct =||A GNN1 -A GNN2 || F Among them, A GNN1 , A GNN2 Represents the adjacency matrix inside each super node in GNN1 and GNN2, respectively, ||.|| F Represents the Frobenius norm. The mutual distillation loss of splitting super nodes is expressed as follows: Among them, D represents the set of all nodes after splitting, and represents the features of the super nodes after the corresponding split in the first and second graph neural networks, L split Represents the node splitting feature loss.
10. A graph neural network training device based on graph structure-level knowledge mutual distillation, include: A training architecture building module for a graph neural network training architecture including a first graph neural network and a second graph neural network in parallel; A learner construction module, used to construct a node-level knowledge mutual distillation learner and a graph structure-level knowledge mutual distillation learner for the first and second graph neural networks, respectively, wherein the graph structure-level knowledge mutual distillation learner further includes a graph structure-level knowledge mutual distillation learner based on a node connection subgraph structure and a node aggregation graph structure; the node connection subgraph structure is based on which each node and neighbor connection relationship constitutes a small subgraph, and the node aggregation graph structure is based on which multiple nodes with edge interconnections are aggregated into a super node; A selection module, used to select the one-to-one corresponding layers of the first and second graph neural networks; The graph neural network training module is used to perform graph neural network training for graph structure-level knowledge mutual distillation. During the graph neural network training process, the first and second graph neural networks serve as teacher networks and student networks respectively, and node-level knowledge mutual distillation and graph structure-level knowledge mutual distillation are implemented for the one-to-one corresponding layers of the selected first and second graph neural networks; a graph structure-level knowledge mutual distillation loss function is constructed to obtain a trained graph neural network for application in the scenario to be applied.
