Graph convolution network training method, graph data processing method, device and equipment
By clustering nodes in graph convolutional networks to enhance intra-cluster connectivity and reduce inter-cluster communication, the method addresses inefficiencies in training, leading to improved efficiency and reduced computational overhead.
Patent Information
- Authority / Receiving Office
- HK · HK
- Patent Type
- Applications
- Current Assignee / Owner
- CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD
- Filing Date
- 2026-05-09
- Publication Date
- 2026-07-17
AI Technical Summary
The training of graph convolutional networks is inefficient due to the large computational overhead and time required by the model, primarily caused by the sparsity and irregularity of graph data leading to frequent memory accesses and cross-cluster communication.
A method that clusters target nodes and source nodes to maximize intra-cluster connectivity and minimize inter-cluster connectivity, allowing for efficient reuse of feature information stored in cache and reducing redundant memory accesses and cross-cluster communication.
This approach improves training efficiency by minimizing redundant memory accesses and cross-cluster communication, resulting in faster output of results with reduced computational overhead.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
(19) State Intellectual Property Office (12) Invention Patent Application (10) Application Publication Number (43) Application Publication Date (21) Application Number 202411258965.0 (22) Application Date 2024.09.09 (71) Applicant Cloud Intelligent Asset Holdings (Singapore) Pte Ltd Address 51 Bras Basa Road, Singapore, Laizaanda Tower #03-06 (72) Inventors Wang Nan, Li Yangcheng, Ling Xingyu, Long Jiabei, Song Zhuoran, Liang Xiaoyao (74) Patent Agency Beijing Tongjun Law Firm 16037 Patent Attorney Huo Lili, Lü Dong (51) Int.Cl. G06N 3 / 08 (2023.01) G06N 3 / 063 (2023.01) G06N 3 / 042 (2023.01) G06N 3 / 0464 (2023.01) G06N 3 / 084(2023.01) G06N 3 / 0895(2023.01) (54) Invention Title: Graph Convolutional Network Training Method, Graph Data Processing Method, Apparatus and Device (57) Abstract: This application provides a graph convolutional network training method, graph data processing method, apparatus and device, applied in the field of graph data technology. The graph convolutional network training method includes: for any convolutional layer, determining multiple target nodes to be processed by the convolutional layer and the source nodes of each target node, where the target nodes are nodes whose feature information is to be updated; determining at least two center nodes from the multiple target nodes, where each center node corresponds to a cluster; assigning the remaining target nodes (excluding the center nodes) to the clusters that share the most common source nodes with the clusters, and assigning each source node to the clusters that share the most edges with the clusters, thus obtaining at least two clustered clusters; during training, reading the feature information of the nodes in the clusters according to the clusters corresponding to any convolutional layer and storing it in a cache, and obtaining the output result of the convolutional layer according to the feature information stored in the cache. This method can improve training efficiency. Claims 3 pages, Description 25 pages, Drawings 9 pages, CN 121638357 A 2026.03.10 CN 1 21 63 83 57 A 1. A graph convolutional network training method, characterized in that the graph convolutional network includes at least one convolutional layer for processing graph data, the graph data including multiple nodes and edges between nodes; the method includes: for any convolutional layer, determining multiple target nodes to be processed by the convolutional layer and the source nodes of each target node, the target node being a node to be updated with feature information, the source node being a node among the neighbor nodes of the target node used to update the feature information of the target node; determining at least two center nodes from the multiple target nodes, each center node corresponding to a cluster, and...The target nodes, excluding the central node, are assigned to the cluster that shares the most common source nodes with the cluster, and each source node is assigned to the cluster that shares the most edges with the cluster, resulting in at least two clustered clusters. During the training of the graph convolutional network, based on the clustered cluster corresponding to any convolutional layer, the feature information of the nodes in the clustered cluster is read and stored in a cache, and the output result of the convolutional layer is obtained based on the feature information stored in the cache. 2. The method according to claim 1, characterized in that, allocating the remaining target nodes (excluding the central node) among the plurality of target nodes to a cluster that shares the most common source nodes with the cluster comprises: determining at least one target node from the remaining target nodes (excluding the central node) among the plurality of target nodes; for any target node among the at least one target node, comparing the neighbor mask of the target node with the cluster mask of each cluster to determine the cluster that shares the most common source nodes with the target node, and allocating the target node to the determined cluster; the neighbor mask is used to characterize the source node of the target node, and the cluster mask is used to characterize the source node of the target node in the cluster; updating the cluster mask of the determined cluster according to the neighbor mask of the target node; if there are target nodes among the remaining target nodes (excluding the central node) that have not been allocated to a cluster, allocating the unallocated target nodes to the cluster in the same manner as the step of comparing the neighbor mask of the target node with the cluster mask of each cluster, until all remaining target nodes (excluding the central node) among the plurality of target nodes are allocated to the cluster. 3. The method according to claim 2, wherein the neighbor mask and the cluster mask are both represented by binary vectors, and the binary vectors are vectors with elements having zero or non-zero values; comparing the neighbor mask of the target node with the cluster masks of each cluster to determine the cluster that has the most common source nodes with the target node includes: for any cluster, performing a logical OR operation between the neighbor mask of the target node and the cluster mask of the cluster, and performing a logical XOR operation between the result of the logical OR operation and the cluster mask of the cluster to obtain a comparison result; based on the comparison results of the target node and each cluster, determining the cluster corresponding to the comparison result with the fewest non-zero value elements in each comparison result as the cluster that has the most common source nodes with the target node. 4. The method according to claim 3, wherein updating the cluster mask of the determined cluster based on the neighbor mask of the target node includes: performing a logical OR operation between the neighbor mask of the target node and the cluster mask of the determined cluster, and determining the result of the logical OR operation as the cluster mask of the determined cluster.5. The method according to claim 1, characterized in that determining at least two center nodes from the plurality of target nodes includes: determining the degree of each target node from the plurality of target nodes; Based on the degree of each target node, determining at least two target nodes with the highest degree in descending order as the at least two center nodes. 6. The method according to claim 1, characterized in that assigning each source node to the cluster with the most edges to the cluster includes: For any source node, calculating the number of edges connecting the source node to target nodes in each cluster based on the adjacency matrix corresponding to the convolutional layer, obtaining the number of edges between the source node and each cluster; Based on the number of edges between the source node and each cluster, assigning the source node to the cluster with the largest number of edges to the cluster. 7. The method according to claim 1, wherein when the number of convolutional layers is multiple, any one of the convolutional layers is the last convolutional layer, and after determining the cluster corresponding to the last convolutional layer, the method further includes: for the other convolutional layers besides the last convolutional layer, performing the following operations in reverse order: taking the source node of the convolutional layer following the current convolutional layer as the target node of the current convolutional layer, and the clustering result of the target node of the current convolutional layer inherits the clustering result of the source node of the convolutional layer following the current convolutional layer; assigning the source node of the current convolutional layer to the corresponding cluster to obtain the cluster corresponding to the current convolutional layer. 8. The method according to claim 1, characterized in that, based on the clustered cluster corresponding to any of the convolutional layers, reading the feature information of nodes in the clustered cluster and storing it in a cache, and obtaining the output result of the convolutional layer based on the feature information stored in the cache, includes: based on the clustered cluster corresponding to any of the convolutional layers, reading the feature information of nodes in the clustered cluster and storing it in a cache, determining the weight matrix and adjacency matrix to be calculated with the feature information; based on the training strategy of the graph convolutional network or the number of rows and columns of the adjacency matrix, determining the multiplication order of the feature information, the weight matrix and the adjacency matrix, and calculating the feature information, the weight matrix and the adjacency matrix according to the multiplication order to obtain the output result of the convolutional layer. 9. The method according to claim 8, characterized in that, during forward propagation, if the training strategy of the graph convolutional network is full-batch training, or if the training strategy is non-full-batch training and the number of rows of the adjacency matrix is greater than or equal to the number of columns, the multiplication order is: multiplying the feature information with the weight matrix, and multiplying the resulting product with the adjacency matrix; if the training strategy is non-full-batch training and the number of rows of the adjacency matrix is less than ....The adjacency matrix is multiplied with the feature information, and the resulting product is multiplied with the weight matrix. 10. The method according to claim 8, characterized in that, during backpropagation, if the training strategy of the graph convolutional network is full-batch training, or if the training strategy is non-full-batch training and the number of rows of the adjacency matrix is greater than or equal to the number of columns, the corresponding multiplication order when calculating the partial derivative of the weight matrix is: multiplying the partial derivative of the transpose of the adjacency matrix and the result matrix, and multiplying the resulting product with the transpose of the feature information, wherein the result matrix is the matrix obtained after multiplying the adjacency matrix, the feature information, and the weight matrix during forward propagation; when calculating the partial derivative of the feature information, the corresponding multiplication order is: multiplying the partial derivative of the transpose of the adjacency matrix and the result matrix, and multiplying the resulting product with the transpose of the weight matrix; if the training strategy is non-full-batch training and the number of rows of the adjacency matrix is less than the number of columns, the corresponding multiplication order when calculating the partial derivative of the weight matrix is: multiplying the partial derivative of the transpose of the feature information and the transpose of the adjacency matrix... (claim 2 / 3) Page 3 CN 121638357 A Multiplication operation, and multiplying the obtained product with the partial derivative of the result matrix; when calculating the partial derivative of the feature information, the corresponding multiplication order is: multiplying the partial derivative of the result matrix with the transpose of the weight matrix, and multiplying the obtained product with the transpose of the adjacency matrix. 11. A graph data processing method, characterized in that it includes: acquiring graph data to be processed; processing the graph data based on a graph convolutional network to obtain a corresponding processing result; wherein, the graph convolutional network is trained based on the method described in any one of claims 1-10. 12. A graph convolutional network training apparatus, characterized in that the graph convolutional network includes at least one convolutional layer for processing graph data, the graph data including multiple nodes and edges between nodes; the apparatus includes: a determination module, configured to, for any convolutional layer, determine multiple target nodes to be processed by the convolutional layer and the source nodes of each target node, the target node being a node to be updated with feature information, the source node being a node among the neighboring nodes of the target node used to update the feature information of the target node; and an allocation module, configured to determine at least two center nodes from the multiple target nodes, each center node corresponding to a cluster, allocate the remaining target nodes (excluding the center nodes) to the cluster with the most common source nodes with the cluster, and allocate each source node to the cluster with the most edges with the cluster, thereby obtaining at least two clustered clusters;A processing module is configured to, during the training process of the graph convolutional network, read feature information of nodes in the clustered clusters corresponding to any convolutional layer and store it in a cache, and obtain the output result of the convolutional layer based on the feature information stored in the cache. 13. An electronic device, characterized in that it comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the electronic device to perform the method as described in any one of claims 1-11. 14. A computer-readable storage medium, characterized in that the computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method as described in any one of claims 1-11. 15. A computer program product, characterized in that it comprises a computer program, which, when executed by a processor, implements the method as described in any one of claims 1-11. Claims 3 / 3 Page 4 CN 121638357 A Graph Convolutional Network Training Method, Graph Data Processing Method, Apparatus and Device Technical Field
[0001] This application relates to the field of graph data technology, and in particular to a graph convolutional network training method, graph data processing method, apparatus and device. Background Art
[0002] Graph Convolutional Network (GCN) is a deep learning model used to process graph data, and is one of the important models in the field of Graph Neural Network (GNN). Graph data can also be called graph structure data or graph. Before applying a graph convolutional network, some graph data as samples is needed to train the graph convolutional network.
[0003] When training a graph convolutional network, due to the structure and scale of the graph data itself, the model training time is long and the computational overhead is large, which leads to low training efficiency. Summary of the Invention
[0004] This application provides a graph convolutional network training method, graph data processing method, apparatus and device to improve the training efficiency of graph convolutional networks.
[0005] In a first aspect, embodiments of this application provide a graph convolutional network training method, the graph convolutional network including at least one convolutional layer for processing graph data, the graph data including multiple nodes and edges between nodes; the method includes:
[0006] For any convolutional layer, determining multiple target nodes to be processed by the convolutional layer and the source node of each target node, the target node being a node whose feature information is to be updated, and the source node of the target node being a node among the neighboring nodes of the target node used to update the feature information of the target node;
[0007] From the plurality of target nodes, at least two central nodes are determined, each central node corresponds to a cluster, and the remaining target nodes other than the central nodes are assigned to the clusters that share the most source nodes with the clusters, and each source node is assigned to the clusters that share the most edges with the clusters, thus obtaining at least two clustered clusters;
[0008] During the training process of the graph convolutional network, according to the clustered clusters corresponding to any convolutional layer, the feature information of the nodes in the clustered clusters is read and stored in a cache, and the output result of the convolutional layer is obtained according to the feature information stored in the cache.
[0009] In a second aspect, embodiments of this application provide a graph data processing method, including:
[0010] obtaining graph data to be processed;
[0011] processing the graph data based on a graph convolutional network to obtain a corresponding processing result; wherein, the graph convolutional network is trained by the graph convolutional network training method of the first aspect.
[0012] In a third aspect, embodiments of this application provide a graph convolutional network training apparatus, the graph convolutional network including at least one convolutional layer for processing graph data, the graph data including multiple nodes and edges between nodes; the apparatus includes:
[0013] a determining module, configured to, for any convolutional layer, determine multiple target nodes to be processed by the convolutional layer as specified in the specification 1 / 25 page 5 CN 121638357 A and the source nodes of each target node, the target node being a node to be updated with feature information, the source node being a node among the neighboring nodes of the target node used to update the feature information of the target node;
[0014] an allocation module, configured to determine at least two center nodes from the multiple target nodes, each center node corresponding to a cluster, allocate the remaining target nodes other than the center nodes to the clusters that have the most common source nodes with the clusters, and allocate each source node to the clusters that have the most edges with the clusters, to obtain at least two clustered clusters;
[0015] A processing module is configured to, during the training process of the graph convolutional network, read the feature information of nodes in the clustered cluster corresponding to any convolutional layer and store it in a cache, and obtain the output result of the convolutional layer based on the feature information stored in the cache.
[0016] In a fourth aspect, embodiments of this application provide an electronic device, including:
[0017] at least one processor; and
[0018] a memory communicatively connected to the at least one processor;
[0019] wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the electronic device to perform the method described in any of the above aspects.
[0020] Fifthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method described in any of the above aspects.
[0021] Sixthly, embodiments of this application provide a computer program product, including a computer program, which, when executed by a processor, implements the method described in any of the above aspects.
[0022] The graph convolutional network training method, graph data processing method, apparatus, and device provided in embodiments of this application, for any convolutional layer of a graph convolutional network, can initialize and construct at least two clusters by determining at least two center nodes among multiple target nodes, assigning the remaining target nodes (excluding the center nodes) among multiple target nodes to the cluster with the most common source nodes with the cluster, and assigning each source node to the cluster with the most edges with the cluster, thereby clustering at least two clustered clusters. Based on this, clustering was performed on the target nodes and each source node using clustering methods that maximize intra-cluster connectivity and minimize inter-cluster connectivity, respectively. This ensures that target nodes within the same cluster share the most common source nodes, while different clusters share the fewest common source nodes. Thus, when updating target nodes within the same clustered cluster, the feature information of common source nodes can be reused to the maximum extent. This means that feature information already stored in the cache can be called up more frequently, reducing the number of times feature information is read from memory or other storage media and written back to the cache. This reduces redundant memory accesses, data transmission volume, and the frequency of cross-cluster communication. This method can quickly obtain multiple optimally allocated clusters with less computational overhead, allowing the graph convolutional network to avoid redundant memory accesses and cross-cluster communication during training, efficiently outputting results, and thus improving the training efficiency of the graph convolutional network.
[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0024] Figure 1 is a schematic diagram of graph convolutional network processing graph data provided in an embodiment of this application;
[0025] Figure 2 is a flowchart of a graph convolutional network training method provided in an embodiment of this application;
[0026] Figure 3 is one of the training efficiency comparison diagrams provided in an embodiment of this application; Specification 2 / 25 pages 6 CN 121638357 A
[0027] Figure 4 is another training efficiency comparison diagram provided in an embodiment of this application;
[0028] Figure 5 is a schematic diagram of an adjacency matrix provided in an embodiment of this application;
[0029] Figure 6 is a schematic diagram of full-batch training provided in an embodiment of this application;
[0030] Figure 7 is one of the schematic diagrams of non-full-batch training provided in an embodiment of this application;
[0031] Figure 8 is a schematic diagram of non-full-batch training provided in an embodiment of this application;
[0032] Figure 9 is a schematic diagram of the data flow of multi-PE parallel computing provided in an embodiment of this application;
[0033] Figure 10 is a schematic diagram of the block memory access data flow provided in an embodiment of this application;
[0034] Figure 11 is a schematic diagram of block conflict provided in an embodiment of this application;
[0035] Figure 12 is a schematic diagram of a block conflict elimination mechanism provided in an embodiment of this application;
[0036] Figure 13 is a schematic diagram of a block conflict elimination mechanism provided in an embodiment of this application;
[0037] Figure 14 is a schematic diagram of a block conflict elimination mechanism provided in an embodiment of this application;
[0038] Figure 15 is a schematic diagram of offline rearrangement provided in an embodiment of this application;
[0039] Figure 16 is a schematic diagram of the rearrangement hardware device connection provided in an embodiment of this application;
[0040] Figure 17 is a flowchart of a graph data processing method provided in an embodiment of this application;
[0041] Figure 18 is a structural schematic diagram of an electronic device provided in an embodiment of this application.
[0042] The above-described embodiments of this application have been clearly illustrated by the accompanying drawings, which will be described in more detail below. These drawings and textual descriptions are not intended to limit the scope of the concept of this application in any way, but rather to illustrate the concept of this application to those skilled in the art by referring to specific embodiments. Detailed Description
[0043] Exemplary embodiments will be described in detail here, examples of which are illustrated in the accompanying drawings. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.
[0044] It should be noted that the user information (including but not limited to user device information, user attribute information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards, and provide corresponding operation entry points for users to choose to authorize or refuse.
[0045] Graph data includes nodes and edges. Nodes represent objects, and edges represent the relationships between them. The goal of GCN is to learn the complex relationships between nodes in the graph and to perform tasks such as node classification and node representation learning on the graph. The design of GCN is inspired by the structure of graphs and local neighborhood information, enabling it to effectively capture the complex relationships between nodes in a graph. The basic idea of GCN is to learn information from the graph by iteratively updating the representations of nodes. Each node aggregates information from its neighbors to update its own representation; a node's neighbors are other nodes directly connected to it by edges. If two nodes have an edge, they are neighbors of each other; a node and all its neighbors constitute its neighborhood. The process of aggregating neighbor information for information transmission can be achieved through a hierarchical neural network structure.The structure is implemented by updating the node representation locally in each layer. The node representation or node information can be understood as information used to represent the features of the node, such as the feature information of the node.
[0046] The graph convolutional layer in GCN performs convolution operations in the neighborhood of each node, thereby integrating the information of the neighboring nodes. The graph convolutional layer in GCN can also be simply referred to as the convolutional layer. The core operations of GCN include aggregating the information of neighboring nodes and updating the node representation. This enables GCN to capture the semantic and structural information of nodes in the structure of graph data, and is applicable to various fields such as social networks, molecular structures, and recommendation systems. In general, graph convolutional networks are a powerful deep learning model suitable for processing graph structure data. By learning the relationships between nodes and local structural information, it can effectively solve many practical problems.
[0047] Figure 1 is a schematic diagram of the graph convolutional network processing graph data provided in the embodiment of this application. As shown in Figure 1, each dot represents a node, and the line segment connecting two dots represents the edge connecting the two nodes. For example, in the graph data of a social network, a node can represent a social member in the social network, and an edge between two nodes can represent a social relationship between the two social members. As another example, in the graph data of a product recommendation system, a node can represent a user or a product in the recommendation system, and an edge between two nodes can represent a relationship between users or between products.
[0048] As shown in the aggregation stage in Figure 1, the black nodes represent nodes whose node information needs to be updated, i.e., destination nodes. Other nodes directly connected to the destination node are its neighbor nodes. By aggregating the information of neighbor nodes, the information of the destination node can be updated, i.e., the convolution operation is implemented. Hidden layers are network layers in a graph convolutional network that process graph data. Hidden layers include linear transformation layers, normalization layers, and pooling layers, etc. A graph convolutional network can include one or more hidden layers. The information of each node after the convolution operation is combined and processed through a linear rectified function (ReLU), and the processed graph data is input into the hidden layers for further processing. The graph data output after the hidden layer processing can trigger the specific task module to solve the actual problem, and output the output result after the graph data has been processed by the graph convolutional network. This result is used to solve the problem in the actual application scenario.
[0049] For example, graph data has sparsity and irregularity, which are determined by the nature of graph structure.Graph data is typically sparse, meaning that the number of actual edges in a graph is much smaller than the number of edges if all nodes in the graph had edges. In a large-scale network, most nodes do not have edges between them, so the adjacency matrix of a graph is often a sparse matrix. This makes it necessary to consider how to efficiently represent and manipulate these sparse structures when storing and processing graph data to avoid wasting storage and computing resources. The adjacency matrix can be a matrix used to represent the edges between nodes in the graph data. For example, the rows and columns of the adjacency matrix represent each node in turn. If there is no edge between two nodes, the elements in the corresponding rows and columns of these two nodes are zero. If there is an edge between two nodes, the elements in the corresponding rows and columns of these two nodes are non-zero. An element with a value of zero is a zero element, and an element with a value of non-zero is a non-zero element.
[0050] The irregularity of graph data is manifested in the fact that the connection between nodes may be arbitrary, unlike a regular grid structure. The degree (i.e., the number of edges of a node) of different nodes may vary greatly. Some nodes may have very few neighboring nodes, resulting in a low degree, while some nodes may have a large number of neighboring nodes, resulting in a high degree. Due to the irregular connection relationships between nodes in graph data, the structure of graph data is irregular. Due to the irregular structure of many graph data, algorithms or models for processing arbitrary graph data cannot be simply designed based on regular graphs.
[0051] Due to the complex connection relationships between nodes and the sparsity of edges, graph data will have irregularity and sparsity. Therefore, during the training process of graph convolutional networks, repeated memory access and cross-cluster communication will occur. Repeated memory access and cross-cluster communication will increase the consumption of computing resources and the training time required, which will lead to a decrease in the training efficiency of graph convolutional networks.
[0052] In graph convolutional networks, the information update of a node depends on the information of its neighboring nodes. This means that when calculating new information for each node, it is necessary to access the information of at least some of the node's neighboring nodes. Due to the sparsity and irregularity of graph data, some nodes may have many neighboring nodes, while some nodes may have only a few neighboring nodes. This uneven distribution of neighbor nodes can lead to a large number of duplicate memory accesses. (Page 4 / 25, CN 121638357 A)
[0053] For example, when updating node information, multiple target nodes are usually updated in batches. During the update, the information of each target node's neighbor nodes is accessed from memory and cached in a cache area for update operations. If multiple target nodes in the same batch share some common neighbor nodes, then during the update operation, the information of the common neighbor nodes can be directly called from the cache area to update multiple target nodes; if each target node...If nodes do not share common neighbor nodes, the neighbor nodes in the cache cannot be reused, resulting in unnecessary duplicate memory accesses during the next parallel update. During duplicate memory accesses, memory accesses are frequent, and the cache also needs to be frequently deleted and stored for newly read data. All of these will increase the overhead of computing resources, prolong the operation time, and reduce the efficiency of training graph convolutional networks. It can be seen that if multiple target nodes updated in the same batch can share more node information, the frequency of memory access can be reduced, the overhead of computing resources can be reduced, the training time can be shortened, and the training efficiency can be improved.
[0054] Some graph data may have a large amount of data. When processing large-scale graph data, it needs to be completed in a distributed computing environment. In a distributed environment, the computation of graph convolutional networks usually needs to be performed across multiple computing nodes. A computing node can be understood as a computing device in a distributed environment. A single computing node generally cannot accommodate the entire graph data. Due to the distributed data operation method, the graph data needs to be distributed across multiple computing nodes, so that each node only processes a part of the graph. However, due to the sparsity and irregularity of the graph, when updating the target node, some or all of the neighboring nodes of some target nodes may be on other computing nodes. Therefore, when computing graph convolution, it is necessary to obtain the information of neighboring nodes from other computing nodes, that is, cross-cluster communication occurs. The overhead of cross-cluster communication is usually greater than the overhead of memory access. Therefore, frequent cross-cluster communication will cause network bandwidth bottlenecks, increase computing latency, and reduce training efficiency. It can be seen that by reasonably distributing the graph data, making the connection between nodes on the same computing node close and making the connection between nodes on different computing nodes as small as possible, the frequency of cross-cluster communication can be reduced, thereby reducing computing overhead and time consumption, and thus improving training efficiency.
[0055] Considering that if the graph partitioning (METIS) algorithm is used to segment the graph data, although the entire graph can be divided into multiple graph tiles, the METIS algorithm needs to traverse the entire graph multiple times, which has a large computing overhead and may further exacerbate the reduction in training efficiency. Specifically, when the METIS algorithm partitions a graph, it first simplifies the graph by merging some nodes in the graph data multiple times, reducing the original graph to a small-scale graph with fewer nodes. Then, this small-scale graph needs to be divided into patches. After dividing into multiple patches, the size of each patch needs to be gradually increased to restore the nodes to their original state. Throughout this process, the nodes and edges in the entire graph data need to be read multiple times, resulting in significant computational overhead. Therefore, graph partitioning based on existing methods is insufficient to meet the requirements of efficient training.
[0056] In view of this, to effectively improve the training efficiency of graph convolutional networks, this application provides a graph convolutional network training method. For any convolutional layer of the graph convolutional network, at least two intermediate nodes are determined from multiple target nodes.The core node can initialize and construct at least two clusters. The remaining target nodes (excluding the core node) are assigned to the cluster with the most shared source nodes, and each source node is assigned to the cluster with the most edges. This results in at least two clustered clusters. Based on this, for the target nodes and their neighboring nodes used for updating the target node's feature information (i.e., each source node), clustering is used. By calculating the number of shared source nodes between the target node and the cluster, the target nodes can be quickly assigned to clusters. This ensures that target nodes within the same cluster share the most common source nodes, maximizing the sharing of source node feature information during target node updates. Furthermore, based on the number of edges between the source node and the cluster, each source node can be quickly assigned to the cluster with the most edges, minimizing connections between clusters while maximizing the sharing of source node feature information, thus reducing the frequency of cross-cluster communication. Therefore, this method can quickly obtain multiple optimized clusters with less computational overhead. During the training process of the graph convolutional network, based on the clusters corresponding to the convolutional layers (page 5 / 25, CN 121638357 A), the feature information of nodes in the clusters is read and stored in the cache. When updating the target nodes based on the feature information stored in the cache, repeated memory accesses, data transmission volume of electronic devices, and cross-cluster communication can be reduced, and the output results of the convolutional layers can be obtained quickly, thereby improving the training efficiency of the graph convolutional network.
[0057] Figure 2 is a flowchart illustrating a graph convolutional network training method provided in an embodiment of this application. The method of this embodiment can be implemented on electronic devices with corresponding information processing functions, such as computers, servers, or server clusters. When implementing this method on electronic devices, it can be implemented in the cloud, locally deployed, on a client, or implemented using Internet of Things (IoT) devices. Graph convolutional networks include at least one convolutional layer for processing graph data, which includes multiple nodes and edges between nodes, as shown in Figure 2. The method may include:
[0058] Step 201: For any convolutional layer, determine multiple target nodes to be processed by the convolutional layer and the source nodes of each target node. The target node is the node whose feature information is to be updated, and the source node is the node among the target node's neighboring nodes used to update the target node's feature information.
[0059] For example, the convolutional layer can be a network layer performing convolution operations. A graph convolutional network may include one or more convolutional layers. Each convolutional layer updates the feature information of nodes through convolution operations. The convolution operation process may also be...This can be understood as the process of aggregating feature information. If multiple convolutional layers are included, the network parameters of each convolutional layer can be the same or different, and the target nodes corresponding to each convolutional layer can be the same or different.
[0060] The feature information of a node can be understood as information used to describe the attributes, properties, or other related features of a node. The feature information of a node can be in various forms, such as numbers, vectors, or matrices. The features described by the feature information can depend on the scenario or domain from which the graph data originates. For example, in graph data from a user's social network, nodes represent users, and the feature information of a node can be a feature matrix used to describe information such as the user's age, gender, interests, and geographical location.
[0061] For example, the graph data includes multiple nodes. For any convolutional layer, the node whose feature information is to be updated by performing convolution operations through that convolutional layer can be understood as the target node in that convolutional layer. In some convolutional layers, all nodes in the graph data can be target nodes in that convolutional layer; in some convolutional layers, some nodes in the graph data are target nodes in that convolutional layer. Whether all or some nodes are target nodes can be set according to the actual application scenario of the convolutional layer. For example, in some scenarios, considering all nodes as target nodes would require too much training overhead. Therefore, all nodes can be trained in batches, with each batch containing a portion of nodes trained as target nodes. The sum of the target nodes trained in all batches is the total number of nodes in the graph data.
[0062] Among the neighboring nodes of the target node, the node used to update the feature information of the target node is the source node. It can be understood that the source node is the neighboring node sampled by the target node during the aggregation process. When the feature information of the neighboring nodes is aggregated in the convolutional layer to update the feature information of the target node, it can be updated by aggregating the feature information of all neighboring nodes or by aggregating the feature information of a portion of the neighboring nodes. This can depend on the settings of the convolutional layer. For example, if the length of the edge between nodes represents the strength of the relationship between nodes, the longer the edge, the weaker the relationship, and the shorter the edge, the stronger the relationship; assuming that the edge length is used as the basis for sampling each neighboring node, the neighboring node with an edge length less than the preset edge length can be determined as the source node.
[0063] For example, after determining multiple target nodes to be processed, the source node of the target node can be determined according to the sampling strategy of the target node. For example, for any target node to be processed, if the sampling strategy is full sampling, then all neighboring nodes of the target node can be determined as source nodes; if the sampling strategy is partial sampling at a preset proportion, then a preset proportion of the target node's neighboring nodes can be randomly determined as source nodes; or see page 6 / 25 of the specification, 10 CN 121638357 A.The source node of the target node is determined according to at least one of the following conditions: sorting of neighboring nodes based on feature information, sorting based on the length of the edge with the target node, etc., according to a preset ratio or a preset number. For example, the difference between the feature information of each neighboring node and the feature information of the target node is calculated according to the feature information of each neighboring node, and the preset number of neighboring nodes with larger differences are determined as the source nodes of the target node. Another example is that the lengths of the edges between each neighboring node and the target node are sorted in ascending order, and the preset number of neighboring nodes with the largest differences are determined as the source nodes of the target node.
[0064] It is understood that due to different methods of determining the target node, neighboring node sampling strategies, etc., the time and computing resources consumed in determining multiple target nodes to be processed and the source nodes of each target node are different, which will lead to a deviation in the comparison and evaluation of training efficiency. Therefore, the consumption factors of this part can be aligned first in order to more accurately evaluate the training efficiency.
[0065] Step 202: Determine at least two center nodes from multiple target nodes. Each center node corresponds to a cluster. Assign the remaining target nodes (excluding the center nodes) to the clusters that share the most source nodes with the clusters. Assign each source node to the cluster that shares the most edges with the clusters, thus obtaining at least two clustered clusters.
[0066] Here, the center node can be understood as the cluster center of the cluster. Each cluster corresponds to one cluster center, that is, each cluster corresponds to one center node. The center node can also be understood as the first target node added to the cluster after the initial cluster is established.
[0067] For example, when determining at least two center nodes from multiple target nodes, a preset or random number of target nodes can be randomly determined as at least two center nodes from all target nodes. In some application scenarios, at least two center nodes can be determined from all target nodes according to a preset strategy. For example, the preset strategy is to divide the graph into local regions according to the overall structure of the graph, and obtain at least two local regions; for any local region, a target node determined in the local region is determined as a center node; based on this, at least two center nodes can be determined.
[0068] The remaining target nodes among the multiple target nodes other than the center node are the target nodes among the multiple target nodes to be processed that have not been determined as center nodes. For each target node among the remaining target nodes other than the center node, the number of source nodes that the target node has in common with each cluster can be determined first, and then the numbers can be compared, and the target node can be assigned to the cluster with the largest number. Among them, the common source node can be understood as the source node that is the same as all the source nodes of the target node to be assigned and all the source nodes of all target nodes in the cluster.
[0069] For example, there are three clusters: cluster 1, cluster 2, and cluster 3. A target node to be assigned is target node a, and its source nodes are nodes b, c, and d. In cluster 1, all source nodes for all target nodes are nodes b, c, d, and e. Therefore, the common source nodes for target node a and cluster 1 are nodes b, c, and d, resulting in a total of 3 common source nodes. In cluster 2, all source nodes for all target nodes are nodes b, c, e, f, and g. Therefore, the common source nodes for target node a and cluster 2 are nodes b and c, resulting in a total of 2 common source nodes. In cluster 3, all source nodes for all target nodes are nodes d, e, and h. Therefore, the common source node for target node a and cluster 3 is node d, resulting in a total of 1 common source node. Based on this, target node a can be assigned to cluster 1, which has the most common source nodes with cluster 1.
[0070] After allocating the remaining target nodes (excluding the central node) from multiple target nodes to the corresponding clusters, each cluster has at least one target node, including the central node, and each target node is connected to one or more source nodes. For any source node and any cluster, the edge between the source node and the cluster can be understood as all edges between the source node and all target nodes in the cluster. When allocating a source node to the cluster with the most edges connected to it, the number of edges between the source node and the cluster can be determined first, then the numbers can be compared, and the source node can be allocated to the cluster with the most edges connected to it.
[0071] For example, after allocating the remaining target nodes (excluding the central node) from multiple target nodes to clusters 1, 2, and 3, the number of target nodes in each cluster may increase. Therefore, for a certain source node x, source node x may have edges connected to multiple target nodes in a cluster. Assuming that source node x has edges connecting to 5 target nodes in cluster 1, then the number of edges between source node x and cluster 1 is 5; source node x has edges connecting to 3 target nodes in cluster 2, then the number of edges between source node x and cluster 2 is 3; source node x has no edges connecting to target nodes in cluster 3, then the number of edges between source node x and cluster 3 is 0; based on this, source node x can be assigned to cluster 1, which has the most edges with clusters.
[0072] Through the above allocation of the remaining target nodes (excluding the central node) and each source node among multiple target nodes, at least two clusters can be obtained, and each cluster has many common source nodes among its target nodes. This allows for maximizing the sharing of source node feature information in the on-chip cache during convolution operations, reducing...The number of frequent accesses in memory is reduced; the source node is assigned to the cluster with the most edges with the cluster, so the source node is closely connected to the target node in the assigned cluster and sparsely connected to the target node in other clusters. Therefore, there are fewer connections between clusters, which can reduce the frequency of cross-cluster communication and save cross-cluster communication overhead and training time for training graph convolutional networks.
[0073] Step 203: During the training process of graph convolutional networks, according to the clusters corresponding to any convolutional layer, the feature information of the nodes in the clusters is read and stored in the cache, and the output result of the convolutional layer is obtained according to the feature information stored in the cache.
[0074] For example, through the above steps 201 and 202, the target nodes and source nodes in the graph data corresponding to the convolutional layer can be clustered to obtain at least two clusters corresponding to the convolutional layer. When performing convolution operations, the convolutional layer can read the feature information of nodes in each cluster in batches and store it in the cache. Based on the feature information stored in the cache, the feature information of the target nodes in the cluster is updated. Once the feature information of all target nodes in each cluster has been updated, the convolutional layer can output its output.
[0075] It is understood that the feature information of all nodes in the graph data can be pre-stored in the memory, hard disk, or other storage media of the electronic device. After obtaining the clusters, the feature information of all target nodes and all source nodes in the same cluster can be read from the storage medium and stored in the cache, such as the on-chip cache of the processor of the electronic device. Since clusters with the same number of common source nodes have the most common source nodes, storing the feature information of each node in the same cluster in the cache can reduce the reading and caching of unused feature information compared to clusters that are not clustered or do not maximize common source nodes. This avoids the need to access memory again to read and write to the cache when the required feature information is not in the cache, thus reducing repeated memory accesses, reducing data transmission volume, reducing the computational load of electronic devices, and improving training efficiency.
[0076] Figure 3 is one of the training efficiency comparison diagrams provided in the embodiments of this application, and Figure 4 is another training efficiency comparison diagram provided in the embodiments of this application. In order to more intuitively illustrate the target node and the source node, in Figures 3 and 4, the direction of the arrow on the edge is the direction from the source node to the target node, that is, the node pointed to by the arrow is the target node, and the node at the source end of the arrow is the source node. It should be noted that the node in the dashed circle represents the unsampled neighbor node.
[0077] As shown in Figure 3, if the target nodes v1, v2, v3, and v4 are not clustered according to the steps described above in this embodiment, v1 and v2 may be updated in the same batch as a single patch A1.1, and v3 and v4 may be updated as a separate patch. (See page 8 / 25 of the manual, 12 CN)Block A2.1 (121638357) undergoes feature information updates in the same batch. It can be seen that when updating block A1.1, it is necessary to access and cache the source nodes v5 to v8 of v1 and the source nodes v8 to v11 of v2. Only the feature information of source node v8 can be reused twice in the on-chip cache; the feature information of other source nodes is used only once. Similarly, when updating block A2.1, it is necessary to access and cache the source nodes v9 to v12 of v3 and the source nodes v6 to v9 of v4. Only the feature information of source node v9 can be reused twice in the on-chip cache; the feature information of other source nodes is used only once. Based on the above, it can be seen that multiple memory accesses are required during the update process.
[0078] As shown in Figure 4, if the target nodes v1, v2, v3, and v4 are clustered according to the steps described above in this embodiment, specifically, from the target nodes v1, v2, v3, and v4, target node v1 can be determined as the central node corresponding to cluster 1, and target node v2 can be determined as the central node corresponding to cluster 2. Then, target nodes v3 and v4 are assigned to the clusters that share the most common source nodes with the clusters. Cluster 1 includes target node v1, and the source nodes of target node v1 are v5, v6, v7, and v8, so the source nodes of cluster 1 are v5, v6, v7, and v8; Cluster 2 includes target node v2, and the source nodes of target node v2 are v8, v9, v10, and v11, so the source nodes of cluster 2 are v8, v9, v10, and v11. The source nodes of target node v3 are v9, v10, v11, and v12. Target node v3 does not share any source nodes with cluster 1. Target node v3 shares source nodes v9, v10, and v11 with cluster 2, having three shared source nodes. Therefore, target node v3 can be assigned to cluster 2. The source nodes of target node v4 are v6, v7, v8, and v9. Target node v4 shares source nodes v6, v7, and v8 with cluster 1, having three shared source nodes. Target node v4 shares source nodes v8 and v9 with cluster 2, having two shared source nodes. Therefore, target node v4 can be assigned to cluster 1.
[0079] v1 and v4, which share the most common source nodes, are clustered into one cluster, represented by tile A1.1. During updates, the feature information of v1 and v4 is updated in the same batch. Similarly, v2 and v3, which share the most common source nodes, are clustered into one cluster, represented by tile A2.1. During updates, the feature information of v2 and v3 is updated in the same batch. It can be seen that when updating tile A1.1, it is only necessary to access and cache the source nodes v5 to v8 of v1 and the source nodes v6 to v9 of v4. The feature information of source nodes v6, v7, and v8 can be reused twice in the on-chip cache, and the number of shareable source nodes is clearly defined.The number of source nodes v8 to v11 of v2 and v9 to v12 of v3 needs to be accessed and cached. The feature information of source nodes v9, v10 and v11 can be reused twice in the on-chip cache, and the number of source nodes that can be shared is also significantly increased. Based on the above, it can be seen that after obtaining the cluster by adopting the above method, the feature information of the nodes in the clustered cluster can be read, which can reduce the number of feature information that needs to be read when updating each batch, thus reducing the number of repeated memory accesses and saving computational resources and training time.
[0080] In Figures 3 and 4, matrix A can represent the adjacency matrix of the target node and the source node, and matrix B can represent the feature information matrix of the source node. Through matrix operations of matrix A and matrix B, the result of the operation can be obtained as 0, then the result 01.1 corresponds to the target node A1.1 and the result 02.1 corresponds to the source node A2.1. By training graph convolutional networks using this method, GCN training can be performed on a cluster basis, merging repeated accesses to source nodes v6, v7, v10, and v11, and allocating target nodes sharing source nodes to the same cluster, thereby optimizing data locality, reducing memory access redundancy, and improving training efficiency.
[0081] For example, in a distributed computing environment, a computing node can be responsible for updating target nodes in one or more clusters. When a computing node is responsible for updating target nodes in multiple clusters, it can be updating multiple clusters with relatively close inter-cluster connections. For example, multiple clusters with a large number of edges are multiple clusters with relatively close inter-cluster connections.
[0082] The graph convolutional network training method provided in this embodiment can initialize and construct at least two clusters for any convolutional layer of the graph convolutional network by determining at least two central nodes among multiple target nodes. The remaining target nodes, excluding the central nodes, are assigned to the cluster with the most common source nodes with the cluster, and each source node is assigned to the cluster with the most edges with the cluster. At least two clustered clusters can be formed. Based on this, clustering was performed on the target nodes and each source node using clustering methods that maximize intra-cluster connectivity and minimize inter-cluster connectivity, respectively. This ensures that target nodes within the same cluster share the most common source nodes, while different clusters share the fewest common source nodes. This maximizes the reuse of common source node feature information when updating target nodes within the same clustered cluster. Specifically, it allows for more frequent reuse of feature information already stored in the cache, reducing the number of times feature information is read from memory or other storage media and written back to the cache. This reduces redundant memory accesses, data transfer volume, and the frequency of cross-cluster communication. This method can achieve faster processing with less computational overhead.Multiple optimally allocated clusters are quickly obtained, allowing the graph convolutional network to avoid repeated memory accesses and cross-cluster communication during training, and efficiently output results, thereby improving the training efficiency of the graph convolutional network.
[0083] Since clustering only requires calculating the number of common source nodes and the number of edges between source nodes and each cluster, the clustering method in this embodiment is a lightweight two-stage dynamic clustering mechanism compared to existing graph partitioning methods such as graph decomposition. Lightweight means that the computational overhead is small. Under the premise of small computational overhead, by maximizing intra-cluster connectivity and minimizing inter-cluster connectivity, target nodes that share more source nodes are allocated to the same cluster, achieving efficient intra-cluster processing, reducing memory access redundancy and cross-cluster communication, and significantly improving the training efficiency and data locality of the graph convolutional network. This mechanism is not only applicable to mini-batch GCN training acceleration, but also to full-batch GCN training acceleration, where mini-batch is not full-batch.
[0084] In some embodiments, when allocating the remaining target nodes (excluding the central node) among a plurality of target nodes to the cluster that shares the most common source nodes with the cluster, this can be specifically implemented in the following manner:
[0085] Determine at least one target node from the remaining target nodes (excluding the central node) among the plurality of target nodes. For any target node among the at least one target node, compare the neighbor mask of the target node with the cluster mask of each cluster to determine the cluster that shares the most common source nodes with the target node, and allocate the target node to the determined cluster. The neighbor mask is used to characterize the source node of the target node, and the cluster mask is used to characterize the source node of the target node in the cluster. Update the cluster mask of the determined cluster according to the neighbor mask of the target node. If there are target nodes among the remaining target nodes (excluding the central node) that have not been allocated to the cluster, allocate the target nodes that have not been allocated to the cluster in the same manner as the step of comparing the neighbor mask of the target node with the cluster mask of each cluster, until all remaining target nodes (excluding the central node) among the plurality of target nodes are allocated to the cluster.
[0086] For example, after determining each central node, the clusters corresponding to each central node are determined. These clusters are initial clusters. Other target nodes (excluding the central node) need to be allocated to each cluster through one or more allocations.
[0087] For example, if all target nodes (excluding the central node) are determined, only one allocation is needed to allocate all target nodes to each cluster; if only one target node (excluding the central node) is determined each time, multiple allocations may be required to allocate all target nodes to each cluster.Target nodes are assigned to various clusters. In multiple assignments, at least one target node can be randomly selected from the remaining target nodes (excluding the central node).
[0088] The neighbor mask can be a mask used to represent the source nodes of the target node, and can be in various forms, such as representing the neighbor mask through an ordered sequence or a set. The cluster mask can be a mask used to represent the source nodes of the target node in the cluster, and the representation of the cluster mask can be the same as that of the neighbor mask.
[0089] Taking the representation of neighbor mask and cluster mask in the form of sets as an example, for instance, a target node determined from multiple target nodes excluding the central node (page 10 / 25 of the specification, CN 121638357 A) is designated as target node v1, and its neighbor mask is (v2, v3, v4), indicating that the source nodes of target node v1 are source nodes v2, v3, and v4; the cluster mask of cluster 1 is (v2, v4, v5, v6), indicating that all source nodes of all target nodes in cluster 1 are source nodes v2, v4, v5, and v6. The cluster mask of cluster 2 is (v2, v6, v7, v8), indicating that all source nodes of all target nodes in cluster 2 are source nodes v2, v6, v7, and v8. By comparing the neighbor masks (v2, v3, v4) with the cluster masks (v2, v4, v5, v6) and (v2, v6, v7, v8) respectively, it can be quickly determined that the target node v1 has two common source nodes with cluster 1 and one common source node with cluster 2. Therefore, the target node v1 can be assigned to cluster 1.
[0090] Since a new target node has been assigned to the cluster, the cluster mask of the cluster needs to be updated. When updating the cluster mask of the determined cluster based on the neighbor mask of the target node, the neighbor mask and the cluster mask can be merged, and the duplicate source nodes can be merged to obtain the updated cluster mask.
[0091] For example, the neighbor mask (v2, v3, v4) of target node v1 is merged with the cluster mask (v2, v4, v5, v6) of cluster 1 to obtain (v2, v3, v4, v2, v4, v5, v6). After merging the duplicate source nodes v2 and v4, the updated cluster mask of cluster 1 is obtained as (v2, v3, v4, v5, v6). This updated cluster mask is then compared with subsequently determined target nodes to perform cluster allocation for unassigned target nodes.
[0092] In this embodiment, by determining at least one target node from among the remaining target nodes other than the central node, the allocation of unassigned target nodes to the cluster can be performed once or multiple times, improving the allocation efficiency.The flexibility of the allocation is enhanced. Since neighbor masks and cluster masks simplify the representation of source nodes, comparing the neighbor mask of the target node with the cluster masks of each cluster allows for rapid identification of the cluster with the most common source nodes to the target node with minimal computation, thus improving allocation speed. Because some clusters have been allocated new target nodes, the cluster mask of the identified clusters can be updated based on the neighbor mask of the target node, enabling dynamic updates and accurately representing the source nodes of all target nodes within the current cluster. Furthermore, if there are target nodes among multiple target nodes other than the central node that have not been allocated to a cluster, repeating the previous allocation process will ensure that all remaining target nodes are allocated to the cluster.
[0093] In some embodiments, both the neighbor mask and the cluster mask are represented by binary vectors, where each binary vector is a vector with elements that are either zero or non-zero. When comparing the neighbor mask of the target node with the cluster masks of each cluster to determine the cluster that shares the most common source nodes with the target node, this can be achieved in the following way:
[0094] For any cluster, perform a logical OR operation between the neighbor mask of the target node and the cluster mask of the cluster, and perform a logical XOR operation between the result of the logical OR operation and the cluster mask of the cluster to obtain a comparison result. Based on the comparison results between the target node and each cluster, determine the cluster corresponding to the comparison result with the fewest non-zero elements as the cluster that shares the most common source nodes with the target node.
[0095] For example, the elements in the binary vector are either zero or non-zero, that is, the elements in the binary vector are zero elements or non-zero elements. Non-zero values can be 1 or other numerical values, where zero can represent NOT or false, and non-zero values can represent OFF or PROWN. The neighbor mask and cluster mask, represented by binary vectors, can be used for logical operations to achieve more convenient target node allocation.
[0096] The order of each element in the binary vector can correspond to the order of each source node. For example, the eight nodes v1-v8 are arranged in order from v1 to v8, and their order corresponds to each element in the binary vector. Taking a non-zero value of 1 as an example, the neighbor mask (v2, v3, v4) of the target node v1 can be represented as (0, 1, 1, 1, 0, 0, 0, 0), where the value of the first element is 0, indicating that node v1 is not a source node of the target node v1, that is, node v1 is not its own source node; the value of the second element is 1, indicating that node v2 is a source node of the target node v1; the value of the third element is 1, indicating that node v3 is a source node of the target node v1, and so on, without further explanation.
[0097] Similarly, the cluster mask (v2, v4, v5, v6) of cluster 1 can be represented as (0, 1, 0, 1, 1, 1, 0, 0), where the value of the first element is 0, indicating that node v1 is not the source node of the target node in cluster 1; the value of the second element is 1, indicating that node v2 is the source node of the target node in cluster 1; the value of the third element is 0, indicating that node v3 is not the source node of the target node in cluster 1, and so on, without further explanation. The cluster mask (v2, v6, v7, v8) of cluster 2 can be represented as (0, 1, 0, 0, 0, 1, 1, 1).
[0098] Perform a logical OR operation between the neighbor mask of the target node and the cluster mask of the cluster, and perform a logical XOR operation between the result of the logical OR operation and the cluster mask of the cluster to obtain the comparison result. The logical operation process can be represented as md,c = (md ∨ mc) ⊕ mc, where md represents the neighbor mask of the target node, mc represents the cluster mask of the cluster, ∨ represents the logical OR operation, ⊕ represents the logical XOR operation, and md,c represents the comparison result obtained by logically operating the neighbor mask of the target node and the cluster mask of the cluster. After obtaining the comparison results with each cluster, the cluster corresponding to the comparison result with the fewest non-zero value elements can be determined as the cluster that has the most common source nodes with the target node. This can be understood as follows: the logical OR operation can merge the range of the target node with the range of the source nodes of the cluster. Then, when performing an XOR operation with the cluster mask, it can filter out all the source nodes in the merged range that are different from the source nodes of the cluster. The cluster corresponding to the comparison result with the fewest non-zero value elements is recorded as the cluster that has the most common source nodes with the target node. Therefore, the cluster to which the target node should be assigned can be quickly obtained through simple logical operations. Compared with methods such as graph partitioning, which involve traversing the entire graph data multiple times and performing graph shrinking and enlarging operations, the computational overhead of logical operations is significantly less.
[0099] For example, the neighbor mask (0, 1, 1, 1, 0, 0, 0, 0) of target node v1 is logically ORed with the cluster mask (0, 1, 0, 1, 1, 1, 0, 0) of cluster 1. That is, the two elements in the same order are logically ORed, (0, 1, 1, 1, 0, 0, 0, 0) ∨ (0, 1, 0, 1, 1, 1, 0, 0) = (0 ∨ 0, 1 ∨ 1, 1 ∨ 0, 1 ∨ 1, 0 ∨ 1, 0 ∨ 0, 0 ∨ 0) = (0, 1, 1, 1, 1, 1, 0, 0). Perform a logical XOR operation between the result and the cluster mask of cluster 1, i.e., (0, 1, 1, 1, 1, 1, 0, 0) ⊕ (0, 1, 0, 1, 1, 1, 0, 0) = (0 ⊕ 0, 1 ⊕ 1, 1 ⊕ 0, 1 ⊕ 1, 1 ⊕ 1, 1, 0 ⊕ 0, 0 ⊕ 0) = (0, 0, 1, 0, 0, 0, 0, 0).
[0100] Similarly, the result of a logical OR operation between the neighbor mask (0, 1, 1, 1, 0, 0, 0, 0) of target node v1 and the cluster mask (0, 1, 0, 0, 0, 1, 1, 1) of cluster 2 is (0, 1, 1, 1, 0, 1, 1, 1). A logical XOR operation between this result and the cluster mask of cluster 2 is then performed, resulting in (0, 0, 1, 1, 0, 0, 0, 0). The comparison result between target node v1 and cluster 1 (0, 0, 1, 0, 0, 0, 0) contains one non-zero element, and the comparison result between target node v1 and cluster 2 (0, 0, 1, 1, 0, 0, 0, 0) contains two non-zero elements. Based on the comparison results between the target node and cluster 1 and cluster 2, the target node can be assigned to cluster 1. In this embodiment, the number of clusters is relatively small, only two, and the number of source nodes is also small. Imagine in large-scale graph data, if multiple clusters need to be clustered and the number of source nodes is large, the advantages in computational cost and time become apparent when comparing and assigning target nodes through logical operations.
[0101] In this embodiment, both the neighbor mask and the cluster mask are represented by binary vectors, allowing for logical operations on them. By performing the logical operations described above on the neighbor mask of the target node and the cluster mask of the cluster, the target node can be quickly compared with each cluster, achieving rapid assignment to the cluster with the most common source nodes. Based on this, the method of this embodiment can save computational cost and time, improving training efficiency.
[0102] In some embodiments, when updating the cluster mask of a determined cluster based on the neighbor mask of the target node, it can be implemented in the following way:
[0103] Perform a logical OR operation between the neighbor mask of the target node and the cluster mask of the determined cluster, and determine the result of the logical OR operation as the cluster mask of the determined cluster.
[0104] Since the cluster with a newly added target node needs to merge the source node of the newly added target node into the cluster mask, merging through logical OR operation is a fast and effective means of updating the cluster mask. Performing a logical OR operation between the neighbor mask of the target node and the cluster mask of the determined cluster can be understood as merging two masks represented by binary vectors through logical OR operation.
[0105] Taking the example of the above embodiment, after the target node v1 is assigned to cluster 1, the neighbor mask (0, 1, 1, 1, 0, 0, 0, 0) of the target node v1 can be logically ORed with the cluster mask (0, 1, 0, 1, 1, 1, 0, 0) of cluster 1.That is, (0, 1, 1, 1, 0, 0, 0, 0) ∨ (0, 1, 0, 1, 1, 1, 0, 0) = (0, 1, 1, 1, 1, 1, 0, 0), so the updated cluster mask of cluster 1 (0, 1, 1, 1, 1, 1, 0, 0) represents that the source nodes of each target node in cluster 1 are (v2, v3, v4, v5, v6).
[0106] In this embodiment, the cluster mask of the cluster with allocated target nodes can be updated by a relatively simple logical OR operation, realizing fast and accurate updating of the cluster mask with less computational overhead.
[0107] In some embodiments, at least two center nodes are determined from multiple target nodes. Specifically, this can be done by: determining the degree of each target node from multiple target nodes; and determining at least two target nodes with the highest degree in the sorting from largest to smallest according to the degree of each target node as at least two center nodes.
[0108] The degree is the number of edges connected to a node. For a node, its degree can be quickly determined. Since a node with a higher degree indicates that it has multiple neighboring nodes, a target node with a higher degree can be a more important or key node in the graph. Updating the feature information of target nodes with higher degrees can more effectively describe the local structure of the graph data. When determining the center node, the degree of the target node is used as the basis, and clustering is performed with each target node with a higher degree as the center node. This can preserve the structural information of the graph data as much as possible, balance the globality and locality of the graph data, and optimize the locality of the graph data.
[0109] For example, for any convolutional layer, given d target nodes, first calculate the degree of each target node. In the order of degree from largest to smallest, the target nodes corresponding to the first k degrees are determined as the center nodes of the k clusters. Here, d and k are both positive integers, k is greater than or equal to 2 and k is less than or equal to d.
[0110] In this embodiment, the degree of each target node is determined from multiple target nodes; based on the degree of each target node, in descending order of degree, at least two target nodes corresponding to the highest degree are determined as at least two center nodes. Based on this, by determining center nodes from multiple target nodes by degree and performing clustering based on each center node, the local structural information of the graph data can be effectively preserved, making the clusters after clustering helpful in optimizing the locality of the graph data.
[0111] In some embodiments, when assigning each source node to the cluster with the most edges to the cluster, this can be specifically implemented as follows:
[0112] For any source node, based on the adjacency matrix corresponding to the convolutional layer, the number of edges connecting the source node to the target nodes in each cluster is calculated to obtain the number of edges between the source node and each cluster; based on the number of edges between the source node and each cluster, the source node is assigned to the cluster with the largest number of edges to the cluster.
[0113] For example, the adjacency matrix can be a matrix used to represent the edges between nodes in graph data. For example, in the adjacency matrix of graph data including n nodes, the first row represents node 1, the second row represents node 2, and so on, with the nth row representing node n; the first column represents node 1, the second column represents node 2, and so on, with the nth column representing node n. If the element value of the i-th row and j-th column of the adjacency matrix is 0, it means that there is no edge connecting node i and node j; if the element value of the i-th row and j-th column of the adjacency matrix is non-zero, it means that there is an edge connecting node i and node j, where n is any positive integer, and i and j are both positive integers less than or equal to n. The number of edges between a node and one or more nodes can be quickly calculated using the adjacency matrix.
[0114] Clustering each target node into a cluster can be understood as the first stage in a lightweight two-stage dynamic clustering mechanism. The second stage is to allocate each source node to a cluster. In the second stage, the source nodes can be clustered based on the information of the target nodes already clustered in the first stage.
[0115] For example, the clustering degree is defined as the number of edges between the source node and the cluster, that is, the number of edges between the source node and all target nodes in the cluster. The clustering degree can reflect the strength of the relationship between the source node and the cluster. Determining the clustering degree between the source node and the cluster determines the number of edges between the source node and the cluster.
[0116] Figure 5 is a schematic diagram of the adjacency matrix provided in the embodiment of this application. As shown in Figure 5, for any convolutional layer, the adjacency matrix A of the graph data corresponding to the convolutional layer is obtained. The clustering degree between each source node and each cluster can be dynamically calculated through the adjacency matrix A. For example, assuming the target nodes in cluster 1 are target nodes v2, v5, and v7, when calculating the number of edges connecting source node v4 to the target nodes in cluster 1, we can read the element values of the columns corresponding to target nodes v2, v5, and v7 from the row corresponding to source node v4 in the adjacency matrix A, and calculate the number of non-zero values. This number of non-zero values represents the number of edges connecting source node v4 to the target nodes in cluster 1. As shown in Figure 5, two elements have non-zero values, indicating that source node v4 has 2 edges connecting to the target nodes in cluster 1, meaning the cluster degree between source node v4 and cluster 1 is 2. Using the adjacency matrix, we can quickly determine the cluster degree between any source node and any cluster, i.e., quickly identify the cluster with the largest number of edges between the source node and the cluster, and assign the source node to that cluster. Alternatively, when determining the cluster degree, we can also calculate the non-zero element values in the column containing the source node in the adjacency matrix; this method achieves the same effect.
[0117] In this embodiment, based on the adjacency matrix corresponding to the convolutional layer, the relationship between the source node and each cluster can be quickly calculated.The number of edges connected to the target node is used to obtain the number of edges between the source node and each cluster, so that the source node can be greedily assigned to the cluster with the largest number of edges with the cluster. Based on this, the maximum cluster degree of all source nodes can be quickly assigned, improving the allocation efficiency of source nodes.
[0118] In some embodiments, when there are multiple convolutional layers, any convolutional layer is the last convolutional layer. After determining the cluster corresponding to the last convolutional layer, the method further includes:
[0119] For other convolutional layers except the last convolutional layer, the following operations are performed in reverse order: the source node of the next convolutional layer after the current convolutional layer is taken as the target node of the current convolutional layer, and the clustering result of the target node of the current convolutional layer inherits the clustering result of the source node of the next convolutional layer; the source node of the current convolutional layer is assigned to the corresponding cluster to obtain the cluster corresponding to the current convolutional layer.
[0120] For example, when the graph convolutional network includes multiple convolutional layers, the processing of any convolutional layer in the above embodiments can be the processing of the last convolutional layer. After determining the cluster corresponding to the last convolutional layer based on the methods of the above embodiments, the current convolutional layer can be quickly clustered by inverting the clustering results of the source nodes of the next convolutional layer. In some graph convolutional networks, the last convolutional layer can be the output layer of the graph convolutional network.
[0121] For example, if the graph convolutional network includes three convolutional layers, named as the first convolutional layer, the second convolutional layer, and the third convolutional layer respectively from the input end to the output end of the graph data, the clusters corresponding to the third convolutional layer can be determined by the methods of any of the above embodiments. For example, cluster 1 and cluster 2 are clustered in the third convolutional layer.
[0122] In some scenarios, the node that is the target node in the previous convolutional layer is the source node in the next convolutional layer, and the node that is the source node in the previous convolutional layer is the target node in the next convolutional layer. The source nodes and target nodes are interchanged in two adjacent convolutional layers. Therefore, the clustering results of the source nodes of clusters 1 and 2 in the third convolutional layer can be inherited as the clustering results of the target nodes of the second convolutional layer. When the second convolutional layer clusters the clusters, the process of determining multiple target nodes and assigning clusters to each target node can be omitted. The clusters corresponding to the second convolutional layer can be obtained by simply assigning the source nodes according to the clustering degree of each source node and each cluster in the second convolutional layer. Based on this, the clustering efficiency of the second convolutional layer can be improved. Similarly, after the second convolutional layer clusters the source nodes, the clustering results of the source nodes can be inherited to the first convolutional layer as the clustering results of the target nodes of the first convolutional layer, which also improves the clustering efficiency of the first convolutional layer.
[0123] In this embodiment, when there are multiple convolutional layers, for the other convolutional layers besides the last one,In the stacking layer method, the source nodes of the next convolutional layer are used as the target nodes of the current convolutional layer in reverse order, and the clustering results of the target nodes of the current convolutional layer inherit the clustering results of the source nodes of the next convolutional layer. The source nodes of the current convolutional layer are then assigned to the corresponding clusters to obtain the clusters corresponding to the current convolutional layer. Based on this, the time for clustering the corresponding clusters of each convolutional layer in a graph convolutional network with multiple convolutional layers can be shortened, reducing the consumption of computing resources and effectively improving the training efficiency of the graph convolutional network. For example, in the training process of a graph convolutional network, the data dimension of the graph data varies greatly in full-batch and non-full-batch training strategies, and different data dimensions have a significant impact on the computational efficiency in the data calculation process. Therefore, in order to improve computational efficiency, the method of this embodiment proposes a reconfigurable computational order mechanism to optimize the selection of matrix multiplication order in full-batch and non-full-batch training strategies. By dynamically adjusting the computational order, a better computational order is determined, thereby reducing computational overhead and improving the training efficiency of the graph convolutional network.
[0124] In some embodiments, based on the clustered clusters corresponding to any convolutional layer, the feature information of the nodes in the clustered clusters is read and stored in a cache, and the output result of the convolutional layer is obtained based on the feature information stored in the cache, including:
[0125] Based on the clustered clusters corresponding to any convolutional layer, the feature information of the nodes in the clustered clusters is read and stored in a cache, and the weight matrix and adjacency matrix to be calculated with the feature information are determined; based on the training strategy of the graph convolutional network or the number of rows and columns of the adjacency matrix, the multiplication order of the feature information, weight matrix and adjacency matrix is determined, and the feature information, weight matrix and adjacency matrix are calculated according to the multiplication order to obtain the output result of the convolutional layer.
[0126] For example, for each clustered cluster corresponding to any convolutional layer, the feature information of the nodes of one or more clusters can be read in batches and stored in a cache. When updating the calculation, the feature information can be the feature information matrix of each node, where each row in the feature information matrix represents each node, and each column represents the feature value of the node corresponding to the row. The weight matrix to be calculated with feature information can be obtained by reading the model parameters of any convolutional layer of the graph convolutional network. The adjacency matrix can be obtained by the input graph data or by the graph data corresponding to any convolutional layer.
[0127] The training strategy of the graph convolutional network can include full-batch training and non-full-batch training. Full-batch training can be understood as updating the feature information of all nodes in the graph data during training, while non-full-batch training can be understood as updating the feature information of only some nodes in the graph data during training. The adjacency matrix can also be a matrix representing the connection relationship between the target node and the source node. When the number of target nodes is different from the number of source nodes, the number of rows and columns of the adjacency matrix is different.
[0128] Figure 6 is a schematic diagram of full-batch training provided in an embodiment of this application. As shown in Figure 6, for example, when the full-batch training strategy is executed in the (I+1)th layer of a graph convolutional network, feature information is updated for each node, meaning each node is a target node, where I is a natural number. The adjacency matrix for full-batch training has the same number of rows and columns, which is the total number of nodes. This adjacency matrix has the same meaning as the adjacency matrix in the above embodiments. Filled squares in the adjacency matrix indicate that the element value of the corresponding row and column is non-zero, and unfilled squares indicate that the element value of the corresponding row and column is zero.
[0129] Figure 7 is one of the schematic diagrams of non-full batch training provided in the embodiments of this application. As shown in Figure 7, for example, when performing non-full batch training in the I layer of the graph convolutional network, the feature information of nodes v3 and v4 will be updated. That is, nodes v3 and v4 are target nodes, and the source nodes corresponding to each target node include nodes v2, v5, v6 and v7. The number of rows and columns in the adjacency matrix of non-full batch training can be different. When performing non-full-batch training in the (l+1)th layer after the I-th layer of the graph convolutional network, feature information is updated for nodes v2 and v5. That is, nodes v2 and v5 are target nodes, and the source nodes corresponding to each target node include nodes v3 and v4. In this layer, nodes v6 and v7, represented by dashed circles, are unsampled nodes. Although node v6 is a neighbor of node v5 and node v7 is a neighbor of node v3, they are not sampled during feature information updates. Therefore, unsampled nodes can be omitted in the adjacency matrix.
[0130] Figure 8 is a second schematic diagram of non-full-batch training provided in the embodiment of this application. As shown in Figure 8, similar to the non-full-batch training in Figure 7, during non-full-batch training, the target nodes and source nodes of the current I-th layer and the next (l+1)th layer can be interchanged. The nodes represented by dashed circles are all unsampled nodes. Each progressive layer can have more neighbor nodes that are not sampled by the target nodes. The adjacency matrix of the I-th layer non-full batch 1 and the adjacency matrix of the (I+1)-th layer non-full batch 1 are shown in the figure. Non-full batch 0 and non-full batch 1 can be understood as non-full batch codes that distinguish different non-full batch strategies.
[0131] According to the cluster corresponding to any convolutional layer, after reading the feature information of the nodes in the cluster after clustering and determining the weight matrix and adjacency matrix to be calculated with the feature information, the multiplication order of feature information, weight matrix and adjacency matrix can be dynamically determined according to the training strategy of the graph convolutional network or the number of rows and columns of the adjacency matrix, with the goal of minimizing computational overhead. The calculation can be performed according to the multiplication order to obtain the output result of the convolutional layer.
[0132] In this embodiment, the feature information is determined according to the training strategy of the graph convolutional network or the number of rows and columns of the adjacency matrix.The product of feature information, weight matrix, and adjacency matrix is calculated in the order of multiplication, and the output of the convolutional layer is obtained by calculating the feature information, weight matrix, and adjacency matrix in the order of multiplication. This allows for the rational use of computing resources when computing resources are limited, reducing the workload of storage and computing units during operation and improving the efficiency of operation.
[0133] For example, during the training of a graph convolutional network, the calculation formula for forward propagation can be expressed as the following formulas (1) and (2):
[0134] Zl=AXlWl (1)
[0135] Xl+1=σ(Zl) (2)
[0136] Wherein, A represents the adjacency matrix; Xl represents the feature information corresponding to the I-th convolutional layer, which can be the feature information matrix of each node corresponding to the I-th convolutional layer; Wl represents the weight matrix of the I-th convolutional layer; Zl represents the result matrix obtained by the I-th convolutional layer after calculating the adjacency matrix, feature information and weight matrix; σ represents the activation function, such as ReLU; Xl+1 represents the feature information corresponding to the (l+1)-th convolutional layer, which is the feature information obtained by the I-th convolutional layer after updating each node.
[0137] The calculation formula for backpropagation can be expressed as the following formulas (3) to (5):
[0138]
[0139]
[0140]
[0141] Where, represents the partial derivative of the result matrix; represents the partial derivative of the weight matrix; represents the partial derivative of the feature information; XlT represents the transpose matrix of the feature information; AT represents the transpose matrix of the adjacency matrix; WlT represents the transpose matrix of the weight matrix.
[0142] In some embodiments, during forward propagation, if the training strategy of the graph convolutional network is full-batch training, or if the training strategy is non-full-batch training and the number of rows in the adjacency matrix is greater than or equal to the number of columns, the multiplication order is: multiply the feature information and the weight matrix, and multiply the resulting product with the adjacency matrix; if the training strategy is non-full-batch training and the number of rows in the adjacency matrix is less than the number of columns, the multiplication order is: multiply the adjacency matrix and the feature information, and multiply the resulting product with the weight matrix.
[0143] For example, when determining the calculation order in forward propagation, formula (1) is mainly involved. The three calculation factors in formula (1) have two calculation orders, namely A(XlWl) and (AXl)Wl, that is, it is necessary to determine whether to calculate the product of Xl and Wl first or the product of A and Xl first.
[0144] Since the computational cost is relatively small when calculating the product of Xl and Wl first and then the product of A and XlWl during the forward propagation of full-batch training, if the training strategy of the graph convolutional network is full-batch training, the feature information and weight matrix can be multiplied during the forward propagation, and the resulting product can be multiplied with the adjacency matrix to obtain the output of the convolutional layer.Results.
[0145] Since the adjacency matrix A in each convolutional layer is dynamic and its data dimension is asymmetric, a dynamic calculation order can be adopted during forward propagation in non-full-batch training. The calculation order can be determined according to the dimension of A sampled in each non-full-batch calculation, prioritizing the generation of matrices with smaller dimensions to minimize computational overhead.
[0146] If the training strategy is non-full-batch training and the number of rows in the adjacency matrix is greater than or equal to the number of columns, for example, if the dimension of the adjacency matrix A corresponding to the convolutional layer is n×m and n≥m during non-full-batch training, then calculating the product of Xl and Wl first, and then calculating the product of A and (XlWl), will result in lower computational overhead. If the training strategy is non-full-batch training and the number of rows in the adjacency matrix is less than the number of columns, i.e., n<m, then calculating the product of A and Xl first, and then calculating the product of (AXl) and Wl, can reduce computational overhead. Therefore, if the training strategy of the graph convolutional network is non-full-batch training and the number of rows in the adjacency matrix is greater than or equal to the number of columns, the feature information and the weight matrix can be multiplied, and the resulting product can be multiplied with the adjacency matrix to obtain the output of the convolutional layer. If the training strategy is non-full-batch training and the number of rows in the adjacency matrix is less than the number of columns, the adjacency matrix and the feature information are multiplied, and the resulting product is multiplied with the weight matrix to obtain the output of the convolutional layer.
[0147] For example, the convolutional layer performs convolution operations based on the feature information of each node input to the convolutional layer, as well as the weight matrix and adjacency matrix to be calculated with the feature information, to obtain the updated feature information of each node. The updated feature information is the output of the convolutional layer. The output can be used in the backpropagation process to adjust the model parameters of the convolutional layer. For example, the weight matrix of the convolutional layer can be adjusted based on the output.
[0148] In this embodiment, during forward propagation, if the training strategy of the graph convolutional network is full-batch training, or if the training strategy is non-full-batch training and the number of rows in the adjacency matrix is greater than or equal to the number of columns, then the feature information, weight matrix, and adjacency matrix are multiplied in the order A(XlWl); if the training strategy is non-full-batch training and the number of rows in the adjacency matrix is less than the number of columns, then the feature information, weight matrix, and adjacency matrix are multiplied in the order (AXl)Wl. Based on this, computational overhead can be reduced and training efficiency can be improved.
[0149] In some embodiments, during backpropagation, if the training strategy of the graph convolutional network is full-batch training, or if the training strategy is non-full-batch training and the number of rows in the adjacency matrix is greater than or equal to the number of columns, when calculating the partial derivative of the weight matrix, the corresponding multiplication order is: multiply the partial derivative of the transpose matrix of the adjacency matrix and the result matrix, and multiply the resulting product with the transpose matrix of the feature information, wherein the result matrix is the adjacency matrix and feature matrix during forward propagation.The matrix obtained by multiplying the information and weight matrices; when calculating the partial derivative of the feature information, the corresponding multiplication order is: multiply the partial derivative of the transpose of the adjacency matrix and the result matrix, and multiply the resulting product with the transpose of the weight matrix;
[0150] If the training strategy is non-full batch training and the number of rows of the adjacency matrix is less than the number of columns, when calculating the partial derivative of the weight matrix, the corresponding multiplication order is: multiply the transpose of the feature information and the transpose of the adjacency matrix, and multiply the product obtained from page 17 / 25 of the specification 21 CN 121638357 A with the partial derivative of the result matrix; when calculating the partial derivative of the feature information, the corresponding multiplication order is: multiply the partial derivative of the result matrix with the transpose of the weight matrix, and multiply the resulting product with the transpose of the adjacency matrix.
[0151] For example, when determining the calculation order in backpropagation, formulas (4) and (5) are mainly involved. In full-batch computation, considering that there are two possible computation orders for formula (4), namely, and since it usually has a smaller dimension than Xl, the first computation will generate a smaller matrix. Therefore, another advantage of prioritizing the computation order is that its result can be reused for the computation of formula (5). It can be verified that the computation order of requires fewer multiply-accumulate (MAC) operations compared to the computation order of . Therefore, in the backpropagation of the full-batch training strategy, choosing the order of computation for formula (4) and the order of computation for formula (5) can improve the efficiency of backpropagation.
[0152] For example, if the training strategy is non-full-batch training and the number of rows of the adjacency matrix is greater than or equal to the number of columns, that is, n≥m of the adjacency matrix A, then the computation order for formula (4) and formula (5) can be the same as the computation order of backpropagation in the full-batch training strategy, so as to reduce the computational overhead and improve the efficiency of training.
[0153] If the training strategy is non-full-batch training and the number of rows in the adjacency matrix is less than the number of columns, i.e., n < m in the adjacency matrix A, then the calculation order of formulas (4) and (5) can be the opposite of the calculation order of backpropagation in the full-batch training strategy. That is, the calculation order of formula (4) is selected according to the order selected in formula (5) to reduce computational overhead and improve training efficiency. As shown in Figure 7, in the training process of non-full-batch 0 in the (1+1)th layer, the dimension of the adjacency matrix A is 2×2, i.e., n = m, then the calculation order of formula (4) is selected according to the order selected in formula (5). As shown in Figure 8, in the training process of non-full-batch 1 in the (1+1)th layer, the dimension of the adjacency matrix A is 2×3, i.e., n < m, then the calculation order of formula (4) is selected according to the order selected in formula (5).
[0154] For example, during backpropagation, the convolutional layer calculates the partial derivative of the result matrix based on the output result Xl+1 obtained in the forward propagation of the feature information Xl, thereby obtaining the partial derivative of the weight matrix and the partial derivative of the feature information. Based on this, the output result of the convolutional layer during backpropagation can be obtained. For example, this output result can be the value of the loss function used to adjust the weight matrix. After obtaining the output results of each convolutional layer in backpropagation, the model parameters of the graph convolutional network are adjusted based on the output results to complete one round of training. Therefore, when the computational efficiency of both the forward and backpropagation stages is improved, the training efficiency of one round can be greatly improved.
[0155] Optionally, after multiple rounds of forward and backpropagation, that is, after multiple rounds of training, when the updated feature information output by the convolutional layer of the graph convolutional network in the forward propagation has a relatively accurate representational power, it can be determined that the training of the graph convolutional network is complete. Among them, the determination of whether the representational power of the updated feature information output is relatively accurate can be determined according to the application requirements in the specific scenario.
[0156] In this embodiment, determining the computation order based on the training strategy is a mechanism for reconfigurable computation order. During backpropagation, this reconfigurable computation order mechanism significantly reduces the computational overhead in GCN training, improves training efficiency, and adapts to changes in different data dimensions by dynamically adjusting the computation order, providing an efficient solution for full-batch training and non-full-batch training. Through this mechanism, the training process of GCN can be effectively optimized, especially when dealing with large-scale graph data, providing a more efficient and flexible computation strategy.
[0157] For example, during graph convolutional network training, due to the sparsity and irregularity of graph data, factors such as storage and computation efficiency, irregular neighborhood structure, and the balance between locality and globality can affect the improvement of training efficiency. Specifically, on the one hand, graph data includes many sparse matrices. Since sparse matrices include a large number of zero elements, the existing matrix operation methods (pages 18 / 25, CN 121638357 A) are usually inefficient in terms of storage and computation when performing operations on sparse matrices. Therefore, setting efficient sparse matrix operation and storage methods is an important aspect of improving the performance of graph convolutional networks. On the other hand, the degree and connectivity of nodes in a graph can be highly irregular. Some nodes may have very few neighbors, while others may have a large number of neighbors; this phenomenon is known as irregular neighborhood structure. The irregularity of graph data makes existing batch processing methods complex and unsuitable for computation on graph data with irregular neighborhood structures. Therefore, it is necessary to design algorithms that adapt to irregular neighborhood structures to fully utilize hardware acceleration devices and improve computational efficiency. Furthermore, graph convolutional networks typically update information by aggregating information from neighboring nodes.The representation of each node involves the transmission of local information. However, due to the irregularity of the graph, a balance needs to be found between the transmission of local information and the integration of global information. When designing graph convolutional networks, it is necessary to consider how to effectively utilize local and global information to balance locality and globality while improving computational efficiency. To address these challenges, new GCN architectures, optimization methods, and hardware acceleration strategies are constantly being proposed in the field to better handle sparse and irregular graph data, thereby improving the efficiency of training and inference.
[0158] Sparse matrix multiplication generally has two forms: Sparse-Dense Matrix Multiplication (SDMM) and Sparse-Sparse Matrix Multiplication (SPMM). SDMM is a matrix multiplication operation in which one matrix is a sparse matrix and the other is a dense matrix. The sparse matrix contains a large number of zero elements, while the dense matrix is mostly non-zero elements. SPMM is an operation for multiplying two sparse matrices in which both the input matrix and the weight matrix have a large number of zero elements. In deep learning and neural networks, SPMM is an important computational operation, especially when dealing with large-scale data, which can significantly improve computational efficiency. The basic idea of SPMM is to only calculate the product of non-zero elements in the input matrix and weight matrix, thereby avoiding unnecessary calculations on zero elements. This is very important for handling sparse data structures, because in practical applications, input data and weights are usually highly sparse, i.e., most elements are zero. The advantage of sparse matrix multiplication is that it reduces the computation and storage overhead and improves the operating efficiency of neural networks. It has been widely used in various deep learning models such as Convolutional Neural Networks (CNNs) and Graph Neural Networks. In practice, sparse matrix multiplication can be implemented through various algorithms and data structures to handle the multiplication operation of sparse matrices more efficiently. This is especially important for processing large-scale data, graph data, or applications that need to run in resource-constrained environments.
[0159] To improve the efficiency of sparse matrix multiplication in graph convolutional networks, it can be improved through heterogeneous accelerators of GCNs or architectures based on SDMM. In heterogeneous architectures, dedicated engines are designed for the aggregation and union phases in the forward propagation of GCNs. For example, a single-instruction, multiple-data (SIMD) aggregation engine and a systolic array-based joint engine accelerate the computation of the aggregation and joint phases, respectively. This heterogeneous architecture performs well on certain specific datasets, but it cannot fully utilize the resources of both engines. This is because the aggregation and joint phases of different datasets...The proportions of the merging stages are different, while the computing power of the two engines is fixed, so there will be a load imbalance problem between the two engines.
[0160] In SDMM-based architectures, such as Adaptive Weighted Bilateral Graph Convolutional Network (AWB-GCN) and Graph Convolutional Network with Adaptive eXponential Neighborhood (GCNAX), they observe that the forward propagation of GCN contains multiple sparse matrices, so they accelerate the forward propagation of GCN by supporting SDMM. AWB-GCN focuses on the load imbalance problem in SDMM and proposes an SDMM-based architecture to dynamically balance the workload of multiple processing elements (PEs). GCNAX explores the characteristics of different datasets and designs a configurable matrix multiplication cyclic sorting and merging mechanism to optimize SDMM. In general, SDMM-based architectures focus on optimizing SDMM in the forward propagation of GCN. Instruction manual, pages 19 / 25, 23 CN 121638357 A
[0161] The Gustavson algorithm is an algorithm for efficiently performing matrix multiplication, mainly including steps such as block division, skipping zero elements, data rearrangement, and parallelization. Specifically, the sparse matrix is divided into blocks, and operations are performed on each block. Unnecessary computations are reduced by detecting and skipping zero elements in the sparse matrix. The data of the sparse matrix is rearranged to improve the effective use of the cache and reduce cache misses. The characteristics of parallel computing are utilized to improve the overall computational performance. The performance improvement of the Gustavson algorithm is mainly due to the optimization of its data access mode and computation process, making the computation more efficient on modern computer architectures.
[0162] The above solutions are all for accelerating GCN inference, but there is no accelerator for GCN training. Given that GCN is a semi-supervised learning method, it needs to be trained before inference, so there is an urgent need for a novel and efficient accelerator design that enables GCN to adapt to larger inputs and achieve fast training. Existing solutions only consider the SDMM during the forward propagation of GCN, and do not consider the SPMM during the backward propagation of GCN. Therefore, the above methods are not suitable for accelerating the entire GCN training process. Due to the omission of SPMM in various solutions, there will be a lot of redundant calculations and memory accesses for zero elements when using the above methods to calculate GCN training, resulting in a waste of computing and memory resources.
[0163] The embodiments of this application provide a high-efficiency GCN training accelerator, the significant feature of which is that it can uniformly supportSDMM and SPMM are used to improve the forward and backward propagation efficiency of GCN. The accelerator is specially customized with a block-free access strategy and offline reordering technology, which effectively reduces the data movement cost and improves the resource utilization efficiency.
[0164] In some embodiments, the above-mentioned graph convolution training method further includes: during the training process, for any first matrix and second matrix to be multiplied, when the first matrix is an M×K sparse matrix and the second matrix is a K×N sparse matrix or a dense matrix, the multiplication result of the first matrix and the second matrix is calculated in parallel by N PEs.
[0165] Wherein, M, K and N are all positive integers, and N PEs correspond one-to-one with the N columns of the second matrix, used to calculate the multiplication result of the corresponding columns; each PE is specifically used to sequentially read the elements of each column in the first matrix, perform calculations with the elements of the corresponding column, and when the PE reads any target column in the first matrix, if other PEs are already reading the target column, the PE obtains the reading result of the other PEs. If the obtained reading result is a partial element of the target column, then after other PEs have finished reading the target column, the PE reads the other elements in the target column except for the partial element.
[0166] Exemplarily, PE is a processing unit, and multiple PEs calculate the multiplication result of the first matrix and the second matrix in parallel, with each PE responsible for calculating the elements of one column.
[0167] Exemplarily, sparse matrix multiplication can include two processing methods: one is sparse matrix multiplication based on compressed sparse row (CSR) and row-wise data streams. CSR is a compressed format for sparse matrices by row compression. It reduces storage space by storing only the values of non-zero elements and their corresponding row indices, enabling fast sparse matrix multiplication. Row-wise refers to the operation of multiplying each row of a matrix element-wise with the row of another matrix. This operation is performed independently for each row of the matrix, and the result is a new row containing the result of multiplying the elements at each position. Another type is sparse matrix multiplication based on compressed sparse column (CSC) and column-wise data streams. CSC is a compressed format for sparse matrices by column compression. It reduces storage space by storing only the values of non-zero elements and their corresponding column indices, enabling fast sparse matrix multiplication. Column-wise refers to the operation of multiplying each column of a matrix element-wise with the column of another matrix. This operation is performed independently for each column of the matrix, and the result is a new column containing the result of multiplying the elements at each position.
[0168] The method provided in this embodiment is based on column-wise sparse matrix multiplication data streams to simultaneously support SDMM.And SPMM. Sparse matrix multiplication can be abstracted into a representation of O = AB, where matrix A represents the first matrix, matrix B represents the second matrix, and matrix O represents the result matrix of the product operation. When executing this method, the data flow calculates the product of one element of matrix B and an entire column of A each time, and obtains the partial sum of an entire column of O. Each PE reads one element of B each time, reads the corresponding column of A according to the row number of B, and obtains the output row and column according to the row number of A and the column number of B. Different PEs are statically mapped to different columns of B and are responsible for the calculation of the corresponding columns, and obtain different columns of output.
[0169] Figure 9 is a schematic diagram of the data flow of multi-PE parallel computing provided in the embodiment of this application. As shown in Figure 9, black squares represent zero elements and white squares represent non-zero elements. PE 0 and PE 1 are responsible for the 0th column (column numbered sequentially from 0) and the 1st column of matrix B, respectively, and obtain the 0th column and the 1st column of matrix O. Taking PE 0 as an example, PE 0 reads the first non-zero element from the 0th column of matrix B, with a row number of 1 (row numbers start from 0 and are numbered sequentially). Correspondingly, PE 0 reads the 1st column of matrix A and multiplies it with the non-zero element of matrix B. Based on the row number of the non-zero element in matrix A and the column number of the non-zero element in matrix B, PE 0 can obtain the row and column numbers in the output matrix O and accumulate the results of the partial sums in matrix O. Based on this data flow of parallel computation by multiple PEs, the calculation of zero elements in sparse matrix multiplication can be eliminated, thereby accelerating sparse matrix multiplication.
[0170] Specifically, the data flow of parallel computation by multiple PEs can reuse the non-zero elements in matrix B to complete the calculation of the entire column of matrix A, thus reducing repeated memory accesses to matrix B. Furthermore, each PE is responsible for calculating the multiplication of a non-zero element in matrix B with the corresponding column of non-zero elements in matrix A, avoiding the calculation of zero elements in sparse matrix multiplication and improving the calculation speed of sparse matrix multiplication. Furthermore, matrices A and B are compressed using the CSC format, which can eliminate redundant memory accesses to zero elements in sparse matrices.
[0171] Optionally, to achieve parallel computing of multiple PEs, this application embodiment provides a block design to support parallel memory accesses of different PEs. Three caches can be set as AMBuff, BMBuff, and OMBuff to store matrices A, B, and O respectively. Assuming the dimensions of matrices A, B, and O are (M×K), (K×N), and (M×N) respectively, the number of banks for AMBuff, BMBuff, and OMBuff are K, N, and N respectively, and each bank stores one column of data in the matrix. The number of PEs is also N, and each PE is directly connected to the corresponding bank of BMBuff and OMBuff, and connected through a crossbar.All blocks of AMBuff are connected. When M, K, and N are larger, the area of the on-chip cache required is larger, and the off-chip memory access is less. Therefore, this embodiment uses a matrix block method to achieve a balance between on-chip area and off-chip memory access.
[0172] For example, a configuration of M=1024, N=16, and K=16 is used. Considering that matrices A and B are sparse matrices, while matrix O is a dense matrix, this embodiment uses the CSC compression format to store matrices A and B, and uses a dense format to store matrix O. Figure 10 is a schematic diagram of the block memory access data flow provided in this embodiment. As shown in Figure 10, block 1 in AMBuff stores the non-zero elements of the first column of matrix A and the corresponding row number. In the Tth and T+1th clock cycles, PE 1 reads the non-zero element b1,1 and the corresponding row number. Correspondingly, PE 1 reads all non-zero elements in the first column of matrix A, calculates the product with b1,1, and finally sums the product with the corresponding partial sums, and writes the resulting sum back to OMBuff for storage.
[0173] Existing sparse matrix multiplication based on row-wise and column-wise data streams has the problem of block conflicts, which slows down the memory access speed for the same block. Figure 11 is a schematic diagram of block conflicts provided by the embodiment of this application. As shown in Figure 11, when two elements in different columns of matrix B are multiplied by the second column of matrix A at the same time, these two elements of matrix B need to access the elements of the same column of matrix A, thus causing the problem of block conflicts. To this end, the embodiment of this application provides a mechanism to eliminate block conflicts, so as to improve the parallelism of multi-PE parallel computing, thereby accelerating sparse matrix multiplication.
[0174] For example, for each column of matrix A, a pointer can be set to point to the element currently being accessed in that column. When different elements of matrix B access the same element of matrix A, the element being accessed in matrix A is broadcast to different PEs, thereby merging access requests for the same element and eliminating the problem of block conflicts in the data stream during matrix multiplication. When different elements of matrix B access different elements of the same column of matrix A, the access order of column elements of matrix A in the original data stream can be changed. It can be accessed not in the order from beginning to end, but in the order of pointer movement. This mechanism can be understood as a block conflict elimination mechanism.
[0175] Figure 12 is a schematic diagram of one of the block conflict elimination mechanisms provided in the embodiments of this application, Figure 13 is a schematic diagram of another of the block conflict elimination mechanisms provided in the embodiment of this application (pages 21 / 25, CN 121638357 A), and Figure 14 is a schematic diagram of a third of the block conflict elimination mechanism provided in the embodiments of this application. As shown in Figures 12 to 14, PE0 and PE1 are respectively responsible for calculating the result of multiplying the two columns of matrix B and the corresponding columns of matrix A. In the T+1 clock cycle, PE0 and PE11. Access elements a0,2 and a3,1 in CG-AMBuff, where CG-AMBuff represents the cache after adding pointers to AMBuff. Since elements a0,2 and a3,1 are located in slot 1 and slot 2 respectively, no slot conflict occurs. In clock cycle T+2, PE 0 and PE 1 simultaneously access the element in the second column of slot 2 in CG-AMBuff. Following the original conflict-free mechanism, b2,0 should be multiplied by a1,2 to get 01,0, while b2,1 should be multiplied by a0,2 to get 00,1. Following this order, PE 0 and PE 1 would simultaneously access two different elements in slot 2, resulting in a conflict and memory access delay. To improve memory access speed, a slot conflict resolution mechanism is introduced. By setting pointers, element b2,1 is calculated according to the pointer movement order and the columns of matrix A. Therefore, according to the data flow with conflict resolution mechanism, element b2,1 is multiplied by a1,2 first instead of a0,2 to get o1,1. In the T+3 clock cycle, the pointer moves to the end of the second column of matrix A and then returns to the first element. At this time, element b2,1 is multiplied by a0,2 to get a0,1. In this way, access to different elements of the same column of matrix A in the same clock cycle can be eliminated, that is, access requests to the same element are merged, solving the block conflict problem in sparse matrix multiplication and accelerating the memory access of sparse matrix multiplication.
[0176] For example, the reasonable use of cache space in sparse matrix operation has a great impact on the improvement of computing efficiency and hardware resource arrangement. In order to reduce the size of on-chip cache, in some implementations, the matrix in GCN training can be computed and stored in blocks. The overall design can be based on the goal that each matrix block has a similar number of non-zero elements. For example, the column elements in adjacent matrix blocks in matrix A can be rearranged offline according to the number of non-zero elements in the matrix.
[0177] Specifically, given that the number of adjacent matrix blocks in matrix A is s, it can be understood as dividing matrix A into s matrix blocks. Before GCN training, the columns in the s adjacent matrix blocks can be sorted in descending order according to the number of non-zero elements, so that the number of non-zero elements in different columns of the same matrix block is as equal as possible. After rearrangement, load balancing within each matrix block of matrix A can be achieved more efficiently. In addition, the column numbers of each column of matrix A before rearrangement can be recorded to guide the corresponding rows of matrix B to be rearranged during computation.
[0178] Figure 15 is a schematic diagram of offline rearrangement provided in the embodiment of this application. As shown in Figure 15, for matrix blocks P0 and P1 in matrix A, according to the number of non-zero elements in each column of each matrix block, the two adjacent matrix blocks P0 and P1 are rearranged.The columns of matrix block P1 are rearranged. As can be seen from the figure, the columns (0, 1, 2) in matrix block P0 are rearranged into columns (1, 2, 3); the columns (3, 4, 5) in matrix block P1 are rearranged into columns (0, 4, 5). It can be seen that each column of matrix block P0 contains the same number of non-zero elements, with each column containing 3 non-zero elements; each column of matrix block P1 contains the same number of non-zero elements, with each column containing 1 non-zero element. In this way, the workload of each matrix block in matrix A is balanced. At the same time, the column numbers of the initial columns will be recorded as (1, 2, 3) and (0, 4, 5), which can be used to rearrange the corresponding rows of matrix B during runtime.
[0179] After rearranging matrix A, matrix B can be rearranged to facilitate the matrix multiplication O = AB. Specifically, since the adjacent s matrix blocks in matrix A are multiplied by the corresponding matrix blocks in matrix B, the rows of the adjacent s matrix blocks in matrix B can be rearranged synchronously during the calculation. As shown in Figure 15, during GCN training, row (1, 2, 3) is rearranged into row (0, 1, 2) in matrix B. From a hardware implementation perspective, to ensure sequential off-chip memory access to matrix B, a reshuffle buffer (Reshuffle BMBuff) can be set up to store s adjacent matrix blocks in matrix B. Therefore, rows of B can be rearranged on-chip without generating discontinuous off-chip memory requests.
[0180] Figure 16 is a schematic diagram of the reshuffle hardware device connection provided in an embodiment of this application. As shown in Figure 16, Reshuffle BMBuff first prefetches s adjacent matrix blocks (Adjacent B tiles) of matrix B. CG-AMBuff reads the rearranged matrix blocks of matrix A from off-chip memory (pages 22 / 25 of specification, CN 121638357 A). Reshuffle BMBuff reads the column index of matrix A before rearrangement, i.e., the initial column ID. Based on the original column index of matrix A, Reshuffle BMBuff sends the corresponding row number of matrix B to BMBuff. Each processing unit PE calculates the product of the non-zero element in a column of matrix B and the corresponding column of matrix A, generating a partial sum in the corresponding O matrix, and finally writes it back to OMBuff. The number s of adjacent matrix blocks affects the effectiveness of offline reshuffling technology and the overhead of Reshuffle BMBuff. For example, s can be set to 16 to balance efficiency and overhead. Through matrix reshuffling technology, the problem of load imbalance during GCN training can be alleviated, and GCN training can be accelerated.
[0181] This application embodiment also provides a graph data processing method. Figure 17 shows a graph data processing method provided by this application embodiment.According to the flowchart of the processing method, as shown in Figure 17, the method includes:
[0182] Step 1701, obtaining graph data to be processed.
[0183] Step 1702, processing the graph data based on a graph convolutional network to obtain the corresponding processing result.
[0184] Wherein, the graph convolutional network is trained based on the graph convolutional network training method of any of the above embodiments.
[0185] For example, the graph data to be processed can be graph data obtained from data acquired in application scenarios such as social networks, molecular structures, and recommendation systems, after graph data transformation. For example, in a recommendation system, based on multiple user information data, product information data, and the relationship data between users and products in the recommendation system, graph data transformation is performed to construct graph data about users and products in the recommendation system, and the graph data to be processed can be obtained by reading the graph data.
[0186] Optionally, according to the task requirements of a specific application scenario, the graph convolutional network obtained after training using the training method provided in any of the above embodiments is fine-tuned for the task to obtain a graph convolutional network capable of performing tasks in the specific application scenario. Because the above training method is used, this graph convolutional network can shorten the training time in the early stages of training and can be quickly deployed to the application stage after task fine-tuning. The acquired graph data to be processed is input into the trained graph convolutional network, and the graph convolutional network can output the processing results of the graph data processed in the specific application scenario.
[0187] For example, the task requirement of a recommendation system can be to classify and recommend nodes based on the updated feature information of each node in the graph data. Among the neighboring nodes of the user's corresponding node, the neighboring nodes corresponding to the product are classified as recommended nodes and not recommended nodes, and the products corresponding to the recommended neighboring nodes are output as the output result. The graph convolutional network obtained based on the training methods of the above embodiments can provide updated feature information with relatively accurate representation. Classification and recommendation based on updated feature information can be a capability of the graph convolutional network after task fine-tuning.
[0188] For example, in an application with product recommendation functionality, data on multiple users and multiple products is acquired and converted into graph data. After processing this graph data using the finely tuned graph convolutional network described above, the output processing result can include information on one or more products recommended to one or more users. This product information can include the recommended product name, product attributes, and product price, etc.
[0189] The specific implementation principles and processes of each step in this embodiment can be found in the foregoing embodiments, and will not be repeated here.
[0190] The graph data processing method provided in this embodiment uses a graph convolutional network trained with high training efficiency. It is suitable for scenarios with certain requirements for training time and training resource investment, has high adaptability, and can be applied to a wide range of graph data processing scenarios.
[0191] This application embodiment also provides a graph convolutional network training device. The graph convolutional network includes at least one convolutional layer for processing graph data, which includes multiple nodes and edges between nodes. The device includes:
[0192] A determination module, used to determine, for any convolutional layer, multiple target nodes to be processed by the convolutional layer and the source nodes of each target node, wherein the target node is the node whose feature information is to be updated, and the source node is the node among the neighboring nodes of the target node used to update the feature information of the target node;
[0193] An allocation module, used to determine at least two center nodes from the multiple target nodes, each center node corresponding to a cluster, and to allocate the remaining target nodes (excluding the center nodes) to the cluster with the most common source nodes, and to allocate each source node to the cluster with the most edges, thereby obtaining at least two clustered clusters;
[0194] The processing module is used to read the feature information of the nodes in the clustered clusters corresponding to any convolutional layer and store it in the cache during the training process of the graph convolutional network, and obtain the output result of the convolutional layer based on the feature information stored in the cache.
[0195] The specific implementation principle and effect of the device provided in this application embodiment can be referred to the foregoing embodiment, and will not be repeated here.
[0196] This application embodiment also provides a graph data processing device, including:
[0197] an acquisition module, used to acquire graph data to be processed;
[0198] a processing module, used to process the graph data based on the graph convolutional network to obtain the corresponding processing result; wherein, the graph convolutional network is trained based on the graph convolutional network training method of any of the above embodiments.
[0199] The specific implementation principle and effect of the device provided in this application embodiment can be referred to the foregoing embodiment, and will not be repeated here.
[0200] Figure 18 is a schematic diagram of the structure of an electronic device provided in this application embodiment. As shown in FIG18, the electronic device of this embodiment may include:
[0201] at least one processor 1801; and a memory 1802 communicatively connected to the at least one processor; wherein, the memory 1802 stores instructions executable by the at least one processor 1801, the instructions being executed by the at least one processor 1801 to cause the electronic device to perform the method described in any of the above embodiments. Optionally, the memory 1802 may be independent or integrated with the processor 1801.
[0202] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the foregoing embodiments, and will not be repeated here.
[0203] This application embodiment also provides a computer-readable storage medium, wherein the computer-readable storage medium storesA computer executes instructions, and when the processor executes the computer execute instructions, it implements the method described in any of the foregoing embodiments.
[0204] This application also provides a computer program product, including a computer program, which, when executed by a processor, implements the method described in any of the foregoing embodiments.
[0205] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules is merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed.
[0206] The integrated modules implemented in the form of software functional modules can be stored in a computer-readable storage medium. The software functional modules stored in a storage medium include several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute some steps of the methods described in the various embodiments of this application. Specification page 24 / 25 28 CN 121638357 A
[0207] It should be understood that the above-mentioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly embodied in the execution of the hardware processor, or executed by a combination of hardware and software modules in the processor. The memory may include high-speed random access memory (RAM), and may also include non-volatile memory (NVM), such as at least one disk storage device, and may also be a USB flash drive, portable hard drive, read-only memory, disk, or optical disk, etc.
[0208] The above-mentioned storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), and Erasable Programmable Read-Only Memory (EEPROM).Memory (EPROM), Programmable read-only memory (PROM), Read-Only Memory (ROM), Magnetic storage, Flash memory, Disk or Optical disk. The storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0209] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application-specific integrated circuit. Of course, the processor and the storage medium can also exist as discrete components in an electronic device or host device.
[0210] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.
[0211] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0212] The above are only preferred embodiments of this application and do not limit the patent scope of this application. All equivalent structural or equivalent process transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application. Instruction manual, pages 25 / 25; 29 CN 121638357 A; Figure 1; Figure 2; Instruction manual drawing, page 1 / 9; 30 CN 121638357 A; Figure 3; Figure 4; Instruction manual drawing, page 2 / 9; 31 CN 121638357 A; Figure 5; Figure 6; Figure 7; Instruction manual drawing, page 3 / 9; 32 CN 121638357 A; Figure 8; Figure 9; Instruction manual drawing, page 4 / 9; 33 CN 121638357 A; Figure 10; Instruction manual drawing, page 5 / 9; 34 CN 121638357 A; Figure 11; Figure 12; Instruction manual drawing.Page 35, Sheet 6 / 9, Figures 13 and 14 of Chinese Patent Application No. CN 121638357 A; Page 36, Sheet 7 / 9, Figures 15 and 16 of Chinese Patent Application No. CN 121638357 A; Page 37, Sheet 8 / 9, Figures 17 and 18 of Chinese Patent Application No. CN 121638357 A; Page 38, Sheet 9 / 9, Abstract of Chinese Patent Application No. CN 121638357 A The application provides a graph convolution network training method, a graph data processing method, an apparatus and a device, and applies to the technical field of graph data. The graph convolution network training method comprises the following steps: for any convolution layer, determining a plurality of target nodes to be processed by the convolution layer and source nodes of the target nodes, the target nodes being nodes to be updated in feature information; determining at least two center nodes from the plurality of target nodes, any center node corresponding to a cluster, distributing the remaining target nodes except the center nodes in the plurality of target nodes to the cluster having the most common source nodes with the cluster, and distributing each source node to the cluster having the most edges with the cluster,to obtain at least two clustered clusters; in the training process, reading the feature information of the nodes in the clustered clusters according to the clustered clusters corresponding to any convolution layer and storing the feature information in a cache, and obtaining the output result of the convolution layer according to the feature information stored in the cache. The method can improve the training efficiency.
Claims
1. A method for training a graph convolutional network, characterized in that, The graph convolution network comprises at least one convolution layer for processing graph data comprising a plurality of nodes and edges between the nodes; the method comprises: For any convolution layer, determining a plurality of target nodes to be processed by the convolution layer, and source nodes of each target node, the target node being a node to be updated with feature information, and the source node of the target node being a node in the neighbor nodes of the target node for updating the feature information of the target node; Determining at least two center nodes from the plurality of target nodes, any center node corresponding to a cluster, and assigning the remaining target nodes other than the center nodes in the plurality of target nodes to the cluster having the most common source nodes with the cluster, and assigning each source node to the cluster having the most edges with the cluster, to obtain at least two clustered clusters; During the training process of the graph convolution network, reading the feature information of the nodes in the clustered cluster corresponding to any convolution layer, and storing the feature information in a cache, and obtaining the output result of the convolution layer according to the feature information stored in the cache.
2. The method of claim 1, wherein, Assigning the remaining target nodes other than the center nodes in the plurality of target nodes to the cluster having the most common source nodes with the cluster comprises: Determining at least one target node from the remaining target nodes other than the center nodes in the plurality of target nodes, for any target node in the at least one target node, comparing the neighbor mask of the target node with the cluster mask of each cluster to determine the cluster having the most common source nodes with the target node, and assigning the target node to the determined cluster; the neighbor mask is used to represent the source nodes of the target node, and the cluster mask is used to represent the source nodes of the target nodes in the cluster; Updating the cluster mask of the determined cluster according to the neighbor mask of the target node; In the case that there are target nodes not assigned to the cluster among the remaining target nodes other than the center nodes in the plurality of target nodes, the target nodes not assigned to the cluster are assigned in the same manner as the step of comparing the neighbor mask of the target node with the cluster mask of each cluster, until the remaining target nodes other than the center nodes in the plurality of target nodes are all assigned to the cluster.
3. The method of claim 2, wherein, The neighbor mask and the cluster mask are represented by binary vectors, and the binary vector is a vector with zero or non-zero value elements; Comparing the neighbor mask of the target node with the cluster mask of each cluster to determine the cluster having the most common source nodes with the target node comprises: For any cluster, performing a logical OR operation on the neighbor mask of the target node and the cluster mask of the cluster, and performing a logical XOR operation on the result of the logical OR operation and the cluster mask of the cluster to obtain a comparison result; According to the comparison results of the target node and each cluster, the cluster corresponding to the comparison result with the least number of non-zero value elements in each comparison result is determined as the cluster having the most common source nodes with the target node.
4. The method of claim 3, wherein, updating a cluster mask of the determined cluster according to a neighbor mask of the target node, comprising: performing a logical OR operation on the neighbor mask of the target node and the cluster mask of the determined cluster, and determining a result of the logical OR operation as the cluster mask of the determined cluster.
5. The method of claim 1, wherein, determining at least two center nodes from the plurality of target nodes, comprising: determining a degree of each of the target nodes from the plurality of target nodes; determining at least two target nodes corresponding to degrees in front in a degree descending order as the at least two center nodes according to the degrees of each of the target nodes.
6. The method of claim 1, wherein, allocating each source node to a cluster having the most edges with the cluster, comprising: for any source node, calculating a number of edges of the source node connected with target nodes in each cluster according to an adjacency matrix corresponding to the convolution layer, to obtain a number of edges of the source node with each cluster; allocating the source node to a cluster having the largest number of edges with the cluster according to the number of edges of the source node with each cluster.
7. The method of claim 1, wherein, when the number of the convolution layers is a plurality, the any convolution layer is a last convolution layer, after determining the cluster corresponding to the last convolution layer, the method further comprises: for other convolution layers except the last convolution layer, performing the following operations in reverse order in sequence: taking source nodes of a next convolution layer of a current convolution layer as target nodes of the current convolution layer, and a clustering result of the target nodes of the current convolution layer inherits a clustering result of the source nodes of the next convolution layer; allocating source nodes of the current convolution layer to corresponding clusters to obtain clusters corresponding to the current convolution layer.
8. The method of claim 1, wherein, reading feature information of nodes in the clustered clusters corresponding to any convolution layer and storing the feature information into a cache according to the clustered clusters, and obtaining an output result of the convolution layer according to the feature information stored in the cache, comprising: reading feature information of nodes in the clustered clusters corresponding to any convolution layer and storing the feature information into a cache, determining a weight matrix and an adjacency matrix to be calculated with the feature information; determining a multiplication order of the feature information, the weight matrix and the adjacency matrix according to a training strategy of the graph convolution network or a number of rows and columns of the adjacency matrix, and calculating the feature information, the weight matrix and the adjacency matrix according to the multiplication order to obtain the output result of the convolution layer.
9. The method of claim 8, wherein, when forward propagation, if the training strategy of the graph convolution network is full batch training, or if the training strategy is non-full batch training and the number of rows of the adjacency matrix is greater than or equal to the number of columns, the multiplication order is: performing a product operation on the feature information and the weight matrix, and performing a product operation on the obtained product and the adjacency matrix; if the training strategy is non-full batch training and the number of rows of the adjacency matrix is less than the number of columns, the multiplication order is: performing a product operation on the adjacency matrix and the feature information, and performing a product operation on the obtained product and the weight matrix.
10. The method of claim 8, wherein, In back propagation, if the training strategy of the graph convolution network is full batch training, or if the training strategy is non-full batch training and the number of rows of the adjacency matrix is greater than or equal to the number of columns, in the calculation of the partial derivative of the weight matrix, the corresponding multiplication order is: the partial derivative of the transpose matrix of the adjacency matrix and the result matrix is multiplied, and the obtained product is multiplied with the transpose matrix of the feature information, wherein the result matrix is a matrix obtained by multiplying the adjacency matrix, the feature information and the weight matrix in forward propagation; in the calculation of the partial derivative of the feature information, the corresponding multiplication order is: the partial derivative of the transpose matrix of the adjacency matrix and the result matrix is multiplied, and the obtained product is multiplied with the transpose matrix of the weight matrix; If the training strategy is non-full batch training and the number of rows of the adjacency matrix is less than the number of columns, in the calculation of the partial derivative of the weight matrix, the corresponding multiplication order is: the transpose matrix of the feature information and the transpose matrix of the adjacency matrix are multiplied, and the obtained product is multiplied with the partial derivative of the result matrix; in the calculation of the partial derivative of the feature information, the corresponding multiplication order is: the partial derivative of the result matrix and the transpose matrix of the weight matrix are multiplied, and the obtained product is multiplied with the transpose matrix of the adjacency matrix.
11. A graph data processing method, comprising: Comprising: Obtaining graph data to be processed; Processing the graph data based on a graph convolution network to obtain a corresponding processing result; wherein the graph convolution network is trained based on the method of any one of claims 1-10.
12. A graph convolutional network training device, characterized in that, The graph convolution network comprises at least one convolution layer for processing graph data, the graph data comprising a plurality of nodes and edges between nodes; the device comprises: A determination module for determining, for any convolution layer, a plurality of target nodes to be processed by the convolution layer and source nodes of each target node, the target node being a node to be updated with feature information, and the source node of the target node being a node in the neighbor nodes of the target node for updating the feature information of the target node; An allocation module for determining at least two center nodes from the plurality of target nodes, any center node corresponding to a cluster, and allocating the remaining target nodes other than the center nodes in the plurality of target nodes to the cluster having the most common source nodes with the cluster, and allocating each source node to the cluster having the most edges with the cluster to obtain at least two clustered clusters; A processing module for reading the feature information of the nodes in the clustered clusters and storing it in a cache according to the clustered clusters corresponding to any convolution layer in the training process of the graph convolution network, and obtaining the output result of the convolution layer according to the feature information stored in the cache.
13. An electronic device, comprising: Comprising: At least one processor; And A memory connected in communication with the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to perform the method of any one of claims 1-11.
14. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer executable instructions, and when the processor executes the computer executable instructions, the method of any one of claims 1-11 is implemented.
15. A computer program product, characterised in that, The computer program is executed by the processor to implement the method of any one of claims 1-11.