Model parameter fusion method and apparatus
11373116 · 2022-06-28
Assignee
Inventors
Cpc classification
G06F16/00
PHYSICS
G06F17/18
PHYSICS
International classification
Abstract
Embodiments of the present invention provide a model parameter fusion method and apparatus, which relate to the field of machine learning and intend to reduce a data transmission amount and implement dynamical adjustment of computing resources during model parameter fusion. The method includes: dividing, by an i.sup.th node, a model parameter of the i.sup.th node into N blocks, where the i.sup.th node is any node of N nodes that participate in a fusion, and 1≤i≤N≤M; receiving, by the i.sup.th node, i.sup.th model parameter blocks respectively sent by other nodes of the N nodes than the i.sup.th node; fusing, by the i.sup.th node, an i.sup.th model parameter block of the i.sup.th node and the i.sup.th model parameter blocks respectively sent by the other nodes, so as to obtain the i.sup.th general model parameter block; and distributing, by the i.sup.th node, the i.sup.th general model parameter block to the other nodes of the N nodes.
Claims
1. A method for fusing model parameters by a machine learning system including M nodes, the method comprising: receiving, by an i.sup.th node, fusion indication information from a fusion controller; dividing, by the i.sup.th node, a model parameter of the i.sup.th node into N blocks according to the fusion indication information, wherein the i.sup.th node is one of N nodes that participate in a fusion and that are of the M nodes, wherein 1≤i≤N≤M, and wherein an i.sup.th block of the N blocks resulting from the division of the model parameter is an i.sup.th model parameter block of the i.sup.th node; receiving, by the i.sup.th node, i.sup.th model parameter blocks respectively sent by nodes of the N nodes other than the i.sup.th node; fusing, by the i.sup.th node, the i.sup.th model parameter block of the i.sup.th node and the i.sup.th model parameter blocks respectively sent by the other nodes, so as to obtain an i.sup.th general model parameter block; and distributing, by the i.sup.th node, the i.sup.th general model parameter block to the other nodes of the N nodes than the i.sup.th node.
2. The method according to claim 1, wherein the fusion indication information is received after the N nodes that meet a fusion condition, which are determined according to a received address and received fusion state information of a k.sup.th node, wherein the fusion indication information comprises addresses and/or numbers of the N nodes, wherein the k.sup.th node is a node that has completed a specified iteration task and that is of the M nodes, wherein 1≤k≤M, and wherein the fusion state information comprises a computation state and/or a quantity of iterations of the node.
3. The method according to claim 2, further comprising: upon the fusion controller being a first node among T nodes of the M nodes, and T≤M, receiving, by the k.sup.th node, an address of the first node sent by the first node and sending, by the k.sup.th node according to the address of the first node, the address and the fusion state information of the k.sup.th node to the first node.
4. The method according to claim 2, further comprising: before dividing the model parameter of the i.sup.th node into N blocks, broadcasting, by a k.sup.th node, an address and fusion state information of the k.sup.th node to each node of the M nodes; and receiving, by the k.sup.th node, fusion indication information sent by a second node, wherein the second node is one of the M nodes, wherein the fusion indication information is sent by the second node after the N nodes that meet a fusion condition are determined according to the received address and fusion state information of the k.sup.th node, and wherein the fusion indication information comprises addresses and/or numbers of the N nodes.
5. The method according to claim 1, further comprising: sending, by the ith node, a j.sup.th model parameter block of the i.sup.th node to a j.sup.th node of the N nodes, wherein 1≤j≤N and j≠i.
6. The method according to claim 5, wherein the method further comprises: receiving, by the i.sup.th node, the j.sup.th model parameter block that results from a fusion by the j.sup.th node and that is sent by the j.sup.th node; consolidating, by the i.sup.th node, associated parts of all received general model parameters that result from fusions by the other nodes of the N nodes and that are received from the other nodes, so as to generate a new general model parameter of the i.sup.th node; and performing, by the i.sup.th node, an iterative computation according to the new general model parameter.
7. A model parameter fusion apparatus, applied to a machine learning system, wherein the machine learning system comprises M model parameter fusion apparatuses and the apparatus comprises: at least one processor; and a non-transitory computer-readable storage medium coupled to the at least one processor and storing programming instructions for execution by the at least one processor, wherein the programming instructions instruct the at least one processor to: receiving fusion indication information from a fusion controller; divide a model parameter of the model parameter fusion apparatus into N blocks according to the fusion indication information, wherein N is a quantity of model parameter fusion apparatuses that participate in a fusion and that are of the M model parameter fusion apparatuses, and wherein an i.sup.th block of the N blocks resulting from the division of the model parameter is an i.sup.th model parameter block, and 1≤i≤N≤M; receive i.sup.th model parameter blocks respectively sent by model parameter fusion apparatuses of the N model parameter fusion apparatuses other than the model parameter fusion apparatus; fuse the i.sup.th model parameter block of the model parameter fusion apparatus and the i.sup.th model parameter blocks respectively sent by the other model parameter fusion apparatuses, so as to obtain an i.sup.th general model parameter block; and distribute the i.sup.th general model parameter block to the other model parameter fusion apparatuses of the N model parameter fusion apparatuses than the model parameter fusion apparatus.
8. The apparatus according to claim 7, wherein after a specified iteration task is completed, the programming instructions further instruct the at least one processor to: send an address and fusion state information of the model parameter fusion apparatus to a fusion controller, wherein the fusion state information comprises a computation state and/or a quantity of iterations of the model parameter fusion apparatus, wherein the fusion indication information is sent by the fusion controller after the N model parameter fusion apparatuses that meet a fusion condition are determined according to received addresses and fusion state information of K model parameter fusion apparatuses, wherein the fusion indication information comprises addresses and/or numbers of the N model parameter fusion apparatuses, and wherein the K model parameter fusion apparatuses are model parameter fusion apparatuses that have completed the specified iteration task and that are of the M model parameter fusion apparatuses, and 1≤K≤M.
9. The apparatus according to claim 8, wherein the fusion controller is a first model parameter fusion apparatus, the first model parameter fusion apparatus is one among T model parameter fusion apparatuses of the M model parameter fusion apparatuses, and T≤M and the programming instructions further instruct the at least one processor to: receive an address of the first model parameter fusion apparatus sent by the first model parameter fusion apparatus; and send the address and the fusion state information of the model parameter fusion apparatus to the first model parameter fusion apparatus according to the address of the first model parameter fusion apparatus.
10. The apparatus according to claim 7, the programming instructions further instruct the at least one processor to: broadcast the address and the fusion state information of the model parameter fusion apparatus to each model parameter fusion apparatus of the M model parameter fusion apparatuses; and receive fusion indication information sent by a second model parameter fusion apparatus, wherein the second model parameter fusion apparatus is one of K model parameter fusion apparatuses of the M model parameter fusion apparatuses, wherein the fusion indication information is sent by the second model parameter fusion apparatus after the N model parameter fusion apparatuses that meet a fusion condition are determined according to received addresses and fusion state information of the K model parameter fusion apparatuses, wherein the fusion indication information comprises addresses and/or numbers of the N model parameter fusion apparatuses, and wherein the K model parameter fusion apparatuses are model parameter fusion apparatuses that have completed a specified iteration task and that are of the M model parameter fusion apparatuses, and 1≤K≤M.
11. The apparatus according to claim 7, the programming instructions further instruct the at least one processor to: receive addresses and fusion state information of K model parameter fusion apparatuses, wherein the fusion state information comprises a computation state and/or a quantity of iterations of a model parameter fusion apparatus, wherein the K model parameter fusion apparatuses are model parameter fusion apparatuses that have completed a specified iteration task and that are of the M model parameter fusion apparatuses, and 1≤K≤M; determine, according to the received addresses and fusion state information of the K model parameter fusion apparatuses, the N model parameter fusion apparatuses that meet a fusion condition; and send fusion indication information to the other model parameter fusion apparatuses of the N model parameter fusion apparatuses than the model parameter fusion apparatus, so that the other model parameter fusion apparatuses of the N model parameter fusion apparatuses perform a parameter fusion according to the fusion indication information, wherein the fusion indication information comprises addresses and/or numbers of the N model parameter fusion apparatuses.
12. The apparatus according to claim 11, the programming instructions further instruct the at least one processor to: send an address of the model parameter fusion apparatus to other model parameter fusion apparatuses of the M model parameter fusion apparatuses than the model parameter fusion apparatus, so that the other model parameter fusion apparatuses of the M model parameter fusion apparatuses send, according to the received address, addresses and fusion state information of the other model parameter fusion apparatuses.
13. The apparatus according to claim 7, the programming instructions further instruct the at least one processor to: send a j.sup.th model parameter block of the model parameter fusion apparatus to a j.sup.th model parameter fusion apparatus of the N model parameter fusion apparatuses, wherein 1≤j≤N and j≠i.
14. The apparatus according to claim 13, the programming instructions further instruct the at least one processor to: receive the j.sup.th model parameter block that results from a fusion by the j.sup.th model parameter fusion apparatus and that is sent by the j.sup.th model parameter fusion apparatus; consolidate general model parameters sent by the other model parameter fusion apparatuses, so as to generate a new general model parameter; and perform an iterative computation according to the new general model parameter.
15. A node comprising a processor and a memory, the memory storing executable code and data, the processor configured to execute the code and thereby provide the model parameter fusion method according to claim 1.
Description
BRIEF DESCRIPTION OF DRAWINGS
(1) To describe the technical solutions in the embodiments of the present invention more clearly, the following briefly describes the accompanying drawings required for describing the embodiments or the prior art. Apparently, the accompanying drawings in the following description show merely some embodiments of the present invention, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
(11)
(12)
(13)
(14)
(15)
(16)
(17)
DESCRIPTION OF EMBODIMENTS
(18) The following clearly and completely describes the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are merely some but not all of the embodiments of the present invention. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
Embodiment 1
(19) A machine learning system architecture applied in an embodiment of the present invention is shown in
(20) The data storage device 101 may be a data storage server 101, and the data storage server 101 may be configured to store source data used for model parameter training. A storage capacity of the data storage server 101 is far greater than a storage capacity of a computation server 1021 on the model training platform 102. The source data may be language data, image data, video data, or the like. The source data includes multiple data sets, each data set further includes multiple type subsets, and each type subset has a data tag used to indicate a category. Tags of type subsets included in a same data set are the same; for example, the data set may include multiple character images having a character tag, or may include multiple animal images having an animal tag, or another category of images.
(21) The model parameter training platform 102 includes: the computation server 1021 configured to perform an iterative computation, where the computation server 1021 may also be referred to as a node, which may be specifically a common computer, a mobile terminal, a workstation, a general-purpose server, a special-purpose server, or the like; and a switch 1022 configured to be responsible for data communication between computation servers. The computation server 1021 has a local storage device, and a capacity of the storage device is less than that of the data storage server 101. During model training, each computation server reads, in a sampling manner, specific data from the data storage server 101 to a local storage device for model parameter training. The model parameter training platform 102 may obtain, by performing model parameter training and a model parameter training fusion on a data set having a data tag, a finally outputted general model parameter obtained by means of fusion; and a data type of new data may be identified according to the general model parameter. For example, when an image data set having a character tag is used to perform a model parameter fusion, a character image in new image data may be identified according to a finally outputted model parameter; when an image data set having an animal tag is used to perform a model parameter fusion, an animal image in new image data may be identified according to a finally outputted model parameter.
(22) The model parameter storage server 103 is configured to store a model parameter obtained by means of training. When completing the training and fusion, the model parameter training platform 102 may send a final model parameter obtained by means of fusion to the model parameter storage server 103, so that the model parameter is stored in the model parameter storage server 103 for later use. In addition, a model parameter that is initially used by the computation server 1021 in the model parameter training platform 102 to perform the model parameter training and the model parameter fusion may also be obtained from the model parameter storage server 103.
Embodiment 2
(23)
(24) Step 201: A node used to perform a model parameter fusion obtains a data subset in a data set.
(25) The data set refers to a data set used to perform a model parameter iterative computation. The data set may be language data, image data, video data, or the like. The data set includes multiple type subsets, and each type subset has a data tag used to indicate a category. Tags of type subsets included in a same data set are the same.
(26) In addition, the data set may be stored in advance in a storage device such as a hard disk or a disk, or may be stored in advance in a data storage server. When the node obtains a data subset from the data set, the storage device may, for example, be directly connected to a device in which the node is located to obtain the data subset, or may obtain data from the data storage server.
(27) It should be noted that a data set for performing the model parameter fusion is far greater than an amount of data used by an actual model parameter; therefore, when the node obtains a data subset in the data set, the node may extract a specific amount of data from the data set; if a computation capability of each node is known in advance, an amount of data of a data subset to be obtained by the node may be allocated according to the computation capability of the node.
(28) Step 202: Each node performs a specified iterative computation based on the data subset and a current model parameter.
(29) When performing the model parameter iterative computation for the first time, each node may perform the iterative computation based on an obtained data subset and an initial model parameter; when completing the iterative computation, each node may perform next iterative computation based on the data subset and a currently obtained model parameter.
(30) The initial model parameter indicates an initialized model parameter of each node, and initial model parameters of all nodes may be the same. The currently obtained model parameter indicates a model parameter obtained by performing a current iterative computation by each node, or a currently received model parameter, that is, a currently newest model parameter.
(31) Step 203: A k.sup.th node sends an address and fusion state information of the k.sup.th node to a fusion controller, where the fusion state information includes a computation state and/or a quantity of iterations of the node, the k.sup.th node is a node that has completed a specified iteration task and that is of M nodes, and 1≤k≤M.
(32) The M nodes included in the machine learning system separately perform the specified iterative computation based on an obtained data subset and model parameter. When any node of the M nodes completes the specified computation, the node sends an address and fusion state information of the node to the fusion controller.
(33) The fusion state information includes a computation state and/or a quantity of iterations of the node, that is, when sending the fusion state information to the fusion controller, the k.sup.th node may send a current computation state, or send a current quantity of completed iterations, or send both the current computation state and the current quantity of iterations to the fusion controller. The computation state herein indicates whether the specified iterative computation is completed.
(34) In addition, the address of the k.sup.th node may be an IP address of the node, a MAC (Media Access Control, Media Access Control, which is also referred to as a physical address) address, a number of the node, or the like. This is not limited in this embodiment of the present invention.
(35) Step 204: The fusion controller receives an address and fusion state information of a node that has completed the specified computation and that is of the M nodes, determines N nodes that meet a fusion condition, and sends fusion indication information to each node of the N nodes, where the fusion indication information is sent by the fusion controller after the N nodes that meet the fusion condition are determined according to the received address and fusion state information of the k.sup.th node, and the fusion indication information includes addresses and/or numbers of the N nodes.
(36) Quantities of N nodes that are determined by the fusion controller at different times and that meet the fusion condition are the same or different. In addition, the fusion indication information includes the addresses and/or the numbers of the N nodes.
(37) It should be noted that N nodes that participate in a fusion are determined from the M nodes according to a preset fusion condition. The fusion condition may be that a quantity of nodes that have completed an iterative computation reaches a preset value, and during each fusion, the preset value may be a constant, or may be variable; or the fusion condition is that a quantity of times that the specified computation is completed reaches a preset quantity of times, and during each fusion, the preset quantity of times may be a constant, or may be variable; or the fusion condition is that an iterative computation has been performed for a preset duration, and during each fusion, the preset duration may be a constant, or may be variable. Certainly, the fusion condition may also be another condition, or the like. This is not limited in detail in the present invention.
(38) In addition, if N nodes have completed the fusion, when the fusion controller determines another N nodes, the fusion controller may determine the nodes that have completed the fusion, and N nodes of nodes that have not completed the fusion and have completed the specified computation.
(39) Further, a fixed node may serve as the fusion controller, or different nodes may alternately serve as the fusion controller, or at least one node may serve as the fusion controller in a distributed manner. Specifically, the three different types of fusion controllers are described below.
(40) A first type: A fixed node serves as the fusion controller. The fixed node may be set in advance, and after completing the specified computation, any node of the M nodes may send an address and fusion state information of the node to the fixed fusion controller; the fixed fusion controller determines, based on the received address and fusion state information, N nodes that meet the fusion condition, and sends fusion indication information to each node of the N nodes.
(41) A second type: Different nodes alternately serve as the fusion controller. A node that first serves as the fusion controller may be referred to as a first node, and the first node is any node of T nodes of the M nodes, where T≤M.
(42) Different nodes alternately serve as the fusion controller. To enable the M nodes to send addresses and fusion state information to the current fusion controller after completing the specified computation, before a k.sup.th node sends an address and fusion state information of the k.sup.th node to a fusion controller in step 203, the k.sup.th node receives an address of the first node sent by the first node, that is, a node that currently serves as the fusion controller sends an address of the node to the M nodes.
(43) Correspondingly, that a k.sup.th node sends an address and fusion state information of the k.sup.th node to a fusion controller includes: sending, by the k.sup.th node according to the address of the first node, the address and the fusion state information of the k.sup.th node to the first node.
(44) Then, the first node, which is used as a fusion controller in a first time period, receives an address and fusion state information sent by a node that has completed the specified iterative computation; the first node determines, based on the received address and fusion state information, N nodes that meet the fusion condition, and sends fusion indication information to each node of the N nodes.
(45) After a preset condition is met, the first node determines a second node as a fusion controller in a second time period, where the second node is any node of K nodes of the M nodes. The first node sends node fusion information to the second node, where the node fusion information includes the addresses and the fusion state information of the M nodes. The first node sends an address of the second node to other nodes than the second node.
(46) That is, after meeting the preset condition, the first node may specify any node of the K nodes of the M nodes as a node that serves as next fusion controller, and the specified node is used as the second node and serves as the fusion controller in the second time period. In addition, the first node sends node fusion information of the M nodes to the next fusion controller, and sends an address of the next fusion controller to other nodes. Likewise, the node that serves as the next fusion controller may specify a node to serve as an after-next fusion controller, and so on.
(47) If the second node is faulty in the second time period, the first node may determine a third node as the parameter fusion controller in the second time period, where the third node is any node of the K nodes of the M nodes.
(48) That is, when the second node is faulty and cannot be used as the fusion controller, the first node that serves as a previous fusion controller redetermines any node of the K nodes of the M nodes as the fusion controller in the second time period, and the redetermined node may be referred to as the third node.
(49) It should be noted that the preset condition may be that a specific time passes, or a specific quantity of fusions passes, or a specific quantity of iterations passes, or the like. This is not limited in this embodiment of the present invention.
(50) In addition, the specific time, the specific quantity of fusions, and the specific quantity of iterations may be set in advance, and time lengths, and quantities of fusions, and quantities of iterations that are set at different times may be constant, or may be variable. This is not limited in this embodiment of the present invention.
(51) A third type: At least one node serves as the fusion controller in a distributed manner, and the at least one node may be all or some of the M nodes.
(52) When any node of the M nodes completes the specified computation, the k.sup.th node broadcasts the address and the fusion state information of the k.sup.th node to each node of the M nodes, and at least one node of the M nodes receives the address and the fusion state information sent by the k.sup.th node after the k.sup.th node completes the specified computation. The k.sup.th node is any node that has completed the specified computation and that is of the M nodes.
(53) That is, when one or more nodes of the M nodes all record node fusion information of the M nodes, after completing the fusion, each node sends an address and fusion state information of the node, for example, a computation state and/or a quantity of iterations of the node, to at least one node that records the node fusion information and that is of the M nodes.
(54) Then, any node of the at least one node determines, according to the received address and fusion state information of the k.sup.th node, N nodes that meet the fusion condition, and sends fusion indication information to each node of the N nodes. Each node receives the fusion indication information sent by any node of the at least one node, where the fusion indication information is sent after the N nodes that meet the fusion condition are determined, and the fusion indication information includes addresses and/or numbers of the N nodes.
(55) It should be noted that a number of a node is used to uniquely indicate the node, and the number of the node may be a sequence number randomly allocated to the node, or may be any value randomly allocated to the node, or the like. This is not limited in this embodiment of the present invention.
(56) Step 205: When receiving the fusion indication information, an i.sup.th node divides a model parameter of the i.sup.th node into N blocks, and receives i.sup.th model parameter blocks respectively sent by other nodes of the N nodes than the i.sup.th node, where the i.sup.th node is any node of the N nodes that participate in a fusion and that are of the M nodes, 1≤i≤N≤M, and an i.sup.th block of the N blocks resulting from the division of the model parameter is an i.sup.th model parameter block. The i.sup.th model parameter block herein refers to a model parameter block that corresponds to the i.sup.th node and that is of the N model parameter blocks resulting from the division, and the i.sup.th node is responsible for performing a subsequent fusion operation on the i.sup.th model parameter block.
(57) For example, as shown in
(58) When the i.sup.th node receives the i.sup.th model parameter blocks respectively sent by the other nodes of the N nodes than the i.sup.th node, and distributes the i.sup.th general model parameter block to the other nodes of the N nodes, a full-duplex data transmission manner may be used, that is, when sending data to another node, the i.sup.th node may simultaneously receive data sent by the another node; for example, the i.sup.th node uses a full-duplex network interface card. This is not limited in the present invention.
(59) Step 206: The i.sup.th node sends a j.sup.th model parameter block of the i.sup.th node to a j.sup.th node of the N nodes, where 1≤j≤N and j≠i.
(60) That is, the i.sup.th node sends, to the other nodes of the N nodes, other model parameter blocks of the divided model parameter than the i.sup.th block; that is, the j.sup.th model parameter blocks are sent to the j.sup.th node, and the j.sup.th node is responsible for fusing the j.sup.th model parameter blocks. The j.sup.th model parameter block herein is a model parameter that corresponds to the j.sup.th node and that is of the N model parameter blocks resulting from the division, and the j.sup.th node is responsible for performing a subsequent fusion operation.
(61) Step 207: The i.sup.th node fuses the i.sup.th model parameter block of the i.sup.th node and the i.sup.th model parameter blocks respectively sent by the other nodes, so as to obtain the i.sup.th general model parameter block, and distributes the i.sup.th general model parameter block to the other nodes of the N nodes.
(62) For example, as shown in
(63) Step 208: The i.sup.th node receives the j.sup.th general model parameter block that results from a fusion by the j.sup.th node and that is sent by the j.sup.th node, and consolidates corresponding parts of all received general model parameters that result from fusions by the other nodes of the N nodes than the i.sup.th node and that are sent by the other nodes, so as to generate a new general model parameter of the i.sup.th node.
(64) When the j.sup.th node of the N nodes that participate in the fusion obtains by means of fusion, the j.sup.th general model parameter block, the j.sup.th node sends the j.sup.th general model parameter block to the i.sup.th node, and the i.sup.th node receives the j.sup.th general model parameter block fused by the j.sup.th node, where 1≤j≤N and j≠i.
(65) Then, the i.sup.th node consolidates the received general model parameters that result from fusions by the other nodes of the N nodes than the i.sup.th node and that are sent by the other nodes and the i.sup.th general model parameter block obtained by means of fusion by the i.sup.th node, so as to obtain a new general model parameter fused by the N nodes.
(66) Further, after the i.sup.th node obtains the new general model parameter fused by the N nodes, the i.sup.th node may return to step 202 to perform the iterative computation based on the data subset and the new general model parameter fused by the N nodes until a final model parameter is outputted.
(67) According to the model parameter fusion method provided in this embodiment of the present invention, a fusion controller determines N nodes that meet a fusion condition; an i.sup.th node divides a model parameter of the i.sup.th node into N blocks, receives i.sup.th model parameter blocks respectively sent by other nodes of the N nodes than the i.sup.th node, then fuses an i.sup.th model parameter block of the i.sup.th node and the i.sup.th model parameter blocks respectively sent by the other nodes, so as to obtain the i.sup.th general model parameter block, and finally distributes the i.sup.th general model parameter block to the other nodes of the N nodes, where the i.sup.th node is any node of the N nodes that participate in a fusion. Therefore, computing resources can be dynamically adjusted, capabilities of dynamically deleting and adding a node are provided, and in addition, each node that participates in the fusion may simultaneously send a model parameter and receive a model parameter, which improves network resource utilization and system stability.
Embodiment 3
(68)
(69) a division unit 301, configured to divide a model parameter of the model parameter fusion apparatus into N blocks, where N is a quantity of model parameter fusion apparatuses that participate in a fusion and that are of the M model parameter fusion apparatuses, an i.sup.th block of the N blocks resulting from the division of the model parameter is an i.sup.th model parameter block, and 1≤i≤N≤M, where the i.sup.th model parameter block herein refers to a model parameter block that corresponds to an i.sup.th model parameter fusion apparatus and that is of the N model parameter blocks resulting from the division, and the i.sup.th model parameter fusion apparatus is responsible for performing a subsequent fusion operation on the i.sup.th model parameter block;
(70) a first receiving unit 302, configured to receive i.sup.th model parameter blocks respectively sent by other model parameter fusion apparatuses of the N model parameter fusion apparatuses than the model parameter fusion apparatus;
(71) a fusion unit 303, configured to fuse the i.sup.th model parameter block of the model parameter fusion apparatus and the i.sup.th model parameter blocks respectively sent by the other model parameter fusion apparatuses, so as to obtain the i.sup.th general model parameter block; and
(72) a first sending unit 304, configured to distribute the i.sup.th general model parameter block to the other model parameter fusion apparatuses of the N model parameter fusion apparatuses than the model parameter fusion apparatus.
(73) When the i.sup.th model parameter blocks respectively sent by the other model parameter fusion apparatuses of the N model parameter fusion apparatuses than the model parameter fusion apparatus are received, and the i.sup.th general model parameter block is distributed to the other model parameter fusion apparatuses of the N model parameter fusion apparatuses, a full-duplex data transmission manner may be used, that is, when data is sent to another model parameter fusion apparatus, data sent by the another model parameter fusion apparatus may be simultaneously received; for example, a full-duplex network interface card is used. This is not limited in this embodiment of the present invention.
(74) In addition, the N model parameter fusion apparatuses that participate in the fusion are determined from the M model parameter fusion apparatuses according to a preset fusion condition. The fusion condition may be that a quantity of nodes that have completed an iterative computation reaches a preset value, and during each fusion, the preset value may be a constant, or may be variable; or the fusion condition is that a quantity of times that a specified computation is completed reaches a preset quantity of times, and during each fusion, the preset quantity of times may be a constant, or may be variable; or the fusion condition is that an iterative computation has been performed for a preset duration, and during each fusion, the preset duration may be a constant, or may be variable. Certainly, the fusion condition may also be another condition, or the like. This is not limited in detail in this embodiment of the present invention.
(75) Optionally, as shown in
(76) a second sending unit 305, configured to: after a specified iteration task is completed, send an address and fusion state information of the model parameter fusion apparatus to a fusion controller, where the fusion state information includes a computation state and/or a quantity of iterations of the model parameter fusion apparatus; and
(77) a second receiving unit 306, configured to receive fusion indication information, where the fusion indication information is sent by the fusion controller after the N model parameter fusion apparatuses that meet a fusion condition are determined according to received addresses and fusion state information of K model parameter fusion apparatuses, the fusion indication information includes addresses and/or numbers of the N model parameter fusion apparatuses, the K model parameter fusion apparatuses are model parameter fusion apparatuses that have completed the specified iteration task and that are of the M model parameter fusion apparatuses, and 1≤K≤M.
(78) Optionally, as shown in
(79) a third receiving unit 307, configured to receive an address of the first model parameter fusion apparatus sent by the first model parameter fusion apparatus; and
(80) correspondingly, the second sending unit 305 is specifically configured to:
(81) send the address and the fusion state information of the model parameter fusion apparatus to the first model parameter fusion apparatus according to the address of the first model parameter fusion apparatus.
(82) It should be noted that when the model parameter fusion apparatus is a first model parameter fusion apparatus, the first model parameter fusion apparatus may be any model parameter fusion apparatus of the K model parameter fusion apparatuses of the M model parameter fusion apparatuses, and the K model parameter fusion apparatuses of the M model parameter fusion apparatuses may alternately serve as the first model parameter fusion apparatus; that is, the first model parameter fusion apparatus may specify any model parameter fusion apparatus of the K model parameter fusion apparatuses of the M model parameter fusion apparatuses to serve as next model parameter fusion apparatus, and the next model parameter fusion apparatus may specify an after-next model parameter fusion apparatus, and so on.
(83) Optionally, as shown in
(84) a broadcast unit 308, configured to broadcast the address and the fusion state information of the model parameter fusion apparatus to each model parameter fusion apparatus of the M model parameter fusion apparatuses, which means that each model parameter fusion apparatus of the M model parameter fusion apparatuses may simultaneously record an address and fusion state information, which means that each model parameter fusion apparatus of the M model parameter fusion apparatuses may simultaneously record an address and fusion state information of a model parameter fusion apparatus; and
(85) a fourth receiving unit 309, configured to receive fusion indication information sent by a second model parameter fusion apparatus, where the second model parameter fusion apparatus is any model parameter fusion apparatus of K model parameter fusion apparatuses of the M model parameter fusion apparatuses, the fusion indication information is sent by the second model parameter fusion apparatus after the N model parameter fusion apparatuses that meet a fusion condition are determined according to received addresses and fusion state information of the K model parameter fusion apparatuses, the fusion indication information includes addresses and/or numbers of the N nodes, the K model parameter fusion apparatuses are model parameter fusion apparatuses that have completed a specified iteration task and that are of the M model parameter fusion apparatuses, and 1≤K≤M.
(86) That is, any model parameter fusion apparatus of nodes that simultaneously record addresses and fusion state information of the M model parameter fusion apparatuses is used as a second model parameter fusion apparatus, and the second model parameter fusion apparatus serves as next model parameter fusion apparatus.
(87) Optionally, as shown in
(88) a fifth receiving unit 310, configured to receive addresses and fusion state information of K model parameter fusion apparatuses, where the fusion state information includes a computation state and/or a quantity of iterations of a model parameter fusion apparatus, the K model parameter fusion apparatuses are model parameter fusion apparatuses that have completed a specified iteration task and that are of the M model parameter fusion apparatuses, and 1≤K≤M;
(89) a determining unit 311, configured to determine, according to the received addresses and fusion state information of the K model parameter fusion apparatuses, the N model parameter fusion apparatuses that meet a fusion condition; and
(90) a third sending unit 312, configured to send fusion indication information to the other model parameter fusion apparatuses of the N model parameter fusion apparatuses than the model parameter fusion apparatus, so that the other model parameter fusion apparatuses of the N model parameter fusion apparatuses than the model parameter fusion apparatus perform a parameter fusion according to the fusion indication information, where the fusion indication information includes addresses and/or numbers of the N nodes.
(91) Optionally, as shown in
(92) a fourth sending unit 313, configured to send an address of the model parameter fusion apparatus to other model parameter fusion apparatuses of the M model parameter fusion apparatuses than the model parameter fusion apparatus, so that the other model parameter fusion apparatuses of the M model parameter fusion apparatuses than the model parameter fusion apparatus send, according to the received address, addresses and fusion state information of the other model parameter fusion apparatuses.
(93) Optionally, the apparatus further includes:
(94) a fifth sending unit, configured to send a j.sup.th model parameter block of the i.sup.th model parameter fusion apparatus to a j.sup.th model parameter fusion apparatus of the N model parameter fusion apparatuses, where 1≤j≤N and j≠i.
(95) That is, other model parameter blocks of the divided model parameter than the i.sup.th block are sent to the other model parameter fusion apparatuses of the N model parameter fusion apparatuses; j.sup.th blocks having a same number are sent to the j.sup.th model parameter fusion apparatus, and the j.sup.th model parameter fusion apparatus is responsible for fusing the j.sup.th model parameter blocks.
(96) Optionally, as shown in
(97) a sixth receiving unit 314, configured to receive the j.sup.th general model parameter block that results from a fusion by the j.sup.th model parameter fusion apparatus and that is sent by the j.sup.th model parameter fusion apparatus;
(98) a consolidation unit 315, configured to receive the j.sup.th general model parameter block that results from a fusion by the j.sup.th model parameter fusion apparatus and that is sent by the j.sup.th model parameter fusion apparatus; and
(99) a computation unit 316, configured to perform an iterative computation according to the new general model parameter.
(100) According to the model parameter fusion apparatus provided in this embodiment of the present invention, N model parameter fusion apparatuses that meet a fusion condition are determined; a model parameter of an i.sup.th model parameter fusion apparatus is divided into N blocks; i.sup.th model parameter blocks respectively sent by other model parameter fusion apparatuses of the N model parameter fusion apparatuses than the i.sup.th model parameter fusion apparatus are received; then, an i.sup.th model parameter block of the i.sup.th model parameter fusion apparatus and the i.sup.th model parameter blocks respectively sent by the other model parameter fusion apparatuses are fused, so as to obtain the i.sup.th general model parameter block; and finally, the i.sup.th general model parameter block is distributed to the other model parameter fusion apparatuses of the N model parameter fusion apparatuses. Therefore, computing resources can be dynamically adjusted, and in addition, network resource utilization and system stability are improved.
Embodiment 4
(101)
(102) a receiving unit 401, configured to receive an address and fusion state information sent by a node that has completed a specified computation and that is of the M nodes, where the fusion state information includes a computation state and/or a quantity of iterations of the node;
(103) a first determining unit 402, configured to determine, according to the received address and fusion state information, N nodes that meet a fusion condition, where quantities of N nodes that are determined at different times and that meet the fusion condition are the same or different; and
(104) a first sending unit 403, configured to: send fusion indication information to each node of the N nodes, where the fusion indication information includes addresses and/or numbers of the N nodes, so that each node of the N nodes divides a model parameter of the node into N blocks; and send an i.sup.th model parameter block resulting from the division of the model parameter of the node to an i.sup.th node, where 1≤i≤N, each node of the N nodes fuses model parameters received by the node, and each node of the N nodes distributes a model parameter resulting from the fusion to other nodes of the N nodes than the node.
(105) Optionally, the fusion condition is that a quantity of nodes that have completed the specified computation reaches a preset value, or that a quantity of times that the specified computation is completed reaches a preset quantity of times, or that a preset duration has expired. During each fusion, the preset value, the preset quantity of times, and the preset duration may be constants, or may be variable. Certainly, in an actual application, the fusion condition may further be another condition, or the like. This is not limited in this embodiment of the present invention.
(106) Optionally, the first determining unit is further specifically configured to:
(107) determine nodes that have completed a fusion, and N nodes of nodes that have not completed the fusion and have completed the specified computation.
(108) Optionally, as shown in
(109) a second sending unit 404, configured to send an address of the first node to other nodes of the M nodes than the first node.
(110) Optionally, as shown in
(111) a second determining unit 405, configured to: after a preset condition is met, determine a second node as a model parameter fusion apparatus in a second time period, where the second node is any node of K nodes of the M nodes, and K≤M;
(112) a third sending unit 406, configured to send node fusion information to the second node, where the node fusion information includes addresses and fusion state information of the M nodes; and
(113) a fourth sending unit 407, configured to send an address of the second node to other nodes than the second node.
(114) The preset condition may be that a specific time passes, or a specific quantity of fusions passes, or a specific quantity of iterations passes, or the like. This is not limited in the present invention.
(115) It should be noted that the specific time, the specific quantity of fusions, and the specific quantity of iterations may be set in advance; and the specific time, the specific quantity of fusions, and the specific quantity of iterations may be constant, or may be variable.
(116) Optionally, the apparatus further includes:
(117) a third determining unit, configured to: if the second node is faulty in the second time period, determine a third node as the model parameter fusion apparatus in the second time period, where the third node is any node of the K nodes of the M nodes.
(118) That is, when the second node is faulty, the second determining unit redetermines a node of the M nodes as the model parameter fusion apparatus in the second time period; in this case, the node may be referred to as a third node.
(119) Optionally, the model parameter fusion apparatus is at least one node of the M nodes; and that the at least one node receives an address and fusion state information sent by each node after the node completes the specified computation, determines the N nodes that meet the fusion condition, and sends the fusion indication information to each node of the N nodes is: determining, by any node of the at least one node according to the received address and fusion state information, the N nodes that meet the fusion condition, and sending the fusion indication information to each node of the N nodes.
(120) That is, when one or more nodes of the M nodes all record node fusion information of the M nodes, after completing the fusion, each node sends an address and fusion state information of the node, for example, a computation state and/or a quantity of iterations of the node, to at least one node that records the node fusion information and that is of the M nodes. Any node of the at least one node determines, according to the received address and fusion state information, the N nodes that meet the fusion condition, and sends the fusion indication information to each node of the N nodes.
(121) According to the model parameter fusion apparatus provided in this embodiment of the present invention, N nodes that meet a fusion condition are determined based on an address and fusion state information sent by a node that has completed a specified computation and that is of M nodes, and fusion indication information is sent to each node of the N nodes, so that each node of the N nodes divides a model parameter of the node into N blocks, and sends an model parameter block of the model parameter to an node; each node of the N nodes fuses model parameters received by the node, and each node of the N nodes distributes a model parameter resulting from the fusion to other nodes of the N nodes. Therefore, computing resources can be dynamically adjusted, capabilities of dynamically deleting and adding a node are provided, and in addition, each node that participates in the fusion may simultaneously send a model parameter and receive a model parameter, which improves network resource utilization and system stability.
Embodiment 5
(122)
(123) A person of ordinary skill in the art may understand that a structure shown in
(124) The following describes each component of the node in detail.
(125) The memory 1201 may be configured to store data, a software program, and a module, and mainly includes a program storage area and a data storage area. The program storage area may store an operating system, an application program required by at least one function, and the like; the data storage area may store data created according to use of a model parameter fusion apparatus, and the like. In addition, the memory may include a high-speed random access memory, and may further include a non-volatile memory, for example, at least one disk storage device, a flash memory device, or another volatile solid-state storage device.
(126) The processor 1202 is a control center of the node and is connected to each part of the entire node by using various interfaces and lines, and performs, by running or executing the software program and/or the module that are/is stored in the memory 1201 and invoking the data stored in the memory 1201, various functions of the node and data processing, so as to perform overall monitoring on the node. Optionally, the processor 1202 may include one or more processing units. Preferably, an application processor and a modem processor may be integrated into the processor 502, where the application processor mainly processes an operating system, a user interface, an application program, and the like; and the modem processor mainly processes wireless communication. It may be understood that, alternatively, the foregoing modem processor may not be integrated into the processor 1202.
(127) The power component 1203 is configured to supply power to each component of the node. The power component 503 may include a power management system, one or more power supplies, and another component related to power generation, management, and distribution of the node.
(128) The input/output interface 1204 provides an interface between the processor 1202 and a peripheral interface module, for example, the peripheral interface module may be a keyboard, or a mouse cursor.
(129) The communications component 1205 is configured to facilitate communication between the node and another device in a wired or wireless manner. The node may connect to a communication-standard-based wireless network, such as WiFi, 2G or 3G, or a combination thereof.
(130) Although not shown, the node may further include an audio component, a multimedia component, and the like, which is not described in this embodiment of the present invention.
(131) According to the node provided in this embodiment of the present invention, each node of N nodes that participate in a fusion divides a model parameter of the node into N blocks, and sends an i.sup.th model parameter block of the model parameter to an i.sup.th node. Each node of the N nodes fuses model parameters received by the node, and distributes a model parameter resulting from the fusion to other nodes of the N nodes. Therefore, capabilities of dynamically deleting and adding a node are provided, and in addition, each node that participates in the fusion may simultaneously send a model parameter and receive a model parameter, which improves network resource utilization and system stability.
Embodiment 6
(132)
(133) A person of ordinary skill in the art may understand that a structure shown in
(134) The following describes each component of the fusion controller in detail.
(135) The memory 1301 may be configured to store data, a software program, and a module, and mainly includes a program storage area and a data storage area. The program storage area may store an operating system, an application program required by at least one function, and the like; the data storage area may store data created according to use of a model parameter fusion apparatus, and the like. In addition, the memory may include a high-speed random access memory, and may further include a non-volatile memory, for example, at least one disk storage device, a flash memory device, or another volatile solid-state storage device.
(136) The processor 1302 is a control center of the fusion controller and is connected to each part of the entire fusion controller by using various interfaces and lines, and performs, by running or executing the software program and/or the module that are/is stored in the memory 1301 and invoking the data stored in the memory 1301, various functions of the fusion controller and data processing, so as to perform overall monitoring on the fusion controller. Optionally, the processor 1302 may include one or more processing units. Preferably, an application processor and a modem processor may be integrated into the processor 502, where the application processor mainly processes an operating system, a user interface, an application program, and the like; and the modem processor mainly processes wireless communication. It may be understood that, alternatively, the foregoing modem processor may not be integrated into the processor 1302.
(137) The power component 1303 is configured to supply power to each component of the fusion controller. The power component 503 may include a power management system, one or more power supplies, and another component related to power generation, management, and distribution of the fusion controller.
(138) The input/output interface 1304 provides an interface between the processor 1302 and a peripheral interface module, for example, the peripheral interface module may be a keyboard, or a mouse cursor.
(139) The communications component 1305 is configured to facilitate communication between the fusion controller and another device in a wired or wireless manner. The fusion controller may connect to a communication-standard-based wireless network, such as WiFi, 2G or 3G, or a combination thereof.
(140) Although not shown, the fusion controller may further include an audio component, a multimedia component, and the like, which is not described in this embodiment of the present invention.
(141) According to the fusion controller provided in this embodiment of the present invention, N nodes that meet a fusion condition are determined based on an address and fusion state information sent by a node that has completed a specified computation and that is of M nodes, and fusion indication information is sent to each node of the N nodes, so that each node of the N nodes divides a model parameter of the node into N blocks, and sends an i.sup.th model parameter block of the model parameter to an i.sup.th node; each node of the N nodes fuses model parameters received by the node, and each node of the N nodes distributes a model parameter resulting from the fusion to other nodes of the N nodes. Therefore, computing resources can be dynamically adjusted, and in addition, network resource utilization and system stability are improved.
Embodiment 7
(142) An embodiment of the present invention provides a machine learning system, where the machine learning system includes the node described in Embodiment 5, and the fusion controller described in Embodiment 6.
(143) Optionally, the fusion controller is provided separate from the node, or is configured on the node.
(144) According to the machine learning system provided in this embodiment of the present invention, a fusion controller determines, based on an address and fusion state information sent by a node that has completed a specified computation and that is of M nodes, N nodes that meet a fusion condition, and sends fusion indication information to each node of the N nodes, so that each node of the N nodes that participate in a fusion divides a model parameter of the node into N blocks, and sends an i.sup.th model parameter block of the model parameter to an i.sup.th node; each node of the N nodes fuses model parameters received by the node, and each node of the N nodes distributes a model parameter resulting from the fusion to other nodes of the N nodes. Therefore, computing resources can be dynamically adjusted, capabilities of dynamically deleting and adding a node are provided, and in addition, each node that participates in the fusion may simultaneously send a model parameter and receive a model parameter, which improves network resource utilization and system stability.
(145) Finally, it should be noted that the foregoing embodiments are merely intended for describing the technical solutions of the present invention but not for limiting the present invention. Although the present invention is described in detail with reference to the foregoing embodiments, persons of ordinary skill in the art should understand that they may still make modifications to the technical solutions described in the foregoing embodiments or make equivalent replacements to some technical features thereof, without departing from the spirit and scope of the technical solutions of the embodiments of the present invention.