In-network multi-hop gradient convergence method for distributed model training

By calculating the multi-hop gradient aggregation structure in the network during distributed model training, and using programmable switches to perform multiple aggregation of model gradients, the problems of limited network throughput improvement and high communication overhead in the existing technology are solved, and a more efficient solution is achieved. Efficient model training and communication reduction.

CN118863014AActive Publication Date: 2024-10-29BEIJING INST OF TECH

Patent Information

Application Number
CN202410874961.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-10-29
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

Existing on-network aggregation solutions cannot flexibly select multiple programmable switches within the data center network for multiple aggregation of model gradients, resulting in limited network throughput improvement and high network communication overhead.

Method used

A multi-hop gradient aggregation method in the network is proposed for distributed model training. The controller calculates and determines the multi-hop gradient aggregation structure in the network, and uses programmable switch nodes to perform multiple aggregation and forwarding of model gradients to form a multi-hop tree. The convergence structure reduces gradient communication traffic and network bandwidth consumption.

Benefits of technology

It realizes multiple aggregation of model gradients in the data center network, reduces network communication load, improves model training efficiency and distributed model training throughput, and alleviates the network bandwidth bottleneck of model aggregation server nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118863014A_ABST
    Figure CN118863014A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed model training-oriented intra-network multi-hop gradient convergence method, which comprises the following steps of: calculating an intra-network multi-hop gradient convergence structure of distributed model training by a controller according to a network state, and marking gradient fragments sent by each training node according to the calculated intra-network multi-hop gradient convergence structure; the characteristic that the programmable switches can flexibly analyze data packets is utilized, when the gradient fragments pass through the programmable switches, multiple times of convergence and forwarding of the gradient fragments in a data center network are executed through cooperation of the multiple programmable switches, and therefore network flow generated by model gradient communication is greatly reduced, and the communication efficiency is improved. Meanwhile, the throughput of distributed model training is increased, and model training is accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of distributed machine learning, and in particular to an in-network multi-hop gradient convergence method for distributed model training. Background Art

[0002] With the development of big data technology and the surge in enterprise application demand, the training data of neural network models is increasing, and the complexity of the models is also increasing. The storage and computing resources of a single machine are no longer sufficient to support the growing amount of training data and increasingly complex training models. In order to speed up model training, distributed model training has emerged. Distributed model training is usually deployed in a data center network, using the computing and storage resources of multiple computing nodes in the data center network for parallel training, thereby accelerating the model training process. The parameter server architecture is a popular distributed model training architecture, which consists of training nodes and model aggregation server nodes. Under the parameter server architecture, each training node trains a local model based on its local training data, and sends the trained local model gradients to the model aggregation server node for aggregation; the model aggregation server node aggregates the model gradients from different training nodes, and sends the global aggregation results of the gradients to each training node, so that each training node can use the global aggregation results to update the local model and then conduct the next round of iterative training. However, as the amount of training data and model complexity of distributed model training increases, the amount of gradient communication required for each round of iterative training also continues to increase. For example, in the natural language processing model Megatron-Turing jointly developed by Microsoft and Nvidia, each training node needs to exchange 530 billion gradient data in each round of training. A large number of existing studies have shown that the increase in gradient communication leads to a decrease in the efficiency of distributed model training, and network communication overhead has become the main bottleneck of model training.

[0003] On-network computing technology provides a new opportunity to solve the network communication bottleneck problem faced by distributed model training. By writing user-defined packet processing and forwarding logic on programmable switches, on-network computing technology can realize online computing of data during network transmission, thereby reducing communication delays and improving overall computing efficiency. Based on the computing concept of on-network computing technology, recent research uses on-network aggregation technology to transfer the model gradient aggregation process in distributed model training from model aggregation server nodes to programmable switch nodes. Specifically, each training node sends the locally trained model gradient to the network. When the model gradient passes through the programmable switch node, the programmable switch node aggregates the model gradients from multiple training nodes and forwards the aggregated gradient results to the model aggregation server node. The model aggregation server node performs global aggregation of model gradients. In this way, on-network aggregation technology reduces the communication overhead of gradient interaction during distributed model training, improves model training throughput and accelerates model training.

[0004] In recent years, scholars have proposed a series of in-network aggregation solutions for distributed model training. Representative solutions include SwitchML, ATP, Panama and GRID. SwitchML designs a pool-based streaming aggregation protocol between the rack-top switch and each training node in a single rack; ATP deploys the gradient aggregation position fixedly on the rack-top switch connecting each training node and the rack-top switch connecting the model aggregation server node, providing an in-network aggregation solution for multi-tenant and cross-rack scenarios; Panama customizes an accelerator based on NetFPGA, which evenly distributes the gradient aggregation task to multiple aggregation trees in a round-robin manner for aggregation, thereby improving the model gradient aggregation efficiency; GRID uses mathematical modeling and optimization methods to calculate the gradient routing and aggregation strategy, thereby improving the throughput of model training.

[0005] However, the main problem with existing on-line aggregation solutions is that they do not support flexible selection of multiple programmable switches in the data center network to perform multiple aggregations of model gradients in the network, which limits the further improvement of network throughput and causes large network communication overhead. For example, SwitchML and ATP can only be aggregated through a few fixed-position rack-top switches, and cannot flexibly select high-level switches in the data center network (such as aggregation switches and core switches in the fat-tree network topology of the data center network, and spine switches in the leaf-spine network topology) to perform gradient aggregation. Therefore, when the packet processing capacity or available memory resources of the rack-top switch are limited, the gradient aggregation efficiency will be affected, resulting in a longer model gradient communication time; Panama and GRID only allow model gradients to be aggregated at most once in the data center network, so their effect on reducing gradient traffic is limited, and the network communication overhead caused by distributed model training in the data center network is still large. Summary of the invention

[0006] In view of this, the purpose of the present invention is to overcome the shortcomings of existing in-network aggregation solutions and provide an in-network multi-hop gradient aggregation method for distributed model training, which can realize multiple aggregation of model gradients on multiple programmable switch nodes in a data center network, thereby achieving the purpose of accelerating model training and reducing network communication load overhead.

[0007] To achieve the above-mentioned invention object, the present invention proposes an in-network multi-hop gradient convergence method for distributed model training, wherein the distributed model training comprises a controller, at least one local training node, at least one programmable switch node and at least one model convergence server node, wherein the controller is responsible for calculating the in-network multi-hop gradient convergence structure of the model when the distributed model training is initialized; the training node is responsible for training the model locally during each round of model training iteration, and sending the trained model gradient flow through the programmable switch node to the model convergence server node; the programmable switch node is responsible for aggregating and forwarding the model gradient; the model convergence server node is responsible for globally aggregating the model gradients sent by all training nodes and sending the global convergence result flow of the model gradients to each training node;

[0008] The distributed model training specifically includes the following steps:

[0009] Step S1: The controller calculates the multi-hop gradient convergence structure in the network according to the network status

[0010] The controller calculates the in-network multi-hop gradient convergence structure corresponding to the distributed model training according to the collected network resource status, and sends the convergence structure to the model convergence server node and each training node. The in-network multi-hop gradient convergence structure includes the following two aspects:

[0011] In the first aspect, a set of programmable switch nodes on the path through which the gradient flow sent from each training node to the model aggregation server node passes in a distributed model training system, and aggregation meta-information of each node in the node set, wherein the set of programmable switch nodes on the path through which the gradient flow sent from any training node to the model aggregation server node passes and the aggregation meta-information of each node in the node set are sorted in the order of the nodes passed on the gradient flow path from the training node to the model aggregation server node; the aggregation meta-information of each node in the set of programmable switch nodes on the path through which the gradient flow sent from any training node to the model aggregation server node passes includes whether the gradient flow should be aggregated on the node, the number of training nodes that should be aggregated on the node, and the egress port number of the gradient flow forwarded on the node;

[0012] In the second aspect, a set of programmable switch nodes on the path through which the global convergence result flow of the gradient sent from the model convergence server node to each training node in the distributed model training system passes, and convergence meta-information of each node in the node set, wherein the set of programmable switch nodes on the path through which the global convergence result flow of the gradient sent from the model convergence server node to any training node passes, and the convergence meta-information of each node in the node set are sorted in the order of the nodes passed on the path of the global convergence result flow of the gradient from the model convergence server node to the training node; the convergence meta-information of each node in the set of programmable switch nodes on the path through which the global convergence result flow of the gradient sent from the model convergence server node to any training node passes includes whether the gradient flow has converged on the node and the egress port number of the global convergence result flow of the gradient forwarded on the node;

[0013] In the intra-network multi-hop gradient convergence structure in step S1, the set of programmable switch nodes on the path through which the gradient flow from any training node to the model convergence server node passes is completely consistent with the nodes included in the set of programmable switch nodes on the path through which the gradient global convergence result flow from the model convergence server node to the training node passes, and the order of the nodes in the node set is opposite;

[0014] In step S1, after each training node and the model aggregation server node receive the intra-network multi-hop gradient aggregation structure sent by the controller, each training node and the model aggregation server node save the intra-network multi-hop gradient aggregation structure in the memory;

[0015] Step S2: Each training node marks the gradient fragment according to the corresponding multi-hop gradient aggregation structure in the network

[0016] According to the set of programmable switch nodes on the path through which the gradient flow sent by each training node to the model aggregation server node in the multi-hop gradient aggregation structure in the network issued by the controller passes, and the aggregation meta information of each node in the node set, each training node marks the trained gradient slices, and sets the destination address of the gradient slices to the model aggregation server node, and then each training node sends the gradient slices to the network;

[0017] Step S3: Programmable switch node processes gradient sharding

[0018] Step S3.1: The programmable switch node determines whether the gradient shards should be converged.

[0019] When a gradient shard reaches a programmable switch node, determine whether the gradient shard should be converged on the programmable switch node according to the convergence meta information of the first node in the node set in the gradient shard tag. If it should not be converged, execute step S3.2; otherwise, execute step S3.3.

[0020] Step S3.2: The programmable switch node forwards the gradient slices that should not be aggregated

[0021] If the gradient shard should not be aggregated on the programmable switch node, the programmable switch node records the forwarding outbound port number in the aggregation meta-information of the first node in the node set in the gradient shard tag, then deletes the first node in the node set in the gradient shard tag and its aggregation meta-information, and forwards the gradient shard to the next hop node in the network according to the recorded forwarding outbound port number, and executes step S3.6;

[0022] Step S3.3: The programmable switch node aggregates the gradient shards that should be aggregated

[0023] If the gradient slice should be aggregated on the programmable switch node, the programmable switch node allocates the gradient slice to a specific memory unit for aggregation, increases the number of aggregated training nodes recorded in the memory unit by 1, and executes step S3.4;

[0024] Step S3.4: The programmable switch node determines whether the gradient sharding has completed convergence

[0025] When the gradient sharding is converged, the programmable switch node compares the number of converged training nodes in the corresponding memory unit with the number of training nodes that should be converged on the programmable switch node in the convergence meta information of the first node in the node set in the gradient sharding tag. If the two are equal, it means that the programmable switch has completed the convergence of the corresponding gradient fragments of the training nodes on which convergence should occur, and then execute step S3.5. If the two are not equal, execute step S3.7.

[0026] Step S3.5: The programmable switch node forwards the gradient sharding aggregation result

[0027] The programmable switch node records the forwarding outbound port number in the aggregation meta-information of the first node in the node set in the gradient sharding mark, then deletes the first node in the node set in the gradient sharding mark and its aggregation meta-information, writes the gradient aggregation result in the corresponding memory unit into the gradient sharding, and forwards the gradient sharding carrying the gradient aggregation result to the next hop node in the network according to the recorded forwarding outbound port number, and then enters step S3.6;

[0028] Step S3.6: Is the next hop node in the network a programmable switch node?

[0029] If the next hop node is a programmable switch node, repeat step S3; if the next hop node is a model aggregation server node, execute step S4;

[0030] Step S3.7, the programmable switch node discards the gradient slice;

[0031] Step S4: Model aggregation server node processes gradient fragments

[0032] Step S4.1: The model aggregation server node performs gradient global aggregation to generate gradient global aggregation result fragments

[0033] When the gradient shards arrive at the model aggregation server node, the model aggregation server node performs global gradient aggregation. When the gradient shards corresponding to all training nodes are fully aggregated, the model aggregation server node generates N gradient global aggregation result shards. Each gradient global aggregation result shard carries the same gradient global aggregation result. N is equal to the number of training nodes in distributed model training.

[0034] Step S4.2: Model aggregation server node marks gradient global aggregation result shards

[0035] The model convergence server node sets the destination addresses of the N gradient global convergence result slices to the training nodes in sequence. After that, the model convergence server node marks the N gradient global convergence result slices respectively according to the programmable switch node set on the path through which the gradient global convergence result flow sent from the model convergence server node to each training node passes in the network multi-hop gradient convergence structure stored in the memory in step S1 and the convergence meta-information of each node in the node set, and sends them to the network, wherein each gradient global convergence result slice marks the programmable switch node set on the path through which the gradient global convergence result flow sent from the model convergence server node to a certain training node passes and the convergence meta-information of each node in the node set;

[0036] Step S5: The programmable switch node processes the global gradient aggregation result

[0037] Step S5.1: The programmable switch node determines whether there is a gradient shard convergence on it.

[0038] When the gradient global convergence result fragment arrives at a programmable switch node, it is determined whether a gradient fragment has been converged on the programmable switch node according to the convergence meta information of the first node in the node set in the gradient global convergence result fragment tag. If a gradient fragment has been converged on the programmable switch node, it means that the gradient convergence result in the specific memory unit corresponding to the gradient fragment needs to be cleared so that it can be reused to converge the gradient, and step S5.2 is executed, otherwise step S5.3 is executed;

[0039] Step S5.2: The programmable switch node clears the gradient aggregation result of a specific memory unit

[0040] If any gradient slices are aggregated on the programmable switch node, the programmable switch node clears the gradient aggregation result of the specific memory unit, and then executes step S5.3;

[0041] Step S5.3: Programmable switch node forwards gradient global aggregation result fragments

[0042] The programmable switch node records the forwarding outbound port number in the aggregation meta-information of the first node in the node set in the gradient global aggregation result fragmentation mark, then deletes the first node in the node set in the gradient global aggregation result fragmentation mark and its aggregation meta-information, and forwards the gradient global aggregation result fragment to the next hop node in the network according to the recorded forwarding outbound port number, and executes step S5.4;

[0043] Step S5.4: Is the next hop node in the network a training node?

[0044] If the next hop node is a training node, execute step S6; if the next hop node is a programmable switch node, repeat step S5;

[0045] Step S6: The training node receives the global gradient aggregation result and updates the local model

[0046] When the gradient global aggregation result shard reaches the training node, the training node uses the gradient global aggregation result carried in the gradient global aggregation result shard to update the local model, so that the training node can use the updated local model to perform the next round of iterative training.

[0047] The object of the invention of the present invention is achieved in this way:

[0048] The present invention discloses an intra-network multi-hop gradient convergence method for distributed model training. The method uses a controller to calculate the intra-network multi-hop gradient convergence structure of distributed model training, and uses the characteristic that programmable switches can flexibly parse data packets. When a gradient slice passes through a programmable switch, it is determined whether the gradient slice should be converged on the programmable switch according to the intra-network multi-hop gradient convergence structure in the gradient slice tag. If so, gradient convergence is performed, otherwise the programmable switch node directly forwards the gradient slice. When the programmable switch has converged all the corresponding gradient slices that should be converged on it, the programmable switch forwards the gradient slice carrying the gradient convergence result to the next-hop programmable switch node in the network, and the next-hop programmable switch node repeats the above judgment and convergence process until the partially converged gradient slices are forwarded to the model convergence server node, and the model convergence server node executes The gradient shards are globally aggregated, and each programmable switch in the data center network collaborates to aggregate and forward the gradient shards, thereby forming a multi-hop tree-like aggregation structure of the model gradient in the data center network. Each aggregation switch on the multi-hop tree-like aggregation structure can perform partial aggregation on the model gradient, thereby greatly reducing the network traffic generated by the gradient communication. At the same time, since the programmable switch has reduced a large amount of gradient traffic, the number of gradient shards that ultimately reach the model aggregation server node is reduced, alleviating the network bandwidth communication bottleneck at the model aggregation server node in distributed model training, reducing the probability of network congestion, and then reversely promoting the gradient sending rate of the training nodes in each distributed model training to further increase, thereby increasing the throughput of distributed model training and accelerating model training. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 The logical architecture diagram proposed by the present invention;

[0050] Figure 2 This is a flow chart of the in-network multi-hop gradient convergence method for distributed model training proposed by the present invention;

[0051] Figure 3 A distributed model training network topology diagram - a specific example diagram proposed by the present invention;

[0052] FIG4( a ) is a diagram showing a specific example of a model gradient aggregation structure that limits model gradients to be aggregated at most once in a network in the prior art;

[0053] FIG4( b ) is a diagram showing a specific example of a model gradient convergence structure calculated by the controller according to the network state proposed by the present invention;

[0054] Figure 5 This is a specific example diagram of the distributed model training training node gradient sharding data packet structure proposed by the present invention;

[0055] Figure 6 This is a specific example diagram of the distributed model training model aggregation server node gradient global aggregation result fragment data packet structure proposed by the present invention; DETAILED DESCRIPTION

[0056] The present invention is described in detail below with reference to the accompanying drawings and examples so that those skilled in the art can better understand the present invention. It should be noted that in the following description, when the detailed description of known functions and designs may dilute the main content of the present invention, these descriptions will be omitted here.

[0057] The present invention provides an intra-network multi-hop gradient convergence method for distributed model training, named HINA. The basic idea is to improve the model training throughput and accelerate the distributed model training by converging the model gradients multiple times on multiple programmable switch nodes in the data center network, while reducing the network communication overhead.

[0058] Figure 1 It is a logical architecture diagram of the present invention, such as Figure 1 As shown, distributed model training is deployed in a data center network, including a controller, at least one local training node, at least one programmable switch node, and at least one model aggregation server node. All training nodes form a training node pool; all model aggregation server nodes form a model aggregation server node pool; all programmable switch nodes in the data center form a programmable switch node pool, and all programmable switches in the programmable switch node pool can be divided into multiple layers according to the topological architecture of the data center network, and each layer is composed of at least one programmable switch, wherein the controller is responsible for collecting the network resource status when the distributed model training task is initialized, calculating the multi-hop gradient aggregation structure in the network according to the collected network status, and sending the calculated multi-hop gradient aggregation structure in the network to each training node and model aggregation server node of the distributed model training; the training node is responsible for performing local model training and sending the trained gradient slices to the model aggregation server node via multiple programmable switch nodes; the programmable switch nodes of each layer are responsible for partially aggregating and forwarding the gradient slices to the next layer of programmable switch nodes or until the model aggregation server node, and the gradient slices are aggregated multiple times on the multi-layer programmable switch nodes in the data center, thereby forming a multi-hop gradient aggregation structure in the network, and at the same time, the programmable switch nodes are also responsible for forwarding the gradient global aggregation result slices to each training node; the model aggregation server node is responsible for performing global aggregation on the received partially aggregated gradient slices, and sending the gradient global aggregation result slices to each training node via multiple programmable switch nodes.

[0059] Figure 2A flow chart of the in-network multi-hop gradient convergence method for distributed model training provided by the present invention.

[0060] In this embodiment, if Figure 2 As shown, an in-network multi-hop gradient convergence method for distributed model training of the present invention comprises the following steps:

[0061] Step S1: The controller calculates the multi-hop gradient convergence structure in the network according to the network status

[0062] The controller calculates the intra-network multi-hop gradient aggregation structure corresponding to the distributed model training according to the collected network resource status, and sends the aggregation structure to the model aggregation server node and each training node;

[0063] In this embodiment, the distributed model training network topology diagram is as follows: Figure 3 As shown in the figure, a distributed model training task is deployed in a data center network. The data center network architecture adopts a fat tree network topology architecture. The distributed model training task includes 6 training nodes (w1-w6) marked by squares and a model aggregation server node ( Figure 3 The training nodes and the model aggregation server nodes PS are located on the physical host server in the data center network. The data center network contains 7 programmable switch nodes (S1-S7) marked by rounded rectangles. The model gradient packet aggregation capacity of each programmable switch is 6Gbps. The black connecting lines represent the links in the data center network. The capacity of each link is 6Gbps. The letters (L1-L7) next to the links indicate the names of the links. For ease of reading and explanation, Figure 3 Components in the data center network that are not related to distributed model training are omitted and only components related to it are shown.

[0064] The model gradient aggregation structure in the prior art that limits the model gradient to be aggregated at most once in the network is shown in FIG4(a). The model gradient aggregation structure calculated by the controller according to the network state in the present invention is shown in FIG4(b). Figure 3 Keeping the same, the following is the part contained in Figure 4 Figure 34(a) and 4(b), the training nodes w1-w6 send the gradient stream composed of gradient slices to the model aggregation server node PS via the programmable switch node. The gray rounded rectangle represents the programmable switch where gradient slice aggregation and gradient slice forwarding occur. The white rounded rectangle represents the programmable switch that only performs gradient slice forwarding but does not aggregate gradient slices. In Figure 4(a), the 6 / 6 in the upper right corner of the aggregation switch S1 in the network represents the model gradient packet aggregation capacity of the programmable switch, which is 6 Gbps. The model gradient packet aggregation capacity consumed by gradient slice aggregation is 6 Gbps (Figure 4 The numbers in the upper right corner of other aggregation switches in FIG4 are the same). In FIG4(a), 4 / 6 next to the L2 link represents that the link capacity of L2 is 6 Gbps. Since the link load consumed by gradient slicing forwarding is 4 Gbps (the numbers next to other links in FIG4 are the same), the number 2 below each training node in FIG4(a) represents that the maximum sending rate of the training node side that can be achieved by the prior art is 2 Gbps. The number 3 below each training node in FIG4(b) represents that the maximum sending rate of the training node side that can be achieved by the present invention is 3 Gbps. In FIG4, f1-f6 respectively represent the gradient flows composed of the gradient slicing sent by w1-w6. Represented by the training node w i The gradient flow f composed of the sent gradient fragments i With the training node w j The gradient flow f composed of the sent gradient fragments j In the programmable switch node S k The gradient flow composed of the partially converged gradient slices generated by the upper convergence (For example, in Figure 4(b) This means that the gradient shard f4 sent by w4 and the gradient shard f5 sent by w5 converge on switch S3 to form a gradient shard Represented by the training node w i -w j The sent gradient slice fi-fj is sent to the programmable switch node S k Partially converged gradient shards generated by the upper convergence (For example, in Figure 4(a) This means that the gradient slice f4 sent by w4, the gradient slice f5 sent by w5, and the gradient slice f6 sent by w6 converge on switch S6, forming a partially converged gradient slice. ), all gradient flows composed of all gradient slices are represented by black solid lines with arrows.

[0065] In order to illustrate the difference between the present invention and other solutions and the advantages of the present invention, a comparative explanation is now given with respect to the two model gradient convergence structures in FIG. 4 .

[0066] FIG4(a) shows the model gradient aggregation structure generated by the prior art GRID. As shown in FIG4(a), GRID limits the model gradient to be aggregated at most once in the data center network, where S1 aggregates the gradient flow f1-f3 sent by w1-w3, and then S1 sends the aggregated flow The model is sent to the model aggregation server node PS, which performs global aggregation. Since the model gradient packet aggregation capability of S1 is 6Gbps, w1-w3 can send gradient fragments at a speed of 6 / 3=2Gbps; S6 aggregates the gradient flows f4-f6 sent by w4-w6, and then S6 sends the aggregated flows The model is sent to the model aggregation server node PS, which performs global aggregation. Since the model gradient packet aggregation capability of S6 is 6 Gbps, w4-w6 can also send gradient fragments at a speed of 6 / 3 = 2 Gbps. At this time, the remaining available bandwidth of the link L1 between S5 and S1 is 6-2*2-2 = 0 Gbps (the link bandwidth is all composed of f2 and f3 are occupied). In summary, the maximum transmission rate of GRID's training node side is 2Gbps.

[0067] FIG4(b) shows the model gradient aggregation structure generated by HINA of the present invention. As shown in FIG4(b), HINA can allow the model gradient to arbitrarily select a programmable switch node in the data center network to perform gradient aggregation, and does not limit the number of times the model gradient is aggregated in the network. Among them, w4 and w5 can send f4 and f5 to S3 at a speed of 6 / 2=3Gbps respectively, and S3 aggregates f4 and f5 to form After that, S3 will Forward to S6 at 3Gbps; w6 can send f6 to S6 along the w6-S4-S6 path at 3Gbps; S6 receives and f6, converge to form and will Forward to S5 along the path S6-S7-S5 at 3Gbps; w2 and w3 can send f2 and f3 to S2 at 3Gbps respectively, and S2 aggregates f2 and f3 to form After that, S2 will Forwarded to S5 at 3Gbps speed; S5 aggregates the received and Converging Flow After that, S5 will be at 3Gbps speed Forward to S1; w1 sends f1 to S1 at 3Gbps; S1 aggregates the received With f1, forming a converging flow After that, S1 will With 3Gbps forwarding to the model aggregation server node PS, the maximum transmission rate of HINA's training node side can reach 3Gbps, which is 50% higher than GRID. According to the gradient multi-hop aggregation process in Figure 4(b), it can be seen that the multi-hop aggregation of model gradients also further reduces the inlet bandwidth of the model aggregation server node PS side: the inlet bandwidth consumption of the model aggregation server node PS in Figure 4(b) is 3Gbps, which is 25% lower than GRID. In summary, by realizing multi-hop aggregation of model gradients, HINA can further improve the maximum sending rate of each training node, improve the throughput of distributed model training, and then shorten the gradient communication time.

[0068] The intra-network multi-hop gradient convergence structure includes the following two aspects:

[0069] In the first aspect, a set of programmable switch nodes on the path through which the gradient flow sent from each training node to the model aggregation server node passes in a distributed model training system, and aggregation meta-information of each node in the node set, wherein the set of programmable switch nodes on the path through which the gradient flow sent from any training node to the model aggregation server node passes and the aggregation meta-information of each node in the node set are sorted in the order of the nodes passed on the gradient flow path from the training node to the model aggregation server node; the aggregation meta-information of each node in the set of programmable switch nodes on the path through which the gradient flow sent from any training node to the model aggregation server node passes includes whether the gradient flow should be aggregated on the node, the number of training nodes that should be aggregated on the node, and the egress port number of the gradient flow forwarded on the node;

[0070] As shown in FIG4(b), it can be seen that the set of programmable switch nodes on the path through which the gradient flow sent from each training node to the model aggregation server node in the distributed model training system calculated by the controller and the aggregation meta-information of each node in the node set are:

[0071] For the convenience of explanation and understanding, the specific port number of the programmable switch forwarding the gradient flow is omitted in the description of this example, and the name of the link connected by the programmable switch is used instead of the corresponding forwarding port number of the gradient flow forwarded along the link. Specifically, as shown in Figure 4(b), for the training node w1, the gradient flow it sends to the model aggregation server node PS is f1 and the aggregated The gradient flow path only passes through S1, so the intra-network multi-hop gradient aggregation structure about w1 is {w1: [S1: {Agg: 1, Cnt: 6, Port: L7}]}. In the intra-network multi-hop gradient aggregation structure about w1 {w1: [S1: {Agg: 1, Cnt: 6, Port: L7}]}, w1 represents that the aggregation structure is about w1, {w1: [S1]} represents that the gradient flow passes through S1, S1: {Agg: 1, Cnt: 6, Port: L7} represents the aggregation meta-information about the S1 node, Agg: 1 represents that the gradient fragments sent by w1 should be aggregated on S1, Cnt: 6 represents the number of training nodes on S1 where gradient aggregation should occur is 6, and Port: L7 represents that the gradient fragments sent by w1 are forwarded to the model aggregation server node PS on S1 along the port connected to L7.

[0072] For the training node w2, the gradient flow sent to the model aggregation server node PS is f2, and The gradient flow path passes through S2, S5 and S1, so the intra-network multi-hop gradient aggregation structure about w2 is {w2: [S2: {Agg: 1, Cnt: 2, Port: L2}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]}, where w2 represents that the aggregation structure is about w2, {w2: [S2, S5, S1]} represents that the gradient flow passes through S2, S5 and S1 in sequence, and S2: {Agg: 1, Cnt: 2, Port: L2} represents that the gradient fragments sent by w2 should be aggregated on S2, and the number of training nodes on S2 where gradient aggregation should occur is 2 (w2 and w3 in Figure 4(b)), and the gradient fragments sent by w2 are on S2. 4(b) are w2, w3, w4, w5 and w6), and the gradient slices sent by w2 are forwarded to S1 along the port connected to L1 on S5; S1: {Agg: 1, Cnt: 6, Port: L7} means that the gradient slices sent by w2 should be converged on S1, and the number of training nodes on S1 that should have gradient convergence is 6 (w1, w2, w3, w4, w5 and w6 in Figure 4(b)), and the gradient slices sent by w2 are forwarded to the model aggregation server node PS on S1 along the port connected to L7.

[0073] For the training node w4, the gradient flow sent to the model aggregation server node is f4, and The gradient flow path passes through S3, S6, S7, S5 and S1, so the intra-network multi-hop gradient aggregation structure about w4 is {w4: [S3: {Agg: 1, Cnt: 2, Port: L3}, S6: {Agg: 1, Cnt: 3, Port: L6}, S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]}, where w4 represents the aggregation structure about w4, {w4: [S3, S6, S7, S5, S1]} represents that the gradient flow passes through S3, S6, S7, S5 and S1 in sequence. S3: {Agg: 1, Cnt: 2, Port: L3} represents that the gradient fragments sent by w4 should be converged on S3. The number of training nodes on which gradient convergence should occur on S3 is 2 (w4 and w5 in Figure 4(b)), and the gradient fragments sent by w4 are forwarded to S6 on S3 along the port connected to L3. S6: {Agg: 1, Cnt: 3, Port: L6} represents that the gradient fragments sent by w4 should be converged on S6. Gradient convergence should occur on S6 The number of training nodes is 3 (w4, w5 and w6 in Figure 4(b)), and the gradient slices sent by w4 are forwarded to S7 on S6 along the port connected to L6; S7: {Agg: 0, Cnt: 0, Port: L5} means that the gradient slices sent by w4 should not be converged on S7, and the number of training nodes on which gradient convergence should occur on S7 is 0, and the gradient slices sent by w4 are forwarded to S5 on S7 along the port connected to L5; S5: {Agg: 1, Cnt: 5, Port: L1} means that the gradient slices sent by w4 should be converged on S5, and S5 The number of training nodes on which gradient convergence should occur is 5 (w2, w3, w4, w5 and w6 in Figure 4(b)), and the gradient slices sent by w4 are forwarded to S1 on S5 along the port connected to L1; S1: {Agg: 1, Cnt: 6, Port: L7} means that the gradient slices sent by w4 should be converged on S1, and the number of training nodes on which gradient convergence should occur is 6 (w1, w2, w3, w4, w5 and w6 in Figure 4(b)), and the gradient slices sent by w4 are forwarded to the model aggregation server node PS on S1 along the port connected to L7.

[0074] The gradient aggregation structure of the model gradient shards sent by w3, w5 and w6 follows a similar structure to w1, w2 and w4. Finally, the intra-network multi-hop gradient aggregation structure sent from each training node to the model aggregation server node PS is as follows:

[0075] {w1:[S1:{Agg:1,Cnt:6,Port:L7}]};

[0076] {w2: [S2: {Agg: 1, Cnt: 2, Port: L2}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]};

[0077] {w3: [S2: {Agg: 1, Cnt: 2, Port: L2}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]};

[0078] {w4: [S3: {Agg: 1, Cnt: 2, Port: L3}, S6: {Agg: 1, Cnt: 3, Port: L6}, S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]};

[0079] {w5: [S3: {Agg: 1, Cnt: 2, Port: L3}, S6: {Agg: 1, Cnt: 3, Port: L6}, S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]};

[0080] {w6: [S4: {Agg: 0, Cnt: 0, Port: L4}, S6: {Agg: 1, Cnt: 3, Port: L6}, S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]};

[0081] The controller sends the corresponding intra-network multi-hop gradient aggregation structure of each training node to each training node respectively, and each training node saves the corresponding intra-network multi-hop gradient aggregation structure in the memory for subsequent marking of the model gradient fragments;

[0082] In the second aspect, a set of programmable switch nodes on the path through which the global convergence result flow of the gradient sent from the model convergence server node to each training node in the distributed model training system passes, and convergence meta-information of each node in the node set, wherein the set of programmable switch nodes on the path through which the global convergence result flow of the gradient sent from the model convergence server node to any training node passes, and the convergence meta-information of each node in the node set are sorted in the order of the nodes passed on the path of the global convergence result flow of the gradient from the model convergence server node to the training node; the convergence meta-information of each node in the set of programmable switch nodes on the path through which the global convergence result flow of the gradient sent from the model convergence server node to any training node passes includes whether the gradient flow has converged on the node and the egress port number of the global convergence result flow of the gradient forwarded on the node;

[0083] In the intra-network multi-hop gradient convergence structure in step S1, the set of programmable switch nodes on the path through which the gradient flow from any training node to the model convergence server node passes is completely consistent with the nodes included in the set of programmable switch nodes on the path through which the gradient global convergence result flow from the model convergence server node to the training node passes, and the order of the nodes in the node set is opposite;

[0084] In step S1, after each training node and the model aggregation server node receive the intra-network multi-hop gradient aggregation structure sent by the controller, each training node and the model aggregation server node save the intra-network multi-hop gradient aggregation structure in the memory;

[0085] As shown in FIG4(b), it can be seen that the set of programmable switch nodes on the path through which the gradient global aggregation result flow sent from the model aggregation server node to each training node in the distributed model training system calculated by the controller and the aggregation meta-information of each node in the node set are:

[0086] For the convenience of explanation and understanding, the specific port number of the programmable switch forwarding the gradient global convergence result flow is omitted in the description of this example, and the link name connected to the programmable switch or the name of the training node connected to it is used instead of the forwarding port number corresponding to the forwarding gradient global convergence result flow. Specifically, as shown in Figure 4(b), for the model convergence server node, the gradient global convergence result flow sent to the training node w3 is exactly the same as the nodes contained in the programmable switch node set on the path through which the gradient flow sent from the training node w3 to the model convergence server node passes, and the sorting order of each node in the node set is opposite. Since the intra-network multi-hop gradient convergence structure of the model gradient shard sent by the training node w3 to the model convergence server node is {w3: [S2: {Agg: 1, Cnt: 2, Port: L2}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]}, so the intra-network multi-hop gradient aggregation structure of the gradient global aggregation result shard sent by the model aggregation server node to the training node w3 is {w3: [S1: {Agg: 1, Port: L1}, S5: {Agg: 1, Port: L2}, S2: {Agg: 1, Port: w3}]}, where w3 represents the intra-network multi-hop gradient aggregation structure Regarding w3, {w3: [S1, S5, S2]} means that the gradient global aggregation result slices pass through S1, S5 and S2 in sequence (which is opposite to the order of the programmable switch nodes on the path through which the gradient flow from w3 to the model aggregation server node passes); S1: {Agg: 1, Port: L1} means that the gradient global aggregation result slice sent to w3 passes through S1 and the corresponding gradient slices are aggregated, and the gradient global aggregation result slice sent to w3 is forwarded to S5 on S1 along the port connected to L1; S5 : {Agg: 1, Port: L2} means that the gradient global convergence result slice sent to w3 passes through S5 and the corresponding gradient slices are converged, and the gradient global convergence result slice sent to w3 is forwarded to S2 along the port connected to L2 on S5; S2: {Agg: 1, Port: w3} means that the gradient global convergence result slice sent to w3 passes through S2 and the corresponding gradient slices are converged, and the gradient global convergence result slice sent to w3 is forwarded to w3 along the port connected to w3 on S2.

[0087] The in-network multi-hop gradient aggregation structure of the global model gradient aggregation result shards sent from the model aggregation server node to w1, w2, w4, w5 and w6 follows a similar structure to w3. Finally, the in-network multi-hop gradient aggregation structure of the global model gradient aggregation result sent from the model aggregation server node to each training node is as follows:

[0088] {w1:[S1:{Agg:1,Port:w1}]};

[0089] {w2: [S1: {Agg: 1, Port: L1}, S5: {Agg: 1, Port: L2}, S2: {Agg: 1, Port: w2}]};

[0090] {w3: [S1: {Agg: 1, Port: L1}, S5: {Agg: 1, Port: L2}, S2: {Agg: 1, Port: w3}]};

[0091] {w4: [S1: {Agg: 1, Port: L1}, S5: {Agg: 1, Port: L5}, S7: {Agg: 0, Port: L6}, S6: {Agg: 1, Port: L3}, S3: {Agg: 1, Port: w4}]};

[0092] {w5: [S1: {Agg: 1, Port: L1}, S5: {Agg: 1, Port: L5}, S7: {Agg: 0, Port: L6}, S6: {Agg: 1, Port: L3}, S3: {Agg: 1, Port: w5}]};

[0093] {w6: [S1: {Agg: 1, Port: L1}, S5: {Agg: 1, Port: L5}, S7: {Agg: 0, Port: L6}, S6: {Agg: 1, Port: L4}, S4: {Agg: 0, Port: w6}]};

[0094] The controller sends the calculated intra-network multi-hop gradient convergence structure to the corresponding training nodes and model convergence server nodes respectively, and each training node and model convergence server node stores the intra-network multi-hop gradient convergence structure in memory;

[0095] Step S2: Each training node marks the gradient fragment according to the corresponding multi-hop gradient aggregation structure in the network

[0096] According to the set of programmable switch nodes on the path through which the gradient flow sent by each training node to the model aggregation server node in the multi-hop gradient aggregation structure in the network issued by the controller passes, and the aggregation meta information of each node in the node set, each training node marks the trained gradient slices, and sets the destination address of the gradient slices to the model aggregation server node, and then each training node sends the gradient slices to the network;

[0097] Figure 5 The distributed model training node gradient sharding data packet structure of the present invention is as follows: Figure 5As shown, the gradient slicing includes the traditional IP field, the newly added gradient slicing intra-network multi-hop gradient convergence structure field and the INA field. The function of the traditional IP field is the same as that of the traditional data packet in the data center; the newly added gradient slicing intra-network multi-hop gradient convergence structure field is used to mark the intra-network multi-hop gradient convergence structure generated in step S1. Each training is based on the corresponding intra-network multi-hop gradient convergence structure stored in the memory in step S1. Figure 5 The newly added multi-hop gradient aggregation structure field in the gradient slicing network is filled from left to right in the order of the gradient slicing. The newly added multi-hop gradient aggregation structure field in the gradient slicing network contains multiple {Agg, Cnt, Port} field groups, each of which represents the aggregation meta-information of a programmable switch node on the path through which the gradient slicing passes in sequence. Agg represents whether the gradient has been aggregated on the programmable switch node, Cnt represents the number of training nodes that should be aggregated on the programmable switch node, and Port represents the forwarding port number of the gradient slicing on the programmable switch node; the function of the INA field is to guide the model gradient aggregation. Specifically, the Ack in the INA field is 0, indicating that the data packet is a gradient slicing sent from the training node to the model aggregation server node, otherwise it represents that the data packet is a gradient global aggregation result slicing sent from the model aggregation server node to the training node; the SlotId in the INA field is used to identify a specific memory unit in the positioning programmable switch node, and the programmable switch node determines on which specific memory unit the gradient slicing should be aggregated according to this field.

[0098] Specifically, for the training node w4, the corresponding intra-network multi-hop gradient aggregation structure of the gradient slice sent by it is {w4: [S3: {Agg: 1, Cnt: 2, Port: L3}, S6: {Agg: 1, Cnt: 3, Port: L6}, S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]}, and the structure is marked in sequence to the newly added intra-network multi-hop gradient aggregation structure field of the gradient slice data packet. After the marking is completed, w4 sets the destination address IP in the traditional IP field to the model aggregation server node, sets the Ack in the INA field to 0, sets the SlotId field to the identifier of the specific memory unit of the programmable switch node where the gradient slice is aggregated, and finally sends the gradient slice to the network. The gradient slice marking and processing methods of the remaining training nodes are similar to those of w4.

[0099] Step S3: Programmable switch node processes gradient sharding

[0100] Step S3.1: The programmable switch node determines whether the gradient shards should be converged.

[0101] When a gradient shard reaches a programmable switch node, determine whether the gradient shard should be converged on the programmable switch node according to the convergence meta information of the first node in the node set in the gradient shard tag. If it should not be converged, execute step S3.2; otherwise, execute step S3.3.

[0102] Step S3.2: The programmable switch node forwards the gradient slices that should not be aggregated

[0103] If the gradient shard should not be aggregated on the programmable switch node, the programmable switch node records the forwarding outbound port number in the aggregation meta-information of the first node in the node set in the gradient shard tag, then deletes the first node in the node set in the gradient shard tag and its aggregation meta-information, and forwards the gradient shard to the next hop node in the network according to the recorded forwarding outbound port number, and executes step S3.6;

[0104] Step S3.3: The programmable switch node aggregates the gradient shards that should be aggregated

[0105] If the gradient slice should be aggregated on the programmable switch node, the programmable switch node allocates the gradient slice to a specific memory unit for aggregation, increases the number of aggregated training nodes recorded in the memory unit by 1, and executes step S3.4;

[0106] Step S3.4: The programmable switch node determines whether the gradient sharding has completed convergence

[0107] When the gradient sharding is converged, the programmable switch node compares the number of converged training nodes in the corresponding memory unit with the number of training nodes that should be converged on the programmable switch node in the convergence meta information of the first node in the node set in the gradient sharding tag. If the two are equal, it means that the programmable switch has completed the convergence of the corresponding gradient fragments of the training nodes on which convergence should occur, and then execute step S3.5. If the two are not equal, execute step S3.7.

[0108] Step S3.5: The programmable switch node forwards the gradient sharding aggregation result

[0109] The programmable switch node records the forwarding outbound port number in the aggregation meta-information of the first node in the node set in the gradient sharding mark, then deletes the first node in the node set in the gradient sharding mark and its aggregation meta-information, writes the gradient aggregation result in the corresponding memory unit into the gradient sharding, and forwards the gradient sharding carrying the gradient aggregation result to the next hop node in the network according to the recorded forwarding outbound port number, and then enters step S3.6;

[0110] Step S3.6: Is the next hop node in the network a programmable switch node?

[0111] If the next hop node is a programmable switch node, repeat step S3; if the next hop node is a model aggregation server node, execute step S4;

[0112] Step S3.7, the programmable switch node discards the gradient slice;

[0113] Specifically, as shown in Figure 4(b), the gradient shard sent by w4 carries the gradient shard mark [S3: {Agg: 1, Cnt: 2, Port: L3}, S6: {Agg: 1, Cnt: 3, Port: L6}, S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}] to S3. S3 determines that the gradient shard should be converged on S3 itself according to the convergence meta-information {Agg: 1, Cnt: 2, Port: L3} of the first node in the node set in the gradient shard mark. Therefore, S3 divides the gradient shard into It is assigned to a specific memory unit for aggregation. At this time, the number of training nodes that have been aggregated in the memory unit is 0+1=1 (only w4 is included), which is different from the number of training nodes Cnt: 2 that should be aggregated on the programmable switch node in the aggregation meta information {Agg: 1, Cnt: 2, Port: L3} of the first node in the node set in the gradient sharding mark. Therefore, S3 discards the gradient sharding. After that, the gradient sharding sent by w5 carries the gradient sharding mark [S3: {Agg: 1, Cnt: 2, Port: L3}, S6: {Agg: 1, Cnt: 3, Port: L6}, S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5 , Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}] to S3, S3 determines that the gradient shard should be converged on S3 itself according to the convergence meta-information {Agg: 1, Cnt: 2, Port: L3} of the first node in the node set in the gradient shard mark, so S3 assigns the gradient shard to a specific memory unit for convergence. At this time, the number of converged training nodes in the memory unit is 1+1=2 (including w4 and w5), which is the same as the number of training nodes Cnt: 2 that should be converged on the programmable switch node in the convergence meta-information {Agg: 1, Cnt: 2, Port: L3} of the first node in the node set in the gradient shard mark. , then S3 records the forwarding port number Port: L3 in the aggregation meta-information {Agg: 1, Cnt: 2, Port: L3} of the first node in the node set in the gradient sharding mark, and then deletes the first node in the node set in the gradient sharding mark and its aggregation meta-information [S3: {Agg: 1, Cnt: 2, Port: L3}] (the gradient sharding mark after deleting the first node and its aggregation meta-information is [S6: {Agg: 1, Cnt: 3, Port: L6}, S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]),The gradient aggregation results in the corresponding memory unit are written into the gradient slice, and the gradient slice carrying part of the gradient aggregation results is forwarded to the next hop node S6 in the network through the L3 link according to the recorded forwarding port number Port: L3.

[0114] When S6 receives the partially converged gradient shard, it repeats step S3, and judges that the gradient shard should be converged on S6 itself according to Agg:1 in the convergence meta-information {Agg:1, Cnt:3, Port:L6} of the first node in the node set in the gradient shard mark, so S6 allocates the gradient shard to a specific memory unit for convergence. At this time, the number of converged training nodes in the memory unit is 2 (including w4 and w5), which is different from the number of training nodes Cnt:3 that should be converged on the programmable switch node in the convergence meta-information {Agg:1, Cnt:3, Port:L6} of the first node in the node set in the gradient shard mark, and S6 discards the gradient shard.

[0115] When S4 receives the gradient shard sent by w6, S4 determines that the gradient shard should not be converged on S4 itself according to the convergence meta information {Agg: 0, Cnt: 0, Port: L4} of the first node in the node set in the gradient shard mark [S4: {Agg: 0, Cnt: 0, Port: L4}, S6: {Agg: 1, Cnt: 3, Port: L6}, S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]. Therefore, S4 records the convergence meta information of the first node in the node set in the gradient shard mark {Agg: 0, Cnt: 0, Port: L4}. The forwarding port number Port: L4 in the aggregation meta-information is recorded, and then the first node in the node set in the gradient sharding mark and its aggregation meta-information [S4: {Agg: 0, Cnt: 0, Port: L4}] is deleted (the gradient sharding mark after deleting the first node and its aggregation meta-information is [S6: {Agg: 1, Cnt: 3, Port: L6}, S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]), and the gradient sharding is forwarded to the next hop node S6 in the network through the L4 link according to the recorded forwarding port number Port: L4.

[0116] When S6 receives the gradient shard, it executes step S3. According to the convergence meta-information {Agg: 1, Cnt: 3, Port: L6} of the first node in the node set in the gradient shard mark [S6: {Agg: 1, Cnt: 3, Port: L6}, S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}], it is judged that the gradient shard should be converged on S6 itself. Therefore, S6 allocates the gradient shard to a specific memory unit for convergence. At this time, the number of converged training nodes in the memory unit is 2+1=3 (including w4, w5 and w6), which is consistent with the convergence meta-information {Agg: 1, Cnt: 3, Port: L6} of the first node in the node set in the gradient shard mark. The convergence should occur on the programmable switch node If the number of training nodes Cnt:3 of the cluster is the same, then S6 records the forwarding port number Port: L6 in the convergence meta-information {Agg: 1, Cnt: 3, Port: L6} of the first node in the node set in the gradient sharding mark, and then deletes the first node in the node set in the gradient sharding mark and its convergence meta-information [S6: {Agg: 1, Cnt: 3, Port: L6}] (the gradient sharding mark after deleting the first node and its convergence meta-information is [S7: {Agg: 0, Cnt: 0, Port: L5}, S5: {Agg: 1, Cnt: 5, Port: L1}, S1: {Agg: 1, Cnt: 6, Port: L7}]), writes the gradient convergence result in the corresponding memory unit into the gradient shard, and forwards the gradient shard carrying the gradient convergence result to the next hop node S7 in the network through the L6 link according to the recorded forwarding port number Port: L6. Other switches S1, S2, S5, and S7 in the data center network perform similar steps to S3, S6, and S4.

[0117] Step S4: Model aggregation server node processes gradient fragments

[0118] Step S4.1: The model aggregation server node performs gradient global aggregation to generate gradient global aggregation result fragments

[0119] When the gradient shards arrive at the model aggregation server node, the model aggregation server node performs global gradient aggregation. When the gradient shards corresponding to all training nodes are fully aggregated, the model aggregation server node generates N gradient global aggregation result shards. Each gradient global aggregation result shard carries the same gradient global aggregation result. N is equal to the number of training nodes in distributed model training.

[0120] Step S4.2: Model aggregation server node marks gradient global aggregation result shards

[0121] The model convergence server node sets the destination addresses of the N gradient global convergence result slices to the training nodes in sequence. After that, the model convergence server node marks the N gradient global convergence result slices respectively according to the programmable switch node set on the path through which the gradient global convergence result flow sent from the model convergence server node to each training node passes in the network multi-hop gradient convergence structure stored in the memory in step S1 and the convergence meta-information of each node in the node set, and sends them to the network, wherein each gradient global convergence result slice marks the programmable switch node set on the path through which the gradient global convergence result flow sent from the model convergence server node to a certain training node passes and the convergence meta-information of each node in the node set;

[0122] Figure 6 The distributed model training model of the present invention aggregates the server node gradient global aggregation result fragment data packet structure, such as Figure 6 As shown, the gradient global convergence result shard contains the traditional IP field, the newly added gradient global convergence result shard intra-network multi-hop gradient convergence structure field and the INA field. The function of the traditional IP field is the same as that of the traditional data packet in the data center; the newly added gradient global convergence result shard intra-network multi-hop gradient convergence structure field is used to mark the intra-network multi-hop gradient convergence structure generated in step S1. The model convergence server node follows the corresponding intra-network multi-hop gradient convergence structure stored in the memory in step S1. Figure 6 The newly added multi-hop gradient aggregation structure field of the gradient global aggregation result slice network is filled from left to right. The newly added multi-hop gradient aggregation structure field of the gradient global aggregation result slice network contains multiple {Agg, Port} field groups, each of which represents the aggregation meta-information of a certain programmable switch node on the path where the gradient global aggregation result slice passes in sequence. Agg represents whether the gradient slice has been aggregated on the programmable switch node, and Port represents the forwarding port number of the gradient global aggregation result slice on the programmable switch node. The function of the INA field is to guide the clearing of the model gradient of a specific memory unit. Specifically, the Ack in the INA field is 0, indicating that the data packet is a gradient slice sent from the training node to the model aggregation server node, otherwise it represents that the data packet is a gradient global aggregation result slice sent from the model aggregation server node to the training node. The SlotId in the INA field is used to identify a specific memory unit in the positioning programmable switch node. The programmable switch node determines on which specific memory unit part of the gradient aggregation result should be cleared according to this field, so as to facilitate the repeated application of the memory unit to perform new model gradient slice aggregation.

[0123] When the gradient shards arrive at the model aggregation server node, the model aggregation server node performs global gradient aggregation and generates N global gradient aggregation result shards. The model aggregation server node sets the destination addresses of the N global gradient aggregation result shards to the training nodes w1-w6 in sequence. After that, the intra-network multi-hop gradient aggregation structure corresponding to the global gradient aggregation result shards sent by the model aggregation server node to the training node w4 is {w4: [S1: {Agg: 1, Port: L1}, S5: {Agg: 1, Port: L5}, S7: {Agg: 0, Port: L6}, S6: {Agg: 1, Port: L3}, S3: {Agg: 1, Port: w4}]}, and the model aggregation server node marks the structure in sequence to the newly added intra-network multi-hop gradient aggregation structure field of the global gradient aggregation result shards in the data packet of the global gradient aggregation result shards. The marking method of the global gradient aggregation result shards from the model aggregation server node to the remaining training nodes w1, w2, w3, w5 and w6 is similar to that of w4. After the model aggregation server node marks the newly added gradient global aggregation result shard network multi-hop gradient aggregation structure field in the gradient global aggregation result shard, it sets the Ack in the INA field of the N gradient global aggregation result shards to 1, sets the SlotId field to the identifier of the specific memory unit of the programmable switch node where the gradient shards are aggregated, and finally sends the gradient global aggregation result shard to the network.

[0124] Step S5: The programmable switch node processes the global gradient aggregation result

[0125] Step S5.1: The programmable switch node determines whether there is a gradient shard convergence on it.

[0126] When the gradient global convergence result fragment arrives at a programmable switch node, it is determined whether a gradient fragment has been converged on the programmable switch node according to the convergence meta information of the first node in the node set in the gradient global convergence result fragment tag. If a gradient fragment has been converged on the programmable switch node, it means that the gradient convergence result in the specific memory unit corresponding to the gradient fragment needs to be cleared so that it can be reused to converge the gradient, and step S5.2 is executed, otherwise step S5.3 is executed;

[0127] Step S5.2: The programmable switch node clears the gradient aggregation result of a specific memory unit

[0128] If any gradient slices are aggregated on the programmable switch node, the programmable switch node clears the gradient aggregation result of the specific memory unit, and then executes step S5.3;

[0129] Step S5.3: Programmable switch node forwards gradient global aggregation result fragments

[0130] The programmable switch node records the forwarding outbound port number in the aggregation meta-information of the first node in the node set in the gradient global aggregation result fragmentation mark, then deletes the first node in the node set in the gradient global aggregation result fragmentation mark and its aggregation meta-information, and forwards the gradient global aggregation result fragment to the next hop node in the network according to the recorded forwarding outbound port number, and executes step S5.4;

[0131] Step S5.4: Is the next hop node in the network a training node?

[0132] If the next hop node is a training node, execute step S6; if the next hop node is a programmable switch node, repeat step S5;

[0133] Specifically, as shown in Figure 4(b), when the gradient global convergence result fragment sent by the model convergence server node to w4 passes through S1, S1 determines that there is a gradient fragment converged on the programmable switch node based on the convergence meta information {Agg: 1, Port: L1} of the first node in the node set in the gradient global convergence result fragment label [S1: {Agg: 1, Port: L1}, S5: {Agg: 1, Port: L5}, S7: {Agg: 0, Port: L6}, S6: {Agg: 1, Port: L3}, S3: {Agg: 1, Port: w4}]. At this time, S1 clears the gradient convergence result of the specific memory unit and records the gradient global convergence result. The forwarding port number Port: L1 in the aggregation meta-information {Agg: 1, Port: L1} of the first node in the node set in the shard mark is deleted, and then the first node in the node set in the gradient global aggregation result shard mark and its aggregation meta-information [S1: {Agg: 1, Port: L1}] are deleted (the gradient global aggregation result shard mark after deletion is [S5: {Agg: 1, Port: L5}, S7: {Agg: 0, Port: L6}, S6: {Agg: 1, Port: L3}, S3: {Agg: 1, Port: w4}]), and the gradient global aggregation result shard is forwarded to the next hop node S5 in the network through the L1 link according to the recorded forwarding port number Port: L1.

[0134] When the gradient global convergence result fragment sent by the model convergence server node to w6 passes through S4, S4 determines that no gradient fragment has been converged on the programmable switch node according to the convergence meta information {Agg: 0, Port: w6} of the first node in the node set in the gradient global convergence result fragment mark [S4: {Agg: 0, Port: w6}], and then S4 records the forwarding port number Port: w6 in the convergence meta information {Agg: 0, Port: w6} of the first node in the node set in the gradient global convergence result fragment mark, and then deletes the first node in the node set in the gradient global convergence result fragment mark and its convergence meta information [S4: {Agg: 0, Port: w6}] (the gradient global convergence result fragment mark after deletion is []), and forwards the gradient global convergence result fragment to the next hop node w6 in the network according to the recorded forwarding port number Port: w6. Other switches in the data center network perform steps similar to S1 and S4.

[0135] Step S6: The training node receives the global gradient aggregation result and updates the local model

[0136] When the gradient global aggregation result shard reaches the training node, the training node uses the gradient global aggregation result carried in the gradient global aggregation result shard to update the local model, so that the training node can use the updated local model to perform the next round of iterative training.

[0137] When the gradient global aggregation result shard reaches the training node w1-w6, w1-w6 uses the gradient global aggregation result carried in the gradient global aggregation result shard to update the local model and uses the updated local model to perform the next round of distributed model training.

[0138] In order to further verify the effect of the intra-network multi-hop gradient convergence method provided by the present invention, a simulation evaluation of the method proposed by the present invention was carried out. The evaluation results show that compared with the current optimal method, the present invention reduces the gradient communication time of each round of iterative training model by 40%-87%, accelerates model training, reduces the network communication load overhead by 37%-66%, and reduces the flow of gradient communication within the network.

[0139] Although the above describes the illustrative specific embodiments of the present invention to facilitate those skilled in the art to understand the present invention, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations using the concept of the present invention are protected.

Claims

1. An in-network multi-hop gradient convergence method for distributed model training, wherein the distributed model training comprises a controller, at least one local training node, at least one programmable switch node and at least one model convergence server node, characterized in that: The following steps are involved: Step S1: The controller calculates the multi-hop gradient convergence structure in the network according to the network status The controller calculates the in-network multi-hop gradient convergence structure corresponding to the distributed model training according to the collected network resource status, and sends the convergence structure to the model convergence server node and each training node. The in-network multi-hop gradient convergence structure includes the following two aspects: In the first aspect, a set of programmable switch nodes on the path through which the gradient flow sent from each training node to the model aggregation server node passes in a distributed model training system, and aggregation meta-information of each node in the node set, wherein the set of programmable switch nodes on the path through which the gradient flow sent from any training node to the model aggregation server node passes and the aggregation meta-information of each node in the node set are sorted in the order of the nodes passed on the gradient flow path from the training node to the model aggregation server node; the aggregation meta-information of each node in the set of programmable switch nodes on the path through which the gradient flow sent from any training node to the model aggregation server node passes includes whether the gradient flow should be aggregated on the node, the number of training nodes that should be aggregated on the node, and the egress port number of the gradient flow forwarded on the node; In the second aspect, a set of programmable switch nodes on the path through which the global convergence result flow of the gradient sent from the model convergence server node to each training node in the distributed model training system passes, and convergence meta-information of each node in the node set, wherein the set of programmable switch nodes on the path through which the global convergence result flow of the gradient sent from the model convergence server node to any training node passes, and the convergence meta-information of each node in the node set are sorted in the order of the nodes passed on the path of the global convergence result flow of the gradient from the model convergence server node to the training node; the convergence meta-information of each node in the set of programmable switch nodes on the path through which the global convergence result flow of the gradient sent from the model convergence server node to any training node passes includes whether the gradient flow has converged on the node and the egress port number of the global convergence result flow of the gradient forwarded on the node; In the intra-network multi-hop gradient convergence structure in step S1, the set of programmable switch nodes on the path through which the gradient flow from any training node to the model convergence server node passes is completely consistent with the nodes included in the set of programmable switch nodes on the path through which the gradient global convergence result flow from the model convergence server node to the training node passes, and the order of the nodes in the node set is opposite; In step S1, after each training node and the model aggregation server node receive the intra-network multi-hop gradient aggregation structure sent by the controller, each training node and the model aggregation server node save the intra-network multi-hop gradient aggregation structure in the memory; Step S2: Each training node marks the gradient fragment according to the corresponding multi-hop gradient aggregation structure in the network According to the set of programmable switch nodes on the path through which the gradient flow sent by each training node to the model aggregation server node in the multi-hop gradient aggregation structure in the network issued by the controller passes, and the aggregation meta information of each node in the node set, each training node marks the trained gradient slices, and sets the destination address of the gradient slices to the model aggregation server node, and then each training node sends the gradient slices to the network; Step S3: Programmable switch node processes gradient sharding Step S3.1: The programmable switch node determines whether the gradient shards should be converged. When a gradient shard reaches a programmable switch node, determine whether the gradient shard should be converged on the programmable switch node according to the convergence meta information of the first node in the node set in the gradient shard tag. If it should not be converged, execute step S3.2; otherwise, execute step S3.

3. Step S3.2: The programmable switch node forwards the gradient slices that should not be aggregated If the gradient shard should not be aggregated on the programmable switch node, the programmable switch node records the forwarding outbound port number in the aggregation meta-information of the first node in the node set in the gradient shard tag, then deletes the first node in the node set in the gradient shard tag and its aggregation meta-information, and forwards the gradient shard to the next hop node in the network according to the recorded forwarding outbound port number, and executes step S3.6; Step S3.3: The programmable switch node aggregates the gradient shards that should be aggregated If the gradient slice should be aggregated on the programmable switch node, the programmable switch node allocates the gradient slice to a specific memory unit for aggregation, increases the number of aggregated training nodes recorded in the memory unit by 1, and executes step S3.4; Step S3.4: The programmable switch node determines whether the gradient sharding has completed convergence When the gradient sharding is converged, the programmable switch node compares the number of converged training nodes in the corresponding memory unit with the number of training nodes that should be converged on the programmable switch node in the convergence meta information of the first node in the node set in the gradient sharding tag. If the two are equal, it means that the programmable switch has completed the convergence of the corresponding gradient fragments of the training nodes on which convergence should occur, and then execute step S3.

5. If the two are not equal, execute step S3.

7. Step S3.5: The programmable switch node forwards the gradient sharding aggregation result The programmable switch node records the forwarding outbound port number in the aggregation meta-information of the first node in the node set in the gradient sharding mark, then deletes the first node in the node set in the gradient sharding mark and its aggregation meta-information, writes the gradient aggregation result in the corresponding memory unit into the gradient sharding, and forwards the gradient sharding carrying the gradient aggregation result to the next hop node in the network according to the recorded forwarding outbound port number, and then enters step S3.6; Step S3.6: Is the next hop node in the network a programmable switch node? If the next hop node is a programmable switch node, repeat step S3; if the next hop node is a model aggregation server node, execute step S4; Step S3.7, the programmable switch node discards the gradient slice; Step S4: Model aggregation server node processes gradient fragments Step S4.1: The model aggregation server node performs gradient global aggregation to generate gradient global aggregation result fragments When the gradient shards arrive at the model aggregation server node, the model aggregation server node performs global gradient aggregation. When the gradient shards corresponding to all training nodes are fully aggregated, the model aggregation server node generates N gradient global aggregation result shards. Each gradient global aggregation result shard carries the same gradient global aggregation result. N is equal to the number of training nodes in distributed model training. Step S4.2: Model aggregation server node marks gradient global aggregation result shards The model convergence server node sets the destination addresses of the N gradient global convergence result slices to the training nodes in sequence. After that, the model convergence server node marks the N gradient global convergence result slices respectively according to the programmable switch node set on the path through which the gradient global convergence result flow sent from the model convergence server node to each training node passes in the network multi-hop gradient convergence structure stored in the memory in step S1 and the convergence meta-information of each node in the node set, and sends them to the network, wherein each gradient global convergence result slice marks the programmable switch node set on the path through which the gradient global convergence result flow sent from the model convergence server node to a certain training node passes and the convergence meta-information of each node in the node set; Step S5: The programmable switch node processes the global gradient aggregation result Step S5.1: The programmable switch node determines whether there is a gradient shard convergence on it. When the gradient global convergence result fragment arrives at a programmable switch node, it is determined whether a gradient fragment has been converged on the programmable switch node according to the convergence meta information of the first node in the node set in the gradient global convergence result fragment tag. If a gradient fragment has been converged on the programmable switch node, it means that the gradient convergence result in the specific memory unit corresponding to the gradient fragment needs to be cleared so that it can be reused to converge the gradient, and step S5.2 is executed, otherwise step S5.3 is executed; Step S5.2: The programmable switch node clears the gradient aggregation result of a specific memory unit If any gradient slices are aggregated on the programmable switch node, the programmable switch node clears the gradient aggregation result of the specific memory unit, and then executes step S5.3; Step S5.3: Programmable switch node forwards gradient global aggregation result fragments The programmable switch node records the forwarding outbound port number in the aggregation meta-information of the first node in the node set in the gradient global aggregation result fragmentation mark, then deletes the first node in the node set in the gradient global aggregation result fragmentation mark and its aggregation meta-information, and forwards the gradient global aggregation result fragment to the next hop node in the network according to the recorded forwarding outbound port number, and executes step S5.4; Step S5.4: Is the next hop node in the network a training node? If the next hop node is a training node, execute step S6; if the next hop node is a programmable switch node, repeat step S5; Step S6: The training node receives the global gradient aggregation result and updates the local model When the gradient global aggregation result shard reaches the training node, the training node uses the gradient global aggregation result carried in the gradient global aggregation result shard to update the local model, so that the training node can use the updated local model to perform the next round of iterative training.

Citation Information

Patent Citations

  • Method and device for accelerating distributed machine learning gradient convergence

    CN112862111A

  • Distributed machine learning gradient convergence method and device and model training method

    CN115062771A

  • Robust convergence deployment model and method for distributed machine learning

    CN117592585A

  • Link aggregation system, method, apparatus and device, and medium

    WO2019007109A1

Cited By

  • Distributed model training on-network convergence method based on programmable switch

    CN120956688A

  • Model training acceleration method and system based on in-network gradient data annular full reduction

    CN121660028A