Model aggregation method, system, device and medium based on federated learning

By obtaining client performance indicators and selecting appropriate aggregation algorithms for model aggregation, the problem of complex and slow aggregation process of federated learning models is solved, and the efficiency and capability of model aggregation are improved.

CN113568740BInactive Publication Date: 2024-09-03OPENAILAB
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110804987.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-16
Publication Date
2024-09-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing federated learning model aggregation process is complex and slow. Especially in specific environments, the model aggregation capabilities are low and cannot effectively solve the problem of data islands in small and medium-sized enterprises.

Method used

By obtaining the client's hardware and software performance indicators, the most matching aggregation algorithm is selected for model aggregation to achieve efficient aggregation of models.

Benefits of technology

It speeds up model aggregation, improves model aggregation capabilities in specific environments, and ensures efficient aggregation of client-side training models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113568740B
    Figure CN113568740B
Patent Text Reader

Abstract

The present invention discloses a model aggregation method, system, device and medium based on federated learning. The method is applicable to a management terminal deployed in a distributed network, in which a management terminal and multiple clients are deployed, and includes: obtaining initial training models obtained by training multiple clients and performance indicators of multiple clients; aggregating each initial training model to obtain an aggregated model according to a target aggregation algorithm selected from multiple preset aggregation algorithms and corresponding to the performance indicator. The present invention obtains initial training models obtained by training multiple clients and performance indicators of multiple clients; aggregating each initial training model to obtain an aggregated model according to a target aggregation algorithm selected from multiple preset aggregation algorithms. The method realizes the aggregation of initial training models obtained by training multiple clients based on the performance indicators of the clients, and accelerates the aggregation speed by pre-configuring multiple aggregation algorithms and selecting the algorithm that best matches the client performance indicators for aggregation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a model aggregation method, system, device and medium based on federated learning. Background Art

[0002] As various laws and regulations are gradually improved, the requirements for data security in various industries are gradually increasing. Sensitive data is not suitable for external interaction, but it is hoped that these data can be used for model training. However, the amount of data in small and medium-sized enterprises is not enough to train more accurate models, forming data islands. Federated learning solves the problem of sensitive data interaction, but the accuracy of the models generated by the client varies, resulting in a complex aggregation model process, slow aggregation speed, and low aggregation ability of the model in specific environments. Summary of the invention

[0003] The technical problem to be solved by the present invention is to overcome the defects of the existing aggregation model in the prior art, such as the complex process and slow aggregation speed, and to provide a model aggregation method, system, device and medium based on federated learning.

[0004] The present invention solves the above technical problems through the following technical solutions:

[0005] A first aspect of the present invention provides a model aggregation method based on federated learning, the model aggregation method is applicable to a management terminal deployed in a distributed network, wherein the management terminal and multiple clients are deployed in the distributed network, and the model aggregation method includes:

[0006] Obtaining initial training models obtained by training the multiple clients respectively;

[0007] Obtaining performance indicators of the multiple clients;

[0008] Selecting a target aggregation algorithm corresponding to the performance indicators of the plurality of clients from a plurality of preset aggregation algorithms;

[0009] The initial training models are aggregated according to the target aggregation algorithm to obtain an aggregated model.

[0010] Preferably, the obtaining performance indicators of the plurality of clients includes:

[0011] Obtaining hardware performance indicators of the multiple clients;

[0012] Obtain software performance indicators of the multiple clients.

[0013] Preferably, the obtaining of the hardware performance indicators of the plurality of clients includes:

[0014] The hardware performance indicators of the multiple clients are obtained according to the memory, CPU, storage space and / or power of the multiple clients.

[0015] Preferably, the obtaining of software performance indicators of the plurality of clients includes:

[0016] Software performance indicators of the multiple clients are obtained according to the operating systems, the number of training samples and / or the types of connected networks of the multiple clients.

[0017] Preferably, the selecting a target aggregation algorithm corresponding to the performance indicators of the plurality of clients from a plurality of preset aggregation algorithms includes:

[0018] Obtaining the indicator range to which the performance indicators of the multiple clients belong;

[0019] The target aggregation algorithm is selected from the multiple aggregation algorithms according to the indicator range.

[0020] A second aspect of the present invention provides a model aggregation system based on federated learning, the model aggregation system is applicable to a management terminal deployed in a distributed network, wherein the management terminal and multiple clients are deployed in the distributed network, and the model aggregation system includes a first acquisition module, a second acquisition module, a selection module and an aggregation module;

[0021] The first acquisition module is used to acquire the initial training models obtained by training the multiple clients respectively;

[0022] The second acquisition module is used to acquire the performance indicators of the multiple clients;

[0023] The selection module is used to select a target aggregation algorithm corresponding to the performance indicators of the multiple clients from a plurality of preset aggregation algorithms;

[0024] The aggregation module is used to aggregate the initial training models according to the target aggregation algorithm to obtain an aggregated model.

[0025] Preferably, the second acquisition module includes a first acquisition unit and a second acquisition unit;

[0026] The first acquisition unit is used to acquire hardware performance indicators of the multiple clients;

[0027] The second acquisition unit is used to acquire software performance indicators of the multiple clients.

[0028] Preferably, the first acquisition unit is specifically used to acquire hardware performance indicators of the multiple clients according to the memory, CPU, storage space and / or power of the multiple clients.

[0029] Preferably, the second acquisition unit is specifically used to acquire the software performance indicators of the multiple clients according to the operating systems, the number of training samples and / or the types of connected networks of the multiple clients.

[0030] Preferably, the selection module includes a third acquisition unit and a selection unit;

[0031] The third acquisition unit is used to acquire the indicator range to which the performance indicators of the multiple clients belong;

[0032] The selection unit is used to select the target aggregation algorithm from the multiple aggregation algorithms according to the indicator range.

[0033] A third aspect of the present invention provides a model aggregation method based on federated learning, the model aggregation method is applicable to any client deployed in a distributed network, wherein a management terminal and multiple clients are deployed in the distributed network, and the model aggregation method includes:

[0034] Together with other clients, upload the initial training models obtained through training to the management end, so that after obtaining each of the initial training models, the management end obtains the performance indicators of each of the clients, and selects a target aggregation algorithm corresponding to the performance indicators of the multiple clients from the preset multiple aggregation algorithms, and then aggregates each of the initial training models according to the target aggregation algorithm to obtain an aggregated model.

[0035] Preferably, the model aggregation method further includes:

[0036] When the management terminal is disconnected from the distributed network, at least one client is selected from the multiple clients together with other clients as a new management terminal.

[0037] A fourth aspect of the present invention provides a model aggregation system based on federated learning, the model aggregation system is applicable to any client deployed in a distributed network, wherein a management terminal and multiple clients are deployed in the distributed network, and the model aggregation system includes an upload module;

[0038] The upload module is used to upload the initial training models obtained through training to the management end together with other clients, so that after obtaining each of the initial training models, the management end can obtain the performance indicators of each of the clients, and select a target aggregation algorithm corresponding to the performance indicators of the multiple clients from a plurality of preset aggregation algorithms, and then aggregate each of the initial training models according to the target aggregation algorithm to obtain an aggregated model.

[0039] Preferably, the model aggregation system further includes an election module;

[0040] The election module is used to elect at least one client from the multiple clients as a new management terminal together with other clients after the management terminal is disconnected from the distributed network.

[0041] The fifth aspect of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the model aggregation method based on federated learning as described in the first aspect is implemented, or the model aggregation method based on federated learning as described in the third aspect is executed.

[0042] The sixth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements the model aggregation method based on federated learning as described in the first aspect, or executes the model aggregation method based on federated learning as described in the third aspect.

[0043] The positive and progressive effects of the present invention are:

[0044] The present invention first obtains the initial training models obtained by training multiple clients and the performance indicators of the multiple clients; then selects the target aggregation algorithm corresponding to the performance indicators of the multiple clients from the preset multiple aggregation algorithms; finally, the initial training models are aggregated according to the target aggregation algorithm to obtain the aggregation model. Thus, the initial training models obtained by training multiple clients are aggregated based on the performance indicators of the clients. Since the operating efficiency of the same aggregation algorithm under different performance indicators may be different, the aggregation speed can be accelerated by pre-configuring multiple aggregation algorithms and selecting the algorithm that best matches the client performance indicators for aggregation. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 This is a flowchart of a model aggregation method based on federated learning according to Example 1 of the present invention.

[0046] Figure 2 This is a module diagram of a model aggregation system based on federated learning according to Example 2 of the present invention.

[0047] Figure 3 This is a flowchart of the model aggregation method based on federated learning in Example 3 of the present invention.

[0048] Figure 4 This is a module diagram of a model aggregation system based on federated learning according to Example 4 of the present invention.

[0049] Figure 5 This is a schematic diagram of the structure of an electronic device according to Embodiment 5 of the present invention. DETAILED DESCRIPTION

[0050] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.

[0051] Example 1

[0052] like Figure 1 As shown, this embodiment provides a model aggregation method based on federated learning, which is applicable to a management terminal deployed in a distributed network, wherein a management terminal and multiple clients are deployed in the distributed network. Specifically, the model aggregation method includes:

[0053] Step 101: Obtain initial training models obtained by training multiple clients.

[0054] In this embodiment, the management end pre-creates multiple aggregation instances, for example, the aggregation instance can be an instance of face recognition, voice recognition, etc., or other aggregation instances, and one aggregation instance corresponds to one initial model. When multiple clients need to perform model aggregation for a certain aggregation instance, the management end receives requests from multiple clients to add the aggregation instance, and reviews the requests of multiple clients to join the aggregation instance. After the review is passed, multiple clients download the initial model corresponding to the aggregation instance from the management end, and each trains the initial model to obtain an initial training model, and then multiple clients upload their respective trained initial training models to the management end through protocols such as HTTP (Hypertext Transfer Protocol).

[0055] It should be noted that the client can directly upload the initial training model file to the management end, or upload the initial training model parameters to the management end.

[0056] In this embodiment, the management end can review the requests for adding aggregate instances sent by multiple clients by means of signature authentication. If the signature authentication succeeds, the review is passed; if the signature authentication fails, the review is not passed. Of course, the review can also be conducted by other means, and the review results can be saved in the database and the saved results can be returned.

[0057] Step 102: Obtain performance indicators of multiple clients.

[0058] In this embodiment, the management end receives basic information of multiple clients periodically reported by the multiple clients, and calculates performance indicators of the multiple clients according to the basic information of the multiple clients, so as to provide a decision basis for the scheduling aggregation algorithm.

[0059] In this embodiment, the basic information of the client itself may be the client's power, memory, storage space, CPU (central processing unit), operating system, number of training samples, type of connected network, etc., or other information of the client, which is not specifically limited here.

[0060] Step 103: Select a target aggregation algorithm corresponding to the performance indicators of multiple clients from multiple preset aggregation algorithms.

[0061] In this embodiment, the management end presets multiple basic model aggregation algorithms, for example, the aggregation algorithms include but are not limited to model average aggregation algorithm, BMUF (communication efficient universal distributed optimization) aggregation algorithm, ADMM (alternating direction multiplier method) aggregation algorithm, synchronous SGD (stochastic gradient descent) aggregation algorithm, asynchronous aggregation algorithm, asynchronous SGD aggregation algorithm, AdaDelay (delayed asynchronous) aggregation algorithm, Hogwild (parallel SGD algorithm) aggregation algorithm, exclusion model aggregation algorithm, decentralized aggregation algorithm, etc., and also supports the import of custom aggregation algorithms.

[0062] In this embodiment, the management end selects a target aggregation algorithm corresponding to the performance indicators of the multiple clients from a plurality of preset aggregation algorithms according to the performance indicators of the multiple clients.

[0063] Step 104: Aggregate the initial training models according to the target aggregation algorithm to obtain an aggregated model.

[0064] In this embodiment, after the management end generates the aggregation model, it notifies all the clients participating in the aggregation to download the aggregation model, or download the latest initial training model file or initial training model parameters.

[0065] In this embodiment, the performance indicators of multiple clients obtained by the management end usually belong to the same range. The management end selects a part of the performance indicators from these performance indicators to select an aggregation algorithm, and only uses one aggregation algorithm to aggregate each initial training model.

[0066] In this embodiment, basic information of the aggregation object is saved, such as the name of the aggregation object, unique code, number of aggregations, number of participating clients, aggregation triggering rules (such as the minimum number of devices), aggregation failure rules, selected aggregation process, elected master node (i.e., management end), etc.

[0067] In an implementable solution, step 102 includes: obtaining hardware performance indicators of multiple clients; obtaining software performance indicators of multiple clients.

[0068] In a specific implementation process, hardware performance indicators of multiple clients are obtained according to the memory, CPU, storage space and / or power of the multiple clients.

[0069] In this embodiment, when calculating the hardware performance indicators, the client's memory score accounts for 20%, the CPU score accounts for 30%, the storage space score accounts for 20%, and the power score accounts for 30%. The above score proportions can be set according to actual conditions and are not specifically limited here.

[0070] In a specific implementation process, software performance indicators of multiple clients are obtained according to the operating systems, the number of training samples and / or the types of connected networks of the multiple clients.

[0071] In this embodiment, when calculating the software performance indicators, the client's operating system score accounts for 30% (that is, the iOS (Internet operating system) score accounts for 20% and the Android score accounts for 10% in the operating system), the training sample number score accounts for 40%, and the connected network type score accounts for 70% (that is, 4G is 20% and 5G is 50%). The above score proportions can be set according to actual conditions and are not specifically limited here.

[0072] In this embodiment, the calculation formula for the total hardware indicator score is: total hardware indicator score = (current power / total power)*30%+(current memory / total memory)*20%+(current storage space / total storage space)*20%+number of CPU cores*30%.

[0073] The calculation formula for the total software indicator score is: Total software indicator score = (operating system = 1) * (ios = 20%, Android = 10%) + (number of training samples > 10000 = 1 or number of training samples < 1000 = 0.2) * 40% + (connected network type = 1) * (4G = 20%, 5G = 50%), among which, (operating system = 1) in the formula, 1 is the initial value of the indicator (i.e., operating system).

[0074] In one feasible solution, step 103 includes:

[0075] First, obtain the indicator range to which the performance indicators of multiple clients belong.

[0076] Then, according to the indicator range, the target aggregation algorithm is selected from multiple aggregation algorithms.

[0077] In this embodiment, when the total score of the client's hardware indicators is greater than or equal to 1.5 and the total score of the software indicators is less than or equal to 0.5, it is suitable to select the synchronous aggregation algorithm; when the number of CPU cores*30%>2.0, it is suitable to select the ADMM aggregation algorithm; when (current power / total power)*30%>0.2, it is suitable to select the synchronous SGD aggregation algorithm; when (current memory / total memory)*20%>0.1, it is suitable to select the model average aggregation algorithm; if the scores of each single item (CPU core number, power, memory) do not meet the specified indicator range, the model average aggregation algorithm is selected by default.

[0078] When the client's hardware index score is <= 1.5 and the software index score is >= 0.7, it is suitable to select the asynchronous aggregation algorithm; among them, when the (network type = 1)*(4G = 20%, 5G = 50%) score is > 0.2, it is suitable to select the asynchronous SGD aggregation algorithm; when the (network type = 1)*(4G = 20%, 5G = 50%) score is < 0.1, it is suitable to select the AdaDelay aggregation algorithm; when the (number of training samples > 10000 = 1 or the number of training samples < 1000 = 0.2)*40% score is > 0.3, it is suitable to select the Hogwild aggregation algorithm; if the scores of each single item (operating system, number of training samples, network type) do not meet the specified index range, the asynchronous SGD aggregation algorithm is selected by default.

[0079] It should be noted that if the total score of the client's hardware indicators is high, it is suitable to use the synchronous aggregation algorithm, and if the total score of the software indicators is high, it is suitable to use the asynchronous aggregation algorithm. The higher the number of CPU cores, the stronger the computing power.

[0080] If the client's total hardware index score and total software index score do not meet the specified index range, but are higher than the minimum threshold (0.5 or 0.7), the management end selects the model average aggregation algorithm; if it is lower than the minimum threshold, the exclusion model aggregation algorithm is selected.

[0081] For example, synchronous aggregation algorithms such as the synchronous SGD aggregation algorithm and the model average aggregation algorithm have high requirements on the client's power, memory, storage space, etc., among which power is the main indicator, accounting for 50% of all indicators, [total hardware indicator score = (current power / total power)*30%+(current memory / total memory)*20%+(current storage space / total storage space)*20%+number of CPU cores*30%]. Because it is necessary to wait for all clients to upload the initial training model before performing the aggregation operation, indicators such as CPU, memory, and number of training samples are used to decide the aggregation algorithm for large models.

[0082] This embodiment first obtains the initial training models obtained by training multiple clients and the performance indicators of multiple clients; then selects the target aggregation algorithm corresponding to the performance indicators of multiple clients from the preset multiple aggregation algorithms; finally, aggregates the initial training models according to the target aggregation algorithm to obtain the aggregated model. Thus, the initial training models obtained by training multiple clients are aggregated based on the performance indicators of the clients. Since the operating efficiency of the same aggregation algorithm under different performance indicators may be different, the aggregation speed can be accelerated by pre-configuring multiple aggregation algorithms and selecting the algorithm that best matches the client performance indicators for aggregation.

[0083] Example 2

[0084] like Figure 2As shown, this embodiment provides a model aggregation system based on federated learning, which is suitable for a management terminal deployed in a distributed network, wherein a management terminal and multiple clients are deployed in the distributed network, and the model aggregation system includes a first acquisition module 1, a second acquisition module 2, a selection module 3 and an aggregation module 4.

[0085] The first acquisition module 1 is used to obtain initial training models obtained by training multiple clients respectively.

[0086] In this embodiment, the management end pre-creates multiple aggregation instances, for example, the aggregation instance can be an instance of face recognition, voice recognition, etc., or other aggregation instances, and one aggregation instance corresponds to one initial model. When multiple clients need to perform model aggregation for a certain aggregation instance, the management end receives requests from multiple clients to add the aggregation instance, and reviews the requests of multiple clients to join the aggregation instance. After the review is passed, multiple clients download the initial model corresponding to the aggregation instance from the management end, and each trains the initial model to obtain an initial training model, and then multiple clients upload their respective trained initial training models to the management end through protocols such as HTTP (Hypertext Transfer Protocol).

[0087] It should be noted that the client can directly upload the initial training model file to the management end, or upload the initial training model parameters to the management end.

[0088] In this embodiment, the management end can review the requests for adding aggregate instances sent by multiple clients by means of signature authentication. If the signature authentication succeeds, the review is passed; if the signature authentication fails, the review is not passed. Of course, the review can also be conducted by other means, and the review results can be saved in the database and the saved results can be returned.

[0089] The second acquisition module 2 is used to acquire performance indicators of multiple clients.

[0090] In this embodiment, the management end receives basic information of multiple clients periodically reported by the multiple clients, and calculates performance indicators of the multiple clients according to the basic information of the multiple clients, so as to provide a decision basis for the scheduling aggregation algorithm.

[0091] In this embodiment, the basic information of the client itself may be the client's power, memory, storage space, CPU, operating system, number of training samples, connected network type, etc., or other information of the client, which is not specifically limited here.

[0092] The selection module 3 is used to select a target aggregation algorithm corresponding to the performance indicators of multiple clients from multiple preset aggregation algorithms.

[0093] In this embodiment, the management end presets multiple basic model aggregation algorithms, for example, the aggregation algorithms include but are not limited to model average aggregation algorithm, BMUF aggregation algorithm, ADMM aggregation algorithm, synchronous SGD aggregation algorithm, asynchronous aggregation algorithm, asynchronous SGD aggregation algorithm, AdaDelay aggregation algorithm, Hogwild aggregation algorithm, exclusion model aggregation algorithm, decentralized aggregation algorithm, etc., and also supports the import of custom aggregation algorithms.

[0094] In this embodiment, the management end selects a target aggregation algorithm corresponding to the performance indicators of the multiple clients from a plurality of preset aggregation algorithms according to the performance indicators of the multiple clients.

[0095] The aggregation module 4 is used to aggregate the initial training models according to the target aggregation algorithm to obtain an aggregated model.

[0096] In this embodiment, after the management end generates the aggregation model, it notifies all the clients participating in the aggregation to download the aggregation model, or download the latest initial training model file or initial training model parameters.

[0097] In this embodiment, the performance indicators of multiple clients obtained by the management end usually belong to the same range. The management end selects a part of the performance indicators from these performance indicators to select an aggregation algorithm, and only uses one aggregation algorithm to aggregate each initial training model.

[0098] In this embodiment, basic information of the aggregation object is saved, such as the name of the aggregation object, unique code, number of aggregations, number of participating clients, aggregation triggering rules (such as the minimum number of devices), aggregation failure rules, selected aggregation process, elected master node (i.e., management end), etc.

[0099] In one feasible solution, Figure 2 As shown, the second acquisition module 2 includes a first acquisition unit 21 and a second acquisition unit 22 .

[0100] The first acquisition unit 21 is used to acquire hardware performance indicators of multiple clients.

[0101] The second acquisition unit 22 is used to acquire software performance indicators of multiple clients.

[0102] In a specific implementation process, the first acquisition unit 21 is specifically used to acquire hardware performance indicators of multiple clients according to the memory, CPU, storage space and / or power of the multiple clients.

[0103] In this embodiment, when calculating the hardware performance indicators, the client's memory score accounts for 20%, the CPU score accounts for 30%, the storage space score accounts for 20%, and the power score accounts for 30%. The above score proportions can be set according to actual conditions and are not specifically limited here.

[0104] In a specific implementation process, the second acquisition unit 22 is specifically used to acquire software performance indicators of multiple clients according to the operating systems, the number of training samples and / or the types of connected networks of the multiple clients.

[0105] In this embodiment, when calculating the software performance indicators, the client's operating system score accounts for 30% (that is, the iOS score accounts for 20% and the Android score accounts for 10% in the operating system), the training sample number score accounts for 40%, and the connected network type score accounts for 70% (that is, 4G is 20% and 5G is 50%). The above score proportions can be set according to actual conditions and are not specifically limited here.

[0106] In this embodiment, the calculation formula for the total hardware indicator score is: total hardware indicator score = (current power / total power)*30%+(current memory / total memory)*20%+(current storage space / total storage space)*20%+number of CPU cores*30%.

[0107] The calculation formula for the total software indicator score is: Total software indicator score = (operating system = 1) * (ios = 20%, Android = 10%) + (number of training samples > 10000 = 1 or number of training samples < 1000 = 0.2) * 40% + (connected network type = 1) * (4G = 20%, 5G = 50%), among which, (operating system = 1) in the formula, 1 is the initial value of the indicator (i.e., operating system).

[0108] In one feasible solution, Figure 2 As shown, the selection module 3 includes a third acquisition unit 311 and a selection unit 312 .

[0109] The third acquisition unit 311 is used to acquire the indicator range to which the performance indicators of multiple clients belong.

[0110] The selection unit 312 is used to select a target aggregation algorithm from a plurality of aggregation algorithms according to an indicator range.

[0111] In this embodiment, when the total score of the client's hardware indicators is greater than or equal to 1.5 and the total score of the software indicators is less than or equal to 0.5, it is suitable to select the synchronous aggregation algorithm; when the number of CPU cores*30%>2.0, it is suitable to select the ADMM aggregation algorithm; when (current power / total power)*30%>0.2, it is suitable to select the synchronous SGD aggregation algorithm; when (current memory / total memory)*20%>0.1, it is suitable to select the model average aggregation algorithm; if the scores of each single item (CPU core number, power, memory) do not meet the specified indicator range, the model average aggregation algorithm is selected by default.

[0112] When the client's hardware index score is <= 1.5 and the software index score is >= 0.7, it is suitable to select the asynchronous aggregation algorithm; among them, when the (network type = 1)*(4G = 20%, 5G = 50%) score is > 0.2, it is suitable to select the asynchronous SGD aggregation algorithm; when the (network type = 1)*(4G = 20%, 5G = 50%) score is < 0.1, it is suitable to select the AdaDelay aggregation algorithm; when the (number of training samples > 10000 = 1 or the number of training samples < 1000 = 0.2)*40% score is > 0.3, it is suitable to select the Hogwild aggregation algorithm; if the scores of each single item (operating system, number of training samples, network type) do not meet the specified index range, the asynchronous SGD aggregation algorithm is selected by default.

[0113] It should be noted that if the total score of the client's hardware indicators is high, it is suitable to use the synchronous aggregation algorithm, and if the total score of the software indicators is high, it is suitable to use the asynchronous aggregation algorithm. The higher the number of CPU cores, the stronger the computing power.

[0114] If the client's total hardware index score and total software index score do not meet the specified index range, but are higher than the minimum threshold (0.5 or 0.7), the management end selects the model average aggregation algorithm; if it is lower than the minimum threshold, the exclusion model aggregation algorithm is selected.

[0115] For example, synchronous aggregation algorithms such as the synchronous SGD aggregation algorithm and the model average aggregation algorithm have high requirements on the client's power, memory, storage space, etc., among which power is the main indicator, accounting for 50% of all indicators, [total hardware indicator score = (current power / total power)*30%+(current memory / total memory)*20%+(current storage space / total storage space)*20%+number of CPU cores*30%]. Because it is necessary to wait for all clients to upload the initial training model before performing the aggregation operation, indicators such as CPU, memory, and number of training samples are used to decide the aggregation algorithm for large models.

[0116] This embodiment first obtains the initial training models obtained by training multiple clients and the performance indicators of multiple clients; then selects the target aggregation algorithm corresponding to the performance indicators of multiple clients from the preset multiple aggregation algorithms; finally, aggregates the initial training models according to the target aggregation algorithm to obtain the aggregated model. Thus, the initial training models obtained by training multiple clients are aggregated based on the performance indicators of the clients. Since the operating efficiency of the same aggregation algorithm under different performance indicators may be different, the aggregation speed can be accelerated by pre-configuring multiple aggregation algorithms and selecting the algorithm that best matches the client performance indicators for aggregation.

[0117] Example 3

[0118] This embodiment provides a model aggregation method based on federated learning, which is applicable to any client deployed in a distributed network, wherein a management terminal and multiple clients are deployed in the distributed network, such as Figure 3 As shown, the model aggregation method includes:

[0119] Step 301, upload the initial training models obtained through training to the management end together with other clients, so that after obtaining each initial training model, the management end obtains the performance indicators of each client, and selects a target aggregation algorithm corresponding to the performance indicators of multiple clients from the preset multiple aggregation algorithms, and then aggregates each initial training model according to the target aggregation algorithm to obtain an aggregated model.

[0120] In this embodiment, multiple clients send requests to the management end to add an aggregate instance. After receiving the requests and reviewing them, the multiple clients download the initial model corresponding to the aggregate instance from the management end, and each client trains the initial model to obtain an initial training model. The multiple clients upload the initial training models they have trained to the upper management end through protocols such as HTTP.

[0121] In one feasible solution, Figure 3 As shown, the model aggregation method also includes:

[0122] Step 302: After the management terminal is disconnected from the distributed network, it selects at least one client from multiple clients as a new management terminal together with other clients.

[0123] In this embodiment, after losing the network connection with the management end, the client can elect a new master node (i.e., the management end) for aggregation and send metadata (aggregation instance information, etc.). Specifically, when the original master node fails, one or more master backup nodes are elected from the client to continue to perform the aggregation task.

[0124] This embodiment achieves aggregation of each initial training model by uploading the initial training model obtained by each training to the management terminal together with other clients. When the management terminal is disconnected from the distributed network, it selects at least one client from multiple clients as a new management terminal together with other clients, so that the client can form a network by itself to aggregate models in a small range in a weak network or no network environment, thereby enhancing the model aggregation capability of the client in a specific environment.

[0125] Example 4

[0126] This embodiment provides a model aggregation system based on federated learning, which is applicable to any client deployed in a distributed network, wherein a management terminal and multiple clients are deployed in the distributed network, such as Figure 4 As shown, the model aggregation system includes an uploading module 41.

[0127] The upload module 41 is used to upload the initial training models obtained through respective training to the management end together with other clients, so that after obtaining each initial training model, the management end obtains the performance indicators of each client, and selects a target aggregation algorithm corresponding to the performance indicators of multiple clients from a plurality of preset aggregation algorithms, and then aggregates each of the initial training models according to the target aggregation algorithm to obtain an aggregated model.

[0128] In this embodiment, multiple clients send requests to the management end to add an aggregate instance. After receiving the requests and reviewing them, the multiple clients download the initial model corresponding to the aggregate instance from the management end, and each client trains the initial model to obtain an initial training model. The multiple clients upload the initial training models they have trained to the upper management end through protocols such as HTTP.

[0129] In one feasible solution, Figure 4 As shown, the model aggregation system further includes an election module 42 .

[0130] The election module 42 is used to elect at least one client from multiple clients as a new management terminal together with other clients when the management terminal is disconnected from the distributed network.

[0131] In this embodiment, after losing the network connection with the management end, the client can elect a new master node (i.e., the management end) for aggregation and send metadata (aggregation instance information, etc.). Specifically, when the original master node fails, one or more master backup nodes are elected from the client to continue to perform the aggregation task.

[0132] This embodiment achieves aggregation of each initial training model by uploading the initial training model obtained by each training to the management terminal together with other clients. When the management terminal is disconnected from the distributed network, it selects at least one client from multiple clients as a new management terminal together with other clients, so that the client can form a network by itself to aggregate models in a small range in a weak network or no network environment, thereby enhancing the model aggregation capability of the client in a specific environment.

[0133] Example 5

[0134] Figure 5 A schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the model aggregation method based on federated learning in any one of Embodiments 1 or 3 when executing the computer program. Figure 5 The electronic device 30 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0135] like Figure 5 As shown, the electronic device 30 may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 30 may include, but are not limited to: at least one processor 31, at least one memory 32, and a bus 33 connecting different system components (including the memory 32 and the processor 31).

[0136] The bus 33 includes a data bus, an address bus, and a control bus.

[0137] The memory 32 may include a volatile memory, such as a random access memory (RAM) 321 and / or a cache memory 322 , and may further include a read-only memory (ROM) 323 .

[0138] The memory 32 may also include a program / utility 325 having a set (at least one) of program modules 324, such program modules 324 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0139] The processor 31 executes various functional applications and data processing by running the computer program stored in the memory 32, such as the model aggregation method based on federated learning in any of Embodiments 1 or 3 of the present invention.

[0140] The electronic device 30 may also communicate with one or more external devices 34 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 35. Furthermore, the generated device 30 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 36. Figure 5 As shown, the network adapter 36 communicates with other modules of the model-generated device 30 via the bus 33. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the model-generated device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.

[0141] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.

[0142] Example 6

[0143] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the model aggregation method based on federated learning in any one of Embodiments 1 or 3 is implemented.

[0144] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.

[0145] In a possible implementation, the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the model aggregation method based on federated learning in any one of embodiments 1 or 3.

[0146] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on a user device, partially on a user device, as an independent software package, partially on a user device and partially on a remote device, or entirely on a remote device.

[0147] Although the specific embodiments of the present invention are described above, it should be understood by those skilled in the art that this is only for illustration and the protection scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.

Claims

1. A model aggregation method based on federated learning, the model aggregation method is applicable to a management terminal deployed in a distributed network, wherein the management terminal and multiple clients are deployed in the distributed network, characterized in that: Applied to the management side, the model aggregation method includes: Obtaining initial training models obtained by training the multiple clients respectively; Obtaining performance indicators of the multiple clients includes: Obtaining software performance indicators of the multiple clients; The software performance indicators include the client's operating system, the number of training samples, and the type of network connected; The obtaining of the performance indicators of the plurality of clients further includes: Obtaining hardware performance indicators of the multiple clients includes: Obtain hardware performance indicators of the multiple clients based on the memory, CPU, storage space and power of the multiple clients Selecting a target aggregation algorithm corresponding to the performance indicators of the multiple clients from a plurality of preset aggregation algorithms includes: Obtaining the indicator range to which the performance indicators of the multiple clients belong; According to the indicator range, selecting the target aggregation algorithm from the multiple aggregation algorithms includes: Obtaining a total hardware index score and a total software index score of the client; The calculation formula of the total score of the hardware indicators is: total score of hardware indicators = (current power / total power)*30%+ (current memory / total memory)*20%+ (current storage space / total storage space)*20%+number of CPU cores*30%; The calculation formula of the total score of the software index is: total score of software index = (operating system = 1) * (ios = 20%, Android = 10%) + (number of training samples > 10000 = 1 or number of training samples < 1000 = 0.2) * 40% + (connected network type = 1) * (4G = 20%, 5G = 50%); When the total score of the client's hardware indicators is greater than or equal to 1.5, and the total score of the software indicators is less than or equal to 0.5, the synchronous aggregation algorithm is selected; When the hardware index score of the client is <=1.5 and the software index score is >=0.7, the asynchronous aggregation algorithm is selected; The initial training models are aggregated according to the target aggregation algorithm to obtain an aggregated model.

2. A model aggregation system based on federated learning, wherein the model aggregation system is applicable to a management terminal deployed in a distributed network, wherein the management terminal and multiple clients are deployed in the distributed network, and characterized in that: Applied to the management end, the model aggregation system includes a first acquisition module, a second acquisition module, a selection module and an aggregation module; The first acquisition module is used to acquire the initial training models obtained by training the multiple clients respectively; The second acquisition module is used to acquire the performance indicators of the multiple clients; The second acquisition module includes a second acquisition unit: the second acquisition unit is used to acquire software performance indicators of the multiple clients; wherein the software performance indicators include the operating system of the client, the number of training samples and the type of the connected network; The second acquisition module also includes a first acquisition unit; The first acquisition unit is used to acquire the hardware performance indicators of the multiple clients, and the first acquisition unit is specifically used to acquire the hardware performance indicators of the multiple clients according to the memory, CPU, storage space and power of the multiple clients; The selection module is used to select a target aggregation algorithm corresponding to the performance indicators of the multiple clients from a plurality of preset aggregation algorithms; The selection module includes a third acquisition unit and a selection unit; The third acquisition unit is used to acquire the indicator range to which the performance indicators of the multiple clients belong; The selection unit is used to select the target aggregation algorithm from the multiple aggregation algorithms according to the indicator range, including: Obtaining a total hardware index score and a total software index score of the client; The calculation formula of the total score of the hardware indicators is: total score of hardware indicators = (current power / total power)*30%+ (current memory / total memory)*20%+ (current storage space / total storage space)*20%+number of CPU cores*30%; The calculation formula of the total score of the software index is: total score of software index = (operating system = 1) * (ios = 20%, Android = 10%) + (number of training samples > 10000 = 1 or number of training samples < 1000 = 0.2) * 40% + (connected network type = 1) * (4G = 20%, 5G = 50%); When the total score of the client's hardware indicators is greater than or equal to 1.5, and the total score of the software indicators is less than or equal to 0.5, the synchronous aggregation algorithm is selected; When the hardware index score of the client is <=1.5 and the software index score is >=0.7, the asynchronous aggregation algorithm is selected; The aggregation module is used to aggregate the initial training models according to the target aggregation algorithm to obtain an aggregated model.

3. An electronic 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 model aggregation method based on federated learning as described in claim 1 is implemented.

4. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the model aggregation method based on federated learning as described in claim 1 is implemented.