Systems, computing devices, and storage media for graph neural network processing
By using the graph processing component and the neural network processing component in the graph neural network processing system, the problem that existing technologies cannot support multiple graph neural network models is solved, and flexible adaptation and training of different types of graph neural network models are achieved.
Patent Information
- Application Number
- CN202110593688.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-28
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2041-05-28
AI Technical Summary
Existing technologies struggle to support various types of graph neural network algorithms, especially graph neural networks with single-step aggregation of indirect neighbors and hierarchical aggregation of indirect neighbors. They are unable to effectively collect and aggregate information, resulting in the system's inability to flexibly adapt to different types of graph neural network models.
A graph neural network processing system is provided. Through graph processing components and neural network processing components, it can determine different types of relationships based on the sample node selection method, and support the training of various graph neural network models by aggregating and updating node information.
It achieves flexible support for a variety of graph neural network models, can adapt to the training needs of different types of graph neural network models, and improves the applicability and flexibility of the system.
Smart Images

Figure CN115408530B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and particularly relates to a system for graph neural network processing, a training method of a graph neural network, a computing device and a storage medium. BACKGROUND
[0002] With the rapid development of deep learning technology, various types of graph neural network algorithms are proposed and applied to real scenarios. Among them, the graph neural network algorithm is an algorithm technology that applies traditional neural network algorithm technology to graph data. In the graph neural network algorithm, each node in the graph constantly collects information of its neighbors and aggregates, and finally each node in the graph obtains a low-dimensional vector representation. Among them, the graph neural network algorithm can be applied to knowledge graph, recommendation system and life science scenarios. However, in order to enable algorithm designers to flexibly express the graph neural network algorithm, various graph neural network systems have been developed, and various types of graph neural network algorithms are applied to scenarios. However, the current graph neural network system can only support one type of graph neural network algorithm and apply it to the scene, and cannot flexibly support multiple types of graph neural network algorithms. SUMMARY
[0003] Aspects of the present application provide a system for graph neural network processing, a computing device and a storage medium, to enable flexible support for training of multiple graph neural network models.
[0004] The embodiment of the present application provides a system for graph neural network processing, which is used for processing sample graph data, the sample graph data comprising a plurality of sample nodes and an association relationship between the plurality of sample nodes, the plurality of sample nodes comprising a first node and a second node, the system comprising: an execution component, the execution component comprising: a graph processing component, configured to acquire sample graph data and a sample node selection mode, and determine an association relationship between the first node and the second node from the sample graph data according to the sample node selection mode, the first node being a to-be-processed node in the sample nodes, and the second node being another node in the sample nodes for processing the first node; and a neural network processing component, configured to acquire the association relationship, aggregate information of the second node based on the determined association relationship, and update information of the first node, to be used for a training process of a graph neural network model.
[0005] The embodiment of the present application further provides a method for training a graph neural network, used for processing sample graph data, wherein the sample graph data comprises a plurality of sample nodes and an association relationship between the plurality of sample nodes, and the plurality of sample nodes comprises a first node and a second node; the method comprises the following steps: obtaining sample graph data as a training sample and a corresponding first node, wherein the first node refers to a to-be-processed node in the sample nodes; determining a sample node selection mode for the first node; determining an association relationship between the first node and the second node from the sample graph data according to the sample node selection mode, wherein the second node refers to other nodes in the sample nodes for processing the first node; and aggregating information of the second node based on the determined association relationship, and updating information of the first node for a training process of a graph neural network model.
[0006] The embodiment of the present application further provides an electronic device, comprising a memory and a processor; the memory is used for storing a computer program; and the processor executes the computer program, so as to: obtain sample graph data as a training sample and a corresponding first node; determine a sample node selection mode for the first node, wherein the sample graph data comprises a plurality of sample nodes and an association relationship between the plurality of sample nodes, and the plurality of sample nodes comprises the first node and a second node; determine an association relationship between the first node and the second node from the sample graph data according to the sample node selection mode, wherein the second node refers to other nodes in the sample nodes for processing the first node; and aggregate information of the second node based on the determined association relationship, and update information of the first node for a training process of a graph neural network model.
[0007] The embodiment of the present application further provides a computer readable storage medium storing a computer program, which is executed by one or more processors to cause the one or more processors to implement the steps in the above method.
[0008] In the embodiment of the present application, a graph processing component is used to obtain sample graph data and a sample node selection mode, and determine an association relationship between a first node and a second node from the sample graph data according to the sample node selection mode, wherein the first node refers to a to-be-processed node in the sample nodes, and the second node refers to other nodes in the sample nodes for processing the first node; a neural network processing component is used to obtain the association relationship, aggregate information of the second node based on the determined association relationship, and update information of the first node for a training process of a graph neural network model.
[0009] Since the graph processing component can determine the association relationship between the first node and the second node from the sample graph data through the sample node selection manner, different association relationships can be established through different sample node selection manners, so that the requirements of different types of graph neural network models for the association relationship between nodes can be met through different association relationships. At the same time, the neural network processing component is configured to obtain the association relationship, aggregate information of the second node based on the determined association relationship, and update information of the first node, so as to be used for training of the graph neural network model. Thus, the training of different types of graph neural network models can be supported. Therefore, different types of graph neural network models can be flexibly compatible. BRIEF DESCRIPTION OF DRAWINGS
[0010] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and serve to explain the principles of the application, and do not limit the application. In the drawings:
[0011] Figure 1 A system schematic diagram for graph neural network processing of an exemplary embodiment of the present application;
[0012] Figure 2 A sample graph data schematic diagram of an exemplary embodiment of the present application;
[0013] Figure 3 An association relationship graph schematic diagram of an exemplary embodiment of the present application;
[0014] Figure 4 A flowchart schematic diagram of a graph neural network training method of an exemplary embodiment of the present application;
[0015] Figure 5 A structural schematic diagram of a computing device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0016] To make the purposes, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described clearly and completely below in combination with specific embodiments of the present application and corresponding drawings. Obviously, the described embodiments are only some of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0017] As known from the foregoing, the graph neural network algorithm is an algorithm technology that applies the traditional neural network algorithm technology to graph data. In the graph neural network algorithm, each node in the graph constantly collects information of its neighbors and aggregates, and finally each node in the graph obtains a low-dimensional vector representation. In order to make it clearer, it can be referred toFigure 2 The sample graph data 200 is shown, which can be regarded as the graph data 200. In the graph data 200, the nodes (also referred to as sample vertices) 201 and the association relationship between the nodes 201 are connected by edges 202, that is, the edges 202 are the association relationship. For example, the node A and its neighbor node E are connected by the edge 202. The node A can collect the information of the neighbor nodes and aggregate the information. The neighbor node E is a direct neighbor node of the node A, and the neighbor node G is an indirect neighbor node of the node A.
[0018] Based on this, the graph neural network can be mainly divided into, but not limited to, the following types of graph neural networks: a direct neighbor single-step aggregation type of graph neural network, an indirect neighbor single-step aggregation type of graph neural network, and an indirect neighbor hierarchical aggregation type of graph neural network, and the like. However, in the prior art, the system for processing and training of the graph neural network mainly supports the current mainstream direct neighbor single-step aggregation type of graph neural network. For example, the system can train the type of graph neural network by collecting the information of the direct neighbors (also referred to as direct neighbor nodes) of the nodes in the graph and aggregating the information to obtain the vector corresponding to the node. However, for other types of graph neural networks that are more difficult, such as the indirect neighbor single-step aggregation type of graph neural network and the indirect neighbor hierarchical aggregation type of graph neural network, and the like, the indirect neighbor single-step aggregation type of graph neural network needs to select a plurality of indirect nodes, and then collect the information of the selected indirect neighbors and aggregate the information. The indirect neighbor hierarchical aggregation type of graph neural network not only needs to select a plurality of indirect neighbors, but also needs to collect the information of the selected indirect neighbors and aggregate the information in multiple steps. Due to the relatively complex processing process, such as the single-step aggregation of the indirect neighbors, it is beyond the scope of the system for processing and training of the graph neural network in the prior art to support the collection and aggregation of the direct neighbor information (i.e., direct neighbor single-step aggregation), because it cannot support the selection of the indirect neighbors and the aggregation of the information. For the indirect neighbor hierarchical aggregation type, it is also obviously beyond the scope of the system for processing and training of the graph neural network in the prior art to support the collection and aggregation of the direct neighbors, because it also cannot support the selection of the indirect neighbors and the complex process of the multi-step aggregation. Therefore, the system in the prior art cannot well support the processing and training of these types of graph neural networks.
[0019] Based on this, the embodiments proposed in the present application can solve the above problems and flexibly support the processing and training of a plurality of different graph neural network models.
[0020] In the following, the system for processing of the graph neural network is described in detail in combination with embodiments.
[0021] Figure 1A system diagram for graph neural network processing is provided for an exemplary embodiment of the present application. The system 100 provided by the embodiments of the present application can be deployed on a computing device, such as a server. The system 100 can include an execution component 102, which includes a neural network processing component 108 and a graph processing component 106.
[0022] The graph processing component 106 is configured to obtain sample graph data and a sample node selection manner, and determine an association relationship between a first node and a second node from the sample graph data according to the sample node selection manner.
[0023] The neural network processing component 108 is configured to obtain the association relationship, aggregate information of the second node based on the determined association relationship, and update information of the first node for training of a graph neural network model.
[0024] The sample graph data includes a plurality of sample nodes and an association relationship between the plurality of sample nodes, and the second node corresponding to the sample node selection manner includes a directly associated sample node and / or an indirectly associated sample node corresponding to the first node. The first node refers to a to-be-processed node in the sample nodes, and the second node refers to another node in the sample nodes for processing the first node.
[0025] It should be noted that the system can be deployed on a single server, and the server in the execution subject can be a single physical server, or a hardware server. The server can implement aggregation and updating of information in the sample graph data through the neural network processing component 108 in the system 100 deployed thereon. It can also directly receive corresponding files or user-defined functions, and then generate execution steps or execution contents through the execution component 102 in the system 100 to perform each stage.
[0026] The system 100 can also be deployed on a cluster, such as a server cluster, which can include a plurality of hardware servers (also referred to as physical servers, and the server of the execution device can also be a server in the cluster). Each hardware server can deploy the execution component 102. The cluster can share the system 100. The servers in the cluster can communicate through a preset communication manner. For example, one of the servers can be a master server, which is responsible for load balancing, and then performs load balancing through the load processing component of the system 100 deployed in the cluster, and then distributes the divided sample graph data to the corresponding servers. At the same time, the complete association relationship (or the association relationship corresponding to the divided sample graph data) can also be distributed.
[0027] Also, each server in the cluster can act as a master server, and one server can perform load balancing through the load handling component of the system 100 deployed in the cluster, and then distribute the divided sample graph data to the corresponding servers. At the same time, the complete association relationship (or the association relationship corresponding to the divided sample graph data) can also be distributed.
[0028] In addition, if each server in the cluster is deployed with the system 100, each server can perform load balancing through the load handling component of the system 100 deployed in the cluster, and then distribute the divided sample graph data to the corresponding servers. At the same time, the complete association relationship (or the association relationship corresponding to the divided sample graph data) can also be distributed. After receiving the divided load, the corresponding server can perform aggregation and update of information in the sample graph data, and return the updated information to the master server or the server that distributed the above load. The corresponding server can perform aggregation and update of information in the sample graph data through the neural network processing component 108 in the system 100 deployed in the server cluster. The aggregation and update of information in the sample graph data can also be performed through the neural network processing component 108 in the system 100 deployed on the server. At the same time, for the cluster shared system 100, the corresponding file or user-defined function can be directly received, and then the execution component 102 in the system 100 is used to generate the execution step or the execution content, so as to perform the above stages. Thus, the server can directly execute the corresponding aggregation and update through the neural network processing component 108. For each server deployed with the system 100, one server in the server cluster can receive the corresponding file or user-defined function, and then distribute it to the system 100 of each server, so as to generate the execution step or the execution content through the execution component 102 in each system 100, so as to perform the above stages.
[0029] For virtual devices, such as containers or virtual machines. Multiple virtual devices can form a virtual device cluster, such as multiple containers forming a container cluster, or the virtual device cluster can also be regarded as a device cluster, which can be deployed on a cloud server. The server executing the subject can be a cloud server. The multiple containers are preferably running on the same physical device (such as a hardware server). They can also be running on different physical devices. The system 100 can also be deployed on the container cluster, or each container can be deployed with the system 100. The process of processing information by the cluster composed of multiple servers as described above is similar, and will not be described again. Only explain: taking the container cluster as an example, for the container cluster, the container is running through the instance, based on the neural network processing component 108 in the system 100 to run the load divided, such as aggregation and update, and return the updated information to the main container, or to the container that distributes the load. The containers communicate with each other through the preset communication mode. The container can be realized by relying on the resources of the corresponding physical device.
[0030] The above system is described in detail as follows:
[0031] The graph processing component 106 is configured to obtain sample graph data and a sample node selection manner, and determine an association relationship between a first node and a second node from the sample graph data according to the sample node selection manner.
[0032] The sample graph data includes multiple sample nodes and association relationships between the multiple sample nodes. The first node refers to a to-be-processed node in the sample nodes, and the second node refers to another node in the sample nodes for processing the first node, which can be a to-be-selected node. The second node also refers to a second node corresponding to the sample node selection manner, including a direct association sample node and / or an indirect association sample node corresponding to the first node.
[0033] The sample node selection manner includes a direct association sample node selection manner and an indirect association sample node selection manner. Figure 2 The sample graph data 200 is shown, in which the sample nodes 201 (also referred to as sample vertices) and the association relationships between the sample nodes 201 are connected by edges 202, that is, the edges 202 are the association relationships. For example, the first node A (to-be-processed node) and the sample node E (second node) are connected by the edge 202. When the sample graph data 200 is a knowledge graph, the edge 202 between the first node A (bed) and the sample node E (wardrobe) can represent a "matching" relationship.
[0034] As shown in the figure, the direct association nodes of the first node A are the sample node E, the sample node H, the sample node F, and the sample node D. The indirect association sample nodes can be the sample node B and the like. Figure 2 As shown in the figure, the direct association nodes of the first node A are the sample node E, the sample node H, the sample node F, and the sample node D. The indirect association sample nodes can be the sample node B and the like.
[0035] Graph data refers to a relational graph consisting of nodes (also called vertices) and the relationships between nodes (also called edges), such as a knowledge graph. It should be understood that this graph data can also refer to the above-mentioned... Figure 2 The sample graph data 200 shown can be considered as a type of graph data. Nodes can be considered as... Figure 2 The sample nodes shown are A (also the first node), E, H, etc. The relationships between the nodes can be considered as... Figure 2 The edge 202 shown in the figure.
[0036] The aforementioned sample graph data refers to the graph data used as training samples. This sample graph data includes multiple sample nodes and the relationships between them, and allows designating one sample node as the first node.
[0037] The sample node selection method refers to how to select the corresponding second node from the sample graph data based on the first node, or in other words, using the first node as a benchmark.
[0038] The sample node selection methods include: the selection method of directly related nodes, the selection method of random access in different access directions, and the selection method of information type of intermediate nodes.
[0039] The method for selecting directly related nodes refers to selecting neighboring nodes that are directly related to the first node. For example... Figure 2 As shown, the directly associated nodes (i.e., directly associated neighboring nodes) of the first node A are sample node E, sample node H, sample node F, and sample node D.
[0040] The selection method for random access in different access directions refers to selecting the corresponding sample node by using the first node as a reference and conducting a random walk. For example... Figure 2 As shown, starting from node A, a random walk is performed along different edges 202 (i.e., different access directions) until sample nodes C and G are reached. The selected nodes are then sample nodes C and G. It should be noted that a random walk can also be performed on the direct neighbors of node A, but this will not be elaborated upon further.
[0041] The selection method for intermediate sample node information types refers to setting different types of intermediate sample nodes, connecting the intermediate sample nodes to the first node, and then searching for the corresponding node from the sample graph data that is related to the first node based on the different types of intermediate sample nodes. For example... Figure 2As shown, the first node A can be directly associated with intermediate sample nodes M and N, the type of the intermediate sample node M can be an electrical appliance type, and the type of the intermediate sample node N can be a furniture type. Then, from other nodes associated with the first node A in the sample graph data 200, sample nodes belonging to the two types are found, such as sample nodes C and D belonging to the electrical appliance type, and sample nodes E and B belonging to the furniture type.
[0042] It should be noted that the above selection methods can correspond to node selection methods of different graph neural network types.
[0043] The second node corresponding to the sample node selection method includes a directly associated sample node and / or an indirectly associated sample node corresponding to the first node. The directly associated sample node can include the first node itself, and can also include nodes having a direct relationship with the first node, such as Figure 2 As shown, the directly associated sample nodes of the first node A can include the first node A itself, sample nodes E, D, F, and H connected to the first node A through only one edge 202. Other nodes can be indirectly associated sample nodes of the first node A.
[0044] It should be noted that how the directly associated sample nodes and the indirectly associated sample nodes are determined can be determined autonomously by external input, such as the above-mentioned determination method. There can also be other determination methods, such as the directly associated sample nodes can also include sample nodes having a two-edge association relationship with the first node A, such as sample node B. Due to Figure 2 the limitation, nodes having a multiple-edge association relationship with the first node A are not drawn, but it should be understood that there can be three-edge association relationship sample nodes, and it can be determined that sample nodes having more than three edges are indirectly associated sample nodes. Here, it will not be described again.
[0045] In addition, as shown in Figure 1 The system 100 further includes an interface component 101, the interface component 101 is configured to obtain a user-defined function, the user-defined function is configured to determine an association relationship, aggregate information of a second node, and update, for a training process of a graph neural network model; and an execution component 102, based on the interface component 101, obtains the user-defined function, and converts the user-defined function into execution content corresponding to a neural network processing component 108 and execution content corresponding to a graph processing component 106, so that the neural network processing component 108 and the graph processing component 106 implement the training of the graph neural network model according to the corresponding execution content.
[0046] User-defined functions can be recorded in a file. These are functions or programs written by the user. They are written by the user according to different needs. In this case, the functions described above are used to determine the aforementioned relationships, aggregate the information of the second node, and update it.
[0047] The specific presentation of interface component 101 may be, but is not limited to, a user interface, an API (Application Programming Interface), etc.
[0048] For example, as mentioned earlier, external input operations via the computer's display interface, or user interface, can be determined through three user-defined functions. These functions can be written by the user according to established rules, or selected from multiple functions provided by the server. Different selection methods correspond to different functions. The user-selected function can also have its parameters modified or adapted according to user needs. The determination of the aforementioned relationships, the aggregation of information in the second node, and the updating of information in the second node each correspond to a user-defined function. Thus, the computer obtains the methods for determining the relationships, aggregating and updating the information in the second node based on the determined user-defined functions. Then, the corresponding user-defined function can be sent to the server to determine the relationships, aggregate and update the information in the second node.
[0049] In addition, the server can also call user-defined functions via API to obtain the corresponding user-defined functions, and then determine the relationships, aggregate and update the information of the second node according to the methods described above. This will not be elaborated further.
[0050] like Figure 1 As shown above, the execution component 102 can receive the three user-defined functions or corresponding files through the interface component 101. It then converts the user-defined functions recorded in the file into execution content or steps corresponding to each stage, such as node selection 103, aggregation 104, and update 105, thereby completing the determination of the association, aggregation of the information of the second node, and updating. The converted execution content or steps can then be used by the corresponding neural network processing component 108 and graph processing component 106 in the execution component 102.
[0051] More specifically, the execution component 102 is used to acquire the sample image data used as training samples and the corresponding first node.
[0052] The execution component 102 is configured to acquire sample graph data and determine the first node by the interface component 101 based on the input file.
[0053] The execution component 102 is configured to acquire sample graph data and determine the first node by the interface component 101 based on the input file.
[0054] For example, the user-defined function can be input by the external input operation through the interface component 101, such as the display interface or user interface provided by the computer, so as to acquire the sample graph data, such as the sample knowledge graph and the first node A in the sample graph data.
[0055] Then, the execution component 102 can acquire sample graph data and determine the first node according to the method described above. It will not be repeated here, and only the converted execution content or execution step can be used by the graph processing component 106.
[0056] It should be noted that the file involved herein can be the same file as described above, or another file. The user-defined function can also be the same function as described above, or not.
[0057] Correspondingly, the execution component 102 is configured to determine the sample node selection mode for the first node.
[0058] Therefore, specifically, the execution component 102 is further configured to determine the directly associated sample node and the indirectly associated sample node of the first node based on the interface component 101 and the external input operation.
[0059] As already described above, here will not be described again, only to explain, according to the above-mentioned manner, can be through the interface component 101, such as the computer provided user interface or display interface for external input operation, input how to determine the first node of the direct associated sample node and the indirect associated sample node of the file or user-defined function. Or said definition of the first node of the direct associated sample node and the indirect associated sample node of the file or user-defined function. Thus by the computer to obtain how to determine the first node of the direct associated sample node and the indirect associated sample node of the file or user-defined function, and can be sent by the computer to send the information to the server. So that the server execution component 102 according to the file or user-defined function to determine the first node of the direct associated sample node and the indirect associated sample node, in order to select the sample node based on the sample node selection method. The converted execution content or execution step can be used by the graph processing component 106.
[0060] It should be noted that the file involved here can be the same file as described above, or another file. The user-defined function can also be the same function as described above, or not.
[0061] Specifically, the execution component 102 is also used for determining the sample node selection method (also can be called the determination method of the neighbor type) based on the interface component 101 and the external input operation.
[0062] For example, according to the above-mentioned, can be through the interface component 101, such as the computer provided display interface, or user interface, for external input operation, so as to obtain the sample node selection method, such as the selection method of the direct associated node, can be determined by the user-defined function or the corresponding file (the function can be user-defined according to the writing rule, or from the server provided multiple functions, select the corresponding function, such as different selection method corresponds to different function, the function of the autonomous selection, for the autonomous selection function, also can be according to the autonomous demand to modify the parameter or carry out other adaptation modification). Thus by the computer based on the determined user-defined function or the corresponding file to obtain the sample node selection method. Then the computer can send the user-defined function or the corresponding file of the sample node selection method to the server, to select the sample node based on the calling of the model training system 100.
[0063] Among them, such as Figure 1As shown, the server provides the system 100. Through the execution component 102 therein, that is, the GNN (graph neural network) execution component, based on the received user-defined function corresponding to the selection mode, an execution plan is generated, and the steps of model training provided by the embodiments of the present application are executed, which can include three processes of node selection, aggregation, and update. The execution plan corresponding to the node selection 103, the aggregation 104, and the update 105 can be generated through the GNN execution component 102, and combined to obtain the final execution plan. The converted execution content (that is, the execution plan) or execution steps can be used by the graph processing component 106.
[0064] It should be noted that the directly associated sample nodes and the indirectly associated sample nodes of the first node can be determined in the user-defined function described above. Details are not repeated.
[0065] In addition, the graph processing component 106 is specifically configured to determine the selection path corresponding to the first node and the directly associated sample node from the sample graph data according to the selection mode of the directly associated sample node; and determine the association relationship between the directly associated sample node and the first node according to the determined selection path and the directly associated sample node.
[0066] For example, according to the foregoing, as Figure 2 As shown, the graph processing component 106 in the system 100 deployed by the server can select the directly associated nodes: the sample node E, the sample node H, the sample node F, and the sample node D according to the determined selection mode. And the corresponding selection path can also be from the first node A to the sample node E, that is, the edge 202 between the two nodes. Similarly, the paths between other sample nodes and the first node A are determined. Thus, the final association relationship can be determined, that is, the first node A is directly connected to the sample node E through the edge 202, the first node A is directly connected to the node H through the edge 202, the first node A is directly connected to the sample node F through the edge 202, and the first node A is directly connected to the sample node D through the edge 202. In order to more intuitively determine the association relationship, the graph data of this association relationship can be formed in the manner of Figure 2
[0067] In addition, the number of selected directly associated sample nodes can also be limited, such as a preset number of nodes. According to the foregoing, 2 points are selected, such as the sample node E and the sample node H.
[0068] These can be realized through the user-defined function or the corresponding file.
[0069] Specifically, the graph processing component 106 is used to randomly select corresponding sample nodes from the sample graph data based on the first node, according to the random access selection method of sample nodes in different access directions in the sample graph data; and to create an association relationship between the selected sample nodes and the first node based on the selected sample nodes.
[0070] For example, as mentioned above, such as Figure 2 As shown, the graph processing component 106 in the system 100 deployed on the server can, according to a determined selection method, take the first node A as a reference and randomly walk towards different edges 202, i.e., different access directions, until it reaches sample nodes C and G. Here, it walks through two edges 202. The selected nodes are then sample nodes C and G. Then, sample nodes C and G are directly associated with the first node A. The first node A is directly connected to sample node C through edge 202, and the first node A is directly connected to sample node G through edge 202. To more intuitively determine the association relationship, it can be done according to... Figure 2 This relationship is formed by graph data.
[0071] Furthermore, a predetermined number of sample nodes can be randomly selected from the random walk, as mentioned above, and will not be elaborated further. The importance of the sample nodes selected by the random walk can also be determined, allowing the selection of sample nodes with importance greater than a threshold.
[0072] These can all be achieved through user-defined functions or corresponding files.
[0073] Specifically, the graph processing component 106 is used to: determine intermediate sample nodes, the association between intermediate sample nodes and the first node, and the information type of intermediate sample nodes; select sample nodes of the same information type from the sample graph data based on the first node, and create the association between the corresponding intermediate sample nodes and the selected sample nodes, according to the selection method of information type; and determine the association between the first node, intermediate sample nodes, and selected sample nodes based on the association between intermediate sample nodes and the first node and the association between intermediate sample nodes and the selected sample nodes.
[0074] For example, as mentioned above, such as Figure 2 As shown, the graph processing component 106 in the system 100 deployed on the server can, according to a determined selection method, set intermediate sample nodes M and N directly associated with the first node A. The type of intermediate sample node M can be appliance type, and the type of intermediate sample node N can be furniture type. The types of intermediate sample nodes M and N can then be further refined.
[0075] likeFigure 3 As shown, the intermediate sample node M can include a p1 intermediate sample node, which can correspond to an intermediate sample node of a TV type. The intermediate sample node N can include p2-p4 intermediate sample nodes, which can correspond to a sofa, a wardrobe, a bed and a bookshelf, respectively. Then, the corresponding sample nodes can be selected from the other sample nodes associated with the first node A in the sample graph data 200 shown in FIG. 2, such as the sample node C and the sample node D of the intermediate sample node p1 of the TV type, the node E and the sample node B of the intermediate sample node p2 of the sofa type, the sample node F and the sample node G of the intermediate sample node p3 of the wardrobe type, the sample node G and the sample node H of the intermediate sample node p4 of the bed type, and the sample node H and the sample node I of the intermediate sample node p5 of the bookshelf type. After the sample nodes are selected, the corresponding paths can be determined, such as Figure 2 As shown, for the p1 intermediate sample node, the path is the first node A-sample node D-sample node C. For the p2 intermediate sample node, the path is the first node A-sample node E-sample node B. For the p3 intermediate sample node, the path is the first node A-sample node F-sample node G. For the p4 intermediate sample node, the path is the first node A-sample node H-sample node G. For the p5 intermediate sample node, the path is the first node A-sample node H-sample node I. Figure 2
[0076] Thus, according to the above paths, the association relationship shown in FIG. 3 can be created. Figure 3
[0077] It should be understood that even for a single or single-layer intermediate sample node, such as the intermediate sample nodes M and N in FIG. 2, which belong to the same layer of intermediate sample nodes, the corresponding sample nodes can be directly selected according to the above manner, and then the corresponding association relationship can be generated, which will not be described in detail. Correspondingly, for the intermediate sample nodes p1-p5, the types can be further divided according to the requirements, and then the determination of the association relationship can be performed according to the above manner, which will not be described in detail. Figure 3
[0078] It should be noted that no matter which selection manner is used, the establishment of the final association relationship can be referred to as the establishment of a hierarchical relationship graph, such as the relationship graph shown in FIG. 3, which can include two parts, such as Figure 3 Figure 3 As shown, a schema tree 301, and a neighbor node instance 302. The schema tree 301 can include a first node as a root node and intermediate sample nodes as leaf nodes, i.e., intermediate sample nodes, each of which represents a corresponding neighbor type. And the neighbor node instance 302 can include a plurality of sample nodes.
[0079] These can be implemented through user-defined functions or corresponding files.
[0080] When the intermediate sample node is a multi-layer intermediate sample node, the graph processing component 106 is further configured to determine an association relationship between the multi-layer sample intermediate nodes; and determine the association relationship between the first node, the intermediate sample node, and the selected sample node based on the association relationship between the first layer sample intermediate node and the first node, the association relationship between the multi-layer sample intermediate nodes, and the association relationship between the last layer sample intermediate node and the selected sample node.
[0081] As described above, these will not be repeated here. These can be implemented through user-defined functions or corresponding files.
[0082] After establishing the association relationship, different association relationships can be established through different sample node selection methods, so that different association relationships can be used to meet the requirements of different types of graph neural network models for the association relationship between nodes as described above. On this basis, subsequent aggregation and updating can be completed, thereby supporting the training of different types of graph neural network models.
[0083] For the neural network processing component 108:
[0084] The neural network processing component 108 is configured to obtain the association relationship, aggregate information of the second node based on the determined association relationship, and update information of the first node for use in the training process of the graph neural network model.
[0085] Wherein, the information of the sample node refers to the characteristics of the sample node (such as price information, material information, etc. of the furniture sample node), which can also be a corresponding feature vector.
[0086] The neural network processing component 108 is further configured to: call an access interface of the association relationship; and obtain the association relationship between the first node and the second node according to the called access interface.
[0087] For example, as described above, the neural network processing component 108 can obtain the hierarchical relationship graph from the graph processing component 106 by calling the access interface of the hierarchical relationship graph structure in the API interface 111. Figure 1 As shown, the neural network processing component 108 can obtain the hierarchical relationship graph from the graph processing component 106 by calling the access interface of the hierarchical relationship graph structure in the API interface 111.
[0088] Specifically, the neural network processing component 108 is used to: determine the features of the second node based on preset training parameters; obtain the aggregation method; and aggregate the sample features of the second node according to the aggregation method and the correlation relationship to obtain the final aggregated sample features, so as to update the information of the first node.
[0089] Among them, the features of the second node and the features of the final aggregated sample refer to the feature vector.
[0090] The aggregation method can be an aggregation function. Aggregation can be performed using aggregation functions. An aggregation function is a function that aggregates information from corresponding nodes.
[0091] Specifically, the neural network processing component 108 is used to: determine the association path corresponding to the association relationship, take the direction along the first node as the reference direction, and aggregate the sample features of the second node according to the aggregation function corresponding to each second node in the association path to obtain the final aggregated sample features.
[0092] In this approach, each layer of sample nodes (which can be intermediate sample nodes in a single layer or single-layer sample nodes) shares the same aggregation function. For example... Figure 3 As shown, the first layer of sample nodes, layer 304, shares an aggregation function. The second layer of sample nodes, layer 305, also shares an aggregation function. It should be understood that for layer 303, where the first node A resides, it could be layer 0, in which case aggregation is required. Alternatively, the update here can be considered as aggregation. The third layer of sample nodes, layer 306, does not need an aggregation function.
[0093] For example, as described above, the neural network processing component 108 in the system 100 deployed on the server can, according to, Figure 3 As shown, the relationships, from bottom to top, are according to... Figure 3 The aggregation is performed along the associated path indicated by the arrow direction (i.e., with the target sample node A as the reference direction). For example, the sample feature vector of intermediate sample node p1 is aggregated from the sample feature vectors of first node A, sample node C, and sample node D according to the aggregation function of layer 305. This process continues until aggregation reaches first node A, where the aggregated sample feature vector of first node A is aggregated from the sample feature vectors of intermediate sample node M and intermediate sample node N according to the aggregation function of layer 304. The sample feature vector of a sample node can be obtained by using a preset algorithm, such as embedding or convolution, based on the features corresponding to the sample node. The algorithm has training parameters to obtain the sample feature vector.
[0094] Specifically, the neural network processing component 108 is specifically configured to: obtain an update manner, and update the sample feature of the first node according to the final aggregated sample feature and the update manner.
[0095] The update manner can be updating by an update algorithm or an update rule. The update algorithm or the update rule is used to fuse the aggregated information, such as the aggregated sample feature, with the information of the corresponding node itself, such as the feature. For example, the aggregated sample feature can be directly merged with the sample feature of the first node. Or it can also be based on the merging +1 and the like. Different update algorithms can be selected according to different requirements.
[0096] For example, according to the foregoing, as shown in FIG. 1, the neural network processing component 108 in the system 100 deployed by the server merges the final aggregated sample feature of the first node A with the sample feature of the first node A itself to obtain the final sample feature. Figure 3
[0097] It should be noted that the sample nodes in the sample graph data can have information before updating, so as to obtain the corresponding sample feature vector. The information before updating can be 0.
[0098] In addition, the aggregation manner and the update manner can also be determined by external input.
[0099] Specifically, the execution component 102 is further configured to: determine the aggregation manner and the update manner based on the interface component 101 and the external input operation, input a user-defined function or a corresponding file, determine the aggregation manner and the update manner based on the interface component 101 and the external input operation, input a user-defined function or a corresponding file, and determine the aggregation manner and the update manner based on the interface component 101 and the external input operation, input a user-defined function or a corresponding file; based on the aggregation manner, aggregate the information of the second node according to the determined association relationship, and update the information of the first node according to the update manner.
[0100] The neural network processing component 108 is configured to determine the corresponding aggregation function through the execution content of the file (or the user-defined function), determine the aggregation manner according to the aggregation function, and aggregate the information of the second node based on the determined association relationship.
[0101] The neural network processing component 108 is configured to determine the corresponding update manner through the execution content of the file (or the user-defined function), and update the information of the first node according to the update manner, so as to be used in the training process of the graph neural network model.
[0102] For example, according to the foregoing, the user can input the operation through the interface component 101, such as the user interface or display interface provided by the computer, and input the user-defined function or the corresponding file, so as to provide at least one aggregation function and / or at least one update algorithm (each user-defined function can correspond to an aggregation function or an update algorithm, and the corresponding aggregation function and / or update algorithm for the sample node is determined. Thus, the computer obtains the user-defined function or the corresponding file for determining the corresponding aggregation function and / or update algorithm, and can send the user-defined function or the corresponding file to the server. The execution component 102 converts it according to the manner described above, so that the neural network processing component 108 aggregates and updates according to the aggregation function and / or update algorithm.
[0103] It should be understood that the execution component 102 can also directly preset the corresponding aggregation function and update algorithm for the sample node.
[0104] In the aggregation process, in order to improve the aggregation performance and aggregation efficiency, the aggregation can be performed in the following manner.
[0105] Specifically, the neural network processing component 108 is also configured to: according to the association relationship between the last layer of intermediate sample nodes in the multi-layer intermediate sample nodes and the sample nodes, directly obtaining the sample features of the selected sample nodes corresponding to the last layer of intermediate sample nodes, so as to aggregate according to the directly obtained sample features; according to the association relationship between the multi-layer intermediate sample nodes and the sparse neural network, for the upper layer intermediate sample nodes in the adjacent two layers of intermediate sample nodes, obtaining the sample features of the lower layer intermediate sample nodes corresponding to the upper layer intermediate sample nodes, so as to aggregate according to the obtained sample features; according to the association relationship between the intermediate sample nodes and the first node and the dense neural network, for the first node, obtaining the sample features of the intermediate sample nodes corresponding to the first node, so as to aggregate according to the obtained sample features.
[0106] For example, according to the foregoing, as shown in the figure, Figure 3 For the last layer of intermediate sample nodes in the multi-layer intermediate sample nodes, i.e. the intermediate sample nodes p1-p5 in the layer 305, the association relationship with the sample nodes A-I, before aggregation, the intermediate sample nodes need to obtain the sample features of the corresponding sample nodes, i.e. the sample feature vectors. Then the neural network processing component 108 can directly obtain the sample feature vectors of the selected sample nodes A, C, D corresponding to the intermediate sample node p1, so as to aggregate according to the directly obtained sample features. Without making the corresponding sample nodes send the sample feature vectors to the edge first, so that the intermediate sample node p1 obtains the sample feature vectors from the edge, so as to reduce the resource utilization and improve the aggregation performance.
[0107] For the relationship between upper-layer intermediate sample nodes (i.e., intermediate sample nodes M and N in layer 304) and lower-layer intermediate sample nodes p1-p5, before aggregation, intermediate sample nodes M and N need to obtain the sample features, i.e., sample feature vectors, of the corresponding lower-layer intermediate sample nodes p1-p5. The neural network processing component 108 can then use the sample feature vectors as coefficient tensors and perform aggregation through sparse neural network operations.
[0108] Since each of the intermediate sample nodes p1-p5 corresponds to an intermediate sample node or leaf node in the schema tree, it does not consume much memory space. Therefore, aggregation can be achieved by using sparse neural network operations.
[0109] For the relationship between the intermediate sample nodes in the first layer, i.e., the intermediate sample nodes M and N in layer 304, and the first node, i.e., the first node A, before aggregation, the first node A needs to obtain the sample features, i.e., the sample feature vectors, of the corresponding intermediate sample nodes M and N. Then, the neural network processing component 108 can achieve aggregation through dense neural network operations.
[0110] Among them, such as Figure 3 As shown, the first node A, the root node of the schema tree, corresponds to two types of paths: edges connecting intermediate sample nodes M and N to the first node A. If there are n root nodes, the original input for aggregation can be represented by a shape tensor of 2n×dim, where dim refers to the feature dimension of a node at layer 1 (i.e., layer 304). If each root node needs to sum the features of all the aforementioned two types of paths, the original tensor can be reshaped to n×2×dim. This reshaping operation only changes the logical layout of the tensor and does not involve memory copying. Next, each row in the new tensor is summed in the first dimension to obtain the result, thus completing the dense neural network operation in aggregation.
[0111] In the current system 100, dense neural networks are more effective than sparse neural networks, so dense neural networks are used here to implement aggregation, which can improve aggregation performance.
[0112] After the update, training can begin. Specifically, the server can perform the training process, or the execution component 102 (such as the neural network processing component 108) can continue the training process: based on the updated information of the first node and the real information of the first node, the initial graph neural network corresponding to the association relationship is trained.
[0113] Here, real information refers to real sample features, or real sample feature vectors.
[0114] Specifically, the server or the execution component 102 (such as the neural network processing component 108 therein) is further configured to: determine the training parameters in the initial graph neural network according to the feature difference between the updated feature of the first node and the real feature of the first node, so as to complete the training of the graph neural network model.
[0115] The initial graph neural network model can be a neural network model, and can include the above-mentioned embedding, node selection, aggregation, and updating processes. The model is provided with initial training parameters, i.e., preset training parameters. The parameters can include parameters for the above-mentioned preset algorithms, such as parameters of the embedding or parameters of the convolution algorithm. The parameters can also include parameters in the aggregation function. The parameters can also include parameters in the updating algorithm, and the like. It should be understood that different association relationships can be used to meet the requirements of the association relationship between nodes in different types of graph neural network models, thereby supporting the training of different types of graph neural network models.
[0116] For example, according to the above-mentioned, after the updated sample feature vector of the first node is determined, the training parameters in the model are trained according to the feature difference between the real sample feature vector of the first node and the updated sample feature vector of the first node, the corresponding parameters are obtained, and the model training is completed.
[0117] It should be noted that the above-mentioned execution component 102 can be applied to a separate hardware device, such as a server. The execution component 102 can be directly run by the server, thereby realizing the above-mentioned node selection, aggregation, and updating operations.
[0118] In order to ensure effective training, the training can also be performed in a load balancing manner.
[0119] In addition, as shown in the figure, the system 100 further includes a load processing component 109. The load processing component 109 is configured to obtain the first node in the sample graph data and the corresponding association relationship of the first node determined based on the sample node selection manner based on the graph processing component 106, and determine the training load corresponding to the first node based on the first node in the sample graph data and the corresponding association relationship of the first node determined based on the sample node selection manner. Figure 1 The load processing component 109 is configured to perform load balancing division on the sample graph data based on the training load corresponding to the first node, and distribute the divided sample graph data to a device (which can also be a device for graph neural network processing) for training the graph neural network model.
[0120] The device for training the graph neural network model can also refer to a collective of device resources that complete the training calculation. The device resources can be physical resources such as processors and memories, and can also be virtual resources (such as distributed virtual networks, virtual computing resources, and virtual storage resources).
[0121] For example, according to the foregoing, the load processing component 109 can access the association in the graph processing component 106 through the corresponding access interface in the API interface 111, such as Figure 3 As shown, the first node A has two types of intermediate sample nodes M and N, and the intermediate sample nodes M and N correspond to intermediate sample nodes p1 and p2-p5, respectively. The intermediate sample nodes p1-p5 each correspond to three sample nodes, and each sample node can be set to have a feature of 20 dimensions. The training cost of each intermediate sample node p1-p5 is 20*3 = 60. The training cost of the intermediate sample nodes M and N is 60*1 = 60 and 60*4 = 240, respectively. This can be regarded as training load, or the training load can be determined to be proportional to the training load. Then, the sample graph data is divided according to the training load, such as 4 devices, which can be divided into 4 parts, and the divided sample graph data is distributed to the corresponding servers. At the same time of distributing the divided sample graph data, the complete association (or the association corresponding to the divided sample graph data) can also be distributed.
[0122] It should be noted that the server can perform the above division, then leave one part to itself, and then distribute the other three parts to other servers. Therefore, it will not be described in more detail.
[0123] The communication mode can be, for example, Figure 1 As shown, the system 100 further includes a message passing interface component 107, which is configured to enable the device for training the graph neural network model to communicate between devices.
[0124] As shown in Figure 1 When distributing, the message passing interface component 107 can be used to achieve distribution, for example, the load processing component 109 can call the message passing interface component 107 through the corresponding interface in the API interface 111 to perform distribution.
[0125] In addition, after partitioning, or before partitioning, the load processing component 109 (or the server) can determine whether the current training load exceeds the threshold value, and if it does, it can be partitioned according to the above method to achieve load balancing. Specifically, the load processing component 109 (or the server) is also used to: detect the current training load, and determine whether the current training load exceeds the threshold value; and when the threshold value is exceeded, send a message to other devices used to train the graph neural network model to perform load balancing.
[0126] According to the foregoing, the server can detect the current training load at regular intervals (or the load processing component 109 can detect the current training load through the server), or in real time. For example, the current CPU usage, etc. Determine whether the current training load is greater than the threshold value, and if it is, perform the above load balancing, and then send a message to other servers in the cluster where the server is located to ask whether there is a load margin for training. If there is, the partitioned sample graph data can be sent to the corresponding server.
[0127] According to the foregoing, as shown in Figure 1 The load processing component 109 can still be used to achieve this. Then, when distributing, the message passing interface component 107 can be used to send messages and distribute sample graph data, which will not be described again.
[0128] While achieving load balancing, it is also necessary to reduce the communication overhead between devices.
[0129] Specifically, the load processing component 109 is configured to perform load balancing partitioning on the sample graph data based on the training load of the first node and the number of associated relationships partitioned out in the case of partitioning the sample graph data, and distribute the partitioned sample graph data to the devices used to train the graph neural network model.
[0130] For example, according to the foregoing, in order to limit the communication cost, the distribution process, i.e. the migration process, should not reduce too many edges. If the sample graph data can have multiple partitioning results, and each partitioning result is the same load balancing, then the number of edges partitioned out in the partitioning result can be used to determine the final partitioning result. The partitioning result with the smallest number of partitioned edges is selected for partitioning and sending. This will not be described again.
[0131] In addition, the system 100 is deployed on a cloud server, the cloud server includes a plurality of virtual devices; a load processing component 109 is configured to distribute the divided sample graph data to the virtual devices for training the graph neural network model; a neural network processing component 108 on the virtual device is configured to receive the divided sample graph data, and aggregate information of the second node in the divided sample graph data according to the divided sample graph data and the association relationship, and update information of the first node, so as to train the graph neural network model. Since the foregoing has been described, details are not repeated here.
[0132] It should be further noted that, according to the foregoing, as shown in the system 100 also includes a storage component 110 (may also be referred to as a storage system), a fault tolerance module 112. Among them, the storage component 110 is used to realize the storage function in the training process, which can store sample graph data and information of each sample node, such as features, etc. The fault tolerance module 112 is a module for implementing the fault tolerance mechanism of the system 100, allowing or tolerating the occurrence of error conditions. Figure 1
[0133] After the above model is trained, the training result can be sent to an interface component, such as a user interface, to make the user aware.
[0134] Based on the similar inventive concept, Figure 4 A flowchart of a method for training a graph neural network is shown. The method 400 provided by the embodiments of the present application is executed by a server, and the method 400 is used to process sample graph data, the sample graph data includes a plurality of sample nodes and an association relationship between the plurality of sample nodes, the plurality of sample nodes includes a first node and a second node, and the method 400 includes the following steps:
[0135] 401: Obtain sample graph data as a training sample and a corresponding first node.
[0136] Among them, the first node refers to a to-be-processed node in the sample node.
[0137] 402: Determine the sample node selection mode for the first node.
[0138] 403: According to the sample node selection mode, determine the association relationship between the first node and the second node from the sample graph data.
[0139] 404: Based on the determined association relationship, aggregate information of the second node, and update information of the first node, for the training process of the graph neural network model.
[0140] Since the specific implementation of steps 401-404 has been described in detail above, it will not be repeated here. Only note that the first preset function refers to the user-defined function described above.
[0141] Specifically, the sample graph data and the corresponding first node are obtained as the training sample, including: providing an interface component, so that the sample graph data is input based on the interface component to obtain the sample graph data; and determining the first node based on the interface component and the input operation.
[0142] Specifically, the sample node selection mode for the first node is determined, including: determining the sample node selection mode based on the interface component and the input operation.
[0143] Specifically, the association relationship between the first node and the second node is determined from the sample graph data according to the sample node selection mode, including: according to the selection mode of directly associated sample nodes, determining the selection path corresponding to the first node and the directly associated sample nodes from the sample graph data; and determining the association relationship between the directly associated sample nodes and the first node according to the determined selection path and the directly associated sample nodes.
[0144] Specifically, the association relationship between the first node and the second node is determined from the sample graph data according to the sample node selection mode, including: according to the selection mode of randomly accessing the sample nodes in different access directions in the sample graph data, randomly selecting the corresponding sample nodes from the sample graph data with the first node as the reference; and creating the association relationship between the selected sample nodes and the first node according to the selected sample nodes.
[0145] Specifically, the association relationship between the first node and the second node is determined from the sample graph data according to the sample node selection mode, including: determining the intermediate sample node, the association relationship between the intermediate sample node and the first node, and the information type of the intermediate sample node; according to the selection mode of the information type, selecting the sample nodes of the same information type from the sample graph data with the first node as the reference, and creating the association relationship between the corresponding intermediate sample node and the selected sample node; and determining the association relationship between the first node, the intermediate sample node and the selected sample node based on the association relationship between the intermediate sample node and the first node and the association relationship between the intermediate sample node and the selected sample node.
[0146] In addition, the method 400 further includes: determining the directly associated sample nodes and the indirectly associated sample nodes of the first node based on the interface component and the input operation.
[0147] Further, when the intermediate sample node is a multi-layer intermediate sample node, the method 400 further comprises: determining the association relationship between the multi-layer sample intermediate nodes; determining the association relationship of the first node, the intermediate sample node and the selected sample node based on the association relationship of the first layer sample intermediate node in the multi-layer sample intermediate node and the first node, the association relationship between the multi-layer sample intermediate nodes, and the association relationship of the last layer sample intermediate node in the multi-layer sample intermediate node and the selected sample node.
[0148] Specifically, based on the determined association relationship, the information of the second node is aggregated, including: determining the features of the second node based on the preset training parameters; obtaining an aggregation manner, and aggregating the sample features of the second node according to the aggregation manner and the association relationship to obtain the final aggregated sample features, so as to update the information of the first node.
[0149] Specifically, according to the aggregation manner and the association relationship, the sample features of the second node are aggregated, including: determining an association path corresponding to the association relationship, taking the direction of the first node as a reference direction, and according to the aggregation function corresponding to each second node in the association path, the sample features of the second node are aggregated to obtain the final aggregated sample features.
[0150] Specifically, updating the information of the first node includes: obtaining an update manner, and updating the sample features of the first node according to the final aggregated sample features and the update manner.
[0151] Further, the method 400 further comprises: calling an access interface of the association relationship; and obtaining the association relationship between the first node and the second node according to the called access interface.
[0152] Further, the method 400 further comprises: determining the aggregation manner and the update manner based on the user interface and the input operation; and aggregating the information of the second node according to the determined association relationship based on the aggregation manner, and updating the information of the first node according to the update manner.
[0153] Further, the method 400 further comprises: according to the association relationship of the last layer intermediate sample node in the multi-layer intermediate sample node and the selected sample node, directly obtaining the sample features corresponding to the associated selected sample node for the last layer intermediate sample node, so as to aggregate according to the directly obtained sample features; according to the association relationship between the multi-layer intermediate sample nodes and the sparse neural network, obtaining the sample features corresponding to the associated lower layer intermediate sample node for the upper layer intermediate sample node in the adjacent two layers of intermediate sample nodes, so as to aggregate according to the obtained sample features; and according to the association relationship of the intermediate sample node and the first node and the dense neural network, obtaining the sample features corresponding to the associated intermediate sample node for the first node, so as to aggregate according to the obtained sample features.
[0154] Further, the method 400 further comprises: training the graph neural network corresponding to the association relationship according to the updated information of the first node and the real information of the first node.
[0155] Specifically, the training of the initial graph neural network model is completed by determining the training parameters in the initial graph neural network according to the feature difference between the updated feature of the first node and the real feature of the first node.
[0156] Further, the method 400 further comprises: determining the training load corresponding to the first node based on the first node and the corresponding association relationship determined by the sample node selection manner of the first node; performing load balancing division on the sample graph data based on the training load corresponding to the first node, and distributing the divided sample graph data to the device for training the graph neural network model.
[0157] Further, the method 400 further comprises: detecting the current training load, and determining whether the current training load exceeds a threshold; when the threshold is exceeded, sending a message to other devices for training the graph neural network model to perform load balancing.
[0158] Further, the method 400 further comprises: performing load balancing division on the sample graph data based on the training load corresponding to the first node and the number of association relationships divided out in the case of dividing the sample graph data, and distributing the divided sample graph data to the device for training the initial graph neural network model.
[0159] In addition, the method 400 does not describe the details of the content, which can also refer to the above-mentioned various embodiments of the system 100.
[0160] In the scenario of training the graph neural network in the embodiments of the present application, the sample graph data such as a knowledge graph is externally input through the user interface provided by the first device such as a computer. In the knowledge graph, there can be multiple sample nodes, each of which can represent a corresponding entity such as a bed. The entities, i.e. the sample nodes, have corresponding association relationships, such as the direct association relationship between the sample node A (i.e. the entity A "bed") and the sample node B (i.e. the entity "wardrobe"), which can be represented as A-B (the "-" between the two nodes is the edge), and the association relationship is a matching relationship. The external input can also determine multiple first nodes in the sample graph data, such as the sample node A, which represents the entity A. The sample node N represents the entity N (wardrobe). The sample node M represents the entity M (bookshelf), and so on. The sample node A can be taken as an example for illustration, and the other first nodes refer to the node A, i.e. the entity A.
[0161] In addition, the sample node selection manner for the sample node A can be externally input through a user interface, so as to determine the sample node selection manner. The determined sample node selection manner, the sample graph data and the first node can be sent to a second device, such as a server, through a computer. After the server receives these information, corresponding model training is performed. The corresponding model training can be performed by calling a corresponding interface component. The interface component can encapsulate a method for model training.
[0162] It should be noted that the sample graph data and the first node can also be preset by the second device, without the need for user selection. The second device can directly perform corresponding model training according to the preset sample graph data and the first node.
[0163] After the server receives the above information, the association relationship between the first node and the second node is determined from the sample graph data according to the determined sample node selection manner. The node selection manner includes: a selection manner of directly associated nodes, a selection manner of node access quantity and node importance in different access directions, and a selection manner of information type of intermediate nodes. The above selection manners can correspond to DNFA (direct neighbors with flat aggregation), such as GCN (Graph Convolutional Network) model, INFA (indirect neighbors with flat aggregation), such as PinSage (a model framework based on random walk and GCN), and INHA (indirect neighbors with hierarchical aggregation), such as MA-GNN (Memory Augmented Graph Neural Networks), and other GNN types. Thus, the server can select corresponding neighbor nodes, i.e., the second nodes, from the sample graph data according to the above selection manners, taking the sample node A and the entity A as a reference, so as to generate a corresponding association relationship between the entity A and the second node, which can also be referred to as a hierarchical relationship graph. For example, the entity A is directly connected with a plurality of direct neighbor users, and the entity A and a direct neighbor entity have a connection relationship, such as a matching relationship.
[0164] After determining the hierarchical relationship graph, the server (taking the hierarchical relationship graph of the GCN as an example, i.e., the trained model is a GCN) can aggregate the features of the plurality of neighbor nodes according to the relationship graph, so as to update the features of the entity A. The features of the neighbor nodes can be entity information of the neighbor nodes representing the object entity, such as material information, size information, etc. Thus, the corresponding feature vector can be determined according to the entity information and a preset algorithm, such as embedding. Thus, the feature vectors of the neighbor nodes are determined, the feature vectors of the neighbor nodes are aggregated according to the aggregation function, the aggregated feature vectors are obtained, and then the aggregated feature vectors are combined with the feature vector of the entity A according to the updating mode, and the combination is updated to obtain the updated feature vector of the entity A. In addition, the server can also perform load balancing division on the sample graph data, and then send the divided sample graph data to the third device and the fourth device, etc. Then, each device performs aggregation and updating, and the third device and the fourth device send the updated sample features to the second device.
[0165] It should be noted that the aggregation function and the updating mode can be determined by external input, and the determination mode is similar to the sample node selection mode described above, and will not be described again. The second device can also directly determine the aggregation function and the updating mode.
[0166] The server compares the updated feature vector of the entity A with the real feature vector of the entity A, and trains the initial GCN model by using a loss function to determine the training parameters in the GCN model, which can be parameters for determining the feature vectors of the nodes in the GCN, such as parameters in embedding. The parameters in the aggregation function can also be determined, and the parameters in the updating mode can also be determined if necessary. Thus, the training of the GCN model is completed. Then, the GCN model can be applied.
[0167] In the application process, a graph data, such as a knowledge graph, can be uploaded to the server by a computer. The server can determine the feature vector of an unknown or to-be-improved entity by using the trained GCN model, so as to improve the information of the entity. Thus, the server can automatically determine the corresponding relationship between entities according to the improved entity information, and expand the knowledge graph.
[0168] It should be noted that in addition to being applied in the above examples, it can also be applied to other graphs, such as an online shopping recommendation system.
[0169] In one possible design, the embodiments of the present application provide a computing device, such as a server. As shown in FIG. 5, the device 500 can include a memory 501 and a processor 502. Figure 5 The memory 501 is configured to store a computer program.
[0170] The memory 501 is configured to store a computer program.
[0171] The processor 502 is configured to execute a computer program to acquire sample graph data and a corresponding first node as a training sample, determine a sample node selection manner for the first node, determine an association relationship between the first node and a second node from the sample graph data according to the sample node selection manner, wherein the sample graph data comprises a plurality of sample nodes and an association relationship between the plurality of sample nodes, the plurality of sample nodes comprise the first node and the second node, the second node is another node in the sample nodes for processing the first node, aggregate information of the second node based on the determined association relationship, and update information of the first node for a training process of a graph neural network model.
[0172] Specifically, the processor 502 is specifically configured to provide an interface component to enable the sample graph data to be input based on the interface component to acquire the sample graph data, and determine the first node based on the interface component and an input operation.
[0173] Specifically, the processor 502 is specifically configured to determine the sample node selection manner based on the interface component and the input operation.
[0174] Specifically, the processor 502 is specifically configured to determine a selection path corresponding to the first node and a directly associated sample node from the sample graph data according to a selection manner of directly associated sample nodes, and determine an association relationship between the directly associated sample node and the first node according to the determined selection path and the directly associated sample node.
[0175] Specifically, the processor 502 is specifically configured to randomly select a corresponding sample node from the sample graph data with the first node as a reference according to a selection manner of randomly accessing sample nodes in different access directions in the sample graph data, and create an association relationship between the selected sample node and the first node according to the selected sample node.
[0176] Specifically, the processor 502 is specifically configured to determine an intermediate sample node, an association relationship between the intermediate sample node and the first node, and an information type of the intermediate sample node, select sample nodes of the same information type from the sample graph data with the first node as a reference according to a selection manner of the information type, create an association relationship between the corresponding intermediate sample node and the selected sample node, and determine an association relationship between the first node, the intermediate sample node, and the selected sample node based on the association relationship between the intermediate sample node and the first node and the association relationship between the intermediate sample node and the selected sample node.
[0177] In addition, the processor 502 is further configured to determine a directly associated sample node and an indirectly associated sample node of the first node based on the interface component and the input operation.
[0178] Further, when the intermediate sample node is a multi-layer intermediate sample node, the processor 502 is further configured to: determine an association relationship between the multi-layer sample intermediate nodes; and determine the association relationship of the first node, the intermediate sample node and the selected sample node based on the association relationship between the first layer sample intermediate node and the first node, the association relationship between the multi-layer sample intermediate nodes, and the association relationship between the last layer sample intermediate node and the selected sample node.
[0179] Specifically, the processor 502 is specifically configured to: determine a feature of the second node based on preset training parameters; obtain an aggregation manner, aggregate sample features of the second node according to the aggregation manner and the association relationship, and obtain final aggregated sample features to update information of the first node.
[0180] Specifically, the processor 502 is specifically configured to: determine an association path corresponding to the association relationship, take a direction of the first node as a reference direction, and aggregate sample features of the second node according to an aggregation function corresponding to each second node in the association path to obtain final aggregated sample features.
[0181] Specifically, the processor 502 is specifically configured to: obtain an update manner, and update sample features of the first node according to the final aggregated sample features and the update manner.
[0182] Further, the processor 502 is further configured to: call an access interface of the association relationship; and obtain the association relationship between the first node and the second node according to the called access interface.
[0183] Further, the processor 502 is further configured to: determine the aggregation manner and the update manner based on a user interface and an input operation; aggregate information of the second node according to the determined association relationship based on the aggregation manner, and update information of the first node according to the update manner.
[0184] Further, the processor 502 is further configured to: according to the association relationship between the last layer intermediate sample node and the selected sample node, directly obtain sample features corresponding to the selected sample node for the last layer intermediate sample node, so as to aggregate based on the directly obtained sample features; according to the association relationship between the multi-layer intermediate sample nodes and the sparse neural network, obtain sample features corresponding to adjacent two layers of intermediate sample nodes for an upper layer intermediate sample node in the adjacent two layers of intermediate sample nodes, so as to aggregate based on the obtained sample features; and according to the association relationship between the intermediate sample node and the first node and the dense neural network, obtain sample features corresponding to the intermediate sample node for the first node, so as to aggregate based on the obtained sample features.
[0185] Further, the processor 502 is further configured to train the initial graph neural network corresponding to the association relationship according to the updated information of the first node and the real information of the first node.
[0186] Specifically, the training of the initial graph neural network corresponding to the association relationship according to the updated information of the first node and the real information of the first node includes: determining a training parameter in the initial graph neural network according to a feature difference between the updated feature of the first node and the real feature of the first node, so as to complete the training of the initial graph neural network model.
[0187] Further, the processor 502 is further configured to determine a training load corresponding to the first node based on the first node and the corresponding association relationship determined by the first node based on the sample node selection manner in the sample graph data; perform load balancing division on the sample graph data based on the training load corresponding to the first node, and distribute the divided sample graph data to the device for training the graph neural network model.
[0188] Further, the processor 502 is further configured to detect the current training load, determine whether the current training load exceeds a threshold, and when the threshold is exceeded, send a message to other devices for training the graph neural network model to perform load balancing.
[0189] Further, the processor 502 is further configured to perform load balancing division on the sample graph data based on the training load corresponding to the first node and the number of association relationships divided out in the case of dividing the sample graph data, and distribute the divided sample graph data to the device for training the graph neural network model.
[0190] In addition, the embodiment of the present application provides a computer storage medium, when a computer program is executed by one or more processors, the one or more processors are caused to implement Figure 4 The steps of the training method of the graph neural network in the method embodiment.
[0191] In addition, in some of the processes described in the above embodiments and the accompanying drawings, a plurality of operations appearing in a specific order are included, but it should be clear that these operations can be executed in the order appearing in this text or in parallel, the serial numbers of the operations such as 201, 202, 203, etc. are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes can include more or fewer operations, and the operations can be executed in sequence or in parallel. It should be noted that the "first", "second", etc. in this text are used to distinguish different messages, devices, modules, etc., and do not represent the order, nor do "first" and "second" represent different types.
[0192] The apparatus embodiments described above are only illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected to achieve the purposes of the embodiments according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0193] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be realized by means of a general hardware platform as necessary, and of course can also be realized by means of combination of hardware and software. Based on such understanding, the above technical solutions can be embodied in the form of a computer program product, and the present application can be embodied in the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0194] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be realized by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable multimedia data processing devices to produce a machine, so that the instructions executed by the computer or other programmable multimedia data processing devices generate a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that carries out the functions specified in one or more flows or blocks.
[0195] These computer program instructions can also be stored in a computer readable memory capable of directing the computer or other programmable multimedia data processing devices to work in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including instruction devices, which implement the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that carries out the functions specified in one or more flows or blocks.
[0196] These computer program instructions can also be loaded into a computer or other programmable multimedia data processing device, so that a series of operation steps are performed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide a process for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1one or more processes and / or blocks Figure 1 the steps of a function specified in one or more processes and / or blocks.
[0197] In one typical arrangement, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0198] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, non-volatile memory, such as read-only memory (ROM), EPROM, and / or flash memory. The memory is an example of computer readable media.
[0199] Computer readable media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer readable media does not include transitory media, such as modulated data signals and carriers.
[0200] Finally, it should be noted that the above embodiments are merely used to illustrate the technical solutions of the present application, rather than limiting them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A system for graph neural network processing, the system comprising: The system is used for processing sample graph data, the sample graph data comprises a plurality of sample nodes and an association relationship between the plurality of sample nodes, the plurality of sample nodes comprises a first node and a second node, and the system comprises an execution component, the execution component comprises: a graph processing component, configured to acquire sample graph data and a sample node selection mode, and determine an association relationship between the first node and the second node from the sample graph data according to the sample node selection mode, the first node is a to-be-processed node in the sample nodes, and the second node is another node in the sample nodes for processing the first node; the sample node selection mode comprises a selection mode of a directly associated node, a selection mode of random access in different access directions, or a selection mode of an information type of an intermediate node; a neural network processing component, configured to acquire the association relationship from the graph processing component by calling an access interface of a hierarchical relationship graph structure in an API interface, aggregate information of the second node based on the determined association relationship, and update information of the first node, for a training process of a graph neural network model.
2. The system of claim 1, wherein, The system further comprises an interface component; the interface component is configured to acquire a user-defined function, the user-defined function is used for determining the association relationship, aggregating the information of the second node, and updating, for the training process of the graph neural network model; the execution component acquires the user-defined function based on the interface component, and converts the user-defined function into execution content corresponding to the neural network processing component and execution content corresponding to the graph processing component, so that the neural network processing component and the graph processing component implement the training of the graph neural network model according to the corresponding execution content.
3. The system of claim 2, wherein, The neural network processing component is configured to determine a corresponding aggregation function through the execution content corresponding to the user-defined function, and determine an aggregation mode according to the aggregation function, so as to aggregate the information of the second node based on the determined association relationship.
4. The system of claim 2, wherein, The neural network processing component is configured to determine a corresponding update mode through the execution content corresponding to the user-defined function, so as to update the information of the first node according to the update mode, for the training of the graph neural network model.
5. The system of claim 1, wherein, The system further comprises a load processing component; the load processing component is configured to acquire the first node in the sample graph data and a corresponding association relationship of the first node determined based on the sample node selection mode based on the graph processing component, and determine a training load corresponding to the first node according to the first node in the sample graph data and the corresponding association relationship of the first node determined based on the sample node selection mode; the load processing component is configured to perform load balancing division on the sample graph data based on the training load corresponding to the first node, and distribute the divided sample graph data to a device for training the graph neural network model.
6. The system of claim 5, wherein, The load processing component is configured to perform load balancing partitioning on the sample graph data based on the training load corresponding to the first node and the number of association relationships that are partitioned out in the partitioning of the sample graph data, and distribute the partitioned sample graph data to devices for training the graph neural network model.
7. The system of claim 5 or 6, wherein, The system further includes a message passing interface component; The message passing interface component is configured to enable the devices for training the graph neural network model to communicate between devices.
8. The system of claim 1, wherein, The system further includes a storage component; The storage component is configured to store the sample graph data and information of the sample nodes.
9. The system of claim 5 or 6, wherein, The system is deployed on a cloud server, and the cloud server includes a plurality of virtual devices; The load processing component is configured to distribute the partitioned sample graph data to virtual devices for training a preset graph neural network model. The neural network processing component on the virtual device is configured to receive the partitioned sample graph data, aggregate information of a second node in the partitioned sample graph data according to the partitioned sample graph data and the association relationships, and update information of the first node to train the graph neural network model.
10. A method for training a graph neural network, comprising: The system of any one of claims 1-9 is applied to processing sample graph data, the sample graph data including a plurality of sample nodes and association relationships between the plurality of sample nodes, the plurality of sample nodes including a first node and a second node, and the method includes: obtaining sample graph data as a training sample and a corresponding first node, the first node being a to-be-processed node in the sample nodes; determining a sample node selection mode for the first node, the sample node selection mode including a selection mode of directly associated nodes, a selection mode of random access in different access directions, or a selection mode of information types of intermediate nodes; determining association relationships between the first node and a second node from the sample graph data according to the sample node selection mode, the second node being another node in the sample nodes for processing the first node; obtaining the association relationships from a graph processing component in the system by calling an access interface of a hierarchical relationship graph structure in an API interface, aggregating information of the second node based on the determined association relationships, and updating information of the first node for a training process of a graph neural network model.
11. An electronic device, comprising: The system of any one of claims 1-9 is deployed on an electronic device, and the electronic device includes a memory and a processor; The memory is configured to store a computer program; The processor executes the computer program to: obtain sample graph data as a training sample and a corresponding first node; determine a sample node selection mode for the first node, wherein the sample graph data includes a plurality of sample nodes and association relationships between the plurality of sample nodes, the plurality of sample nodes including a first node and a second node, and the sample node selection mode includes a selection mode of directly associated nodes, a selection mode of random access in different access directions, or a selection mode of information types of intermediate nodes; According to the sample node selection manner, an association relationship between the first node and a second node is determined from the sample graph data, the second node being another node in the sample nodes for processing the first node; An access interface of the hierarchical relationship graph structure in the API interface is called to obtain the association relationship from a graph processing component in the system, information of the second node is aggregated based on the determined association relationship, and information of the first node is updated for a training process of a graph neural network model.
12. A computer readable storage medium storing a computer program, characterized in that, A computer program is executed by one or more processors, causing the one or more processors to implement the steps in the method of claim 10.
Citation Information
Patent Citations
Gang discovery method and system based on graph neural network
CN110263227A
Method and device for updating relational network
CN111291138A