A method of distributing a semantic graph for processing by a plurality of hardware processing units
Patent Information
- Application Number
- CN202311562519.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-22
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-11-22
AI Technical Summary
然而,对于针对语义图之间的数据复用性挖掘,目前相关研究仍是一片空白
[0008]因此,本发明的目的在于克服上述现有技术的缺陷,提供一种分配语义图至多个硬件处理单元处理的方法。
Smart Images

Figure CN117973432B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computers, more specifically to the field of data allocation and processing optimization in computers, and more specifically, to a method for allocating semantic graphs to multiple hardware processing units for processing. Background Technology
[0002] Homogeneous graphs contain only one type of node and edge, so when building a graph neural network, all nodes share the same model parameters and have the same feature space. Heterogeneous graphs, on the other hand, can contain more than one type of node and edge, allowing different types of nodes to have different dimensions of features or attributes. A Heterogeneous Graph Neural Network (HGNN) is a type of neural network used to extract and process structural and semantic information from heterogeneous graphs.
[0003] Heterogeneous graph neural networks (HNNs) are widely used in knowledge graphs, recommender systems, and drug analysis. They receive graph data with nodes of different types as input, and after four stages—semantic graph construction, feature mapping, neighbor aggregation, and semantic aggregation—output a vector representation of each node for downstream tasks. Due to their complex execution process, HNNs involve significant data reuse.
[0004] Current research approaches for data reusability mining in HGNN mainly include two aspects:
[0005] 1. Mining data reusability within semantic graphs;
[0006] 2. Data reuse mining between semantic graphs.
[0007] For data reuse mining within semantic graphs, since HGNNs can be viewed as a combination of multiple GNNs (isomorphic graph neural networks), the node attribute reuse and intermediate result reuse proposed for GNNs remain effective in HGNNs. However, research on data reuse mining between semantic graphs is currently lacking. Summary of the Invention
[0008] Therefore, the purpose of this invention is to overcome the shortcomings of the prior art and provide a method for allocating semantic graphs to multiple hardware processing units for processing.
[0009] The objective of this invention is achieved through the following technical solution:
[0010] According to a first aspect of the present invention, a method for allocating a semantic graph to multiple hardware processing units for processing is provided, comprising the steps of: A1, acquiring multiple semantic graphs and determining the similarity between every two semantic graphs in the multiple semantic graphs, wherein the semantic graphs are graph subgraphs extracted from a preset knowledge graph; A2, constructing a hypergraph, wherein each semantic graph is used as a vertex in the hypergraph, and the similarity calculated in step A1 is used as the weight of the edge between the corresponding two vertices; A3, acquiring the number M of hardware processing units currently used for computation, and dividing the hypergraph into M hypergraphs according to a method of locally or globally minimizing the sum of the weights of deleted edges. A4. Add two virtual points as a start point and an end point to each hypergraph subgraph, and add edges with the same weight between the start point and each vertex and between the end point and each vertex, to obtain an adjusted hypergraph subgraph; A5. For each adjusted hypergraph subgraph, under the condition that each vertex is visited only once, determine the longest path from its start point to its end point, and obtain the processing order information of each semantic graph in the corresponding hypergraph subgraph based on the longest path; A6. Assign the semantic graphs corresponding to all vertices contained in each hypergraph subgraph and the corresponding processing order information to a hardware processing unit for computation.
[0011] Optionally, step A3 includes: determining multiple different partitioning schemes based on the number M of hardware processing units, wherein in each partitioning scheme, one or more edges in the hypergraph are deleted to obtain M hypergraph subgraphs, and each vertex in the hypergraph can only be partitioned into one hypergraph subgraph; calculating the sum of the weights of all deleted edges in each partitioning scheme, and taking the M hypergraph subgraphs obtained by the partitioning scheme with the smallest sum of weights as the mutually exclusive set.
[0012] Optionally, the similarity between the two semantic graphs is obtained based on the ratio of the number of common nodes in the two semantic graphs to the total number of nodes contained in the two semantic graphs.
[0013] Optionally, in step A5, the processing order information of the semantic graph corresponding to each vertex is determined using the longest Hamiltonian algorithm based on the weights of the vertices and edges in the adjusted hypergraph subgraph.
[0014] Optionally, the semantic graphs corresponding to all vertices in the m-th hypergraph subgraph of the M hypergraph subgraphs and their processing order information are assigned to the m-th hardware processing unit, and the corresponding processing order information is sent to the m-th hardware processing unit to indicate the sequential processing order between semantic graphs, wherein m∈[1,M].
[0015] According to a second aspect of the present invention, a product recommendation method is provided, the method comprising: acquiring a preset knowledge graph, the preset knowledge graph including multiple nodes and edges, the multiple nodes including multiple user nodes and multiple product nodes, wherein user nodes are connected by edges based on social relationships, and at least some user nodes are connected by edges with product nodes of interest; acquiring a target user node, acquiring a semantic graph composed of one-hop neighbor nodes of the target user node and a semantic graph composed of each user node and its product nodes of interest in the one-hop neighbor nodes from the preset knowledge graph, thereby obtaining multiple semantic graphs; and using a preset heterogeneous graph neural network model to determine products recommended for the target user node based on the multiple semantic graphs, wherein the multiple semantic graphs are allocated to M hardware processing units according to the method described in the first aspect, and each hardware processing unit processes each obtained semantic graph according to the obtained processing order information.
[0016] Optionally, the step of determining the recommended products for the target user node based on the multiple semantic graphs using a preset heterogeneous graph neural network model includes: acquiring a preset heterogeneous graph neural network model, which includes a feature mapping layer, a neighbor aggregation layer, a semantic aggregation layer, and a prediction layer; each processing hardware unit using the feature mapping layer to read the semantic graph in the order indicated by the processing order information and projecting features based on the original features of the nodes in the semantic graph to obtain the projected features of the nodes; each processing hardware unit using the neighbor aggregation layer to aggregate the projected features of each node and its neighboring nodes in the semantic graph in the order indicated by the processing order information to obtain the features of each node containing neighbor information; using the semantic aggregation layer to aggregate the features containing neighbor information of the same node obtained by different hardware processing units to obtain the feature vectors of each node; and using the prediction layer to determine the recommended products for the target user node based on the feature vectors of the target user node.
[0017] Optionally, the neighbor aggregation layer utilizes a graph convolutional network to perform graph convolution on the projected features of each node and its neighboring nodes in the semantic graph, thereby obtaining the features of each node containing neighbor information.
[0018] According to a third aspect of the present invention, an electronic device is provided, comprising: one or more processors; and a memory for storing executable instructions; wherein the one or more processors are configured to implement the steps of the method described in the first or second aspect by executing the executable instructions. Attached Figure Description
[0019] The embodiments of the present invention will be further described below with reference to the accompanying drawings, wherein:
[0020] Figure 1This is a flowchart illustrating a method for assigning semantic graphs to multiple hardware processing units according to an embodiment of the present invention. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the invention.
[0022] As mentioned in the background section, research on data reuse between semantic graphs in the field of heterogeneous graph neural networks is currently lacking. While researching accelerated architectures for heterogeneous graph neural networks, the inventors discovered that this deficiency in existing technologies stems from neglecting data reuse between semantic graphs. The execution process of heterogeneous graph neural networks includes a semantic graph partitioning stage, which divides the original heterogeneous graph based on node relationships or meta-paths (higher-order node relationships). This characteristic leads to correlations between different semantic graphs, exhibiting data reuse opportunities. The inventors found a correlation between these data reuse opportunities and the semantic graph execution process; by adjusting different execution orders, different reuse effects are observed during the overall execution process. To address this, after obtaining the semantic graph, this application constructs a hypergraph by using the similarity between semantic graphs as edges. Subsequently, on one hand, by deleting edges in step A2 and minimizing the sum of their weights locally or globally, a mutually exclusive set of M hypergraph subgraphs is created. This allows for segmentation by deleting only edges with low similarity, increasing data reuse rates when the hardware processing unit processes the semantic graph later and reducing off-chip memory access. On the other hand, through steps A4-A5, since the edge weights are the similarity of the semantic graphs, the longest path obtained represents the semantic graph processing order under that path, maximizing data reuse and improving the data reuse rate when a single hardware processing unit processes the allocated semantic graph later. Therefore, when the corresponding hardware processing unit processes the semantic graph using a heterogeneous graph neural network model based on the processing order information, the data of the semantic graphs accessed sequentially can be reused, thereby reducing a significant amount of off-chip memory access.
[0023] To facilitate understanding of the application scenarios of this invention, the hardware processing unit and the heterogeneous graph neural network model will be introduced first.
[0024] (1) Hardware processing unit
[0025] Hardware processing units, such as GPUs or CPUs, each have a certain amount of cache. If the required data is not in the cache, the hardware processing unit needs to access the data from a lower-level storage medium, i.e., off-chip memory access, which increases the time overhead of reading data. However, when processing semantic graphs (which generally include multiple nodes and multiple edges), since there may be duplicate nodes between different semantic graphs, if a semantic graph A is processed, its corresponding data may still exist in the cache. If a semantic graph a, which is more similar to semantic graph A, is then processed, some of the data required for processing semantic graph a can be directly obtained from the cache, thus reducing off-chip memory access.
[0026] (2) Heterogeneous graph neural network model
[0027] The heterogeneous graph neural network model includes a feature mapping layer, a neighbor aggregation layer, a semantic aggregation layer, and a prediction layer, wherein:
[0028] The feature mapping layer projects the original features of the nodes in the semantic graph to obtain the projected features of the nodes.
[0029] The neighbor aggregation layer aggregates the features of each node and its neighboring nodes based on their projected features, thus obtaining the features of each node containing neighbor information.
[0030] For each node, the semantic aggregation layer aggregates the features of that node containing neighbor information under different semantic graphs to obtain the feature vector of each node;
[0031] The prediction layer makes predictions based on the feature vectors of the target node, yielding the prediction result. Depending on the application, the prediction result can be a product recommendation or a drug analysis result. For example, in the product recommendation domain, the prediction layer determines the product to recommend to the target user node based on its feature vectors.
[0032] As can be seen, the feature mapping layer and the neighbor aggregation layer process the data related to each semantic graph separately, without involving data interaction between semantic graphs. Therefore, when processing these two layers, the processing can be carried out in the order indicated by the processing order information, thereby utilizing the data existing in the cache for reuse and reducing off-chip memory access.
[0033] See Figure 1 This invention provides a method for allocating semantic graphs to multiple hardware processing units for processing, including steps A1, A2, A3, A4, A5, and A6. To better understand this invention, each step is described in detail below with reference to specific embodiments.
[0034] Step A1: Obtain multiple semantic graphs and determine the similarity between any two semantic graphs, wherein the semantic graphs are subgraphs extracted from a preset knowledge graph.
[0035] According to one embodiment of the present invention, the similarity between the two semantic graphs is obtained based on the ratio of the number of common nodes in the two semantic graphs to the total number of nodes contained in the two semantic graphs.
[0036] To illustrate, if we count every common node in each semantic graph as one when calculating the number of shared nodes, the similarity between semantic graphs is determined as follows:
[0037]
[0038] in, This represents the number of elements contained in the intersection of nodes in two semantic graphs. This represents the total number of nodes contained in the two semantic graphs. Of course, if a shared node is counted as only one node, this can also be used. To calculate the similarity.
[0039] Step A2: Construct a hypergraph, in which each of the semantic graphs is treated as a vertex, and the similarity calculated in step A1 is used as the weight of the edge between the corresponding two vertices.
[0040] According to one embodiment of the present invention, each semantic graph is treated as a vertex, and an edge is constructed between every two vertices, with the weight of the edge set as the similarity between the two semantic graphs corresponding to the two vertices. For example, to simplify, suppose there are three semantic graphs a, b, and c, with a similarity of 0.3 between semantic graphs a and b, a similarity of 0.5 between semantic graphs b and c, and a similarity of 0.2 between semantic graphs a and c. Then, a hypergraph is created containing three vertices a' (corresponding to semantic graph), b' (corresponding to semantic graph b), and c' (corresponding to semantic graph c). In this hypergraph, a connecting edge is provided between every two vertices, with the weight of the edge between vertices a' and b' being 0.3, the weight of the edge between vertices b' and c' being 0.5, and the weight of the edge between vertices a' and c' being 0.2.
[0041] Step A3: Obtain the number M of hardware processing units currently used for computation, and divide the hypergraph into a mutually exclusive set of M hypergraph subgraphs according to the method of minimizing the sum of the weights of the deleted edges locally or globally.
[0042] According to an embodiment of the present invention, step A3 includes: determining multiple different partitioning schemes based on the number M of hardware processing units, wherein in each partitioning scheme, one or more edges in the hypergraph are deleted to obtain M hypergraph subgraphs, and each vertex in the hypergraph can only be partitioned into one hypergraph subgraph; calculating the sum of the weights of all deleted edges in each partitioning scheme, and using the M hypergraph subgraphs obtained by the partitioning scheme with the smallest sum of weights as the mutually exclusive set. For example, step A3 can use the k-cut algorithm or other similar partitioning algorithms to partition the hypergraph. M can be the number of currently available hardware processing units, or the number of hardware processing units in a computing cluster. For example, M = 2, 4, 6, 8, etc. Assuming there are 4 hardware processing units, step A3 is to divide the hypergraph into 4 parts to obtain 4 hypergraph subgraphs, so that the semantic graph corresponding to each hypergraph subgraph can be distributed and executed in the 4 hardware processing units. A mutually exclusive set refers to a set consisting of M partitioned hypergraph subgraphs in which the vertices of different hypergraph subgraphs do not intersect. In other words, a semantic graph can only be partitioned into one of the M hypergraph subgraphs.
[0043] Step A4: Add two virtual points as start and end points to each hypergraph subgraph, and add edges with the same weight between the start point and each vertex and between the end point and each vertex, to obtain the adjusted hypergraph subgraph.
[0044] According to one embodiment of the present invention, assuming a hypergraph subgraph has N vertices, two virtual vertices (referred to as virtual points to distinguish them from the original vertices) need to be added to the hypergraph subgraph as a start point and an end point to facilitate the subsequent search for the longest path. For example, if the weight of the edges added in step A4 between the start point and each vertex, and between the end point and each vertex, is 0 (or can be set to 1 or other equal weights), then N edges with weights of 0 are set between the start point and the N vertices, and N edges with weights of 0 are set between the end point and the N vertices, thereby obtaining the adjusted hypergraph subgraph.
[0045] Step A5: For each adjusted hypergraph subgraph, under the condition that each vertex is visited only once, determine the longest path from its starting point to its ending point, and obtain the processing order information of each semantic graph in the corresponding hypergraph subgraph based on the longest path.
[0046] According to an embodiment of the present invention, in step A5, the processing order information of the semantic graph corresponding to each vertex is determined using the longest Hamiltonian path algorithm based on the weights of the vertices and edges in the adjusted hypergraph subgraph. Since step A4 yields an adjusted hypergraph subgraph with a start point, an end point, and multiple vertices connected by edges, it is a completed graph, thus ensuring the existence of a Hamiltonian path. The longest Hamiltonian algorithm can be used to find the longest path from the start point, passing through each vertex only once, to the end point. The path length is the sum of the weights of all edges on the path. This longest path is the path that maximizes the reuse of input data, from which the processing order information of the semantic graph that maximizes the reuse of input data can be extracted. For example, suppose an adjusted hypergraph subgraph contains a start point, an end point, and semantic graphs corresponding to five original vertices (vertices 1, 2, 3, 4, and 5). Figure 1 If the longest path is represented as start point, vertex 1, vertex 3, vertex 2, vertex 5, vertex 4, and end point, then the processing order information of the semantic graph is semantic. Figure 1 Semantic graphs 3, 2, 5, and 4 are used to instruct the corresponding hardware processing units to process the semantic graphs in that order. This embodiment achieves at least the following beneficial effects: By using the longest Hamiltonian path algorithm, this embodiment finds the longest path that maximizes the reuse of input data. This allows for the processing order of the semantic graphs that maximize input data reuse. This facilitates the subsequent execution of heterogeneous graph neural network models by each hardware processing unit (in the feature mapping stage and the neighbor aggregation stage, or in other words, the stage of independently processing different semantic graphs). The semantic graphs obtained by each hardware processing unit are processed sequentially according to this processing order information, increasing the opportunity for data reuse, reducing off-chip memory access, and thereby reducing the execution time of the heterogeneous graph neural network model and improving the processing performance of the heterogeneous graph neural network model.
[0047] Step A6: Assign the semantic graphs corresponding to all vertices in each hypergraph subgraph and the corresponding processing order information to a hardware processing unit for computation.
[0048] According to an embodiment of the present invention, in step A6, the semantic graphs corresponding to all vertices in the m-th hypergraph subgraph of the M hypergraph subgraphs and their processing order information are assigned to the m-th hardware processing unit, and the corresponding processing order information is sent to the m-th hardware processing unit to indicate the sequential processing order between semantic graphs, wherein m∈[1,M]. This embodiment achieves at least the following beneficial technical effects: instructing the hardware processing unit to process the semantic graphs according to a preset processing order can reduce a significant amount of off-chip memory access.
[0049] The method of allocating semantic graphs to multiple hardware processing units in this invention improves the probability and efficiency of reusing input data between semantic graphs by calculating the similarity between semantic graphs and processing semantic graphs with high similarity within the same time period or on the same hardware unit (e.g., on the same GPU in a GPU cluster). In other words, this invention first calculates the similarity between pairwise semantic graphs. Then, each semantic graph is treated as a vertex, and the similarity is treated as the weight of the edge connecting the two vertices to construct a hypergraph. Next, the k-cut algorithm is executed on the hypergraph to obtain M mutually exclusive sets composed of hypergraph subgraphs, where M is the number of hardware processing units. Then, the Hamiltonian path algorithm is executed on each hypergraph subgraph to find a path that maximizes the reuse of input data. Finally, for each hypergraph subgraph, relevant data (e.g., the original features of nodes, the projected features of nodes) are reused in the feature mapping stage and / or the neighbor aggregation stage according to a preset processing order, thereby reducing a large amount of off-chip memory access.
[0050] According to an embodiment of the present invention, a product recommendation method is also provided. The method includes: acquiring a preset knowledge graph, the preset knowledge graph including multiple nodes and edges, the multiple nodes including multiple user nodes and multiple product nodes, wherein user nodes are connected by edges based on social relationships, and at least some user nodes are connected by edges with product nodes of interest; acquiring a target user node, acquiring a semantic graph composed of one-hop neighbor nodes of the target user node and a semantic graph composed of each user node and its product nodes of interest in the one-hop neighbor nodes from the preset knowledge graph, thereby obtaining multiple semantic graphs; and using a preset heterogeneous graph neural network model to determine products recommended for the target user node based on the multiple semantic graphs, wherein the multiple semantic graphs are allocated to M hardware processing units according to the method of allocating semantic graphs to multiple hardware processing units as described in the foregoing embodiment, and each hardware processing unit processes each obtained semantic graph according to the obtained processing order information.
[0051] According to an embodiment of the present invention, determining the recommended products for a target user node based on the plurality of semantic graphs using a preset heterogeneous graph neural network model includes: acquiring a preset heterogeneous graph neural network model, which includes a feature mapping layer, a neighbor aggregation layer, a semantic aggregation layer, and a prediction layer; each processing hardware unit using the feature mapping layer to read the semantic graph in the order indicated by the processing order information and performing feature projection based on the original features of the nodes in the semantic graph to obtain the projected features of the nodes; each processing hardware unit using the neighbor aggregation layer to aggregate the projected features of each node and its neighboring nodes in the semantic graph in the order indicated by the processing order information to obtain the features of each node containing neighbor information; using the semantic aggregation layer to aggregate the features containing neighbor information of the same node obtained by different hardware processing units to obtain the feature vectors of each node; and using the prediction layer to determine the recommended products for the target user node based on the feature vectors of the target user node. Preferably, the neighbor aggregation layer uses a graph convolutional network (GCN) to perform graph convolution on the projected features of each node and its neighboring nodes in the semantic graph to obtain the features containing neighbor information of each node. Heterogeneous graph neural network models can be implemented using HAN, RGCN, or MAGNN models.
[0052] According to one embodiment of the present invention, the preset heterogeneous graph neural network model is obtained by repeatedly performing the following training process:
[0053] Obtain a knowledge graph for training, which includes multiple nodes and edges. The multiple nodes include multiple user nodes and multiple product nodes. The user nodes are connected by edges based on social relationships, and at least some user nodes are connected by edges with the product nodes they are interested in.
[0054] Randomly select target user nodes from the knowledge graph used for training, and set the product nodes that the user is interested in as tags;
[0055] From the second knowledge graph used for training, obtain the semantic graph composed of the one-hop neighbor nodes of the randomly selected target user node and the semantic graph composed of each user node and the item node of interest in the one-hop neighbor nodes, to obtain multiple semantic graphs used for training.
[0056] Using a heterogeneous graph neural network model, products recommended to randomly selected target user nodes are determined based on multiple semantic graphs used for training.
[0057] The loss value is determined based on the recommended products and corresponding tags for randomly selected target user nodes. The gradient is then calculated based on this loss value, and backpropagation is used to update the parameters of the heterogeneous graph neural network model. The resulting heterogeneous graph neural network model can recommend products of interest to target users (such as new users or users who haven't recorded any products of interest) based on social relationships (e.g., acquaintances, friends).
[0058] In summary, due to the unique semantic processing capabilities of heterogeneous graph neural network (HGNN) models, semantic graph execution is a unique process within their execution. However, existing technologies have not optimized for this characteristic of HGNN models and have not analyzed data reuse within semantic graphs. Optimization schemes for homogeneous graph neural networks (GNNs) mainly focus on data reuse and redundant computation elimination within semantic graphs, without addressing data reuse between different semantic graphs. This significantly limits acceleration research for HGNNs and results in substantial additional overhead. This invention proposes a data reuse mechanism based on perceptual semantic graph similarity to maximize data reuse between a set of semantic graphs, reducing redundant computation and additional off-chip memory access overhead. Experiments show that the proposed perceptual semantic graph similarity data reuse mechanism improves overall execution speed by 18%-74% across different models, with the effect increasing with the number of semantic graphs.
[0059] It should be noted that although the steps are described in a specific order above, it does not mean that the steps must be executed in the above specific order. In fact, some of these steps can be executed concurrently, or even in a different order, as long as the required function can be achieved.
[0060] This invention can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the invention.
[0061] Computer-readable storage media can be tangible devices that hold and store instructions for use by an instruction execution device. Computer-readable storage media can include, for example, but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof.
[0062] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for allocating semantic graphs to multiple hardware processing units for processing, characterized in that, Including the following steps: A1. Obtain multiple semantic graphs and determine the similarity between any two semantic graphs in the multiple semantic graphs, wherein the semantic graphs are subgraphs extracted from a preset knowledge graph; A2. Construct a hypergraph, in which each semantic graph is treated as a vertex, and the similarity calculated in step A1 is used as the weight of the edge between the corresponding two vertices; A3. Obtain the number M of hardware processing units currently used for computation, and divide the hypergraph into a mutually exclusive set of M hypergraph subgraphs according to the method of minimizing the sum of the weights of the deleted edges locally or globally. A4. Add two virtual points as the start point and the end point to each hypergraph subgraph, and add edges with the same weight between the start point and each vertex and between the end point and each vertex, respectively, to obtain the adjusted hypergraph subgraph; A5. For each adjusted hypergraph subgraph, under the condition that each vertex is visited only once, determine the longest path from its starting point to its ending point, and obtain the processing order information of each semantic graph in the corresponding hypergraph subgraph based on the longest path. A6. Assign the semantic graphs corresponding to all vertices in each hypergraph subgraph and their corresponding processing order information to a hardware processing unit for computation. Specifically, assign the semantic graphs corresponding to all vertices in the m-th hypergraph subgraph of the M hypergraph subgraphs and their processing order information to the m-th hardware processing unit, and send the corresponding processing order information to the m-th hardware processing unit to indicate the sequential processing order between the semantic graphs, where m∈[1,M].
2. The method according to claim 1, characterized in that, Step A3 includes: Based on the number M of the hardware processing units, a variety of different partitioning schemes are determined. In each partitioning scheme, one or more edges in the hypergraph are deleted to obtain M hypergraph subgraphs. Each vertex in the hypergraph can only be partitioned into one hypergraph subgraph. Calculate the sum of the weights of all deleted edges in each partitioning scheme, and take the M hypergraph subgraphs obtained by the partitioning scheme with the smallest sum of weights as the mutual exclusion set.
3. The method according to claim 2, characterized in that, The similarity between the two semantic graphs is obtained by the ratio of the number of nodes in the two semantic graphs to the total number of nodes in the two semantic graphs.
4. The method according to claim 1, characterized in that, In step A5, the processing order information of the semantic graph corresponding to each vertex is determined using the longest Hamiltonian algorithm based on the weights of the vertices and edges in the adjusted hypergraph subgraph.
5. A product recommendation method, characterized in that, The method includes: Obtain a preset knowledge graph, which includes multiple nodes and edges. The multiple nodes include multiple user nodes and multiple product nodes. The user nodes are connected by edges based on social relationships, and at least some user nodes are connected by edges with the product nodes they are interested in. Obtain the target user node, and obtain a semantic graph composed of the one-hop neighbor nodes of the target user node and a semantic graph composed of each user node and its interested product node from the preset knowledge graph to obtain multiple semantic graphs. Using a pre-defined heterogeneous graph neural network model, products recommended to target user nodes are determined based on the multiple semantic graphs. The multiple semantic graphs are distributed to M hardware processing units according to the method described in any one of claims 1-4, and each hardware processing unit processes each semantic graph according to the obtained processing order information.
6. The method according to claim 5, characterized in that, The step of using a pre-defined heterogeneous graph neural network model to determine the recommended products for the target user node based on the multiple semantic graphs includes: Obtain a pre-defined heterogeneous graph neural network model, which includes a feature mapping layer, a neighbor aggregation layer, a semantic aggregation layer, and a prediction layer; Each processing hardware unit uses a feature mapping layer to read the semantic graph in the order indicated by the processing order information and performs feature projection based on the original features of the nodes in the semantic graph to obtain the projected features of the nodes. Each processing hardware unit uses the neighbor aggregation layer to aggregate the projected features of each node and its neighboring nodes in the semantic graph according to the order indicated by the processing order information, so as to obtain the features of each node containing neighbor information. The semantic aggregation layer aggregates the features of the same node, which include neighbor information, obtained from different hardware processing units, to obtain the feature vectors of each node. The prediction layer uses the feature vector of the target user node to determine the recommended products for the target user node.
7. The method according to claim 6, characterized in that, The neighbor aggregation layer utilizes a graph convolutional network to perform graph convolution on the projected features of each node and its neighboring nodes in the semantic graph, thereby obtaining the features of each node containing neighbor information.
8. A computer-readable storage medium, characterized in that, It stores a computer program that can be executed by a processor to implement the steps of the method according to any one of claims 1 to 7.
9. An electronic device, characterized in that, include: One or more processors; as well as Memory, wherein the memory is used to store executable instructions; The one or more processors are configured to implement the steps of the method according to any one of claims 1 to 7 by executing the executable instructions.
Citation Information
Patent Citations
Information pushing method and system fusing knowledge graph structure and path semantics
CN114265986A
Intelligent supplier matching method based on semantic graph model
CN114565429A
