A distributed machine learning method, device, terminal device and storage medium

By judging the reception of global parameters on the working nodes of the distributed machine learning system, updating candidate models and continuing training, the problem of differences in data processing capabilities of sub-servers and long return time of global parameters is solved, and the efficiency of model training is improved.

CN114254756BActive Publication Date: 2024-09-10THE HONG KONG POLYTECHNIC UNIV SHENZHEN RES INST
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011016938.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-24
Publication Date
2024-09-10
Estimated Expiration
2040-09-24

AI Technical Summary

Technical Problem

In a distributed machine learning system, due to the difference in data processing capabilities of sub-servers and the long return time of global parameters, the model training time is extended and the efficiency of model training is reduced.

Method used

By judging whether the global parameters sent by the parameter server are received on the working node, if the global parameters are not received within a predetermined time period, the candidate model is updated based on the gradient of the initial model and training continues, so that the working node calculates the global parameters and the transmission time has been in the training state.

Benefits of technology

It saves model training time and improves the efficiency of model training, so that the working node does not need to stop while waiting for the return of global parameters and can continue training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114254756B
    Figure CN114254756B
Patent Text Reader

Abstract

The present application is applicable to the field of computer technology, and provides a distributed machine learning method, apparatus, terminal device and storage medium, the method comprising: training an initial model of this training to obtain a first gradient corresponding to the initial model; judging whether a global parameter sent by a parameter server is received within a first time period, wherein the first time period is a time period for training the initial model of this training; if the global parameter is not received within the first time period, a candidate model is obtained based on the first gradient, and the candidate model is used as the initial model for the next training; the present application obtains a candidate model using the first gradient when the global parameter is not received, and continues to train the candidate model, so that the working node is always in a training state during the time when the parameter server calculates the global parameter and transmits the global parameter to the working node, and does not have to continue training after receiving the global parameter, thereby saving the model training time and making the model training faster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to a distributed machine learning method, apparatus, terminal device and storage medium. Background Art

[0002] Machine learning is a process in which a computer uses existing data to train an initial model to obtain a trained model, and then uses the trained model to predict the required data. Currently, distributed machine learning systems are mostly used to train models. The specific method of using a distributed machine learning system to train a model is as follows: input the training samples into multiple parallel sub-servers, use multiple sub-servers to train the model at the same time, and then send the gradient obtained from the training to the parameter server. The parameter server uses the gradient to update the global parameters, and the updated global parameters are returned to each sub-server. The sub-server uses the global parameters returned by the parameter server to update the model parameters and conduct the next training, and repeat this cycle until the training is completed.

[0003] When there are many sub-servers, due to the differences in data processing capabilities of the sub-servers, the parameter server needs to receive the gradients sent by all sub-servers before it can update the global parameters, and the sub-servers need to receive the global parameters before they can perform the next model training. Since the global parameters take a long time to return, the model training time is extended, reducing the efficiency of model training. Summary of the invention

[0004] The embodiments of the present application provide a distributed machine learning method, apparatus, terminal device and storage medium, which can solve the current problem of low model training efficiency.

[0005] In a first aspect, an embodiment of the present application provides a distributed machine learning method, which is applied to a distributed machine learning system, wherein the distributed machine learning system includes a parameter server and at least two working nodes for training a model, wherein the working nodes are connected to the parameter server, including:

[0006] Training the initial model of this training to obtain a first gradient corresponding to the initial model;

[0007] Determine whether the global parameters sent by the parameter server are received within a first time period, wherein the first time period is a time period for training the initial model this time;

[0008] If the global parameters are not received within the first time period, a candidate model is obtained based on the first gradient, and the candidate model is used as an initial model for the next training.

[0009] In a second aspect, an embodiment of the present application provides a distributed machine learning system, including: a parameter server and at least two working nodes for training a model, the working nodes being connected to the parameter server;

[0010] The working nodes include:

[0011] A model training module, used to train the initial model of this training to obtain a first gradient corresponding to the initial model;

[0012] A judgment module, used to judge whether the global parameters sent by the parameter server are received within a first time period, wherein the first time period is a time period for the working node to train the current model;

[0013] A parameter updating module is used to obtain a candidate model based on the first gradient if the global parameter is not received within a first time period, and to use the candidate model as the current model for the next model training.

[0014] In a third aspect, an embodiment of the present application provides a terminal device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the distributed machine learning method described in any one of the first aspects above when executing the computer program.

[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and wherein when the computer program is executed by a processor, the distributed machine learning method described in any one of the first aspects above is implemented.

[0016] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute the distributed machine learning method described in any one of the above-mentioned first aspects.

[0017] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.

[0018] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the present application trains the initial model of this training through the working node to obtain the first gradient corresponding to the initial model; then determines whether the global parameters sent by the parameter server are received within the time period of this training of the initial model; if the global parameters are not received within the first time period, a candidate model is obtained based on the first gradient, and the candidate model is used as the initial model for the next training; the present application uses the first gradient to obtain the candidate model when the global parameters are not received, and continues to train the candidate model, so that the working node is always in a training state during the time when the parameter server calculates the global parameters and transmits the global parameters to the working node, and does not have to continue training after receiving the global parameters, thereby saving the time of model training and making the model training faster. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0020] Figure 1 is a schematic diagram of a distributed machine learning system provided by an embodiment of the present application;

[0021] Figure 2 It is a flowchart of a distributed machine learning method provided by an embodiment of the present application;

[0022] Figure 3 is a schematic diagram of a process for processing a second gradient provided in an embodiment of the present application;

[0023] Figure 4 It is a flowchart of a method for training a working node model provided in an embodiment of the present application;

[0024] Figure 5 It is a structural diagram of a working node provided in an embodiment of the present application;

[0025] Figure 6 is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application;

[0026] Figure 7 It is a block diagram of a partial structure of a computer provided in one embodiment of the present application. DETAILED DESCRIPTION

[0027] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0028] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0029] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0030] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0031] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0032] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0033] like Figure 1As shown, the distributed machine learning system includes a parameter server and four working nodes for training the model, and the working nodes are connected to the parameter server via a link.

[0034] The sample set is divided into four parts, namely data block D1, data block D2, data block D3 and data block D4. Data block D1 is assigned to working node W1, data block D2 is assigned to working node W2, data block D3 is assigned to working node W3, and data block D4 is assigned to working node W4. The four working nodes calculate the gradients of the corresponding data blocks respectively and send the calculated gradients to the parameter server. After receiving the gradients transmitted by the four working nodes, the parameter server processes the received gradients to obtain global parameters and sends the global parameters to each working node. Each working node uses the received global parameters to update the model parameters and trains the model after the updated parameters.

[0035] In a distributed machine learning system, during the time when a working node transmits gradients to a parameter server, when the parameter server calculates global parameters, and when the parameter server transmits global parameters to the working node, the working node is not working. The working node must receive the global parameters before it can continue working, resulting in a waste of time for the working node between two training sessions.

[0036] Therefore, in the distributed machine learning method provided by the present application, the working nodes are always in working state, which improves the efficiency of model training.

[0037] The following combination Figure 1 The distributed machine learning method of the embodiment of the present application is described in detail.

[0038] Figure 2 A schematic flow chart of the distributed machine learning method provided by the present application is shown, referring to Figure 2 , the method is described in detail as follows:

[0039] S101, training the initial model of this training to obtain a first gradient corresponding to the initial model.

[0040] In this embodiment, the working node is a node that performs iterative training on the model, and the model is continuously trained by continuously updating the model parameters. The working node trains the model based on training data. The training data can be data pre-stored in the working node, or data transmitted to the working node from an external device.

[0041] In this embodiment, the working node trains the model and obtains a first gradient each time it is trained. The original meaning of gradient is a vector (vector), which indicates that the directional derivative of a function at this point has the maximum value along this direction, that is, the function changes fastest along this direction (the direction of this gradient) at this point, and the rate of change is the largest (the modulus of the gradient). The current model in the working node is used as the initial model for this training. The working node trains the initial model and obtains the first gradient corresponding to the initial model.

[0042] S102, determining whether the global parameters sent by the parameter server are received within a first time period, wherein the first time period is a time period for training the initial model this time.

[0043] In this embodiment, the global parameters are initial global parameters updated by the parameter server based on the first gradients received from each working node, the updated initial global parameters are obtained as global parameters, and the global parameters are sent to each node.

[0044] In this embodiment, the first time period is from the start time of the initial model training to the end time of the initial model training. For example, if the initial model training starts at 8:30 and ends at 8:40, the first time period is from 8:30 to 8:40.

[0045] S103: If the global parameter is not received within the first time period, a candidate model is obtained based on the first gradient, and the candidate model is used as an initial model for the next training.

[0046] In a possible implementation, the implementation process of step S103 may include:

[0047] The parameters of the initial model are updated based on the first gradient to obtain a candidate model.

[0048] Specifically, based on the first gradient, the parameters of the initial model are updated using a gradient descent method.

[0049] In this embodiment, if the working node does not receive the global parameters transmitted by the parameter server during the training of the initial model, it means that the parameter server has not yet completed the calculation and has not yet obtained the global parameters. Therefore, the working node cannot use the global parameters to update the parameters in the initial model. The prior art is to continue waiting until the global parameters sent by the parameter server are received, and then use the global parameters to update the parameters of the model. The present application updates the parameters in the initial model according to the first gradient obtained from the training of the initial model this time, and then uses the initial model with updated parameters as the candidate model to continue training the candidate model. The present application does not need to wait for the global parameters, and the working node can always be in a working state.

[0050] Optionally, it can be set that after a preset time when each working node starts working, the parameter server sends a pre-stored global parameter to each working node, so that the working node continues to train the model according to the above steps S101-S103 based on the global parameter. For example, 3 minutes after each working node starts working, the parameter server sends the global parameter a to each working node.

[0051] Optionally, when the working node starts to train the model for the first time, the parameter server can calculate the first global parameter based on the pre-stored data, and send the first global parameter to the working node after the calculation. After receiving the first global parameter, the working node needs to send all the first gradients calculated before the time of receiving the first global parameter to the parameter server.

[0052] Optionally, the first gradient obtained by each working node for the first model training can be uploaded to the parameter server to start the parameter server to calculate the global parameters. Then, the gradient uploaded by each working node for the second time is all the first gradients calculated before the time when the global parameters are first received.

[0053] Optionally, after step S101, the following steps may also be included:

[0054] It is determined whether this training is the first time to train the model. If it is the first time to train the model, the first gradient is sent to the parameter server. If it is not the first time to train the model, the determination of step S102 is continued.

[0055] In an embodiment of the present application, the initial model of this training is trained by the working node to obtain the first gradient corresponding to the initial model; then it is determined whether the global parameters sent by the parameter server are received within the time period of the initial model training; if the global parameters are not received within the first time period, a candidate model is obtained based on the first gradient, and the candidate model is used as the initial model for the next training; the present application uses the first gradient to obtain the candidate model when the global parameters are not received, and continues to train the candidate model, so that the working node is always in a training state during the time when the parameter server calculates the global parameters and transmits the global parameters to the working node, and does not have to continue training after receiving the global parameters, which saves the time of model training and makes the model training faster. The present application uses a parallel processing mechanism of model training and data transmission of the working node, making full use of the time of data transmission and the calculation time of global parameters, and the working node is always in a working state, which speeds up the training of the model.

[0056] In a possible implementation, after step S103, the following may also be included:

[0057] S104: If the global parameters are received within the first time period, a candidate model is obtained based on the global parameters, the candidate model is used as the initial model for the next training, and a second gradient is sent to the parameter server; wherein the second gradient is the first gradient obtained within the second time period, and the second time period is from the time when the global parameters were last received to the time when the global parameters were received within the first time period. After receiving the second gradient, the parameter server obtains the global parameters based on the second gradient and sends the global parameters to the working node.

[0058] Specifically, the parameters of the initial model are updated based on the global parameters to obtain a candidate model.

[0059] In this embodiment, if the working node receives global parameters sent by the parameter server during the training of the initial model, it is necessary to update the parameters of the initial model according to the global parameters, use the initial model after the updated parameters as the candidate model, train the candidate model, and use the training of the candidate model as this training.

[0060] In this embodiment, if the working node receives the global parameters sent by the parameter server, it means that the parameter server has completed the calculation of the global parameters based on the first gradient transmitted by the received working node before this initial training, and the new first gradient needs to be transmitted to the parameter server.

[0061] Specifically, since the first gradient is not sent to the parameter server from the time when the global parameters are received last to the time when the global parameters are received in the first time period, all the first gradients obtained by the working node from the time when the global parameters are received last to the first time period need to be uploaded to the parameter server. Because the number of times the working node trains the model from the time when the global parameters are received last to the first time period may be greater than 1, the first gradients obtained from each training need to be uploaded to the parameter server. It is also possible to group multiple second gradients that need to be uploaded into a gradient set, and encode the gradient set and send it to the parameter server.

[0062] In this embodiment, the second time period is the time period when the working node receives two adjacent global parameters. For example, the working node b receives the global parameters for the second time at 5:10 and the third time at 5:30, then the second time period is from 5:10 to 5:30.

[0063] For example, if the last time the global parameters were received was at 8:10, and the time the global parameters were received in the first time period was 8:40, the working node performed four model trainings between 8:10 and 8:40, and obtained four first gradients respectively, and then the four first gradients were transmitted to the parameter server.

[0064] In this embodiment, the parameter server needs to obtain the first gradients sent by a preset number of working nodes and then calculate the global parameters again.

[0065] It should be noted that if the first global parameter calculated by the parameter server is calculated based on data pre-stored in the parameter server, then after receiving the first global parameter, the working node needs to send all the first steps calculated before the time of receiving the first global parameter to the parameter server. That is, the second time period is from the start time of the working node to the time of receiving the first global parameter.

[0066] like Figure 3 In a possible implementation, the implementation process of sending the second gradient to the parameter server in step S104 may include:

[0067] S1041, performing dimensionality reduction processing on the second gradient to obtain a target gradient;

[0068] S1042: Send the target gradient to the parameter server.

[0069] In this embodiment, the second gradient is subjected to dimensionality reduction processing, which is an operation of converting high-dimensional data into low-dimensional data. For example, if the second gradient is a 32-bit floating point number, the second gradient can be converted into 1-bit data. Performing dimensionality reduction processing on the second gradient can reduce communication data and communication time.

[0070] In a possible implementation, before step S1041, the method may further include:

[0071] Determine whether the number of the second gradients is greater than 1;

[0072] If the number of the second gradients is greater than 1, the sum of all the second gradients is calculated to obtain a candidate gradient.

[0073] In this embodiment, if the number of the second gradients is greater than 1, all the second gradients may be added to obtain candidate gradients, the candidate gradients may be reduced in dimension, and the candidate gradients after the dimension reduction may be transmitted to the parameter server.

[0074] In a possible implementation, the implementation process of the distributed machine learning method may further include:

[0075] If the distributed machine learning system consists of two working nodes, W1 and W2, and a parameter server.

[0076] S201, W1 performs the first training on the initial model M1 to obtain the first gradient TW1; W2 performs the first training on the initial model M2 to obtain the first gradient TW2, and sends TW1 and TW2 to the parameter server respectively;

[0077] S202, after receiving TW1 and TW2, the parameter server calculates the first global parameter.

[0078] At the same time, W1 uses TW1 to update the parameters of the initial model M1 to obtain the candidate model M11, and trains the candidate model M11 to obtain the first gradient TW11.

[0079] W2 uses TW2 to update the parameters of the initial model M2 to obtain the candidate model M22, and trains the candidate model M22 to obtain the first gradient TW22.

[0080] S203, W1 updates the parameters of the initial model M11 using TW11 to obtain the candidate model M111, and trains the candidate model M111 to obtain the first gradient TW111. During the training of M111, W1 receives the global parameter Q1 sent by the parameter server.

[0081] W2 uses TW22 to update the parameters of the initial model M22 to obtain the candidate model M222, and trains the candidate model M222 to obtain the first gradient TW222.

[0082] S204, W1 updates the parameters in M111 based on the acquired global parameter Q1, obtains the candidate model M1111, and trains the candidate model to obtain the first gradient TW1111. At the same time, W1 sends TW1 and TW11 to the parameter server.

[0083] W2 uses TW222 to update the parameters of the initial model M222 to obtain the candidate model M2222, and trains the candidate model M2222 to obtain the first gradient TW2222. During the training of M2222, W2 receives the global parameter Q1 sent by the parameter server.

[0084] S205, W1 uses TW1111 to update the parameters of the initial model M1111 to obtain the candidate model M11111, and trains the candidate model M11111 to obtain the first gradient TW11111.

[0085] W2 uses the global parameter Q1 to update the parameters of the initial model M2222 to obtain the candidate model M22222, and trains the candidate model M22222 to obtain the first gradient TW22222. At the same time, W2 sends TW2, TW22 and TW222 to the parameter server.

[0086] S206, the parameter server calculates the global parameter Q2 based on TW1, TW11, TW2, TW22 and TW222. W1 and W2 continue to train the model according to the above method until the model training is completed.

[0087] In a possible implementation, the implementation process of the distributed machine learning method may further include:

[0088] like Figure 4 As shown in the figure, the distributed machine learning system includes two working nodes, W1 and W2, and a parameter server. The arrows represent the model training process of the working nodes, and the length of the arrows represents the time taken for model training. The square represents the time from when the working node transmits the first gradient to the parameter server to when the working node receives the parameter service sent by the parameter server. A dotted grid represents that the parameter server completes the calculation and transmission of a global parameter.

[0089] S301, W1 performs the first training on the initial model M1 to obtain the first gradient TW1; W2 performs the first training on the initial model M2 to obtain the first gradient TW2;

[0090] S302, W1 updates the parameters of the initial model M1 using TW1 to obtain a candidate model M11, and trains the candidate model M11 to obtain a first gradient TW11. During the training of M11, W1 receives a global parameter Q1 sent by a parameter server.

[0091] W2 uses TW2 to update the parameters of the initial model M2 to obtain the candidate model M22, and trains the candidate model M22 to obtain the first gradient TW22.

[0092] S303, W1 sends the first gradient obtained before receiving the global parameter Q1 to the parameter server, that is, sends TW1 to the parameter server.

[0093] W1 updates the parameters in M11 according to the global parameter Q1, obtains the candidate model M111, and trains the candidate model M111 to obtain the first gradient TW111. Meanwhile, during the training of the candidate model M111, the global parameter Q2 sent by the parameter server is received.

[0094] W2 updates the parameters in M22 according to the first gradient TW22 to obtain a candidate model M222, and trains the candidate model M222 to obtain a first gradient TW222. During the training of M222, W2 receives the global parameter Q1 sent by the parameter server.

[0095] S304, W1 sends the first gradient obtained between the time when global parameter Q1 is received and the time when global parameter Q2 is received to the parameter server, that is, TW11 is sent to the parameter server. W2 sends the first gradient obtained before the time when global parameter Q1 is received to the parameter server, that is, TW2 and TW22 are sent to the parameter server.

[0096] W1 updates the parameters in M111 according to the global parameter Q2, obtains the candidate model M1111, and trains the candidate model M1111 to obtain the first gradient TW1111. Meanwhile, during the training of the candidate model M1111, the global parameter Q3 sent by the parameter server is received.

[0097] W2 updates the parameters in M222 according to the global parameter Q1 to obtain the candidate model M2222, and trains the candidate model M2222 to obtain the first gradient TW2222.

[0098] S305, W1 sends the first gradient obtained from the time when the global parameter Q2 is received to the time when the global parameter Q3 is received to the parameter server, that is, sends TW111 to the parameter server.

[0099] W1 updates the parameters in M1111 according to the global parameter Q3 to obtain the candidate model M11111, and trains the candidate model M11111 to obtain the first gradient TW11111.

[0100] W2 updates the parameters in M2222 according to the first gradient TW2222, obtains the candidate model M22222, and trains the candidate model M22222 to obtain the first gradient TW22222. At the same time, during the training of the candidate model M22222, the global parameter Q2 sent by the parameter server is received. W2 sends TW222 and TW2222 to the parameter server.

[0101] S306: Train the model according to the above method until the training is completed.

[0102] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0103] Corresponding to the distributed machine learning method described in the above embodiment, the distributed machine learning system provided in the embodiment of the present application includes: a parameter server and at least two working nodes for training the model, and the working nodes are connected to the parameter server.

[0104] Reference Figure 5The working node 400 may include: a model training module 410, a judgment module 420 and a parameter updating module 430.

[0105] The model training module 410 is used to train the initial model of this training to obtain a first gradient corresponding to the initial model;

[0106] A judgment module 420 is used to judge whether the global parameters sent by the parameter server are received within a first time period, wherein the first time period is a time period for the working node to train the current model;

[0107] The parameter updating module 430 is used to obtain a candidate model based on the first gradient if the global parameter is not received within the first time period, and use the candidate model as the current model for the next model training.

[0108] In a possible implementation, the parameter updating module 430 may be specifically used to:

[0109] The parameters of the initial model are updated based on the first gradient to obtain a candidate model.

[0110] In a possible implementation, the judging module 420 is also connected to:

[0111] A data updating module, configured to obtain a candidate model based on the global parameters if the global parameters are received within a first time period, use the candidate model as an initial model for next training, and send a second gradient to the parameter server;

[0112] The second gradient is the first gradient obtained within a second time period, and the second time period is from the time when the global parameters were last received to the time when the global parameters were received within the first time period. After receiving the second gradient, the parameter server obtains the global parameters based on the second gradient and sends the global parameters to the working node.

[0113] In a possible implementation, the data update module may be specifically used for:

[0114] The parameters of the initial model are updated based on the global parameters to obtain a candidate model.

[0115] In a possible implementation, the data update module may be specifically used for:

[0116] Performing dimensionality reduction processing on the second gradient to obtain a target gradient;

[0117] The target gradient is sent to the parameter server.

[0118] In a possible implementation, the data update module may be specifically used for:

[0119] Determine whether the number of the second gradients is greater than 1;

[0120] If the number of the second gradients is greater than 1, the sum of all the second gradients is calculated to obtain a candidate gradient;

[0121] Accordingly, the second gradient is subjected to dimensionality reduction processing to obtain a target gradient, including:

[0122] Perform dimensionality reduction processing on the candidate gradient to obtain the target gradient.

[0123] In a possible implementation, the parameter updating module 430 may also be used to:

[0124] Based on the first gradient, the parameters of the initial model are updated using a gradient descent method.

[0125] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0126] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0127] The present application also provides a terminal device, see Figure 6 The terminal device 500 may include: at least one processor 510, a memory 520, and a computer program stored in the memory 520 and executable on the at least one processor 510. When the processor 510 executes the computer program, the steps in any of the above-mentioned method embodiments are implemented, for example Figure 2Steps S101 to S103 in the illustrated embodiment. Alternatively, when the processor 510 executes the computer program, the functions of each module / unit in the above-mentioned device embodiments are implemented, for example Figure 5 Functions of modules 410 to 430 are shown.

[0128] Exemplarily, the computer program may be divided into one or more modules / units, one or more modules / units are stored in the memory 520, and executed by the processor 510 to complete the present application. The one or more modules / units may be a series of computer program segments capable of completing specific functions, and the program segments are used to describe the execution process of the computer program in the terminal device 500.

[0129] Those skilled in the art will understand that Figure 6 It is only an example of a terminal device and does not constitute a limitation on the terminal device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, such as input and output devices, network access devices, buses, etc.

[0130] The processor 510 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0131] The memory 520 may be an internal storage unit of the terminal device, or an external storage device of the terminal device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. The memory 520 is used to store the computer program and other programs and data required by the terminal device. The memory 520 may also be used to temporarily store data that has been output or is to be output.

[0132] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0133] The distributed machine learning method provided in the embodiments of the present application can be applied to terminal devices such as computers, tablet computers, laptop computers, netbooks, personal digital assistants (PDAs), etc. The embodiments of the present application do not impose any restrictions on the specific types of terminal devices.

[0134] Take the terminal device as a computer as an example. Figure 7 FIG. 1 is a block diagram showing a partial structure of a computer provided in an embodiment of the present application. Figure 7 The computer includes: a communication circuit 610, a memory 620, an input unit 630, a display unit 640, an audio circuit 660, a wireless fidelity (WiFi) module 660, a processor 670, and a power supply 680.

[0135] Combine the following Figure 7 A detailed introduction to the various components of the computer:

[0136] The communication circuit 610 can be used for receiving and sending signals during the process of sending and receiving information or making calls. In particular, after receiving the image sample sent by the image acquisition device, it is sent to the processor 670 for processing; in addition, the image acquisition instruction is sent to the image acquisition device. Generally, the communication circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the communication circuit 610 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE)), email, Short Messaging Service (SMS), etc.

[0137] The memory 620 can be used to store software programs and modules. The processor 670 executes various functional applications and data processing of the computer by running the software programs and modules stored in the memory 620. The memory 620 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the computer (such as audio data, a phone book, etc.), etc. In addition, the memory 620 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0138] The input unit 630 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the computer. Specifically, the input unit 630 may include a touch panel 631 and other input devices 632. The touch panel 631, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 631 or near the touch panel 631 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 631 may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 670, and can receive and execute commands sent by the processor 670. In addition, the touch panel 631 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 631, the input unit 630 may also include other input devices 632. Specifically, the other input devices 632 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.

[0139] The display unit 640 can be used to display information input by the user or information provided to the user and various menus of the computer. The display unit 640 may include a display panel 641. Optionally, the display panel 641 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 631 may cover the display panel 641. When the touch panel 631 detects a touch operation on or near it, it is transmitted to the processor 670 to determine the type of touch event. Subsequently, the processor 670 provides a corresponding visual output on the display panel 641 according to the type of touch event. Although in Figure 7 In the embodiment, the touch panel 631 and the display panel 641 are used as two independent components to implement the input and output functions of the computer, but in some embodiments, the touch panel 631 and the display panel 641 can be integrated to implement the input and output functions of the computer.

[0140] The audio circuit 660 can provide an audio interface between the user and the computer. The audio circuit 660 can convert the received audio data into an electrical signal, transmit it to the speaker, and the speaker converts it into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 660 and converted into audio data, and then the audio data is output to the processor 670 for processing, and then sent to another computer through the communication circuit 610, or the audio data is output to the memory 620 for further processing.

[0141] WiFi is a short-range wireless transmission technology. Computers can help users send and receive emails, browse web pages, and access streaming media through WiFi module 660. It provides users with wireless broadband Internet access. Figure 7 A WiFi module 660 is shown, but it is understandable that it is not an essential component of the computer and can be omitted as needed without changing the essence of the invention.

[0142] The processor 670 is the control center of the computer. It uses various interfaces and lines to connect various parts of the entire computer. It executes various functions of the computer and processes data by running or executing software programs and / or modules stored in the memory 620, and calling data stored in the memory 620, so as to monitor the computer as a whole. Optionally, the processor 670 may include one or more processing units; preferably, the processor 670 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 670.

[0143] The computer also includes a power supply 680 (such as a battery) for supplying power to various components. Preferably, the power supply 680 can be logically connected to the processor 670 through a power management system, so that the power management system can manage charging, discharging, power consumption and other functions.

[0144] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it can implement the steps in each embodiment of the above-mentioned distributed machine learning method.

[0145] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in each embodiment of the above-mentioned distributed machine learning method when executing the computer program product.

[0146] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0147] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0148] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0149] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0150] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0151] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A distributed machine learning method, applied to a distributed machine learning system, wherein the distributed machine learning system comprises a parameter server and at least two working nodes for training a model, wherein the working nodes are connected to the parameter server, and wherein: The method includes: Training the initial model of this training to obtain a first gradient corresponding to the initial model; Determine whether the global parameters sent by the parameter server are received within a first time period, wherein the first time period is a time period for training the initial model this time; If the global parameters are not received within the first time period, a candidate model is obtained based on the first gradient, and the candidate model is used as an initial model for the next training.

2. The distributed machine learning method according to claim 1, characterized in that: The step of obtaining a candidate model based on the first gradient includes: The parameters of the initial model are updated based on the first gradient to obtain a candidate model.

3. The distributed machine learning method according to claim 1 or 2, characterized in that: After determining whether the global parameters sent by the parameter server are received within the first time period, the method further includes: If the global parameters are received within the first time period, a candidate model is obtained based on the global parameters, the candidate model is used as an initial model for next training, and a second gradient is sent to the parameter server; The second gradient is the first gradient obtained within a second time period, and the second time period is from the time when the global parameters were last received to the time when the global parameters were received within the first time period. After receiving the second gradient, the parameter server obtains the global parameters based on the second gradient and sends the global parameters to the working node.

4. The distributed machine learning method according to claim 3, characterized in that: The step of obtaining a candidate model based on the global parameters comprises: The parameters of the initial model are updated based on the global parameters to obtain a candidate model.

5. The distributed machine learning method according to claim 3, characterized in that: The sending the second gradient to the parameter server includes: Performing dimensionality reduction processing on the second gradient to obtain a target gradient; The target gradient is sent to the parameter server.

6. The distributed machine learning method according to claim 5, characterized in that: Before performing dimensionality reduction processing on the second gradient to obtain the target gradient, the method further includes: Determine whether the number of the second gradients is greater than 1; If the number of the second gradients is greater than 1, the sum of all the second gradients is calculated to obtain a candidate gradient; Accordingly, the second gradient is subjected to dimensionality reduction processing to obtain a target gradient, including: Perform dimensionality reduction processing on the candidate gradient to obtain the target gradient.

7. The distributed machine learning method according to claim 2, characterized in that: The updating of the parameters of the initial model based on the first gradient includes: Based on the first gradient, the parameters of the initial model are updated using a gradient descent method.

8. A distributed machine learning system, characterized in that: include: A parameter server and at least two working nodes for training the model, wherein the working nodes are connected to the parameter server; The working nodes include: A model training module, used to train the initial model of this training to obtain a first gradient corresponding to the initial model; A judgment module, used to judge whether the global parameters sent by the parameter server are received within a first time period, wherein the first time period is a time period for the working node to train the current model; A parameter updating module is used to obtain a candidate model based on the first gradient if the global parameter is not received within a first time period, and to use the candidate model as the current model for the next model training.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the distributed machine learning method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the distributed machine learning method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method and device for neural network machine learning model training

    CN109754060A

  • Computational storage for distributed computing

    US20180253423A1

  • Training method, apparatus, chip, and system for neural network model

    US20190279088A1