Federated learning methods, devices, electronic devices, and computer-readable storage media

By using a mechanism to filter local model parameters with high similarity and reputation values ​​in federated learning, the problem of malicious nodes affecting the accuracy of the global model is solved, thereby improving model accuracy and learning efficiency.

CN118052274BActive Publication Date: 2026-11-17CHINA TELECOM CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211379126.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-04
Publication Date
2026-11-17
Estimated Expiration
2042-11-04

AI Technical Summary

Technical Problem

In federated learning, the communication environment of participating nodes is complex and hardware resources are limited, resulting in weak resistance to attacks. They are easily manipulated into malicious nodes that send poisoned data, affecting the accuracy of the global model.

Method used

The central node acquires multiple sets of local model parameters, determines their similarity to the baseline model parameters, selects target local model parameters with similarity greater than the first threshold to generate global model parameters, and filters participating nodes through a reputation value and contribution value mechanism to reduce the impact of malicious nodes.

Benefits of technology

It improves the accuracy of the global model, reduces the impact of malicious nodes on model accuracy, and enhances the efficiency and security of federated learning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118052274B_ABST
    Figure CN118052274B_ABST
Patent Text Reader

Abstract

This disclosure provides a federated learning method, apparatus, electronic device, and computer-readable storage medium, relating to the field of machine learning technology. The method is applied to the central node of a federated learning process and includes: acquiring multiple sets of local model parameters; determining the similarity between each set of local model parameters and the baseline model parameters in the current round of federated learning; determining local model parameters with a similarity greater than a first threshold as target local model parameters; and generating global model parameters based on the target local model parameters. By generating global model parameters based on target local model parameters with a similarity greater than the first threshold from multiple sets of local model parameters, the method can, to some extent, avoid the influence of maliciously reported local model parameters on the global model parameters, thereby reducing the possibility of low global model accuracy due to the influence of malicious nodes and improving the accuracy of the global model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of machine learning technology, and more particularly to a federated learning method, apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] In the field of machine learning technology, federated learning achieves efficient use of data while protecting the data privacy of participating nodes by having a central node and participating nodes collaboratively train the model.

[0003] In related technologies, the central node sends a first global model to the participating nodes. After receiving the first global model from the central node, the participating nodes train locally based on the first global model to obtain a local model. Then, the participating nodes upload their local models to the central node. After receiving the local models from the participating nodes, the central node updates the first global model based on all the local models sent by all participating nodes to obtain a second global model.

[0004] However, the complexity of the communication environment and the limited local hardware resources of the participating nodes result in limited attack resistance, making them vulnerable to manipulation into malicious nodes that send poisoned data to compromise model accuracy. Therefore, using all local models to update the first local model makes the accuracy of the updated second global model susceptible to the influence of malicious nodes.

[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0006] This disclosure provides a federated learning method, apparatus, electronic device, and computer-readable storage medium that overcomes, to at least a certain extent, the problem that the accuracy of global models in related technologies is easily affected by malicious nodes.

[0007] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part by practice of this disclosure.

[0008] According to one aspect of this disclosure, a federated learning method is provided, applied to a central node of federated learning, comprising: acquiring multiple sets of local model parameters; determining the similarity between each set of local model parameters and the baseline model parameters in the current round of federated learning; determining the local model parameters with a similarity greater than a first threshold as target local model parameters; and generating global model parameters based on the target local model parameters.

[0009] In one embodiment of this disclosure, the method further includes: determining the contribution value of each participating node in this round of federated learning.

[0010] In one embodiment of this disclosure, the multiple sets of local model parameters include the target local model parameters and non-target local model parameters; determining the contribution value of the participating nodes in this round of federated learning includes: determining the contribution value of the first participating node that obtained the non-target local model parameters in this round of federated learning as a first value; and determining the contribution value of the second participating node that obtained the target local model parameters in this round of federated learning based on the global model parameters and the target local model parameters.

[0011] In one embodiment of this disclosure, determining the contribution value of the second participating node in this round of federated learning based on the global model parameters and the target local model parameters includes: obtaining test samples; constructing a global model based on the global model parameters; constructing a semi-global model corresponding to each target local model parameter; testing the global model and each semi-global model based on the test samples to obtain a first test result corresponding to the global model and a second test result corresponding to each semi-global model; and determining the contribution value of each second participating node in this round of federated learning based on the first test result and the second test result corresponding to each semi-global model.

[0012] In one embodiment of this disclosure, the number of target local model parameters is multiple; the construction of a semi-global model corresponding to each target local model parameter includes: aggregating other target local model parameters from multiple sets of target local model parameters except for any target local model parameter, obtaining the semi-global model parameter corresponding to any target local model parameter, aggregating multiple times to obtain the semi-global model parameter corresponding to each target local model parameter; and constructing a semi-global model corresponding to each semi-global model parameter.

[0013] In one embodiment of this disclosure, the first test result includes the accuracy obtained by the global model processing the test sample; the second test result corresponding to each half-global model includes the accuracy obtained by the semi-global model processing the test sample; determining the contribution value of each second participating node in this round of federated learning based on the first test result and the second test result corresponding to each half-global model includes: determining the average of the accuracy difference between the global model and each half-global model on each test sample, obtaining multiple average accuracy differences, one average accuracy difference corresponding to one half-global model; and determining the contribution value of each second participating node in this round of federated learning based on the multiple average accuracy differences.

[0014] In one embodiment of this disclosure, determining the contribution value of each second participating node in this round of federated learning based on the plurality of average precision differences includes: determining the ratio of each average precision difference to the sum of the plurality of average precision differences to obtain a plurality of ratios; and using each ratio as the contribution value of the corresponding second participating node in this round of federated learning.

[0015] In one embodiment of this disclosure, generating global model parameters based on the target local model parameters includes: determining the weights of the target local model parameters; and aggregating the target local model parameters according to the weights to obtain the global model parameters.

[0016] In one embodiment of this disclosure, determining the weights of the target local model parameters includes: obtaining a first target contribution value of the second participating node, wherein the first target contribution value is determined by a second target contribution value and a corresponding round difference, and the second target contribution value is the last contribution value obtained by the second participating node in its historical participation in federated learning that is not a first value; and determining the weights of the target local model parameters based on the first target contribution value.

[0017] In one embodiment of this disclosure, the method further includes: subtracting a second value from the reputation value of the first participating node; determining the reputation value of the third participating node participating in the first round of federated learning; and determining the participating nodes participating in the next round of federated learning based on the reputation value of the third participating node.

[0018] In one embodiment of this disclosure, determining the participating nodes for the next round of federated learning based on the reputation value of the third participating node includes: determining the third participating node whose reputation value is greater than a second threshold as the participating node for the next round of federated learning.

[0019] In one embodiment of this disclosure, the target local model parameter is a local model parameter with a similarity greater than a first threshold and less than a third threshold.

[0020] According to another aspect of this disclosure, a federated learning apparatus is provided for use at a central node of federated learning, comprising: an acquisition module for acquiring multiple sets of local model parameters; a determination module for determining the similarity between each set of local model parameters and the baseline model parameters in the current round of federated learning; and a generation module for determining the local model parameters with a similarity greater than a first threshold as target local model parameters, and generating global model parameters based on the target local model parameters.

[0021] In one embodiment of this disclosure, the determining module is further configured to determine the contribution value of the participating nodes in this round of federated learning.

[0022] In one embodiment of this disclosure, the multiple sets of local model parameters include the target local model parameters and non-target local model parameters; the determining module is used to determine that the contribution value of the first participating node that obtains the non-target local model parameters in this round of federated learning is a first value; and to determine the contribution value of the second participating node that obtains the target local model parameters in this round of federated learning based on the global model parameters and the target local model parameters.

[0023] In one embodiment of this disclosure, the determining module is configured to: acquire test samples; construct a global model based on the global model parameters; construct a semi-global model corresponding to each target local model parameter; test the global model and each semi-global model based on the test samples to obtain a first test result corresponding to the global model and a second test result corresponding to each semi-global model; and determine the contribution value of each second participating node in this round of federated learning based on the first test result and the second test result corresponding to each semi-global model.

[0024] In one embodiment of this disclosure, the number of target local model parameters is multiple; the determining module is used to aggregate other target local model parameters in the multiple sets of target local model parameters except for any target local model parameter, to obtain the semi-global model parameter corresponding to the target local model parameter, and to aggregate multiple times to obtain the semi-global model parameter corresponding to each target local model parameter; and to construct the semi-global model corresponding to each semi-global model parameter.

[0025] In one embodiment of this disclosure, the first test result includes the accuracy obtained by the global model processing the test sample; the second test result corresponding to each half-global model includes the accuracy obtained by the half-global model processing the test sample; the determining module is used to determine the average value of the accuracy difference between the global model and each half-global model on each test sample, to obtain multiple average accuracy differences, one average accuracy difference corresponding to one half-global model; and to determine the contribution value of each second participating node in this round of federated learning based on the multiple average accuracy differences.

[0026] In one embodiment of this disclosure, the determining module is used to determine the ratio of each average precision difference to the sum of the plurality of average precision differences, thereby obtaining a plurality of ratios; and to use each ratio as the contribution value of the corresponding second participating node in this round of federated learning.

[0027] In one embodiment of this disclosure, the generation module is used to determine the weights of the target local model parameters; and to aggregate the target local model parameters according to the weights to obtain the global model parameters.

[0028] In one embodiment of this disclosure, the generation module is configured to obtain a first target contribution value of the second participating node, the first target contribution value being determined by a second target contribution value and a corresponding round difference, the second target contribution value being the last contribution value obtained by the second participating node in its historical participation in federated learning that is not a first value; and to determine the weights of the target local model parameters based on the first target contribution value.

[0029] In one embodiment of this disclosure, the apparatus further includes: a processing module for subtracting a second value from the reputation value of a first participating node; the determining module for determining the reputation value of a third participating node participating in the first round of federated learning; and the determining module for determining participating nodes participating in the next round of federated learning based on the reputation value of the third participating node.

[0030] In one embodiment of this disclosure, the determining module is used to determine a third participating node whose reputation value is greater than a second threshold as a participating node to participate in the next round of federated learning.

[0031] In one embodiment of this disclosure, the target local model parameter is a local model parameter with a similarity greater than a first threshold and less than a third threshold.

[0032] According to another aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any of the federated learning methods described above by executing the executable instructions.

[0033] According to another aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements any of the federated learning methods described above.

[0034] According to another aspect of this disclosure, a computer program product is provided, the computer program product comprising a computer program or computer instructions, the computer program or computer instructions being loaded and executed by a processor to enable a computer to implement any of the federated learning methods described above.

[0035] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:

[0036] The technical solution provided in the embodiments of this disclosure involves a central node acquiring multiple sets of local model parameters and then determining the similarity between each set of local model parameters and the baseline model parameters of the current round of federated learning. The similarity between the local model parameters and the baseline model parameters can, to some extent, reflect the likelihood that the participating node that obtained the local model parameters is a malicious node. When the similarity between the local model parameters and the baseline model parameters is low (similarity not greater than a first threshold), it can be considered that the participating node that obtained the local model parameters is more likely to be a malicious node. The method of generating global model parameters based on target local model parameters with a similarity greater than the first threshold among multiple sets of local model parameters can, to some extent, avoid the impact of local model parameters reported by malicious nodes on the global model parameters, thereby reducing the possibility of low global model accuracy due to the influence of malicious nodes and improving the accuracy of the global model.

[0037] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0038] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0039] Figure 1 This diagram illustrates a federated learning system according to an embodiment of the present disclosure;

[0040] Figure 2 This diagram illustrates a flowchart of a federated learning method in one embodiment of the present disclosure.

[0041] Figure 3 This invention discloses a flowchart illustrating a method for determining participating nodes in the next round of federated learning in one embodiment.

[0042] Figure 4 This diagram illustrates the selection of participating nodes from a third participating node to participate in the next round of federated learning, according to one embodiment of this disclosure.

[0043] Figure 5 This diagram illustrates a method for aggregating multiple sets of target local model parameters in one embodiment of the present disclosure.

[0044] Figure 6 This diagram illustrates a method for calculating the contribution value of a second participating node in one embodiment of the present disclosure.

[0045] Figure 7This diagram illustrates the generation of a semi-global model in one embodiment of the present disclosure;

[0046] Figure 8 A flowchart of a federated learning method according to another embodiment of this disclosure is shown;

[0047] Figure 9 A schematic diagram of a federated learning apparatus according to one embodiment of the present disclosure is shown;

[0048] Figure 10 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation

[0049] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0050] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0051] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0052] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0053] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0054] Figure 1The diagram illustrates a federated learning system according to an embodiment of the present disclosure, which can apply the federated learning methods or federated learning devices in various embodiments of the present disclosure.

[0055] like Figure 1 As shown, the federated learning system may include: central node 11 and participating nodes 12.

[0056] In this process, the central node 11 can send initial model parameters (the training model parameters used in this round of federated learning) and convergence conditions to the participating nodes 12. The participating nodes 12 can construct the corresponding initial model based on the initial model parameters, perform local training based on the initial model and convergence conditions, and report the local model parameters obtained after training to the central node 11. The central node 11 can calculate the similarity between the local model parameters and the initial model parameters, aggregate the local model parameters whose similarity meets the preset conditions, and subtract a second value from the reputation value of the participating nodes corresponding to the local model parameters that do not meet the conditions. Each participating node 12 is given an initial reputation value before the first round of federated learning.

[0057] In subsequent rounds of federated learning, central node 11 can select participating nodes to participate in the next round of federated learning based on the reputation value of participating node 12.

[0058] The central node 11 and the participating nodes 12 communicate with each other through a network, which can be a wired network or a wireless network.

[0059] Optionally, the aforementioned wireless or wired networks use standard communication technologies and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to Local Area Networks (LANs), Metropolitan Area Networks (MANs), Wide Area Networks (WANs), mobile, wired or wireless networks, private networks, or any combination of virtual private networks. In some embodiments, technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc., are used to represent data exchanged over the network. Furthermore, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Networks (VPNs), and Internet Protocol Security (IPsec) can be used to encrypt all or some links. In other embodiments, custom and / or dedicated data communication technologies can be used to replace or supplement the aforementioned data communication technologies.

[0060] The central node 11 and participating nodes 12 can be various electronic devices, including but not limited to smartphones, tablets, laptops, desktop computers, wearable devices, augmented reality devices, virtual reality devices, etc.

[0061] The central node 11 and participating nodes 12 can also be servers that provide various services. The servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0062] Those skilled in the art will know that Figure 1 The number of participating nodes 12 is merely illustrative. Depending on actual needs, there can be any number of participating nodes, and this embodiment does not limit this.

[0063] The following detailed description of this exemplary implementation method is provided in conjunction with the accompanying drawings and embodiments.

[0064] This disclosure provides a federated learning method that can be executed by any electronic device with computing capabilities. For example, the electronic device may serve as the central node of the federated learning process.

[0065] Figure 2 A flowchart of a federated learning method according to one embodiment of this disclosure is shown, such as Figure 2 As shown, the federated learning method provided in this embodiment includes the following steps S201 to S203.

[0066] S201, the central node obtains multiple sets of local model parameters.

[0067] In this round of federated learning, the central node sends initial model parameters and convergence conditions to the participating nodes. Upon receiving these parameters, each participating node constructs an initial model based on these parameters and performs local training. After completing local training, each participating node reports its local model parameters to the central node. Upon receiving these local model parameters, the central node acquires multiple sets of local model parameters.

[0068] This embodiment of the disclosure does not impose restrictions on how the participating nodes in this round of federated learning perform local training based on the initial model, and it can be determined according to the task requirements of federated learning. For example, if the round of federated learning is round t, where t is an integer greater than or equal to 2, then the initial model constructed by the participating nodes in this round of federated learning based on the initial model parameters is the global model ω obtained in round t-1 of federated learning. t-1 The k-th participating node in this round of federated learning, according to the requirements of the federated learning task, performs a certain action on ω. t-1 Adjustments are made to obtain the model used for training. Subsequently, the k-th participating node in this round of federated learning obtains the local model for the t-th round of federated learning according to the following formula 1.

[0069]

[0070] Where t is the round of federated learning; η is the learning rate in the stochastic gradient descent algorithm; For the k-th participating node in this round of federated learning, based on... The stochastic gradient value; It is the local model obtained by the k-th participating node in this round of federated learning; where k is an integer greater than or equal to 1 and less than or equal to n, and n represents the number of participating nodes in this round of federated learning.

[0071] S202, the central node determines the similarity between the local model parameters of each group and the baseline model parameters in this round of federated learning.

[0072] The baseline model parameters can be the initial model parameters sent by the central node to the participating nodes in this round of federated learning, or they can be model parameters set by the central node based on historical federated learning tasks for this round of federated learning. This disclosure does not limit how the central node sets the baseline model parameters for this round of federated learning based on historical federated learning tasks. Each set of local model parameters refers to the local model parameters among the multiple sets of local model parameters obtained in S201.

[0073] This disclosure does not limit how the similarity between the local model parameters of each group and the baseline model parameters in this round of federated learning is determined. In some embodiments, the similarity between the local model parameters and the baseline model parameters can be represented by a reference distance between the local model parameters and the baseline model parameters. This disclosure does not limit the method by which the reference distance is calculated. For example, the reference distance can be Euclidean distance or cosine distance.

[0074] Taking the reference distance as the cosine distance and the current round of federated learning as the t-th round of federated learning as an example, the cosine distance between the local model parameters and the baseline model parameters can be calculated according to Formula 2.

[0075]

[0076] Where D is the total number of dimensions of the model trained in federated learning; For local models The d-th parameter among the D parameters included. It is the local model obtained by the k-th participating node in the t-th round of federated learning after local training; The parameter is the d-th parameter among the D parameters included in the baseline model parameters for the t-th round of federated learning.

[0077] Where d takes the value of an integer in the range [1, D]; the baseline model corresponding to the baseline model parameters can be the initial model ω in the t-th round of federated learning. t-1 Similarly, the ω t-1 This is also the global model from the previous round of federated learning. If t is 1, then ω t-1 For ω 0 This is the initial model in the first round of federated learning.

[0078] After obtaining the cosine distance between each local model parameter and the baseline model parameter, this disclosure does not limit how to represent the similarity between each local model parameter and the baseline model parameter based on this cosine distance. For example, the cosine distance between each local model parameter and the baseline model parameter can be directly used as the similarity between each local model parameter and the baseline model parameter; or, the value obtained after mathematically processing the cosine distance between each local model parameter and the baseline model parameter can be used as the similarity between each local model parameter and the baseline model parameter. This disclosure does not limit what kind of mathematical processing is performed on the cosine distance. For example, the data processing is a simple scaling process.

[0079] S203, the central node determines the local model parameters with a similarity greater than the first threshold as the target local model parameters, and generates global model parameters based on the target local model parameters.

[0080] Here, the local model parameters with a similarity greater than the first threshold refer to the local model parameters with a similarity greater than the first threshold among the multiple sets of local model parameters obtained in S201. Therefore, the number of sets of target local model parameters can be one or more.

[0081] In one embodiment, the number of groups of target local model parameters is one group, and the central node uses this group of target local model parameters as global model parameters.

[0082] In another embodiment, the number of target local model parameters is multiple. After the central node calculates the similarity between each group of local model parameters and the baseline model parameters, the multiple groups of target local model parameters with similarity greater than a first threshold are aggregated to obtain global model parameters.

[0083] In another embodiment, after the central node calculates the similarity between each group of local model parameters and the baseline model parameters, it aggregates one or more groups of target local model parameters whose similarity is greater than a first threshold and less than a third threshold to obtain global model parameters. That is, the target local model parameters are the local model parameters among the multiple groups of local model parameters whose similarity is greater than a first threshold and less than a second threshold. Here, the first threshold and the third threshold are set values, and the first threshold is less than the third threshold. The specific values ​​of the first threshold and the third threshold are not limited in this embodiment and can be determined based on the similarity representation method and experience.

[0084] The technical solution provided in the embodiments of this disclosure involves a central node acquiring multiple sets of local model parameters and then determining the similarity between each set of local model parameters and the baseline model parameters of the current round of federated learning. The similarity between the local model parameters and the baseline model parameters can, to some extent, reflect the likelihood that the participating node that obtained the local model parameters is a malicious node. When the similarity between the local model parameters and the baseline model parameters is low (similarity not greater than a first threshold), it can be considered that the participating node that obtained the local model parameters is more likely to be a malicious node. The method of generating global model parameters based on target local model parameters with a similarity greater than the first threshold among multiple sets of local model parameters can, to some extent, avoid the impact of local model parameters reported by malicious nodes on the global model parameters, thereby reducing the possibility of low global model accuracy due to the influence of malicious nodes and improving the accuracy of the global model.

[0085] Furthermore, the higher the similarity between the local model parameters and the baseline model parameters, the lower the contribution of the local model parameters to the global model parameters in this round. If local model parameters with high similarity are used to generate the global model parameters in this round, it will dilute the contribution of other local model parameters with high contribution to the global model parameters. Therefore, selecting target local model parameters with similarity greater than the first threshold and less than the third threshold to generate global model parameters can improve the accuracy of the global model corresponding to the global model parameters to a certain extent, accelerate the convergence of the global model, and improve the efficiency of federated learning.

[0086] After completing one round of federated learning, it is necessary to determine the participating nodes for the next round. Before explaining how to determine the participating nodes for the next round of federated learning, it is necessary to first explain that... Figure 2 In the corresponding embodiment, S201, the obtained multiple sets of local model parameters include target local model parameters and non-target local model parameters. The non-target local model parameters are the other local model parameters besides the target local model parameters in the multiple sets of local model parameters. In this round of federated learning, the participating nodes whose local model parameters obtained after local training are the target local model parameters are the first participating nodes, and the participating nodes whose local model parameters are non-target local model parameters are the second participating nodes.

[0087] Another embodiment of this disclosure provides a method for determining participating nodes to participate in the next round of federated learning, such as... Figure 3 As shown, the method for determining the participating nodes to participate in the next federated learning can include the following steps S301 to S303.

[0088] S301, the central node subtracts the second value from the reputation value of the first participating node.

[0089] The second value is a set value, and the specific size of the second value is not limited in this embodiment. For example, the second value may be 0.5 or 1.

[0090] In one embodiment, all third participating nodes participating in the first round of federated learning have the same initial reputation value. This initial reputation value is a set value, and the specific size of the initial reputation value is not limited in this embodiment; it can be set based on a second value and experience. For example, the initial reputation value is 5. If the local model parameters obtained by a third participating node in the first round of federated learning are non-target local model parameters, the reputation value of the third participating node that obtained non-target local model parameters is reduced by the second value. Taking a second value of 1 and an initial reputation value of 5 as an example, after the first round of federated learning, the reputation value of the third participating node that obtained non-target local model parameters in the first round of federated learning is reduced by 1. That is, when the central node selects participating nodes to participate in the second round of federated learning, the reputation value of the third participating node that obtained target local model parameters in the first round of federated learning is 5, and the reputation value of the third participating node that obtained non-target local model parameters in the first round of federated learning is 4.

[0091] Subsequently, in any round of federated learning, participating nodes can be categorized into first participating nodes and second participating nodes based on the obtained local model parameters. Nodes whose obtained local model parameters are not the target local model parameters are first participating nodes, and nodes whose obtained local model parameters are the target local model parameters are second participating nodes. After each round of federated learning, the reputation value of the first participating node in that round is subtracted from the reputation value of the second participating node.

[0092] S302, the central node determines the reputation value of the third participating node in the first round of federated learning.

[0093] The third participating node is the participating node that participates in the first round of federated learning. Subsequent participating nodes in other rounds are selected from the third participating node.

[0094] In one embodiment, determining the reputation value of a third participating node in the first round of federated learning may include: obtaining the reputation value of each third participating node after the completion of this round of federated learning based on its initial reputation value and the reputation values ​​subtracted from its participation in previous rounds of federated learning. For example, if the initial reputation value is 5, the second reputation value is 1, and this round of federated learning is the third round, and a third participating node obtains local model parameters that are all non-target local model parameters in the first, second, and third rounds of federated learning, then the reputation value of this third participating node when the central node selects a participating node for the fourth round of federated learning is 2.

[0095] S303, the central node determines the participating nodes for the next round of federated learning based on the reputation value of the third participating node.

[0096] In one embodiment, determining the participating nodes for the next round of federated learning based on the reputation value of the third participating node may include: determining third participating nodes with reputation values ​​greater than a second threshold as participating nodes for the next round of federated learning. The second threshold is a set value, and its specific size is not limited in this embodiment. For example, the second threshold may be 0 or 1. Figure 4 As shown, taking a second threshold of 0 as an example, when selecting participating nodes to participate in the next round of federated learning, the reputation value of the third participating node 41 is 0, the reputation value of the third participating node 42 is 1, the reputation value of the third participating node 43 is 0, and the reputation value of the third participating node 44 is 5. Therefore, participating nodes with reputation values ​​greater than 0 are selected to participate in the next round of federated learning, resulting in the third participating node 42 and the third participating node 44 participating in the next round of federated learning.

[0097] This disclosure provides a technical solution through embodiments. By setting an initial reputation value for participating nodes, and subtracting a second value from the reputation value when a participating node performs poorly during federated learning (obtaining local model parameters that are not the target local model parameters), and then selecting participating nodes for the next round of federated learning based on the reputation value, it is possible to gradually eliminate participating nodes with poor quality (whose reputation value does not meet the condition because the local model parameters obtained from multiple rounds of federated learning are not the target local model parameters). This ensures that all participating nodes in federated learning are of good quality. This can, to a certain extent, prevent the impact of local model parameters reported by malicious nodes on the global model parameters, thereby reducing the possibility of low global model accuracy due to the influence of malicious nodes and improving the accuracy of the global model.

[0098] After determining the target local model parameters to be aggregated from multiple sets of local model parameters, the target local model parameters are aggregated to obtain the global model parameters. The number of target local model parameters determined from multiple sets of local model parameters is multiple; however, this disclosure does not limit how to aggregate multiple sets of target local model parameters. In one embodiment, a method for aggregating multiple sets of target local model parameters is provided, such as... Figure 5 As shown, the methods for aggregating multiple sets of target local model parameters include S501 to S502.

[0099] S501, the central node determines the weights of the target local model parameters.

[0100] This disclosure does not limit how the central node determines the weights of the target local model parameters. In one embodiment, the central node determining the weights of the target local model parameters may include: obtaining a first target contribution value of the second participating node, the first target contribution value being determined by a second target contribution value and the corresponding round difference, the second target contribution value being the last contribution value obtained by the second participating node in its historical participation in federated learning that is not a first value; and determining the weights of the target local model parameters based on the first target contribution value.

[0101] The contribution value is calculated by the central node after each participating node completes a round of federated learning, based on their contribution to the accuracy of the global model. If a participating node obtains local model parameters that are not the target local model parameters in a round of federated learning, and these parameters do not participate in generating the global model parameters for that round, then the contribution value obtained by that participating node after completing that round is the first value. If a participating node obtains target local model parameters that are the target local model parameters in a round of federated learning, and these parameters participate in generating the global model parameters for that round, then the contribution value obtained by that participating node after completing that round is a value calculated by the central node that is not the first value. How the central node calculates the contribution values ​​of participating nodes will be discussed in detail later. Figure 6 The corresponding embodiments will be described in detail here, and will not be repeated here.

[0102] In one embodiment, the first value is used to indicate that the local model parameters obtained by the participating node in a round of federated learning are non-target local model parameters; that is, the first value indicates that the participating node did not contribute in that round of federated learning. This disclosure does not limit the specific value of the first value and it can be set empirically. For example, the first value can be 0.

[0103] Taking a scenario where the first value is 0 and this is the third round of federated learning as an example, a second participating node participates in the first, second, and third rounds of federated learning and obtains corresponding contribution values. The contribution value obtained by this second participating node in the first round is A1, in the second round it is A2, and in the third round it is A3. The local model parameters obtained by this second participating node in the second and third rounds are non-target local model parameters; the local model parameters obtained by this second participating node in the first round are target local model parameters. Correspondingly, A2 and A3 are both first values, i.e., both A2 and A3 are 0, while A1 is a value calculated by the central node that is not a first value. The last contribution value obtained by this second participating node in its historical federated learning is A3. Among the non-first values ​​obtained by this second participating node in its historical federated learning, the last contribution value obtained is A1, meaning that the second participating node's second target contribution value is A1.

[0104] In one embodiment, the round difference is the difference between the federated learning round corresponding to the second target contribution value and the round corresponding to the current round of federated learning. For example, if the last contribution value obtained by the second participating node in its historical federated learning that is not the first value corresponds to the first round of federated learning, that is, the round corresponding to the second target contribution value is the first round, and the round corresponding to the current round of federated learning is the fourth round, then the round difference is 3.

[0105] In one embodiment, the first target contribution value is the ratio of the second target contribution value to the round difference. Taking a participating node with a second target contribution value of A1 and a round difference of 3 as an example, the first target contribution value is A1 / 3.

[0106] In another embodiment, there are multiple sets of target local model parameters. Among these multiple sets of target local model parameters, there exists a second participating node corresponding to one or some of the target local model parameters, whose contribution values ​​obtained from historical participation in federated learning are all first values. Then, the target contribution value corresponding to this set or some of the target local model parameters is the smallest first target contribution value among the first target contribution values ​​corresponding to the other target local model parameters in the multiple sets of target local model parameters, excluding this set or some of the target local model parameters.

[0107] In one embodiment, obtaining the first target contribution value of the second participating node may include: obtaining the second target contribution value of the second participating node and the round difference; calculating the ratio of the second target contribution value to the round difference to obtain the first target contribution value.

[0108] In another embodiment, the multiple sets of target local model parameters include one or some target local model parameters, and other target local model parameters besides the one or some target local model parameters. The contribution values ​​of the second participating nodes corresponding to the one or some target local model parameters in historical federated learning are all first values. In this case, obtaining the first target contribution value of the second participating node may include: obtaining the second target contribution value of the second participating node corresponding to the other target local model parameters and the round difference; calculating the ratio of the second target contribution value of the second participating node corresponding to the other target local model parameters and the round difference to obtain the first target contribution value of the second participating node corresponding to the other target local model parameters; and taking the smallest first target contribution value among the first target contribution values ​​of the second participating node corresponding to the other target local model parameters as the first target contribution value of the second participating node corresponding to the one or some target local model parameters.

[0109] In one embodiment, the weights of the target local model parameters can be determined using the first target contribution value according to Formula 3 below.

[0110]

[0111] Where t represents the round of this federated learning, It is the first target contribution value of the second participating node that obtains the k-th group of target local model parameters; M is the number of multiple groups of target local model parameters, which is also the number of second participating nodes that obtain multiple groups of target local model parameters; It represents the weights of the k-th group of target local model parameters when participating in the aggregation to generate the global model for this round of federated learning.

[0112] S502, the central node aggregates the target local model parameters according to the weights to obtain the global model parameters.

[0113] The technical solution provided in this disclosure utilizes the first target contribution value of the second participating node corresponding to the target local model parameters to calculate the weight when the target local model parameters are aggregated to generate global model parameters. This method ensures that the second participating node with a higher contribution in historical federated learning will have a higher weight in the aggregation of its target local model parameters when generating global model parameters. Since the contribution is obtained by the central node based on the contribution of participating nodes to the accuracy of the global model, participating nodes with a higher contribution to the accuracy of the global model in historical federated learning will have a higher weight in the aggregation of their target local model parameters when generating the global model in subsequent rounds. This results in a more accurate global model, accelerates model convergence, and improves the efficiency of federated learning.

[0114] In another embodiment, after multiple participating nodes participate in a round of federated learning, it is necessary to determine the contribution value of each participating node in this round of federated learning. In one embodiment, the multiple sets of local model parameters obtained in S201 include the target local model parameters and non-target local model parameters. Determining the contribution value of each participating node in this round of federated learning may include: determining that the contribution value of the first participating node that obtained the non-target local model parameters is a first value; and determining the contribution value of the second participating node that obtained the target local model parameters in this round of federated learning based on the global model parameters and the target local model parameters. This disclosure does not limit how the central node determines the contribution value of the second participating node that obtained the target local model parameters in this round of federated learning based on the global model parameters and the target local model parameters. Figure 6 As shown, the method for calculating the contribution value of the second participating node provided in this embodiment may include the following steps S601 to S605.

[0115] S 601, the central node acquires test samples.

[0116] This disclosure does not limit how the center obtains the test samples. For example, if the test samples are stored in the memory of the central node, obtaining at least one test sample may include retrieving the at least one test sample from the memory of the central node. As another example, if the test samples are stored in the memory of other devices, obtaining at least one test sample may include retrieving the test sample from the memory of other devices via a network. The number of test samples can be one or more, and this disclosure does not limit this.

[0117] S602, the central node constructs a global model based on global model parameters.

[0118] S603, the central node constructs a semi-global model corresponding to the local model parameters of each target.

[0119] The number of groups of target local model parameters can be multiple or a single group. In one embodiment, the number of groups of target local model parameters is multiple. Constructing a semi-global model corresponding to each target local model parameter may include: aggregating the target local model parameters other than any target local model parameter from multiple groups of target local model parameters to obtain the semi-global model parameter corresponding to any target local model parameter, aggregating multiple times to obtain the semi-global model parameter corresponding to each target local model parameter; and constructing a semi-global model corresponding to each semi-global model parameter.

[0120] The method for aggregating the parameters of other target local models is the same as the method for aggregating target local model parameters to obtain global model parameters. The specific implementation of aggregating target local model parameters to obtain global model parameters is as follows: Figure 5 The corresponding embodiments have already described this, and will not be repeated here. However, in aggregating the target local model parameters to obtain the global model parameters, it is necessary to use the contribution values ​​obtained by the corresponding participating nodes in previous rounds to determine the weights corresponding to each target local model parameter in this round of federated learning. Therefore, the following explanation will begin with the contribution value obtained by the third participating node in the first round of federated learning.

[0121] Taking the first round of federated learning as an example, after multiple third-party participating nodes complete local training and obtain their corresponding local models, these nodes report their local model parameters to the central node. Upon receiving these local model parameters, the central node determines multiple sets of target local model parameters from them. The implementation method for determining these multiple sets of target local model parameters is as follows: Figure 2 The corresponding embodiment S203 has already been described, and will not be repeated here.

[0122] Before the first round of federated learning, the first target contribution value of each third participating node is set by default. The specific value of this set value is not limited in this embodiment; for example, the set value is 1. It should be noted that this set value is only used as the first target contribution value of the third participating node in the first round of federated learning.

[0123] The central node uses the first target contribution value of the third participating node corresponding to the target local model parameters, and determines the weight corresponding to each target local model parameter according to Formula 3 above. Accordingly, the weight of each target local model parameter is 1 / N, where N is the same as the number of sets of target local model parameters in the first round of federated learning. Then, the central node aggregates the multiple sets of target local model parameters using 1 / N as the weight of each target local model parameter to obtain the global model parameters in the first round of federated learning. The central node then constructs the global model based on these global model parameters. Finally, a semi-global model corresponding to each target local model parameter is constructed based on these multiple sets of target local model parameters.

[0124] like Figure 7As shown, taking the first round of federated learning with four sets of target local model parameters as an example, each of these four sets of target local model parameters has a weight of 1 / 4 when aggregated to obtain the global model parameters. These four sets of target local model parameters are target local model parameter 71, target local model parameter 72, target local model parameter 73, and target local model parameter 74. Specifically, the semi-global model parameter 75 corresponding to target local model parameter 71 is obtained by aggregating target local model parameters 72, 73, and 74 with a weight of 1 / 3. The semi-global model parameter 76 corresponding to target local model parameter 72 is obtained by aggregating target local model parameters 71, 73, and 74 with a weight of 1 / 3. The semi-global model parameter 77 corresponding to target local model parameter 73 is obtained by aggregating target local model parameters 71, 72, and 74 with a weight of 1 / 3. The semi-global model parameter 78 corresponding to the target local model parameter 74 is obtained by aggregating the target local model parameters 71, 72, and 73 according to their respective weights of 1 / 3.

[0125] Figure 7 The weight 1 / 3 of each target local model parameter in the aggregation to generate semi-global model parameters is obtained from (1 / 4) / [3×(1 / 4)].

[0126] The central node uses test samples to perform accuracy tests on the global model and multiple semi-global models obtained in the first round of federated learning. This yields the test results for the global model and each semi-global model for each test sample. Taking a test sample consisting of two test samples and multiple semi-global models including four semi-global models as an example, the test results for the global model in each test sample include two accuracy values: C1 and C2. The test results for the first semi-global model in each test sample include two accuracy values: B11 and B12. The test results for the second semi-global model in each test sample include two accuracy values: B21 and B22. The test results for the third semi-global model in each test sample include two accuracy values: B31 and B32. The test results for the fourth semi-global model in each test sample include two accuracy values: B41 and B42.

[0127] Next, calculate the average accuracy difference between the multiple test accuracies of the global model and the multiple test accuracies of each half-global model. Using the same two test samples and four half-global models as an example, the average accuracy difference between these four half-global models and the global model is shown in Formulas 4, 5, 6, and 7.

[0128]

[0129]

[0130]

[0131]

[0132] Among them, P1, P2, P3 and P4 are the average values ​​of the accuracy difference between the first to fourth semi-global models and the global model, respectively.

[0133] Next, based on the average accuracy difference between multiple semi-global models and the global model, the contribution of the second participating node corresponding to the parameters of each target local model in the first round of federated learning is calculated. Taking the average accuracy difference of the four semi-global models as P1, P2, P3, and P4 as an example, the contribution values ​​of these four second participating nodes in the first round of federated learning are shown in Formulas 8, 9, 10, and 11 below.

[0134]

[0135]

[0136]

[0137]

[0138] In this context, G1, G2, G3, and G4 represent the contributions of the first to fourth second participating nodes, corresponding to the four target local model parameters, in the first round of federated learning.

[0139] For example, during the second round of federated learning, it can be based on Figure 5 In the corresponding embodiment, the method described in S501 for obtaining the first target contribution value of the second participating node is used to obtain the first target contribution value of the second participating node in the second round of federated learning. Then, based on this first target contribution value, the aggregation of the global model in the second round of federated learning is completed, and the contribution value of the participating nodes in the second round of federated learning is calculated.

[0140] For example, during the a-th round of federated learning, it is also possible to... Figure 5 In the corresponding embodiment, the method described in S501 for obtaining the first target contribution value of the second participating node is used to obtain the first target contribution value of the second participating node in the a-th round of federated learning. Then, based on this first target contribution value, the aggregation of the global model in the a-th round of federated learning is completed, and the contribution value of the participating nodes in the a-th round of federated learning is calculated. Here, a is an integer greater than or equal to 2.

[0141] After determining the contribution values ​​of participating nodes in other rounds prior to this round of federated learning, it is also possible to... Figure 5 In the corresponding embodiment, the method for obtaining the first target contribution value of the second participating node described in S501 is to obtain the first target i contribution value of each second participating node in this round of federated learning, and then construct a global model and a semi-global model corresponding to the parameters of each target local model based on the first target contribution value.

[0142] S604, the central node tests the global model and each half of the global model based on the test samples, and obtains the first test result corresponding to the global model and the second test result corresponding to each half of the global model.

[0143] The global model is used to process each test sample, yielding a processing result for each sample. Based on this result, the accuracy of the global model for each test sample can be determined. Accordingly, the first test result includes the accuracy obtained by the global model for each test sample in at least one test sample. Each half-global model is then used to process each test sample, yielding a processing result for each half-global model for each test sample. Based on this result, the accuracy obtained by each half-global model for each test sample can be determined. Accordingly, the second test result for each half-global model includes the accuracy obtained by the half-global model for each test sample.

[0144] S605, the central node determines the contribution value of each second participating node in this round of federated learning based on the first test result and the second test result corresponding to each half of the global model.

[0145] In one embodiment, the central node determines the contribution value of each second participating node in this round of federated learning based on the first test result and the second test result corresponding to each half of the global model. This may include: determining the average of the accuracy difference between the global model and each half of the global model on each test sample, obtaining multiple average accuracy differences, with one average accuracy difference corresponding to one half of the global model; and determining the contribution value of each second participating node in this round of federated learning based on the multiple average accuracy differences.

[0146] Among them, the average of the accuracy difference between the global model and each half of the global model on each test sample of at least one test sample is determined, and multiple average accuracy differences can be obtained according to Formula 12.

[0147]

[0148] Where t is the round of this federated learning; ω t This is the global model obtained in this round of federated learning; θ i For the i-th test sample; υ(θ)i ,ω t ) is using ω t For θ i The accuracy obtained through processing; L is the number of test samples included. This is the semi-global model corresponding to the k-th set of target local model parameters among multiple sets of target local model parameters; It is to utilize For θ i The precision obtained through processing; For the semi-global model corresponding to the parameters of the k-th target local model With global model ω t The average accuracy difference between them.

[0149] In one embodiment, the average precision difference between each half of the global model and the global model can be directly used as the contribution value of the second participating node in this round of federated learning for obtaining the target local model parameters corresponding to that half of the global model. In another embodiment, the value after mathematically processing the average precision difference can also be used as the contribution value of the corresponding second participating node in this round of federated learning. The specific mathematical processing method is not limited in this disclosure.

[0150] In one embodiment, the mathematical processing method is to calculate a ratio, and determine the contribution value of each second participating node in this round of federated learning based on multiple average precision differences. This may include: determining the ratio of each average precision difference to the sum of multiple average precisions to obtain multiple ratios; and using each ratio as the contribution value of the corresponding second participating node in this round of federated learning.

[0151] The ratio of each average precision difference to the sum of multiple average precisions is determined, and multiple ratios are obtained, which can be achieved according to the following formula 13.

[0152]

[0153] Where t is the round of federated learning; M is the number of sets of parameters for the target local model. The average precision difference between the semi-global model and the global model corresponding to the k-th set of target local model parameters obtained in the t-th round of federated learning; It is the sum of multiple average precision differences; It is the ratio of the average precision difference between the semi-global model and the global model corresponding to the parameters of the k-th target local model to the sum of multiple average precision differences.

[0154] After obtaining the ratio of the average precision difference between each half of the global model and the global model to the multiple average precision differences, this ratio is used as the contribution value of the corresponding second participating node in this round of federated learning.

[0155] The technical solution provided in this disclosure determines the contribution value of the second participating node corresponding to the target local model parameters in this round of federated learning by calculating the average accuracy difference between the global model obtained in one round of federated learning and each half of the global model. Based on this contribution value, the contribution of each second participating node to the accuracy of the global model in one round of federated learning can be determined. Therefore, the target local model parameters obtained by participating nodes with higher target contribution values ​​in one round of federated learning have higher weights when participating in the aggregation to generate the global model. This results in a higher accuracy global model corresponding to the aggregated global model parameters, accelerating model convergence and improving the efficiency of federated learning.

[0156] To facilitate understanding of the technical solutions provided in the embodiments of this disclosure, the following will be combined with the above. Figure 2 , Figure 3 , Figure 5 and Figure 6 The corresponding embodiments are used to fully illustrate one round of federated learning in the embodiments of this disclosure. For example... Figure 8 As shown, the federated learning method in another embodiment of this disclosure includes the following steps S801 to S809.

[0157] S801, participating nodes report local model parameters.

[0158] S802, the central node determines the similarity between the local model parameters and the baseline model parameters.

[0159] S803, the central node uses the local model parameters that meet the similarity criteria as the target local model parameters, and generates global model parameters based on the target local model parameters. The similarity criteria are defined as either a similarity greater than a first threshold, or a similarity greater than the first threshold and less than a third threshold.

[0160] S804, the central node will subtract the second value from the reputation value of the participating nodes that have obtained the non-target local model parameters.

[0161] S805, the central node determines the contribution value of the first participating node that obtains the non-target local model parameters as the first value.

[0162] S806, the central node calculates the contribution value of the second participating node in this round of federated learning based on the global model parameters and the target local model parameters.

[0163] S807, the central node determines whether the global model has converged. If the global model has converged, the process ends; if the global model has not converged, proceed to S808.

[0164] S808, the central node selects participating nodes for the next round of federated learning based on the current reputation value of the third participating node that participated in the first round of federated learning.

[0165] S809, the central node sends the global model to the participating nodes that will participate in the next round of federated learning, thus starting a new round of federated learning.

[0166] For a detailed implementation of S801 to S809, please refer to [link / reference]. Figure 2 , Figure 3 , Figure 5 and Figure 6 The corresponding implementation examples will not be described in detail here.

[0167] The technical solution provided in the embodiments of this disclosure involves a central node acquiring multiple sets of local model parameters and then determining the similarity between each set of local model parameters and the baseline model parameters of the current round of federated learning. The similarity between the local model parameters and the baseline model parameters can, to some extent, reflect the likelihood that the participating node that obtained the local model parameters is a malicious node. When the similarity between the local model parameters and the baseline model parameters is low (similarity not greater than a first threshold), it can be considered that the participating node that obtained the local model parameters is more likely to be a malicious node. The method of generating global model parameters based on target local model parameters with a similarity greater than the first threshold among multiple sets of local model parameters can, to some extent, avoid the impact of local model parameters reported by malicious nodes on the global model parameters, thereby reducing the possibility of low global model accuracy due to the influence of malicious nodes and improving the accuracy of the global model.

[0168] Based on the same inventive concept, this disclosure also provides a federated learning device, as described in the following embodiments. Since the principle by which this device embodiment solves the problem is similar to that of the above-described method embodiments, the implementation of this device embodiment can refer to the implementation of the above-described method embodiments, and repeated details will not be elaborated further.

[0169] Figure 9 A schematic diagram of a federated learning apparatus according to one embodiment of this disclosure is shown, such as... Figure 9 As shown, the device is applied to the central node of federated learning and includes: an acquisition module 91 for acquiring multiple sets of local model parameters; a determination module 92 for determining the similarity between each set of local model parameters and the baseline model parameters in this round of federated learning; and a generation module 93 for determining local model parameters with a similarity greater than a first threshold as target local model parameters and generating global model parameters based on the target local model parameters.

[0170] In one embodiment of this disclosure, the determining module 92 is further configured to determine the contribution value of the participating nodes in this round of federated learning.

[0171] In one embodiment of this disclosure, multiple sets of local model parameters include target local model parameters and non-target local model parameters; the determining module 92 is used to determine the contribution value of the first participating node that has obtained non-target local model parameters in this round of federated learning as a first value; and to determine the contribution value of the second participating node that has obtained target local model parameters in this round of federated learning based on the global model parameters and the target local model parameters.

[0172] In one embodiment of this disclosure, the determining module 92 is used to obtain test samples; construct a global model based on global model parameters; construct a semi-global model corresponding to each target local model parameter; test the global model and each semi-global model based on the test samples to obtain a first test result corresponding to the global model and a second test result corresponding to each semi-global model; and determine the contribution value of each second participating node in this round of federated learning based on the first test result and the second test result corresponding to each semi-global model.

[0173] In one embodiment of this disclosure, the number of target local model parameters is multiple; the determining module 92 is used to aggregate other target local model parameters in the multiple sets of target local model parameters except for any target local model parameter, to obtain the semi-global model parameter corresponding to any target local model parameter, and to aggregate multiple times to obtain the semi-global model parameter corresponding to each target local model parameter; and to construct the semi-global model corresponding to each semi-global model parameter.

[0174] In one embodiment of this disclosure, the first test result includes the accuracy obtained by the global model processing the test sample; the second test result corresponding to each half of the global model includes the accuracy obtained by the half of the global model processing the test sample; the determination module 92 is used to determine the average value of the accuracy difference between the global model and each half of the global model on each test sample, to obtain multiple average accuracy differences, one average accuracy difference corresponding to one half of the global model; and to determine the contribution value of each second participating node in this round of federated learning based on the multiple average accuracy differences.

[0175] In one embodiment of this disclosure, the determining module 92 is used to determine the ratio of each average precision difference to the sum of multiple average precision differences, thereby obtaining multiple ratios; and to use each ratio as the contribution value of the corresponding second participating node in this round of federated learning.

[0176] In one embodiment of this disclosure, the generation module 93 is used to determine the weights of the target local model parameters; and aggregate the target local model parameters according to the weights to obtain the global model parameters.

[0177] In one embodiment of this disclosure, the generation module 93 is used to obtain a first target contribution value of the second participating node, the first target contribution value being determined by the second target contribution value and the corresponding round difference, the second target contribution value being the last contribution value obtained by the second participating node in the history of participating in federated learning that is not the first value; and to determine the weights of the target local model parameters based on the first target contribution value.

[0178] In one embodiment of this disclosure, the apparatus further includes: a processing module 94, configured to subtract a second value from the reputation value of the first participating node; a determining module 92, further configured to determine the reputation value of the third participating node participating in the first round of federated learning; and the determining module 92, further configured to determine the participating node participating in the next round of federated learning based on the reputation value of the third participating node.

[0179] In one embodiment of this disclosure, the determining module 92 is used to determine a third participating node whose reputation value is greater than a second threshold as a participating node to participate in the next round of federated learning.

[0180] In one embodiment of this disclosure, the target local model parameter is a local model parameter whose similarity is greater than a first threshold and less than a third threshold.

[0181] The technical solution provided in this disclosure obtains multiple sets of local model parameters obtained by participating nodes in this round of federated learning after local training based on initial model parameters, and then determines the similarity between each set of local model parameters and the initial model parameters. The similarity between the local model parameters and the initial model parameters can reflect, to some extent, the probability that the participating node that obtained the local model parameters is a malicious node. When the similarity between the local model parameters and the initial model parameters is low, it can be considered that the participating node that obtained the local model parameters is more likely to be a malicious node. The method of generating global model parameters based on at least one set of target local model parameters with a similarity greater than a first threshold can, to some extent, avoid the influence of local model parameters reported by malicious nodes on global model parameters, thereby reducing the possibility of low accuracy of the global model due to the influence of malicious nodes.

[0182] Furthermore, the higher the similarity between the local model parameters and the initial model parameters, the lower the contribution of the local model parameters to the global model parameters in this round. If local model parameters with high similarity are used to generate the global model parameters in this round, it will dilute the contribution of other local model parameters with high contribution to the global model parameters. Therefore, selecting target local model parameters with similarity greater than the first threshold and less than the second threshold to generate global model parameters can, to some extent, increase the accuracy of the global model corresponding to the global model parameters, accelerate the convergence of the global model, and improve the efficiency of federated learning.

[0183] Those skilled in the art will understand that various aspects of this disclosure can be implemented as systems, methods, or program products. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: entirely in hardware, entirely in software (including firmware, microcode, etc.), or in a combination of hardware and software, collectively referred to herein as “circuit,” “module,” or “system.”

[0184] The following reference Figure 10 To describe an electronic device 1000 according to such an embodiment of the present disclosure. Figure 10 The electronic device 1000 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0185] like Figure 10 As shown, the electronic device 1000 is manifested in the form of a general-purpose computing device. The components of the electronic device 1000 may include, but are not limited to: at least one processing unit 1010, at least one storage unit 1020, and a bus 1030 connecting different system components (including storage unit 1020 and processing unit 1010).

[0186] The storage unit stores program code, which can be executed by the processing unit 1010, causing the processing unit 1010 to perform the steps described in the "Detailed Description" section of this specification according to various exemplary embodiments of this disclosure.

[0187] Storage unit 1020 may include readable media in the form of volatile storage units, such as random access memory (RAM) 1201 and / or cache memory 1202, and may further include read-only memory (ROM) 1203.

[0188] Storage unit 1020 may also include a program / utility 1204 having a set (at least one) program module 1205, such program module 1205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0189] Bus 1030 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the multiple bus structures.

[0190] Electronic device 1000 can also communicate with one or more external devices 1040 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with the electronic device 1000, and / or with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 1050. Furthermore, electronic device 1000 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 1060. Figure 10 As shown, network adapter 1060 communicates with other modules of electronic device 1000 via bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0191] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0192] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the methods described above is stored thereon. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of this disclosure described in the "Detailed Description" section above.

[0193] More specific examples of computer-readable storage media in this disclosure may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0194] In this disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device.

[0195] Optionally, the program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0196] In practical implementation, program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0197] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0198] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0199] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0200] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope of this disclosure is indicated by the appended claims.

Claims

1. A federated learning method, characterized in that, The central nodes used in federated learning include: Obtain multiple sets of local model parameters; Determine the similarity between the parameters of each group of local models and the parameters of the baseline model in this round of federated learning; The local model parameters with similarity greater than a first threshold are determined as target local model parameters, and global model parameters are generated based on the target local model parameters. The step of generating global model parameters based on the target local model parameters includes: Obtain the first target contribution value of the second participating node. The first target contribution value is determined by the second target contribution value and the corresponding round difference. The second target contribution value is the last contribution value obtained by the second participating node in the history of participating in federated learning that is not the first value. Based on the first target contribution value, determine the weights of the target local model parameters; The target local model parameters are aggregated according to their weights to obtain the global model parameters; Wherein, the round difference is the difference between the federated learning round corresponding to the second target contribution value and the round corresponding to the current round of federated learning; the first target contribution value is the ratio of the second target contribution value to the round difference; Wherein, the second participating node is the participating node among the participating nodes participating in federated learning whose local model parameters are the target local model parameters; the first value is used to indicate that the local model parameters obtained by the participating node in one round of federated learning are non-target local model parameters.

2. The method according to claim 1, characterized in that, Also includes: Determine the contribution value of each participating node in this round of federated learning.

3. The method according to claim 2, characterized in that, The multiple sets of local model parameters include the target local model parameters and non-target local model parameters; determining the contribution value of each participating node in this round of federated learning includes: The contribution value of the first participating node that obtained the non-target local model parameters in this round of federated learning is determined to be a first value. Based on the global model parameters and the target local model parameters, the contribution value of the second participating node that obtained the target local model parameters in this round of federated learning is determined.

4. The method according to claim 3, characterized in that, The step of determining the contribution value of the second participating node in this round of federated learning based on the global model parameters and the target local model parameters includes: Obtain test samples; Construct a global model based on the global model parameters; Construct a semi-global model corresponding to the local model parameters of each target; The global model and each half of the global model are tested based on the test samples to obtain the first test result corresponding to the global model and the second test result corresponding to each half of the global model. Based on the first test result and the second test result corresponding to each half of the global model, determine the contribution value of each second participating node in this round of federated learning.

5. The method according to claim 4, characterized in that, The number of target local model parameters is multiple; the construction of the semi-global model corresponding to each target local model parameter includes: Aggregate the target local model parameters other than any target local model parameter from multiple sets of target local model parameters to obtain the semi-global model parameters corresponding to any target local model parameter. Aggregate multiple times to obtain the semi-global model parameters corresponding to each target local model parameter. Construct a semi-global model corresponding to each half of the global model parameters.

6. The method according to claim 4, characterized in that, The first test result includes the accuracy obtained by the global model processing the test sample; the second test result corresponding to each half of the global model includes the accuracy obtained by the half-global model processing the test sample; The step of determining the contribution value of each second participating node in this round of federated learning based on the first test result and the second test result corresponding to each half of the global model includes: The average accuracy difference between the global model and each semi-global model on each test sample is determined to obtain multiple average accuracy differences, with one average accuracy difference corresponding to one semi-global model. Based on the multiple average precision differences, the contribution value of each second participating node in this round of federated learning is determined.

7. The method according to claim 6, characterized in that, The step of determining the contribution value of each second participating node in this round of federated learning based on the multiple average precision differences includes: Determine the ratio of each average precision difference to the sum of the multiple average precision differences to obtain multiple ratios; Each ratio is used as the contribution value of the corresponding second participating node in this round of federated learning.

8. The method according to claim 1, characterized in that, Also includes: Subtract the second value from the reputation value of the first participating node; Determine the reputation value of the third participating node in the first round of federated learning; Based on the reputation value of the third participating node, the participating nodes for the next round of federated learning are determined.

9. The method according to claim 8, characterized in that, The step of determining the participating nodes for the next round of federated learning based on the reputation value of the third participating node includes: The third participating node with a reputation value greater than the second threshold is determined as the participating node to participate in the next round of federated learning.

10. The method according to any one of claims 1-9, characterized in that, The target local model parameters are local model parameters whose similarity is greater than the first threshold and less than the third threshold.

11. A federated learning device, characterized in that, The central nodes used in federated learning include: The acquisition module is used to acquire multiple sets of local model parameters; The determination module is used to determine the similarity between the parameters of each group of local models and the parameters of the baseline model in this round of federated learning; The generation module is used to determine the local model parameters whose similarity is greater than a first threshold as target local model parameters, and generate global model parameters based on the target local model parameters; The generation module is further configured to: obtain a first target contribution value of the second participating node, wherein the first target contribution value is determined by the second target contribution value and the corresponding round difference, and the second target contribution value is the last contribution value obtained by the second participating node in the history of participating in federated learning that is not the first value; Based on the first target contribution value, determine the weights of the target local model parameters; The target local model parameters are aggregated according to their weights to obtain the global model parameters; Wherein, the round difference is the difference between the federated learning round corresponding to the second target contribution value and the round corresponding to the current round of federated learning; the first target contribution value is the ratio of the second target contribution value to the round difference; Wherein, the second participating node is the participating node among the participating nodes participating in federated learning whose local model parameters are the target local model parameters; the first value is used to indicate that the local model parameters obtained by the participating node in one round of federated learning are non-target local model parameters.

12. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the federated learning method according to any one of claims 1 to 10 by executing the executable instructions.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the federated learning method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Federated learning-based data security and credibility sharing method and device

    CN112632013A

  • Federal learning-based client contribution calculation method and device

    CN112926897A

  • Federal learning data processing system

    CN112990478A

  • Data processing system based on transverse federated learning

    CN113077056A