Federated learning-based multi-party large model joint training method and apparatus

WO2026218396A1PCT designated stage Publication Date: 2026-10-22ZHEJIANG LAB
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/098918
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-04-17
Filing Date
2025-06-04
Publication Date
2026-10-22

Smart Images

  • Figure CN2025098918_22102026_PF_FP_ABST
    Figure CN2025098918_22102026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present invention are a federated learning-based multi-party large model joint training method and apparatus, the method comprising: evenly dividing a large model to be trained into computing nodes according to the sizes of parameters, setting s as a random seed for all the nodes, and initializing model parameters; each client using private domain data held by the client itself to train the large model, and after completing a round of training, synthesizing gradient parameters of the computing nodes into a complete gradient Gi; generating, as one of sub-secrets, a random number matrix Ri having the same shape as Gi; calculating Ti=Gi-Ri as another sub-secret; respectively sending the two sub-secrets to two central servers for summation to obtain a final update gradient W; the clients dividing W into node update gradients and sending same to corresponding nodes to complete model updating; and repeating the process above until the large model converges or a preset number of iterations is reached. In the present invention, the clients only need to communicate with the central servers, the secret sharing scheme is simple, the communication cost is low, and training of a large model having large scale parameters is supported.
Need to check novelty before this filing date? Find Prior Art

Description

A method and apparatus for joint training of large multi-party models based on federated learning Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for joint training of large multi-party models based on federated learning. Background Technology

[0002] Since its introduction, large model technology has demonstrated outstanding performance in many fields. However, the performance improvement of large models often depends on larger model parameters, more training data, and stronger computing resources. With the rapid depletion of public data, the utilization of private domain data has become urgent. However, the current training methods that centrally store data are difficult to meet the high requirements of privacy protection for private domain data.

[0003] Federated learning, as an important privacy computing technology, can train large models without data leaving the domain, ensuring that the data is usable but not visible. It is an effective method to achieve cross-domain collaborative modeling and fully explore the value of private domain data.

[0004] With the most common Fedavg 1 Taking the algorithm as an example, the entire computing framework consists of a central server Server and n computing clients Worker1, Worker2, ... Worker n The system consists of a computing client, which is also the data holder. The specific training process is as follows:

[0005] a) Initialization: The central server initializes the global model parameters and sends them to all participating clients.

[0006] b) Local training: Each client trains the model using local data and updates the local model parameters.

[0007] c) Parameter upload: The client uploads the updated model parameters to the central server.

[0008] d) Parameter aggregation: The central server calculates the average value of all uploaded parameters and broadcasts this average value back to all clients.

[0009] e) Iteration: Repeat the above steps until the model converges or the preset number of iterations is reached.

[0010] Throughout the training process, the data holder only needs to pass the model parameters obtained from each round of training to the central server, and the private domain data remains local and is not transmitted outside.

[0011] However, in some cases, the input data can be reconstructed using model parameters or training gradients. 2Even a small-probability partial reconstruction can pose a serious threat to the security of private domain data, as demonstrated by the open-source framework Federatedscope. 3 A secret sharing mechanism has been introduced, and the specific process is as follows:

[0012] a) Initialization: Based on a predefined random seed, each client initializes the model parameters locally.

[0013] b) Local training: Each client trains the model using local data to obtain the updated gradient of the model in this round.

[0014] c) Secret sharing: Each client splits the gradient into n sub-secrets, where n is the total number of clients. The sum of the n sub-secrets equals the gradient. Each client keeps one sub-secret and shares one sub-secret with each of the other clients. After sharing, each client holds n sub-secrets from different clients. The sum of these n sub-secrets yields the new encrypted gradient.

[0015] d) Parameter upload: The client uploads the encrypted gradient to the central server.

[0016] e) Parameter aggregation: The central server calculates the average of all uploaded encrypted gradients and broadcasts this average back to all clients. The clients use the received gradients to update their local models.

[0017] f) Iteration: Repeat the above steps until the model converges or the preset number of iterations is reached.

[0018] The above-mentioned technology has the following disadvantages:

[0019] 1. The implementation threshold in actual cross-domain collaboration scenarios of private domain data is relatively high.

[0020] Existing technical solutions require that each client participating in collaborative computing can communicate with each other. However, in real-world scenarios, due to protection needs, holders of highly sensitive private data require that connections with external systems be minimized. Existing data systems are often limited to internal network use only. Enabling connections with all other clients would mean significantly relaxing access restrictions, greatly increasing the security risks of the existing system, making the implementation of such solutions very difficult.

[0021] 2. The system structure is relatively complex and its robustness is poor.

[0022] The existing solution requires all clients to share gradient secrets. If any client crashes or the communication times out during the secret sharing process, the original sub-secrets cannot be correctly reconstructed to create new gradients, and the remaining normal clients are forced to re-share secrets.

[0023] 3. Communication costs are relatively high.

[0024] Since all clients need to communicate pairwise during the secret sharing process, the time consumption is O(n^2). 2 ), where n is the number of clients. As the number of clients participating in collaborative computing increases, the communication cost increases significantly.

[0025] 4. A single computing node on each client cannot meet the needs of training large models.

[0026] Large models have a large number of parameters, and the memory of a single GPU is often insufficient to support the training of large models. Moreover, in order to accelerate the training cycle, a large number of GPUs are usually used for training at the same time. Existing solutions lack application scenarios where the client consists of multiple computing nodes. Summary of the Invention

[0027] The purpose of this invention is to address the shortcomings of existing technologies by providing a method and apparatus for joint training of large multi-party models based on federated learning.

[0028] The objective of this invention is achieved through the following technical solution: a multi-party large model joint training method based on federated learning, comprising the following steps:

[0029] (1) Divide the large model to be trained evenly into each computing node of the computing client according to the parameter size, set s as a random seed for all nodes, and initialize the model parameters.

[0030] (2) Each computing client trains a large model using its own private domain data. After completing one round of training, the gradient parameters of each computing node are combined into a complete gradient G. i ; and generate with G i Random number matrices R of the same shape i As one of the sub-secrets of the secret sharing; calculate T i =G i -R i As another sub-secret;

[0031] (3) The secret R i and T i The secrets are sent to the first central server and the second central server respectively, and the sum of the sub-secrets is calculated. and The final updated gradient W = R + T is obtained and sent to each computation client;

[0032] (4) Each computing client divides W into nodes, updates the gradient, and sends it to the corresponding node to complete the model update;

[0033] (5) Repeat steps (2) to (4) until the large model converges or the preset number of iterations is reached.

[0034] Furthermore, the random seed s is randomly generated by either the first central server or the second central server.

[0035] Furthermore, the gradient parameters of each computation node are combined into the complete gradient G. i ; and generate with G i Random number matrices R of the same shape i As one of the sub-secrets of the secret sharing; calculate T i =G i -R i As another sub-secret, it includes:

[0036] Each computing client selects a computing node as the master node, and non-master nodes send their gradient parameters to the master node; the master node combines the gradient parameters of each computing node into the complete gradient G. i and generate with G i Random number matrices R of the same shape i As one of the sub-secrets of the secret sharing, and for calculating T i =G i -R i As another sub-secret.

[0037] Furthermore, the secret R of the sub-secret i and T i The secrets are sent to the first central server and the second central server respectively, and the sum of the sub-secrets is calculated. and The final updated gradient W = R + T is obtained and sent to each computation client, including:

[0038] The T calculated by the second central server is sent to the first central server, and the first central server calculates the final update gradient W and sends it to each computing client. Each computing client selects a computing node as the master node to receive the data.

[0039] Furthermore, the master node of each computing client divides W into node-updated gradients and sends them to the corresponding nodes to complete the model update.

[0040] Furthermore, based on the parameter partitioning in step (1), the master node of each computing client partitions W into corresponding nodes, updates the gradient, and sends it to the corresponding node.

[0041] This invention also provides a multi-party large model joint training device based on federated learning, comprising:

[0042] The parameter partitioning and initialization module is used to evenly divide the large model to be trained into each computing node of the computing client according to the parameter size. All nodes are set to s as a random seed and the model parameters are initialized.

[0043] The model training module is used by each computing client to train a large model using its own private domain data. After one round of training, the gradient parameters of each computing node are combined into a complete gradient G. i ; and generate with G i Random number matrices R of the same shape i As one of the sub-secrets of the secret sharing; calculate T i =G i -R i As another sub-secret;

[0044] The Secret of the Child R i and T i The secrets are sent to the first central server and the second central server respectively, and the sum of the sub-secrets is calculated. and The final updated gradient W = R + T is obtained and sent to each computation client;

[0045] Each computing client divides W into nodes, updates the gradient, and sends it to the corresponding node to complete the model update.

[0046] Repeat the above process until the large model converges or the preset number of iterations is reached.

[0047] The present invention also provides an electronic device, including a memory and a processor, wherein the memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the above-described multi-party large model joint training method based on federated learning.

[0048] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the above-described method for joint training of a multi-party large model based on federated learning.

[0049] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method for joint training of a multi-party large model based on federated learning.

[0050] Compared with the prior art, the beneficial effects of the present invention are:

[0051] 1. Using a dual central server communication architecture, all clients only need to communicate with the central server and do not need to communicate with other clients, thus avoiding security risks to the original data system.

[0052] 2. The secret sharing scheme is simpler. It only requires splitting the secret into two parts and sending them to the central server. Even if some clients crash or communication times out during the sharing process, there is no need to re-share the secret. The current round of updates is completed by aggregating the gradient of currently valid clients, which is more robust.

[0053] 3. In existing technologies, the communication cost for secret sharing between clients is O(n^2). 2 The communication cost of this invention is only O(n).

[0054] 4. This invention enables parallel training of models under the federated learning framework, which can support the training of large models with a large number of parameters. Attached Figure Description

[0055] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0056] Figure 1 is a schematic diagram of a multi-party large model joint training method based on federated learning provided by an embodiment of the present invention;

[0057] Figure 2 is a schematic diagram of a multi-party large model joint training method based on federated learning provided in Embodiment 1 of the present invention;

[0058] Figure 3 is a schematic diagram of a multi-party large model joint training device module based on federated learning provided in an embodiment of the present invention;

[0059] Figure 4 is a schematic diagram of an electronic device structure provided by an embodiment of the present invention. Detailed Implementation

[0060] The present invention will now be described in detail with reference to the accompanying drawings. Unless otherwise specified, the features of the following embodiments and implementations can be combined with each other.

[0061] The present invention provides a multi-party large model joint training method based on federated learning, as shown in Figure 1, comprising the following steps:

[0062] (1) Divide the large model to be trained evenly into each computing node of the computing client according to the parameter size, set s as a random seed for all nodes, and initialize the model parameters.

[0063] (2) Each computing client trains a large model using its own private domain data. After completing one round of training, the gradient parameters of each computing node are combined into a complete gradient G. i ; and generate with G i Random number matrices R of the same shape i As one of the sub-secrets of the secret sharing; calculate T i =G i -R i As another sub-secret;

[0064] (3) The secret R i and T i The secrets are sent to the first central server and the second central server respectively, and the sum of the sub-secrets is calculated. and The final updated gradient W = R + T is obtained and sent to each computation client;

[0065] (4) Each computing client divides W into nodes, updates the gradient, and sends it to the corresponding node to complete the model update;

[0066] (5) Repeat steps (2) to (4) until the large model converges or the preset number of iterations is reached.

[0067] In one embodiment, the random seed s is randomly generated by a first central server or a second central server.

[0068] In one embodiment, the gradient parameters of each computation node are combined to form the complete gradient G. i ; and generate with G i Random number matrices R of the same shape i As one of the sub-secrets of the secret sharing; calculate T i =G i -R i As another sub-secret, it includes:

[0069] Each computing client selects a computing node as the master node, and non-master nodes send their gradient parameters to the master node; the master node combines the gradient parameters of each computing node into the complete gradient G. i and generate with G i Random number matrices R of the same shape i As one of the sub-secrets of the secret sharing, and for calculating T i =G i -R i As another sub-secret.

[0070] In one embodiment, the sub-secret R i and T i The secrets are sent to the first central server and the second central server respectively, and the sum of the sub-secrets is calculated. and The final updated gradient W = R + T is obtained and sent to each computation client, including:

[0071] The second central server calculates T and sends it to the first central server. The first central server then calculates the final update gradient W and sends it to each computing client. Each computing client selects a computing node as the master node to receive the data.

[0072] In one embodiment, the master node of each computing client divides W into node-updated gradients and sends them to the corresponding nodes to complete the model update.

[0073] In one embodiment, based on the parameter partitioning in step (1), the master node of each computing client partitions W into corresponding nodes, updates the gradient, and sends it to the corresponding node.

[0074] Example 1:

[0075] A multi-party large model joint training method based on federated learning includes two central servers Server1 and Server2 and n computing clients Worker1, Worker2, ... Worker n Each computing client has m1, m2...m nodes respectively. n Each computing client selects a computing node as the master node; as shown in Figure 2, this training method includes:

[0076] (1) Server1 generates a random integer s as a seed and sends s and the model type model_type agreed upon by everyone to the master node of all computing clients;

[0077] (2) All computing clients' master nodes formulate a model allocation scheme based on the model type (model_type). The allocation principle is to evenly distribute large models to each computing node according to their parameter sizes. i The allocation scheme is m i Set of model parameter names The master node distributes the random seed `s`, the model type `model_type`, and the set of model parameter names to the corresponding nodes. All nodes set `s` to the random seed, and then initialize the model parameters according to the model type `model_type` and the set of model parameter names, thus obtaining the model parameters. i = 1, 2, ..., n;

[0078] (3) All computing clients use their own private domain data to train the large model. After completing one round of training, the Worker... i m i Each computing node receives a portion of the gradient from the model update. Non-master nodes send their own gradient parameters to the master node, and the master node will... After being sorted by parameter name, they are combined to form the complete gradient G. i ;

[0079] (4) Worker i Master node generation and G i Random number matrices R of the same shape iAs one of the sub-secrets of the secret sharing, calculating T i =G i -R i As another sub-secret, then R i Send to Server1, with T i Send to Server2;

[0080] (5) Server2 calculates the sum of the sub-secrets. Send T to Server1; Server1 calculates the sum of the sub-secrets. Once the final updated gradient W = R + T is obtained, Server1 sends W to the master node of all computing clients.

[0081] (6) Worker i After the master node receives the update gradient W, it follows the model parameter name set in step (2). Divide the gradient update W into node-based gradient updates. The update gradient is then sent to the corresponding node, which, upon receiving the update gradient, completes the model update. i_j =model i_j -w i_j j = 1, 2, ..., m i ;

[0082] (7) Repeat steps (3) to (6) until the large model converges or the preset number of iterations is reached.

[0083] This invention also provides a multi-party large model joint training device based on federated learning, as shown in Figure 3, comprising:

[0084] The parameter partitioning and initialization module is used to evenly divide the large model to be trained into each computing node of the computing client according to the parameter size. All nodes are set to s as a random seed and the model parameters are initialized.

[0085] The model training module is used by each computing client to train a large model using its own private domain data. After one round of training, the gradient parameters of each computing node are combined into a complete gradient G. i ; and generate with G i Random number matrices R of the same shape i As one of the sub-secrets of the secret sharing; calculate T i =G i -R i As another sub-secret;

[0086] The Secret of the Child R i and T i The secrets are sent to the first central server and the second central server respectively, and the sum of the sub-secrets is calculated. and The final updated gradient W = R + T is obtained and sent to each computation client;

[0087] Each computing client divides W into nodes, updates the gradient, and sends it to the corresponding node to complete the model update.

[0088] Repeat the above process until the large model converges or the preset number of iterations is reached.

[0089] It should be noted that the device embodiment shown in this embodiment matches the content of the above method embodiment, and the content of the above method embodiment can be referred to, and will not be repeated here.

[0090] Figure 4 is a schematic diagram of an electronic device structure provided in an embodiment of the present invention. Referring to Figure 4, the electronic device provided in this embodiment includes: a memory and a processor, wherein the memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions. When the program instructions are loaded and executed by the processor, they implement a multi-party large model joint training method based on federated learning according to the present invention. It should be noted that, in addition to the memory and processor shown in Figure 4, the electronic device may also include other hardware according to its actual function, which will not be described in detail here.

[0091] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the above-described method for joint training of a multi-party large model based on federated learning.

[0092] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method for joint training of a multi-party large model based on federated learning.

[0093] The computer-readable storage medium can be an internal storage unit of any data processing device described in any of the foregoing embodiments, such as a hard disk or memory. The computer-readable storage medium can also be any data processing device, such as a plug-in hard disk, smart media card (SMC), SD card, flash card, etc., equipped on the device. Furthermore, the computer-readable storage medium can include both internal storage units of any data processing device and external storage devices. The computer-readable storage medium is used to store the computer program and other programs and data required by the data processing device, and can also be used to temporarily store data that has been output or will be output.

[0094] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0095] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.

[0096] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.

[0097] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.

[0098] The above embodiments are only used to illustrate the design concept and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly. The protection scope of the present invention is not limited to the above embodiments. Therefore, all equivalent changes or modifications made based on the principles and design ideas disclosed in the present invention are within the protection scope of the present invention.

Claims

1. A multi-party large model joint training method based on federated learning, characterized in that, Includes the following steps: (1) Divide the large model to be trained evenly into each computing node of the computing client according to the parameter size, set s as a random seed for all nodes, and initialize the model parameters. (2) Each computing client trains the large model using its own private domain data. After completing a round of training, the gradient parameters of each computing node are combined into a complete gradient G i ; and a random number matrix R i of the same shape as G i is generated as one of the sub-secrets of the secret sharing; T i = G i - R i is calculated as another sub-secret; (3) sending the sub-secrets R i and T i to the first and second central servers, respectively, and calculating the sum of the sub-secrets and The final updated gradient W = R + T is obtained and sent to each computation client; (4) Each computing client divides W into nodes, updates the gradient, and sends it to the corresponding node to complete the model update; (5) Repeat steps (2) to (4) until the large model converges or the preset number of iterations is reached.

2. The multi-party large model joint training method based on federated learning according to claim 1, characterized in that, The random seed s is randomly generated by either the first central server or the second central server.

3. The multi-party large model joint training method based on federated learning according to claim 1, characterized in that, combining the gradient parameters of each computing node into a complete gradient G i ; and generating a random number matrix R of the same shape as G i i as one of the sub-secrets of the secret share; computing T i = G i - R i as the other sub-secret, comprising:​ Each computing client selects one computing node as the master node, and the non-master node sends its gradient parameters to the master node; the master node combines the gradient parameters of each computing node into a complete gradient G i , and generates a random number matrix R i of the same shape as G i as one of the sub-secrets of the secret sharing, and calculates T i = G i - R i as another sub-secret.

4. The multi-party large model joint training method based on federated learning according to claim 1, characterized in that, sending the sub-secret R i and T i to the first central server and the second central server, respectively, computing the sum of the sub-secrets and obtaining a final updated gradient W = R + T and sending it to each computing client, comprising: The T calculated by the second central server is sent to the first central server, and the first central server calculates the final update gradient W and sends it to each computing client. Each computing client selects a computing node as the master node to receive the data.

5. The multi-party large model joint training method based on federated learning according to claim 4, characterized in that, Each computing client's master node divides W into nodes, updates the gradients, and sends them to the corresponding nodes to complete the model update.

6. The multi-party large model joint training method based on federated learning according to claim 5, characterized in that, Based on the parameter partitioning in step (1), the master node of each computing client partitions W into corresponding nodes, updates the gradient, and sends it to the corresponding node.

7. An apparatus for federated learning-based multi-party large model joint training, characterized in that, include: The parameter partitioning and initialization module is used to evenly divide the large model to be trained into each computing node of the computing client according to the parameter size. All nodes are set to s as a random seed and the model parameters are initialized. A model training module is configured to train the large model using the private domain data held by each computing client, and after completing a round of training, combine the gradient parameters of each computing node into a complete gradient G i ; and generate a random number matrix R i of the same shape as G i as one of the sub-secrets of the secret sharing; and calculate T i = G i - R i as another sub-secret; The sub-secrets R i and T i are sent to the first central server and the second central server, respectively, and the sum of the sub-secrets is calculated and The final updated gradient W = R + T is obtained and sent to each computation client; Each computing client divides W into nodes, updates the gradient, and sends it to the corresponding node to complete the model update. Repeat the above process until the large model converges or the preset number of iterations is reached.

8. An electronic device comprising a memory and a processor, characterized in that The memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the multi-party large model joint training method based on federated learning as described in any one of claims 1-6.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, When the program is executed by the processor, it implements a multi-party large model joint training method based on federated learning as described in any one of claims 1-6.

10. A computer program product comprising a computer program, characterized in that, When executed by a processor, the computer program implements a multi-party large model joint training method based on federated learning as described in any one of claims 1-6.