Large model parallel training method, system and readable storage medium

By constructing a distributed training system and using a greedy algorithm to optimize the parallel strategy of large models, combined with hardware topology-aware scheduling, the problem of poor communication performance in distributed training of large models is solved, thereby improving training efficiency and network communication performance.

CN117311975BActive Publication Date: 2026-11-24SHANG HAI JIE YUE XING CHEN ZHI NENG KE JI YOU XIAN GONG SI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311326879.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-13
Publication Date
2026-11-24
Estimated Expiration
2043-10-13

AI Technical Summary

Technical Problem

Existing technologies lack awareness of complex parallel strategies in large-scale distributed parallel training of models, resulting in poor communication performance and affecting training efficiency. In particular, network congestion may occur when the cluster size is large, reducing training efficiency.

Method used

A distributed training system is constructed, and a greedy algorithm is used to determine the specific parameter values ​​of the number of parallel data sets, the number of parallel pipeline sets, and the number of parallel tensor sets. The greedy algorithm searches for the minimum number of switches and the machine execution order to optimize communication volume. Combined with hardware topology-aware scheduling, communication efficiency is improved.

Benefits of technology

It significantly reduced switch traffic, improved the overall efficiency of large model training, reduced end-to-end latency, improved network communication performance, and increased training efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117311975B_ABST
    Figure CN117311975B_ABST
Patent Text Reader

Abstract

This application provides a method, system, and readable storage medium for parallel training of large models. The method includes: constructing a distributed training system comprising k switches, each with m1, m2, m3, ..., mk machines; determining a parallel strategy for the large model, obtaining specific parameter values ​​for the number of data parallel groups (DP), the number of pipeline parallel groups (PP), and the number of tensor parallel groups (TP), respectively; using a greedy algorithm to search for the minimum number of switches (w) required to satisfy the communication volume for large model training and the execution order array (Rank) of the machines required under the w switches in parallel training; and performing parallel training of the large model based on the Rank. This application improves the computational efficiency of parallel training of large models.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer application technology, and in particular to a method, system and readable storage medium for parallel training of large models. Background Technology

[0002] With the good performance and broad application prospects of large models, the number of model parameters has shown a rapid growth trend, from 100 million parameters in 2018 to hundreds of billions of parameters today.

[0003] The emergence of large-scale models poses significant challenges to the underlying infrastructure. Even with GPUs like the A800 and H800, the computing power and memory of a single GPU are far from sufficient to meet the training requirements of large models. Massive parallel training using thousands or tens of thousands of GPUs is fundamental to the success of large-scale models. To ensure the trainability of large models, breakthroughs must be made in overcoming the computational wall, memory wall, and communication wall at the resource efficiency level to improve overall training throughput. Distributed parallel technology has evolved from a single basic parallel strategy to a combination of multiple parallel strategies, including data parallelism, tensor model parallelism, and pipelined parallelism. Different parallel strategies generate different data communication requirements, and communication performance will affect the overall computing speed.

[0004] High-performance clusters are not simply a matter of piling up computing power; they require specialized scheduling design and optimization to fully utilize their overall computing power. Existing scheduling algorithms, in large-scale distributed parallel training scenarios, struggle to produce optimal scheduling results due to a lack of awareness of complex parallel strategies. For example, when processes with high communication bandwidth are scheduled to nodes on different switches, communication must pass through the top-level switch, severely impacting training performance and, in extreme cases, causing severe network congestion. This can lead to a situation where training efficiency decreases as the cluster size increases.

[0005] Therefore, existing technologies still need to be improved and developed. Summary of the Invention

[0006] One objective of this application is to provide a method, system, and readable storage medium for parallel training of large models, at least to address the problem of low efficiency in training large models using existing cluster computing resources.

[0007] To achieve the above objectives, some embodiments of this application provide the following aspects:

[0008] Firstly, some embodiments of this application also provide a method for parallel training of large models, the method comprising:

[0009] Construct a distributed training system, which includes k switches named n1, n2, n3, ..., nk, and m1, m2, m3, ..., mk machines under each of the k switches, each machine containing a GPU;

[0010] The parallel strategy for large models is determined, and the specific parameter values ​​for the number of data parallel groups DP, the number of pipeline parallel groups PP, and the number of tensor parallel groups TP are D, P, and T, respectively. The communication volume of large model parallel training is thus fixed.

[0011] A greedy algorithm is used to search for the minimum number of switches w required to satisfy the communication volume of large model training with D groups of data parallelism, P groups of pipeline parallelism, and T groups of tensor parallelism, and the execution order array Rank of the machines m'1, m'2, m'3, ..., m'w required under the w switches in parallel training, where Rank represents the process identifier across the entire domain;

[0012] Parallel training of large models is performed based on the Rank.

[0013] Secondly, some embodiments of this application also provide a large-model parallel training system, the large-model parallel training system comprising:

[0014] There are k switches, n1, n2, n3, ..., nk, and m1, m2, m3, ..., mk machines under each of the k switches, and each machine contains a GPU;

[0015] The parallel strategy module is used to determine the parallel strategy for large models, and obtains the specific parameter values ​​of the number of data parallel groups DP, the number of pipeline parallel groups PP, and the number of tensor parallel groups TP as D, P, and T, respectively. The communication volume of large model parallel training is thus fixed.

[0016] The scheduling strategy module is used to use a greedy algorithm to search for the minimum number of switches w required to satisfy the communication volume for large model training of D-group data parallelism, P-group pipeline parallelism, and T-group tensor parallelism, and the execution order array Rank of the machines m'1, m'2, m'3, ..., m'w required under the w switches in parallel training, where Rank represents the process identifier across the entire domain;

[0017] The training execution module is used to perform parallel training of large models based on the Rank.

[0018] Thirdly, some embodiments of this application also provide a computer-readable storage medium storing a model parallel training program supporting heterogeneous clusters, which, when executed by a processor, implements the steps of the large model parallel training method described above.

[0019] This invention constructs a distributed training system comprising k switches, each with several machines, including GPUs. A large-scale model parallel strategy is determined, yielding specific parameter values ​​D, P, and T for the number of data parallel groups (DP), pipelined parallel groups (PP), and tensor parallel groups (TP), respectively, thus fixing the communication volume for large-scale model parallel training. A greedy algorithm is used to search for the minimum number of switches (w) required to satisfy the communication volume for executing D groups of data parallelism, P groups of pipelined parallelism, and T groups of tensor parallelism in large-scale model training, and the execution order array Rank of the machines required under the w switches in parallel training, where Rank represents the process identifier across the entire domain. Large-scale model parallel training is then executed based on Rank. The process involves two parts: parallel strategy determination and parallel training scheduling. The parallel training scheduling uses the three parameters obtained from the parallel strategy determination to employ a greedy algorithm to search for the minimum number of switches required for computational communication volume, the number of machines required under each switch, and the corresponding global rank ID. Executing large-scale model training based on this rank ID significantly improves the efficiency of large-scale model training. Attached Figure Description

[0020] Figure 1 This is a flowchart of the large-model parallel training system of this application;

[0021] Figure 2 This is a schematic diagram of the principle of the large-scale parallel training system of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0023] A method for parallel training of large models, characterized in that the method includes:

[0024] Step S101: Construct a distributed training system, which includes k switches n1, n2, n3, ..., nk, and m1, m2, m3, ..., mk machines under each of the k switches, and each machine includes a GPU;

[0025] Step S102: Determine the parallel strategy for the large model and obtain the specific parameter values ​​of the number of data parallel groups DP, the number of pipeline parallel groups PP, and the number of tensor parallel groups TP as D, P, and T, respectively. The communication volume of the large model parallel training is thus fixed.

[0026] Step S103: Use a greedy algorithm to search for the minimum number of switches w required to satisfy the communication volume of large model training with D-group data parallelism, P-group pipeline parallelism and T-group tensor parallelism, and the execution order array Rank of the machines m'1, m'2, m'3, ..., m'w required under the w switches in parallel training, where Rank represents the process identifier across the entire domain;

[0027] Step S104: Perform parallel training of the large model based on the Rank.

[0028] In some embodiments of this application, the number of TPs T is set to 8, that is, 8 GPU cards communicate within a single machine.

[0029] In some embodiments of this application, the step of using a greedy algorithm to search for the minimum number of switches w required to satisfy the communication volume for performing large model training with D groups of data parallelism, P groups of pipeline parallelism, and T groups of tensor parallelism, and the execution order array Rank of the machines m'1, m'2, m'3, ..., m'w required under the w switches in parallel training, specifically involves:

[0030] Iterate through P groups of Pipelines. For the i-th Pipeline being traversed, iterate through k groups of switches, where 0 ≤ i ≤ P.

[0031] If the number of machines under a certain group of switches is greater than D, then D machines are assigned to P[i] in the current switch, and the D machines are numbered sequentially according to their IP addresses to obtain Rank, and P[i] is the i-th group of Pipeline;

[0032] If there is no group of switches with more than D GPU machines, then the switch with the most machines among the remaining switches is selected first, and all machines of that switch are assigned to P[i]. The machines under that switch are numbered sequentially according to their IP addresses to obtain the Rank, and P[i] is the i-th Pipeline, until the number of machines assigned is equal to D.

[0033] After determining the model parallel partitioning strategy, we propose a hardware topology-aware Rank scheduling method to improve communication efficiency. In distributed training, Rank represents a process identifier across the entire cluster, used for inter-process communication. Depending on the parallel strategy, the communication requirements between different Ranks vary significantly. For example, the communication volume between data parallel processes is significantly greater than that between model pipeline parallel processes. The scheduling system is aware of hardware topology information in the current cluster, including GPU ID, model, memory, computing power, location in the network architecture, and which aggregation group it belongs to. Combining this information with parameters such as the model parallel strategy, aggregation group information, and switch convergence ratio, the system performs global GPU ordering, assigning Ranks to the hardware and allocating Ranks with high communication bandwidth requirements to physical nodes with high communication efficiency.

[0034] The scheduling aims to minimize the end-to-end latency of model training by dividing the entire model into multiple stages. Once the stages are determined, the communication volume is fixed. Because communication efficiency within a switch is greater than communication efficiency across switches, minimizing the end-to-end latency of model training is equivalent to minimizing cross-switch traffic. Let D be the number of DP (data-parallel groups), P be the number of PP (pipeline-parallel groups), and T be the number of TP (tensor-parallel groups). In TP, since each layer has two all-reduce operations in both forward and backward propagation, TP requires very fast interconnectivity between devices. Therefore, unless you have a very fast network, it is not recommended to perform TP across multiple nodes. In practice, the number of TPs is set to 8, representing 8-GPU communication within a single machine, with no cross-switch traffic. D*P*8 = Total number of GPUs.

[0035] There are k switches, n1, n2, n3, ..., nk, each with m1, m2, m3, ..., mk machines. Given (m1 + m2 + m3 + ... + mk) * 8 >= D * P * T, the objective is to minimize the total number of switches containing the selected machines.

[0036] The scheduling uses a greedy algorithm.

[0037]

[0038]

[0039] The Rank of the data parallel group is scheduled to a convergence group, which can significantly reduce the cross-switch communication traffic when the communication library builds topology graphs such as Allreduce and Pipeline.

[0040] In some embodiments of this application, the execution order array Rank of the required machines m'1, m'2, m'3, ..., m'w in parallel training is determined and recorded in the Configmap. In order for the processes to obtain their own Rank information, we use Kubernetes' configmap, and the required GPU server uses configMapRef to obtain the Rank information from the configmap.

[0041] In some embodiments of this application, all training tasks are in a waiting state before the Configmap is prepared; after the Configmap is generated, all related processes are guaranteed to start simultaneously, and the existence of abnormal processes is not allowed. The in-machine processes are scheduled based on the Rank and the network topology awareness capability of Nvidia NCCL are used to establish the optimal ring based on the Ring algorithm, thereby improving the network communication performance of large-scale distributed training.

[0042] The top-level Spine switch in this application experienced a 30% decrease in traffic; the MFU (Medium-to-Future Activated) rate increased from 34% to 51%.

[0043] In some embodiments of this application, the specific parameter values ​​for determining the large model parallel strategy, obtaining the number of data parallel groups DP, the number of pipeline parallel groups PP, and the number of tensor parallel groups TP are D, P, and T, respectively. These values ​​can be obtained based on expert experience or based on an automatic search method.

[0044] A large-scale parallel training system for models, characterized in that the large-scale parallel training system comprises:

[0045] There are k switches, n1, n2, n3, ..., nk, and m1, m2, m3, ..., mk machines under each of the k switches, and each machine contains a GPU;

[0046] The parallel strategy module is used to determine the parallel strategy for large models, and obtains the specific parameter values ​​of the number of data parallel groups DP, the number of pipeline parallel groups PP, and the number of tensor parallel groups TP as D, P, and T, respectively. The communication volume of large model parallel training is thus fixed.

[0047] The scheduling strategy module is used to use a greedy algorithm to search for the minimum number of switches w required to satisfy the communication volume for large model training of D-group data parallelism, P-group pipeline parallelism, and T-group tensor parallelism, and the execution order array Rank of the machines m'1, m'2, m'3, ..., m'w required under the w switches in parallel training, where Rank represents the process identifier across the entire domain;

[0048] The training execution module is used to perform parallel training of large models based on the Rank.

[0049] In another aspect, embodiments of this application also provide a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The aforementioned computer-readable medium carries one or more computer-readable instructions, which may be executed by a processor to implement the steps of the methods and / or technical solutions of the various embodiments of this application.

[0050] It should be noted that the computer-readable medium described in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0051] In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wireline, optical fiber, RF, etc., or any suitable combination thereof.

[0052] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0053] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that this application can be implemented in other specific forms without departing from the spirit or essential characteristics of this application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within this application. No reference numerals in the claims should be construed as limiting the scope of the claims. Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in the apparatus claims may also be implemented by a single unit or device in software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any particular order.

Claims

1. A method for parallel training of large models, characterized in that, The large-model parallel training method includes: Construct a distributed training system, which includes k switches named n1, n2, n3, ..., nk, and m1, m2, m3, ..., mk machines under each of the k switches, each machine containing a GPU; The parallel strategy for large models is determined, and the specific parameter values ​​for the number of data parallel groups DP, the number of pipeline parallel groups PP, and the number of tensor parallel groups TP are D, P, and T, respectively. The communication volume of large model parallel training is thus fixed. A greedy algorithm is used to search for the minimum number of switches w required to satisfy the communication volume for large model training with D groups of data parallelism, P groups of pipeline parallelism, and T groups of tensor parallelism, and the execution order array Rank of the machines m'1, m'2, m'3, ..., m'w required under the w switches in parallel training, where Rank represents the process identifier across the entire domain; specifically: Iterate through P groups of Pipelines. For the i-th Pipeline being traversed, iterate through k groups of switches, where 0 ≤ i ≤ P. If the number of machines under a certain group of switches is greater than D, then D machines are assigned to P[i] in the current switch, and the D machines are numbered sequentially according to their IP addresses to obtain Rank, and P[i] is the i-th group of Pipeline; If there is no group of switches with more than D GPU machines, then the switch with the most machines among the remaining switches is selected first, and all machines of that switch are assigned to P[i]. The machines under that switch are numbered sequentially according to their IP addresses to obtain the Rank, and P[i] is the i-th Pipeline, until the number of machines assigned is equal to D. Parallel training of large models is performed based on the Rank.

2. The large-model parallel training method according to claim 1, characterized in that, The number of TPs (T) is set to 8, meaning that there are 8 GPU cards communicating within a single machine.

3. The large-model parallel training method according to claim 1, characterized in that, After the execution order array Rank of the required machines m'1, m'2, m'3, ..., m'w in parallel training is determined, it is recorded in Configmap. The required GPU server uses configMapRef to obtain the Rank information from Configmap.

4. The large-model parallel training method according to claim 3, characterized in that, Before the Configmap is ready, all training tasks are in a waiting state; after the Configmap is generated, all related processes are guaranteed to start simultaneously, and no abnormal processes are allowed.

5. In the large model parallel training method according to claim 1, the specific parameter values ​​of the large model parallel strategy, the number of data parallel groups DP, the number of pipeline parallel groups PP, and the number of tensor parallel groups TP, are D, P, and T, respectively. These values ​​can be obtained based on expert experience or based on an automatic search method.

6. A large-scale model parallel training system, characterized in that, The large-model parallel training system includes: There are k switches, n1, n2, n3, ..., nk, and m1, m2, m3, ..., mk machines under each of the k switches, and each machine contains a GPU; The parallel strategy module is used to determine the parallel strategy for large models, and obtains the specific parameter values ​​of the number of data parallel groups DP, the number of pipeline parallel groups PP, and the number of tensor parallel groups TP as D, P, and T, respectively. The communication volume of large model parallel training is thus fixed. The scheduling strategy module is used to use a greedy algorithm to search for the minimum number of switches w required to satisfy the communication volume for large model training of D-group data parallelism, P-group pipeline parallelism, and T-group tensor parallelism, and the execution order array Rank of the machines m'1, m'2, m'3, ..., m'w required under the w switches in parallel training, where Rank represents the process identifier across the entire domain; The training execution module is used to perform parallel training of large models based on the Rank.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a model parallel training program that supports heterogeneous clusters. When the model parallel training program that supports heterogeneous clusters is executed by a processor, it implements the steps of the large model parallel training method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Distributed training method and device of model, equipment and storage medium

    CN114186633A

  • Optimization method for executing deep learning tasks in distributed mode and distributed system

    CN115543639A