Efficient mini-batch training method and device for large-scale graph neural network

By using a message-passing flow graph-based out-degree center partitioning and data loading mechanism, the memory and computational efficiency issues in large-scale graph neural network training are solved, enabling efficient micro-batch training and improving the training feasibility and performance of GNN models.

CN119227764BActive Publication Date: 2026-11-24XIDIAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411272021.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-11
Publication Date
2026-11-24
Estimated Expiration
2044-09-11

AI Technical Summary

Technical Problem

Existing technologies for training large-scale graph neural networks face problems such as high memory consumption and low computational efficiency. In particular, micro-batch training suffers from insufficient redundancy reduction, unbalanced load, and high data preparation costs, which limit its practicality and performance in training large-scale GNN models.

Method used

A graph partitioning method based on message passing flow graphs is adopted. The global message passing graph is divided into micro-batch subgraphs by using the out-degree center partitioning strategy. A data loading mechanism for micro-batch is introduced to optimize data loading efficiency and reduce redundancy and load imbalance.

Benefits of technology

It enables efficient training of GNNs on large graphs under memory constraints, maintaining model convergence and accuracy while significantly reducing memory consumption and training time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119227764B_ABST
    Figure CN119227764B_ABST
Patent Text Reader

Abstract

This invention provides an efficient micro-batch training method and apparatus for large-scale graph neural networks. It introduces an auxiliary graph constructed based on message passing and designs a graph partitioning method based on this graph. This method assigns weights to edges based on the out-degree of the source node, effectively grouping target nodes sharing the same source node into the same micro-batch to reduce node redundancy. It also reduces load imbalance by distributing nodes with high out-degrees as evenly as possible across different micro-batches. Furthermore, this invention optimizes the out-degree center graph partitioning process, eliminating the overhead of repartitioning in each training cycle, and introduces a micro-batch-specific data loading mechanism, improving the efficiency of micro-batch data loading during training and reducing data preparation overhead. This invention overcomes the memory wall problem faced by large-scale graph neural network training and makes training large-scale graph neural networks exceeding GPU memory capacity feasible and efficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of graph data analysis and processing technology, specifically relating to an efficient micro-batch training method and apparatus for large-scale graph neural networks. Background Technology

[0002] Generative Neural Networks (GNNs) have become a powerful tool for learning and analyzing graph-structured data, achieving significant predictive performance in various graph-related tasks such as link prediction, node classification, and graph classification. However, training complex GNN models on large graphs presents significant challenges, particularly in terms of memory scalability and computational efficiency. For example, GNNs learn node vector representations by iteratively aggregating features from neighboring nodes. Increasing the depth of aggregation leads to an exponential increase in the number of feature vectors that must be loaded into memory for aggregation. Considering that device memory is a scarce resource on current mainstream hardware accelerators (such as GPUs), methods that enhance model quality, such as deep aggregation, are prone to out-of-memory (OOM) errors. This memory capacity limitation hinders the ability to train GNNs on large graphs using more complex GNN architectures, such as using deeper aggregation depths, larger sampling rates, and more advanced aggregators (e.g., LSTMs), which are crucial for capturing subtle patterns in graph data.

[0003] To overcome the GPU memory limitations of large-scale GNN training, significant research efforts have emerged in recent years in both algorithm and system optimization. On the algorithmic side, researchers have proposed various sampling techniques (e.g., node-based sampling, layer-based sampling, and subgraph-based sampling) to downsample the original graph before applying the GNN model, thus adapting the data to device memory. While sampling enables GNNs to be trained on larger graphs, existing research suggests this may come at the cost of model accuracy. In terms of systems, researchers have developed specialized GNN frameworks, such as DGL (Minjie Wang, DaZheng, Zihao Ye, Quan Gan, Mufei Li, Xiang Song, Jinjing Zhou, Chao Ma, Lingfan Yu, Yu Gai, et al. Deep graph library: A graph-centric, highly-performant package for graph neural networks. arXiv preprint arXiv:1909.01315,2019), PyG (Matthias Fey and Jan Eric Lenssen. Fast graph representation learning with pytorchgeometric. arXiv preprint arXiv:1903.02428,2019), and NeuGraph (Lingxiao Ma, ZhiYang, Youshan Miao, Jilong Xue, Ming Wu, Lidong Zhou, and Yafei Dai. Neugraph: Parallel deep neural network computation on large graphs. In 2019 USENIX Annual Technical Conference, pages (443-458, 2019) These frameworks improve GNN training efficiency by implementing efficient graph operation primitives. However, they encounter memory scalability challenges when dealing with large graphs or complex GNN architectures.Another option is to use distributed frameworks such as DistDGL (Da Zheng, Chao Ma, Minjie Wang, Jinjing Zhou, Qidong Su, Xiang Song, Quan Gan, Zheng Zhang, and George Karypis. Distdgl: distributed graph neural network training for billion-scale graphs. In 2020 IEEE / ACM 10th Workshop on Irregular Applications: Architectures and Algorithms, pages 36-44. IEEE, 2020) to partition and process large graphs in a distributed manner, leveraging the combined memory of multiple GPUs and / or compute nodes to scale model training. While effective, this approach typically involves significantly higher hardware costs, making it impractical for many model scientists with limited hardware budgets.

[0004] Among numerous methods, micro-batch training has emerged as a promising technique in deep learning. It involves dividing a mini-batch into K smaller micro-batches and accumulating the gradients of these micro-batches to update the model weights, such as... Figure 1 As shown. This method can reduce memory usage while maintaining model convergence and quality. Compared with traditional neural network (NN) models, GNNs exhibit more complex dependencies (e.g., N:M) between output / label and input features within a batch, rather than a simple 1:1 mapping. Applying micro-batch training to GNN models presents challenges such as node redundancy, load imbalance, and data preparation overhead. Although recent works such as Betty (Shuangyan Yang, Minjia Zhang, Wenqian Dong, and Dong Li. Betty: Enabling large-scale gnn training with batch-level graph partitioning. In Proceedings of the 28th ACM International Conference on Architectural Support for Programming Languages ​​and Operating Systems, Volume 2, pages 103-117, 2023) have explored micro-batch training based on GNNs, it still has the following drawbacks:

[0005] (1) Insufficient redundancy reduction, (2) Computationally unfriendly load balancing strategy, and (3) High data preparation overhead. These defects result in less than ideal performance in terms of memory consumption reduction and training efficiency, limiting the practicality and performance potential of micro-batch training methods for training large-scale GNN models, thus limiting the applicability of large-scale CNN models in computer applications. Summary of the Invention

[0006] To address the aforementioned problems in existing technologies, this invention provides an efficient micro-batch training method for large-scale graph neural networks. The technical problem to be solved by this invention is achieved through the following technical solution:

[0007] In a first aspect, the present invention provides an efficient micro-batch training method for large-scale graph neural networks, comprising:

[0008] S100 utilizes a graph neural network (GNN) to aggregate features from the input graph and determines the source node, target node, and edges between target nodes involved in the message passing process.

[0009] S200, construct a global message passing graph using the source node, the target node, and the edges between the target node;

[0010] S300, the global message passing graph is divided into subgraphs corresponding to each micro-batch based on the out-degree partitioning method, and the nodes in each subgraph constitute a batch training node list.

[0011] S400, traverse the batch training node list to create a corresponding micro-batch loader (MBL) for each micro-batch for training the micro-batch data.

[0012] Secondly, the present invention provides an efficient micro-batch training device for large-scale graph neural networks, comprising:

[0013] The determination module is configured to use a graph neural network (GNN) to aggregate features of the input graph and determine the source node, target node, and edges between target nodes involved in the message passing process of the GNN.

[0014] The building module is configured to construct a global message passing graph using the source node, the target node, and the edges between the target nodes;

[0015] The partitioning module is configured to divide the global message passing graph into subgraphs corresponding to each micro-batch using an out-degree partitioning method, and to form a batch training node list from the nodes in each subgraph.

[0016] The traversal module is configured to traverse the batch training node list to create a corresponding micro-batch loader (MBL) for each micro-batch for training the micro-batch data.

[0017] Thirdly, the present invention provides a computer device comprising: a memory and a processor, wherein the memory and the processor are coupled together;

[0018] The memory is used to store one or more computer instructions;

[0019] The processor is used to execute one or more computer instructions to implement the efficient micro-batch training method for large-scale graph neural networks as described in the first aspect.

[0020] The present invention has at least the following beneficial effects:

[0021] 1. This invention introduces a message passing flow graph to assist in graph partitioning. By assigning weights to edges, Wenger can effectively group target nodes that share the same source node into the same micro-batch based on the out-degree of the source node. At the same time, it maintains load balance by distributing nodes with high out-degree as evenly as possible to different micro-batches.

[0022] 2. The subgraph partitioning method of this invention can reduce redundant nodes in micro-batches, and reduce the load imbalance problem during training by intelligently allocating nodes with high connectivity.

[0023] 3. This invention optimizes the out-degree center graph partitioning process by using a global message passing flow graph, avoiding the overhead of repartitioning in each training cycle.

[0024] 4. This invention introduces a data loading mechanism for micro-batch processing, which improves the efficiency of data loading and reduces the overhead of data preparation.

[0025] 5. This invention combines message-passing flow graphs, out-degree-centered graph partitioning methods, and micro-batch data loading mechanisms, enabling Wenger to efficiently train GNNs on large graphs even within memory limitations, making training more feasible and efficient. Although this invention employs micro-batch training, it still maintains model convergence and accuracy comparable to full-batch training. Compared to state-of-the-art methods, this invention significantly reduces memory consumption and training time.

[0026] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0027] Figure 1 This is a diagram comparing micro-batch training and mini-batch training.

[0028] Figure 2 This is a flowchart illustrating the efficient micro-batch training method for large-scale graph neural networks of the present invention.

[0029] Figure 3 This is a flowchart of the efficient micro-batch training method for large-scale graph neural networks of the present invention.

[0030] Figure 4 This is a comparative schematic diagram of the local message passing graph and the global message passing graph provided by the present invention;

[0031] Figure 5 This is a schematic diagram comparing the out-degree-based graph partitioning provided by this invention with other graph partitioning results. Detailed Implementation

[0032] The present invention will be further described in detail below with reference to specific embodiments, but the implementation of the present invention is not limited thereto.

[0033] Addressing the challenges of applying micro-batch methods to GNN training and the GPU memory limitations and computational efficiency issues inherent in existing GNN micro-batch training methods, this invention provides an efficient micro-batch training method specifically designed for large-scale GNN training. The key to this training method lies in combining a graph partitioning technique assisted by message-passing flow graphs with a specific data loading mechanism for micro-batches.

[0034] To reduce redundancy and load imbalance, the training method of this invention employs an out-degree-based auxiliary graph partitioning approach. This partitioning method utilizes message passing flow partitioning to construct a global message passing graph. This method assigns weights to edges based on the out-degree of the source node, embedding out-degree information into the global message passing graph. Therefore, it can effectively group target nodes sharing the same source node into the same micro-batch, while maintaining load balance by distributing nodes with high out-degrees as evenly as possible across different micro-batches.

[0035] To reduce data preparation overhead, this invention adapts the out-degree center graph partitioning method to a global message-passing flow graph, avoiding redundant partitioning overhead. Furthermore, the training mechanism of this invention introduces a data loading mechanism for micro-batches to improve the data loading efficiency of micro-batch GNN training. These combined approaches reduce redundancy and load imbalance within different micro-batches and lower the data preparation overhead in micro-batch training, making large-scale GNN training exceeding GPU memory capacity feasible and efficient.

[0036] The following details the technical solution of this invention.

[0037] like Figure 2 and Figure 3As shown, this invention provides an efficient micro-batch training method for large-scale graph neural networks. Figure 2 This is a flowchart illustrating the efficient micro-batch training method for large-scale graph neural networks of the present invention. Figure 3 This is a flowchart of the efficient micro-batch training method for large-scale graph neural networks of the present invention. The present invention utilizes an auxiliary graph called a message-passing flow graph and combines the following key technologies: (1) an out-degree-based partitioning strategy to solve the redundancy and load imbalance problems of different micro-batches in micro-batch GNN training, and (2) a duplicate partitioning elimination mechanism and a specific data loader for micro-batches to reduce the partitioning and data loading overhead in micro-batch GNN training. The present invention constructs a global message-passing graph (GMFG) by tracing the nodes and edges involved in the GNN message-passing flow. Then, using an out-degree-based partitioning method, the GMFG is partitioned into subgraphs representing each micro-batch according to a predetermined number of micro-batches. This partitioning minimizes redundancy and load imbalance within different micro-batches and eliminates the need for duplicate graph partitioning across training cycles. Similar to Betty, Wenger uses a memory-based estimation method to determine the optimal number of micro-batches before partitioning. Finally, Wenger uses the partitioned list of input nodes to instantiate a Micro-Batch Loader (MBL), loading the corresponding graph data independently for each micro-batch. This helps improve the data loading efficiency for subsequent micro-batch training.

[0038] Combination Figure 2 and Figure 3 The present invention provides an efficient micro-batch training method for large-scale graph neural networks, comprising:

[0039] S100 utilizes a graph neural network (GNN) to aggregate features from the input graph and determines the source node, target node, and edges between target nodes involved in the message passing process.

[0040] It's worth noting that a Message Passing Flow Graph (MFG) is a graph representing the direction of data flow, where target nodes receive messages from a subset of source nodes, and edges represent computational dependencies involved in message aggregation during neighbor sampling. Here, the MFG is referred to as "local," meaning there's an independent MFG for each training epoch. The LMFG dynamically captures the directional relationships between nodes during message aggregation. Specifically, for each layer of a GNN, target nodes aggregate features from their neighboring nodes, and these source nodes of one layer become target nodes for the next layer. By tracking this process, an LMFG reflecting the directionality used during training can be constructed, such as... Figure 4As shown, LMFG changes with data shuffling during each training cycle.

[0041] In one specific embodiment of the present invention, S100 includes:

[0042] S110, The input graph is input into the graph neural network (GNN) so that the target node in each layer of the GNN aggregates the features of the input graph from its neighboring nodes and then passes them to the next layer node in the form of message passing; wherein, the node in the GNN used to aggregate features is the target node, and the target node receives messages from the source node;

[0043] S120, in each layer of the GNN, determine the target nodes involved in the message passing process and the edges between the target nodes, where each edge represents the computational dependency involved in message aggregation during neighbor node sampling.

[0044] The purpose of this invention in obtaining the source node, target node, and edges is to construct a Global Message-Passing Graph (GMFG). The process of constructing a global message-passing graph is consistent with that of constructing a local message-passing graph.

[0045] S200, construct a global message passing graph using the source node, the target node, and the edges between the target node;

[0046] It's worth noting that LMFG is an auxiliary graph that captures the message passing process of GNNs, playing a crucial role in reducing redundancy and load imbalance during graph partitioning. With the help of LMFG, Wenger's partitioning method utilizes the out-degree of nodes within the LMFG to transform the problem of minimizing redundancy and load imbalance into minimizing edge cutting weights. This strategy allows Wenger to simultaneously minimize redundancy and load imbalance across different micro-batches.

[0047] Leveraging the directional relationships embedded in LMFGs, Wenger's partitioning strategy aims to optimize the distribution of training nodes in micro-batches, promoting balanced memory usage and efficient computation throughout the training process. The key to this graph partitioning method lies in its ability to transform the problem of minimizing redundancy and load imbalance into minimizing edge cut weights. In out-degree-based graph partitioning, the edge weights in the LMFG are determined by the out-degree of the source node. This choice is crucial because the out-degree provides valuable insights into partitioning in two ways: 1) Higher edge weights imply more frequent reuse of the source node, potentially leading to increased redundancy if edges are cut. 2) Higher edge weights indicate a larger cluster of nodes around the source node, facilitating a more even distribution of highly connected nodes across different subgraphs to improve load balancing.

[0048] By leveraging the informative partitioning properties of LMFG, Wenger effectively groups target nodes with a common source node into the same micro-batch, reducing redundancy. Furthermore, this method alleviates load imbalance by evenly distributing nodes with high egress degrees within the micro-batch, as these nodes can significantly impact peak memory consumption during training.

[0049] Leveraging the directional relationships embedded in LMFGs, Wenger's partitioning strategy aims to optimize the distribution of training nodes in micro-batches, promoting balanced memory usage and efficient computation throughout the training process. The key to this graph partitioning method lies in its ability to transform the problem of minimizing redundancy and load imbalance into minimizing edge cut weights. In out-degree-based graph partitioning, the edge weights in the LMFG are determined by the out-degree of the source node. This choice is crucial because the out-degree provides valuable insights into partitioning in two ways: 1) Higher edge weights imply more frequent reuse of the source node, potentially leading to increased redundancy if edges are cut. 2) Higher edge weights indicate a larger cluster of nodes around the source node, facilitating a more even distribution of highly connected nodes across different subgraphs to improve load balancing.

[0050] By leveraging the informative partitioning properties of LMFG, Wenger effectively groups target nodes with a common source node into the same micro-batch, reducing redundancy. Furthermore, this method alleviates load imbalance by evenly distributing nodes with high egress degrees within the micro-batch, as these nodes can significantly impact peak memory consumption during training.

[0051] S300, the global message passing graph is divided into subgraphs corresponding to each micro-batch based on the out-degree partitioning method, and the nodes in each subgraph constitute a batch training node list.

[0052] Current graph partitioning methods suffer from high redundancy and load imbalance, which limit the effectiveness of micro-batch training in reducing peak memory consumption and improving computational efficiency in GNNs. Unlike previous methods that focus on minimizing edge cut weights to balance the number of edges or nodes in the subgraph without addressing redundancy, this invention introduces an out-degree-centered graph partitioning method to simultaneously minimize redundancy and load imbalance, thereby improving performance. Because micro-batch GNN training methods using Local Message-Passing Graphs (LMFGs) require repeated partitioning and inefficient data loading during the training cycle, data preparation overhead is high. The key innovation of the out-degree-centered graph partitioning method proposed in this invention is the use of an auxiliary graph called the Global Message-Passing Graph (GMFG) and a corresponding GMFG partitioning scheme.

[0053] Refer to Algorithm 1 below:

[0054]

[0055] Algorithm 1 illustrates the graph partitioning process with out-degree centers. Initially, the algorithm takes an LMFG and a specified number of micro-batchs as input. It first extracts source and target nodes from the LMFG (line 1), then uses these nodes to create the graph structure (line 2). Next, it calculates the out-degree of each source node and sets it as the weight of the edges connected to the source node in the graph (lines 3-4), reflecting the influence of each source node on the training nodes. Nodes with higher out-degrees receive larger weights, indicating they have a greater impact on peak memory consumption during training. The algorithm then optimizes the graph by eliminating non-output nodes and self-loops (lines 5-6), ensuring a focused and efficient partitioning process.

[0056] Algorithm 1 applies an existing partitioning algorithm to divide the weighted LMFG into subgraphs corresponding to each micro-batch (line 7). This invention uses the partitioning algorithm of Metis (George Karypis. Metis: Unstructured graph partitioning and sparse matrix ordering system. Technical report, 1997) because it is scalable when handling large-scale graph partitioning tasks. This step ensures fair allocation of high-degree nodes among micro-batches, promoting load balancing and thus minimizing peak memory consumption. Finally, the partitioning algorithm traverses the subgraph, extracts target nodes, and appends the target nodes to `batched_train_nodes_list` (lines 8-12) as the output of the partitioning process. This list explicitly identifies the nodes assigned to each micro-batch, helping to achieve micro-batch training with reduced peak memory consumption and balanced computational load.

[0057] refer to Figure 5 , Figure 5 A concrete example is shown demonstrating how to partition a specific LMFG into two micro-batches while minimizing redundant nodes. The figure illustrates the actual partitioning result implemented by Wenger. Figure 5 (Figure b)). For comparative analysis, this figure also shows two additional partitioning results corresponding to alternative partitioning methods that do not prioritize minimizing edge cut weights. Figure 5(See Figures (a) and (c)). Wenger's out-degree partitioning technique focuses on minimizing the total weight of the cut edges, successfully cutting edges with a total weight of 6. This process produces two distinct subsets of training nodes, denoted as set AC and set B, with only 2 redundant nodes. In contrast, the two alternative partitioning methods produce cut edges with total weights of 7 and 9, respectively, resulting in 3 and 4 redundant nodes. This example demonstrates the efficiency of the graph partitioning method provided by this invention in reducing redundancy.

[0058] It is worth noting that existing micro-batch GNN training methods, such as Betty, suffer from high data preparation overhead due to repeated partitioning and inefficient data loading during the training cycle. To address these two issues, this invention introduces the Global Message Passing Flow Graph (GMFG) as an extended version of the local message passing flow graph. GMFG provides a comprehensive graph structure before training begins, covering all potential message passing paths. Using GMFG, this invention proposes two solutions: (1) adapting to out-degree-based graph partitioning, allowing the one-time partitioning result to be reused in various cycles, eliminating the need for repeated partitioning; and (2) designing a data loading mechanism for micro-batches based on the partitioning result to improve data loading efficiency in micro-batch GNN training.

[0059] In existing training schemes similar to Betty, the dynamic changes in the topology of the input graph necessitate a new partitioning process in each training epoch. This requirement stems from cross-epoch data shuffling, aimed at improving the model's generalization ability by altering the neighboring nodes and edges associated with each training node. Notably, Wenger faces similar requirements. While the basic Wenger model effectively mitigates redundancy and load imbalance by utilizing the auxiliary graph LMFG, it still requires a new partitioning step with an updated LMFG in each training epoch.

[0060] The necessity for repartitioning stems from the inherent limitations of LMFG in capturing comprehensive graph structure information. LMFG captures only a subset of the message flow in the original graph by sampling neighboring nodes in each cycle. Therefore, while LMFG is efficient in partitioning, it only has a partial representation of the graph structure, necessitating iterative partitioning to adapt to the evolving graph dynamics.

[0061] To address this limitation, this invention leverages the inherent structural consistency among various LMFGs by introducing a Global Message Flow Graph (GMFG). For example... Figure 3As shown, constructing a GMFG follows a message passing process similar to that of an LMFG. A notable difference is that a GMFG, as a comprehensive graph structure, includes all potential neighboring nodes and edges involved in passing messages to the training nodes. This holistic representation ensures that each LMFG is a subgraph of the GMFG, and the additional nodes and edges within the GMFG facilitate a broader extraction of redundant information. Therefore, this invention adjusts the out-degree-centered graph partitioning method based on GMFG.

[0062] In one specific embodiment of the present invention, S300 includes:

[0063] S310, extract the source node and the target node in the global message passing graph;

[0064] S320, calculate the out-degree of each source node;

[0065] S330: Based on the out-degree of each source node, set the corresponding weight for the edge connected to the source node to obtain the weighted global message passing graph;

[0066] S340, using a partitioning method, the weighted global message passing graph is divided into subgraphs corresponding to each micro-batch.

[0067] In one specific embodiment of the present invention, S340 includes:

[0068] S341, using a memory-based estimation method to determine the optimal micro-batch size;

[0069] S342, the weighted global message passing graph is divided into subgraphs corresponding to each micro-batch using a partitioning method, according to the number of subgraphs that is the same as the optimal number of micro-batches.

[0070] This step sets the number of subgraphs to be the same as the optimal number of micro-batches; according to the principle of minimizing the total weight of the cutting edges, the weighted global message passing graph is divided into subgraphs corresponding to each micro-batch using a partitioning method.

[0071] In this improved partitioning method of the present invention, instead of using a new LMFG for each training cycle, the proposed graph partitioning algorithm is directly applied to the GMFG to create a batch list of training nodes, including reusable micro-batch training nodes. By adopting this strategy, the one-time partitioning result can be reused in consecutive training cycles, eliminating the need for repeated partitioning during micro-batch GNN training. Crucially, the transition from LMFG to GMFG does not diminish the effectiveness of Wenger's graph partitioning technique in reducing redundancy and load imbalance, because GMFG retains the same fundamental partitioning auxiliary properties as LMFG that are essential for addressing these challenges.

[0072] S400, traverse the batch training node list to create a corresponding micro-batch loader (MBL) for each micro-batch for training the micro-batch data.

[0073] In one specific embodiment of the present invention, S400 includes:

[0074] S410, Traverse the batch training node list to create a corresponding loader MBL for each micro-batch for training the micro-batch data;

[0075] S420 aggregates all MBLs into a list of micro-batch data loaders.

[0076] As mentioned earlier, the data loading efficiency of Betty as described in existing technologies is low due to the cumbersome data extraction and index mapping process. To avoid this inefficiency, this invention introduces a micro-batch-specific data loading mechanism to simplify the data loading process. Utilizing a highly optimized data loader in a GNN framework like DGL, this invention creates a dedicated micro-batch loader (MBL) for each micro-batch. According to DGL's requirements, constructing a data loader using DGL's DataLoader class requires a fixed number of training nodes. This can be easily achieved using the results of out-degree center partitioning based on GMFG.

[0077] As shown in Algorithm 2 below:

[0078] Algorithm 2 illustrates the generation process of MBLs. First, a GMFG is constructed using the training nodes and the input graph (line 1). After constructing the GMFG, this invention performs an out-degree-based partitioning to obtain a list of batch training nodes (line 2). Then, the algorithm iterates through this list to instantiate a dedicated MBL for each microbatch (lines 3-6), finally returning a list of MBLs (line 7). These MBLs can be used for data loading across microbatches during the training cycle.

[0079] In the proposed solution, each MBL operates as an iterable entity, independently shuffling data to separate the data loading processes for different micro-batches. This separation ensures that Wenger's data loading process is independent of the full batch data loader, eliminating the need for the cumbersome data extraction and index mapping procedures seen in Betty. All MBLs are stored in host memory and share the same access permissions to the input graph as the full batch data loader. Observations show that using MBLs adds only a few tens of megabytes of additional memory overhead, which is generally acceptable in practical scenarios where host memory resources are typically abundant.

[0080] It's worth noting that when using MBLs, the same training node may aggregate features from different neighboring nodes compared to using a full batch loader, because they operate differently in the shuffling process of the training node and its neighbors. Each MBL shuffles its own nodes independently, while a full batch loader shuffles all nodes at once. Despite this difference, given that MBLs and full batch loaders operate on the same input graph, the neighbor set and associated features of each training node are consistent in both loading methods, ensuring similar model convergence between them.

[0081] The method of this invention can be implemented based on DGL 2.0.0 and PyTorch 2.0.1. It utilizes DGL's API for Global Message Passing Flow Graph (GMFG) construction, out-degree-based graph partitioning, and micro-batch data loading. The training method of this invention is set up in a DGL-compatible Python module to facilitate large-scale GNN training that overcomes memory limitations.

[0082] The specific implementation process for global GMFG construction is as follows: Wenger constructs GMFG by tracing the message passing process of all training nodes. It creates a dgl.dataloader, which covers all neighbors by sampling nodes, so that neighbor nodes used in the message passing of training nodes can be retrieved by iterating layer by layer through the dataloader. This process forms a dgl.graph representing GMFG. The implementation process for out-degree graph partitioning is as follows: Wenger uses dgl.graph.edges()[0] to get the indices of all source nodes and uses dgl.graph.out_degrees() to calculate the out-degrees of these nodes. These out-degrees are used as edge weights after removing self-loops by dgl.rm_self_loop(). Subsequently, the graph is partitioned by dgl.metis(), and the partitioning results are iteratively processed to extract the training nodes of micro-batches. The implementation process of the micro-batch data loader is as follows: Wenger creates a dgl.dataloader for each micro-batch using the training nodes and the input graph, and then aggregates them into a list of micro-batch data loaders, which facilitates efficient retrieval of data for each micro-batch layer by layer during micro-batch training.

[0083] In an optional embodiment of the present invention, after S400, the efficient micro-batch training method for large-scale graph neural networks further includes:

[0084] For each micro-batch of training data, all MBLs of that micro-batch are selected from the list of the micro-batch data loader to train synchronously on the training data of that micro-batch.

[0085] Secondly, the present invention provides an efficient micro-batch training device for large-scale graph neural networks, comprising:

[0086] The determination module is configured to use a graph neural network (GNN) to aggregate features of the input graph and determine the source node, target node, and edges between target nodes involved in the message passing process of the GNN.

[0087] The building module is configured to construct a global message passing graph using the source node, the target node, and the edges between the target nodes;

[0088] The partitioning module is configured to divide the global message passing graph into subgraphs corresponding to each micro-batch using an out-degree partitioning method, and to form a batch training node list from the nodes in each subgraph.

[0089] The traversal module is configured to traverse the batch training node list to create a corresponding micro-batch loader (MBL) for each micro-batch for training the micro-batch data.

[0090] Thirdly, the present invention provides a computer device, comprising: a memory and a processor, wherein the memory and the processor are coupled together;

[0091] The memory is used to store one or more computer instructions;

[0092] The processor is used to execute one or more computer instructions to implement an efficient micro-batch training method for large-scale graph neural networks.

[0093] This invention provides an efficient micro-batch training method and apparatus for large-scale graph neural networks. It introduces an auxiliary graph constructed based on message passing and designs a graph partitioning method based on this graph. This method assigns weights to edges based on the out-degree of the source node, effectively grouping target nodes sharing the same source node into the same micro-batch to reduce node redundancy. It also reduces load imbalance by distributing nodes with high out-degrees as evenly as possible across different micro-batches. Furthermore, this invention optimizes the out-degree center graph partitioning process, eliminating the overhead of repartitioning in each training cycle, and introduces a micro-batch-specific data loading mechanism, improving the efficiency of micro-batch data loading during training and reducing data preparation overhead. This invention overcomes the memory wall problem faced by large-scale graph neural network training and makes training large-scale graph neural networks exceeding GPU memory capacity feasible and efficient.

[0094] It is worth noting that the terms "first" and "second" in this invention are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0095] Although this application has been described herein in conjunction with various embodiments, those skilled in the art will understand and implement other variations of the disclosed embodiments by reviewing the accompanying drawings, the disclosure, and the appended claims in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude a plurality.

[0096] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.

Claims

1. An efficient micro-batch training method for large-scale graph neural networks, characterized in that, include: S100, using a graph neural network (GNN) to aggregate features from the input graph, and determining the source node, target node, and edges between target nodes involved in the message passing process; S100 includes: S110, The input graph is input into the graph neural network (GNN) so that the target node in each layer of the GNN aggregates the features of the input graph from its neighboring nodes and then passes them to the next layer node in the form of message passing; wherein, the node in the GNN used to aggregate features is the target node, and the target node receives messages from the source node; S120, in each layer of the GNN, determine the target nodes involved in the message passing process and the edges between the target nodes, where each edge represents the computational dependency involved in message aggregation during neighbor node sampling; S200, construct a global message passing graph using the source node, the target node, and the edges between the target node; S300, based on the out-degree partitioning method, the global message passing graph is divided into subgraphs corresponding to each micro-batch, and the nodes in each subgraph constitute a batch training node list; S300 includes: S310, extract the source node and the target node in the global message passing graph; S320, calculate the out-degree of each source node; S330: Based on the out-degree of each source node, set the corresponding weight for the edge connected to the source node to obtain the weighted global message passing graph; S340, using a partitioning method, the weighted global message passing graph is divided into subgraphs corresponding to each micro-batch; S400, traverse the batch training node list to create a corresponding micro-batch loader (MBL) for each micro-batch for training the micro-batch data.

2. The efficient micro-batch training method for large-scale graph neural networks according to claim 1, characterized in that, S340 includes: S341, using a memory-based estimation method to determine the optimal micro-batch size; S342, the weighted global message passing graph is divided into subgraphs corresponding to each micro-batch using a partitioning method, according to the number of subgraphs that is the same as the optimal number of micro-batches.

3. The efficient micro-batch training method for large-scale graph neural networks according to claim 2, characterized in that, S342 includes: Set the number of subgraphs to be the same as the optimal number of micro-batches; Based on the principle of minimizing the total weight of the cutting edges, the weighted global message passing graph is divided into subgraphs corresponding to each micro-batch using a partitioning method.

4. The efficient micro-batch training method for large-scale graph neural networks according to claim 1, characterized in that, The S400 includes: The batch training node list is traversed to create a corresponding loader MBL for each micro-batch for training the micro-batch data; Aggregate all MBLs into a list of micro-batch data loaders.

5. The efficient micro-batch training method for large-scale graph neural networks according to claim 4, characterized in that, Following S400, the efficient micro-batch training method for large-scale graph neural networks also includes: For each micro-batch of training data, all MBLs of that micro-batch are selected from the list of the micro-batch data loader to train synchronously on the training data of that micro-batch.

6. The efficient micro-batch training method for large-scale graph neural networks according to claim 1, characterized in that, The efficient micro-batch training method for large-scale graph neural networks is implemented based on DGL 2.0.0 and PyTorch 2.0.

1.

7. A highly efficient micro-batch training device for large-scale graph neural networks, characterized in that, include: The determination module is configured to perform feature aggregation on the input graph using a graph neural network (GNN) and determine the source nodes, target nodes, and edges between target nodes involved in the message passing process of the GNN; the feature aggregation on the input graph using a graph neural network (GNN) and the determination of the source nodes, target nodes, and edges between target nodes involved in the message passing process of the GNN include: S110, The input graph is input into the graph neural network (GNN) so that the target node in each layer of the GNN aggregates the features of the input graph from its neighboring nodes and then passes them to the next layer node in the form of message passing; wherein, the node in the GNN used to aggregate features is the target node, and the target node receives messages from the source node; S120, in each layer of the GNN, determine the target nodes involved in the message passing process and the edges between the target nodes, where each edge represents the computational dependency involved in message aggregation during neighbor node sampling; The building module is configured to construct a global message passing graph using the source node, the target node, and the edges between the target nodes; The partitioning module is configured to partition the global message passing graph into subgraphs corresponding to each micro-batch using an out-degree-based partitioning method, and to construct a batch training node list from the nodes in each subgraph; the out-degree-based partitioning method for partitioning the global message passing graph into subgraphs corresponding to each micro-batch and constructing a batch training node list from the nodes in each subgraph includes: S310, extract the source node and the target node in the global message passing graph; S320, calculate the out-degree of each source node; S330: Based on the out-degree of each source node, set the corresponding weight for the edge connected to the source node to obtain the weighted global message passing graph; S340, using a partitioning method, the weighted global message passing graph is divided into subgraphs corresponding to each micro-batch; The traversal module is configured to traverse the batch training node list to create a corresponding micro-batch loader (MBL) for each micro-batch for training the micro-batch data.

8. A computer device, characterized in that, include: The memory and the processor are coupled; The memory is used to store one or more computer instructions; The processor is used to execute one or more computer instructions to implement the efficient micro-batch training method for large-scale graph neural networks as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Method and device for identifying target information asset

    CN110166289A

  • Graph convolutional neural network training and graph operation method, device, equipment and system

    CN115130642A