Federal learning method and device, computer equipment and storage medium

By updating the client weight coefficient and completing global model aggregation, the problem of insufficient global fairness in federated learning is solved, the model accuracy and fairness are improved, and the fairness needs of different terminals are met.

CN119312940APending Publication Date: 2025-01-14CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310854745.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-12
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

Existing federated learning technologies are difficult to meet the needs of fair contributions of strong performance terminals and fair results of weak performance terminals, resulting in insufficient global fairness.

Method used

By obtaining the model parameters, model accuracy and model contribution of each client, the client weight coefficient is updated according to the model accuracy and contribution, and the global model aggregation is completed based on the updated weight coefficient and model parameters, improving global fairness and model Accuracy.

Benefits of technology

The accuracy and fairness of the global model are improved, and the fairness of contributions of strong performance terminals and the fairness of results of weak performance terminals are met.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119312940A_ABST
    Figure CN119312940A_ABST
Patent Text Reader

Abstract

The invention relates to a federal learning method and device, computer equipment and a storage medium, and relates to the technical field of machine learning. The method comprises the following steps: in a federated learning process of at least two clients, obtaining current-round model parameters, current-round model accuracy and current-round model contribution reported by the at least two clients based on a current-round global model; determining current-round system parameters according to the accuracy of each current-round model, the contribution of each current-round model and the weight coefficient of the client in the previous round; wherein the current-round system parameters comprise the current-round system accuracy, the current-round result fair value and the current-round contribution fair value; and if the current-round system parameters do not meet the federated learning ending condition, updating the previous-round client weight coefficient by adopting the current-round system parameters to obtain the current-round client weight coefficient, and determining the next-round global model according to each current-round model parameter and the current-round client weight coefficient. According to the invention, the accuracy and the global fairness of the global model are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Compared with other privacy computing technologies such as cryptography-based multi-party secure computing (MPC) and hardware-based trusted execution environment (TEE), federated learning faces the risk of whether the data / model is secure and reliable during the process of exchanging models and updating results.

[0003] To address this challenge, trusted federated learning has been proposed. This is a federated learning method that balances the privacy protection effect and learning efficiency of terminal participants while ensuring the availability of the model. A trusted federated learning must have certain privacy protection and security anti-attack capabilities while meeting the agreed model availability. At the same time, the complexity of the entire machine learning is controllable and the learning efficiency is guaranteed.

[0004] Due to differences in local storage and computing capabilities and local data of terminal devices, different terminals contribute differently to model accuracy after participating in federated training. Terminals with strong performance hope to obtain benefits proportional to their own efforts, that is, the federated learning system is fair to contributions. Terminals with weak performance hope that the model obtained after participating in training will not be biased towards the data and resources of terminals with strong performance, that is, the federated learning system is fair in results.

[0005] Based on this, how to improve the global fairness of federated learning has become a technical problem that needs to be solved urgently. Summary of the invention

[0006] Based on this, it is necessary to provide a federated learning method, apparatus, computer device and storage medium that can improve the global fairness of federated learning in response to the above technical problems.

[0007] In a first aspect, the present application provides a federated learning method, which is applied to a server. The method comprises:

[0008] In the process of federated learning between at least two clients, obtain the current round model parameters, current round model accuracy and current round model contribution reported by at least two clients based on the current round global model;

[0009] Determine the system parameters of this round according to the accuracy of each model in this round, the contribution of each model in this round and the weight coefficient of the client in the previous round; wherein the system parameters of this round include the accuracy of the system in this round, the fair value of the result in this round and the fair value of the contribution in this round;

[0010] If the system parameters of this round do not meet the end conditions of federated learning, the client weight coefficients of the previous round are updated using the system parameters of this round to obtain the client weight coefficients of this round, and the global model of the next round is determined based on the model parameters of each round and the client weight coefficients of this round.

[0011] In one embodiment, determining the current round system parameters according to the accuracy of each current round model, the contribution of each current round model and the weight coefficient of the client in the previous round includes:

[0012] Determine the accuracy of the current round system and the fairness value of the current round results based on the accuracy of each model in this round and the weight coefficient of the client in the previous round;

[0013] The fair value of the contribution of this round is determined according to the contribution amount of each model in this round and the weight coefficient of the client in the previous round.

[0014] In one embodiment, determining the current round system accuracy and the current round result fairness value according to the current round model accuracy and the previous round client weight coefficient includes:

[0015] The weight of each client in the previous round of client weight coefficients is used to weight the accuracy of the model in this round corresponding to each client to obtain the accuracy utility value of each client;

[0016] Based on the Jain fairness index, the fairness value of the result of this round is determined according to the accuracy utility value of each client and the number of clients.

[0017] In one embodiment, determining the fair value of contribution in this round according to the contribution amount of each model in this round and the weight coefficient of the client in the previous round includes:

[0018] Determine the contribution rate of each client in this round according to the contribution of each model in this round;

[0019] Determine the contribution utility value of each client according to the current round contribution rate of each client and the client weight coefficient of the previous round;

[0020] Based on the Jain fairness index, the contribution fairness value of this round is determined according to the contribution utility value of each client and the number of clients.

[0021] In one embodiment, determining the current round contribution rate of each client according to the contribution amount of each current round model includes:

[0022] The ratio of the contribution of each model in this round to the sum of the contribution of each model in this round is taken as the contribution rate of each client in this round.

[0023] In a second aspect, the present application provides a federated learning method, which is applied to a client. The method comprises:

[0024] Determine the client's model parameters, model accuracy, and model contribution based on local sample data and the global model sent by the server.

[0025] The model parameters of this round, the accuracy of this round model and the contribution of this round model are reported to the server, so that the server can determine the system parameters of this round based on the client weight coefficient of the previous round, and the accuracy of this round model and the contribution of this round model reported by each client, and determine the next round of global model according to the client weight coefficient of this round obtained by updating the client weight coefficient of the previous round with the system parameters of this round when the system parameters of this round do not meet the end condition of federated learning.

[0026] In one embodiment, the local sample data includes local training data and local test data; determining the accuracy of the current round model and the contribution of the current round model of the client according to the local sample data and the current round global model sent by the server includes:

[0027] Using the local training data, training the current round global model to obtain the current round local model;

[0028] Determining the accuracy of the local model of the client according to the local test data and the local model of this round;

[0029] The current round model contribution of the client is determined according to the current round global model and the current round local model.

[0030] In one embodiment, determining the current round model contribution of the client according to the current round global model and the current round local model includes:

[0031] The gradient similarity between the current round global model and the current round local model is used as the current round model contribution of the client.

[0032] In a third aspect, the present application also provides a federated learning device, which is applied to a server side. The device includes:

[0033] A data receiving module, used for obtaining the current round model parameters, current round model accuracy and current round model contribution reported by at least two clients based on the current round global model during the process of at least two clients performing federated learning;

[0034] A first determination module is used to determine the system parameters of this round according to the accuracy of each model of this round, the contribution of each model of this round and the weight coefficient of the client of the previous round; wherein the system parameters of this round include the accuracy of the system of this round, the fair value of the result of this round and the fair value of the contribution of this round;

[0035] The model determination module is used to update the client weight coefficient of the previous round using the system parameters of this round to obtain the client weight coefficient of this round if the system parameters of this round do not meet the end conditions of federated learning, and determine the global model of the next round according to the model parameters of each round and the client weight coefficient of this round.

[0036] In a fourth aspect, the present application further provides a federated learning device, which is applied to a client side. The device comprises:

[0037] The second determination module is used to determine the client's current round model parameters, current round model accuracy and current round model contribution according to the local sample data and the current round global model sent by the server;

[0038] A data reporting module is used to report the model parameters of this round, the accuracy of the model of this round and the contribution of the model of this round to the server, so that the server can determine the system parameters of this round based on the client weight coefficient of the previous round, and the accuracy of the model of this round and the contribution of the model of this round reported by each client, and determine the next round of global model according to the client weight coefficient of this round obtained by updating the client weight coefficient of the previous round using the system parameters of this round when the system parameters of this round do not meet the end condition of federated learning.

[0039] In a fifth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0040] In the process of federated learning between at least two clients, obtain the current round model parameters, current round model accuracy and current round model contribution reported by at least two clients based on the current round global model;

[0041] Determine the system parameters of this round according to the accuracy of each model in this round, the contribution of each model in this round and the weight coefficient of the client in the previous round; wherein the system parameters of this round include the accuracy of the system in this round, the fair value of the result in this round and the fair value of the contribution in this round;

[0042] If the system parameters of this round do not meet the end conditions of federated learning, the client weight coefficients of the previous round are updated using the system parameters of this round to obtain the client weight coefficients of this round, and the global model of the next round is determined based on the model parameters of each round and the client weight coefficients of this round.

[0043] Alternatively, when the processor executes the computer program, the following steps are implemented:

[0044] Determine the client's model parameters, model accuracy, and model contribution based on local sample data and the global model sent by the server.

[0045] The model parameters of this round, the accuracy of this round model and the contribution of this round model are reported to the server, so that the server can determine the system parameters of this round based on the client weight coefficient of the previous round, and the accuracy of this round model and the contribution of this round model reported by each client, and determine the next round of global model according to the client weight coefficient of this round obtained by updating the client weight coefficient of the previous round with the system parameters of this round when the system parameters of this round do not meet the end condition of federated learning.

[0046] In a sixth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0047] In the process of federated learning between at least two clients, obtain the current round model parameters, current round model accuracy and current round model contribution reported by at least two clients based on the current round global model;

[0048] Determine the system parameters of this round according to the accuracy of each model in this round, the contribution of each model in this round and the weight coefficient of the client in the previous round; wherein the system parameters of this round include the accuracy of the system in this round, the fair value of the result in this round and the fair value of the contribution in this round;

[0049] If the system parameters of this round do not meet the end conditions of federated learning, the client weight coefficients of the previous round are updated using the system parameters of this round to obtain the client weight coefficients of this round, and the global model of the next round is determined based on the model parameters of each round and the client weight coefficients of this round.

[0050] Alternatively, when the computer program is executed by a processor, the following steps are implemented:

[0051] Determine the client's model parameters, model accuracy, and model contribution based on local sample data and the global model sent by the server.

[0052] The model parameters of this round, the accuracy of this round model and the contribution of this round model are reported to the server, so that the server can determine the system parameters of this round based on the client weight coefficient of the previous round, and the accuracy of this round model and the contribution of this round model reported by each client, and determine the next round of global model according to the client weight coefficient of this round obtained by updating the client weight coefficient of the previous round with the system parameters of this round when the system parameters of this round do not meet the end condition of federated learning.

[0053] In a seventh aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0054] In the process of federated learning between at least two clients, obtain the current round model parameters, current round model accuracy and current round model contribution reported by at least two clients based on the current round global model;

[0055] Determine the system parameters of this round according to the accuracy of each model in this round, the contribution of each model in this round and the weight coefficient of the client in the previous round; wherein the system parameters of this round include the accuracy of the system in this round, the fair value of the result in this round and the fair value of the contribution in this round;

[0056] If the system parameters of this round do not meet the end conditions of federated learning, the client weight coefficients of the previous round are updated using the system parameters of this round to obtain the client weight coefficients of this round, and the global model of the next round is determined based on the model parameters of each round and the client weight coefficients of this round.

[0057] Alternatively, when the computer program is executed by a processor, the following steps are implemented:

[0058] Determine the client's model parameters, model accuracy, and model contribution based on local sample data and the global model sent by the server.

[0059] The model parameters of this round, the accuracy of this round model and the contribution of this round model are reported to the server, so that the server can determine the system parameters of this round based on the client weight coefficient of the previous round, and the accuracy of this round model and the contribution of this round model reported by each client, and determine the next round of global model according to the client weight coefficient of this round obtained by updating the client weight coefficient of the previous round with the system parameters of this round when the system parameters of this round do not meet the end condition of federated learning.

[0060] The above-mentioned federated learning method, apparatus, computer equipment and storage medium obtain the model parameters, model accuracy and contribution of each client in this round during the federated learning process, and determine the accuracy of the system, the fairness value of the result and the contribution fairness value of this round according to the accuracy of the model, the contribution of each model and the weight coefficient of the client in the previous round. The weight coefficient of the client in the previous round is optimized by multi-objective optimization according to the accuracy of the system, the fairness value of the result and the contribution fairness value, and the weight coefficient of the client in this round is obtained. The global model convergence is completed according to the weight coefficient of the client in this round and the model parameters of each client in this round to obtain the global model of the next round. This application improves the accuracy and global fairness of the global model, which not only meets the requirements of strong performance terminals for contribution fairness, but also meets the requirements of weak performance terminals for result fairness. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 is an application environment diagram of a federated learning method in one embodiment;

[0062] Figure 2 1 is a flow chart of a federated learning method in one embodiment;

[0063] Figure 3 A schematic diagram of a process for determining a fair value of a result of this round in an embodiment;

[0064] Figure 4 A schematic diagram of a process for determining a fair value of contribution in this round in one embodiment;

[0065] Figure 5 is a flowchart of a federated learning method in another embodiment;

[0066] Figure 6 A schematic diagram of a process for determining current round model parameters, current round model accuracy, and current round model contribution in one embodiment;

[0067] Figure 7 is a flowchart of a federated learning method in another embodiment;

[0068] Figure 8 is a structural block diagram of a federated learning device in one embodiment;

[0069] Fig. 9 is a structural block diagram of a federated learning device in another embodiment;

[0070] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0072] As mentioned in the background technology, the existing technology cannot simultaneously meet the needs of performance-strong terminals in federated learning for contribution fairness and the needs of performance-weak terminals for result fairness. Although some existing technologies, including terminal contribution measurement, resource pre-allocation, introduction of reputation mechanism, dynamic selection of participating terminal clients, dynamic adjustment of global model convergence weights, and personalized federated learning, can improve the fairness of federated learning from the perspective of contribution fairness or result fairness. However, these methods only consider fairness from a single perspective, or need to sacrifice model accuracy, or need to sacrifice terminal client privacy, and cannot enable all terminal clients to obtain models with good performance, or cannot incentivize participating terminals to cooperate in a long-term and stable manner. In addition, in the edge federated learning scenario, the storage and computing resources of the terminal client are limited, and the existing data-based terminal contribution measurement method cannot balance the relationship between fairness and resource overhead.

[0073] Based on this, the present application proposes a federated learning method, apparatus, computer device and storage medium. During the federated learning process, the model parameters, model accuracy and model contribution of each client are obtained, the client weight coefficient is updated according to the model accuracy and model contribution, and the global model convergence is completed based on the updated client weight coefficient and the model parameters of each client to obtain a new round of global model, so as to improve the global fairness of federated learning and the accuracy of the model.

[0074] The federated learning method or device provided in the embodiments of the present application can be applied to Figure 1 In the application environment shown. Figure 1 As shown, the application environment includes: an unlimited number of servers 110 and terminal devices 120, and the servers 110 and the terminal devices 120 are communicatively connected via a network 130.

[0075] The server 110 may be the following server, and the client 120 may be installed on the following terminal device.

[0076] The terminal device may be any electronic device, including but not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a wearable device, an augmented reality device, a virtual reality device, etc. Optionally, the client of the application installed in different terminal devices is the same, or the client of the same type of application based on different operating systems. Based on the different terminal platforms, the specific form of the client of the application may also be different, for example, the application client may be a mobile client, a PC client, etc.

[0077] The server can be a server that provides various services, such as a background management server that provides support for the devices operated by users using terminal devices. The background management server can analyze and process the received request and other data, and feed back the processing results to the terminal device. Optionally, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this disclosure.

[0078] The network 130 can be a wireless network or a wired network, and the wireless network or wired network uses standard communication technology and / or protocols. The network is usually the Internet, but it can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or any combination of a virtual private network). In some embodiments, technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. are used to represent data exchanged through the network. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec), etc. can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above data communication technologies.

[0079] Those skilled in the art will know that Figure 1 The number of servers, terminal devices and networks in the embodiment is only for illustration, and any number of servers, terminal devices and networks may be provided according to actual needs, and the present application embodiment does not limit this.

[0080] The implementation methods of the present application are described in detail below with reference to the accompanying drawings and examples.

[0081] In one embodiment, Figure 2 As shown, a federated learning method is provided, which is applied to Figure 1 The server in the example is used to illustrate the following steps:

[0082] S202, in the process of at least two clients performing federated learning, obtain current-round model parameters, current-round model accuracy, and current-round model contribution reported by at least two clients based on the current-round global model.

[0083] Among them, a client is installed on each terminal device participating in federated learning. The client is used to determine the model parameters, model accuracy and contribution of this round of model according to the global model and local sample data of this round. The model parameters of this round are the model parameters of the local model of this round trained by the client based on the global model of this round and local training data sent by the server. The local model accuracy is the similarity between the output result of the local model of this round trained by the client and the actual result. The contribution of this round of model is the similarity between the local model of this round trained by the client and the global model of this round sent by the server.

[0084] Optionally, during the process of federated learning between at least two clients, the server sends the global model of this round to each client. After receiving the global model of this round, the client trains the local model based on the global model of this round and local test data to obtain the local model of this round, and uses the model parameters of the local model of this round as the model parameters of this round; the client uses local test data to input into the local model of this round to determine the accuracy of the model of this round; the client calculates the similarity between the local model of this round and the global model of this round to obtain the contribution of the model of this round; the client reports the model parameters of this round, the accuracy of this round and the contribution of this round to the server, so that the server obtains the model parameters of this round, the accuracy of this round and the contribution of this round reported by at least two clients based on the global model of this round during the process of federated learning between at least two clients.

[0085] S204, determining the system parameters of this round according to the accuracy of each model of this round, the contribution of each model of this round and the weight coefficient of the client of the previous round; wherein the system parameters of this round include the system accuracy of this round, the fair value of the result of this round and the fair value of the contribution of this round.

[0086] Optionally, the system parameters of this round are determined according to the accuracy of each model in this round, the contribution of each model in this round and the weight coefficient of the client in the previous round, including: determining the system accuracy of this round and the fair value of this round results according to the accuracy of each model in this round and the weight coefficient of the client in the previous round; determining the fair value of this round contribution according to the contribution of each model in this round and the weight coefficient of the client in the previous round.

[0087] S206: If the system parameters of this round do not meet the end conditions of federated learning, the client weight coefficients of the previous round are updated using the system parameters of this round to obtain the client weight coefficients of this round, and the global model of the next round is determined based on the model parameters of each round and the client weight coefficients of this round.

[0088] Among them, the end condition of federated learning can be that the maximum parameter in the current round of system parameters is the same as the set value. For example, when the maximum parameter in the current round of system parameters is the current round of system accuracy, if the current round of system accuracy is the same as the set value, it is determined that the end condition of federated learning is met, otherwise it is determined that the end condition of federated learning is not met. Alternatively, the end condition of federated learning can be that each parameter in the current round of system parameters is greater than the set value. For example, if the current round of system accuracy, the current round of result fairness value and the current round of contribution fairness value are all greater than the set value, it is determined that the end condition of federated learning is met, otherwise it is determined that the end condition of federated learning is not met. The set value can be any value that can be set freely, for example, the set value is 90%, 85%, 83% or 75%, etc.

[0089] Optionally, the client weight coefficient of the previous round is updated using the system parameters of this round to obtain the client weight coefficient of this round, and the client weight coefficient of this round is obtained by performing multi-objective optimization on the client weight coefficient of the previous round based on the model parameters of this round and the client weight coefficient of this round, including: taking the system accuracy of this round, the fair value of the result of this round and the fair value of the contribution of this round as constraints, to obtain the client weight coefficient of this round For example, the constraint condition is set as maxF(Υ)=max[f1(Υ),f2(Υ),f3(Υ)], where f2(Υ)∈[1 / M,1], f3(Υ)∈[1 / M,1], f1(Υ) is the accuracy of the system in this round, f2(Υ) is the fair value of the result in this round, and f3(Υ) is the fair value of the system contribution. The expressions of f1(Υ), f2(Υ) and f3(Υ) are as follows:

[0090]

[0091]

[0092]

[0093] in, is the accuracy utility value of the i-th client in the t-th round; The client weight of the i-th client in round t-1; is the model accuracy of the i-th client in the t-th round. When this round is the t-th round, is the model accuracy of the i-th client in this round; M is the number of clients participating in federated learning in this round; is the contribution utility value of the i-th client in the t-th round.

[0094] Finally, the server aggregates the global model according to the weight coefficient of the client in this round and the parameters of each model in this round to obtain the global model for the next round, as shown in formula (4):

[0095]

[0096] Among them, when this round is the tth round, ω t is the next round of global model, is the local model of the i-th client in this round.

[0097] In this embodiment, during the federated learning process, the model parameters, model accuracy and contribution of each client are obtained. According to the accuracy of each client's model, the contribution of each client's model and the weight coefficient of the previous round, the accuracy of the system, the fair value of the result and the fair value of the contribution are determined. The weight coefficient of the client in the previous round is optimized by multi-objective optimization according to the accuracy of the system, the fair value of the result and the fair value of the contribution, and the weight coefficient of the client in the current round is obtained. According to the weight coefficient of the client in the current round and the model parameters of each client in the current round, the global model convergence is completed to obtain the global model of the next round. This application improves the accuracy and global fairness of the global model, which not only meets the requirements of strong performance terminals for contribution fairness, but also meets the requirements of weak performance terminals for result fairness.

[0098] In one embodiment, this embodiment provides an optional way to determine the fair value of the result of this round, such as Figure 3 As shown, according to the accuracy of each model in this round and the weight coefficient of the client in the previous round, determining the accuracy of the system in this round and the fairness value of the result in this round may include the following steps:

[0099] S302, using the weight of each client in the client weight coefficient of the previous round, weighting the accuracy of the model of this round corresponding to each client, to obtain the accuracy utility value of each client.

[0100] Among them, the accuracy utility value of the target client is the product of the client weight of the target client in the previous round of client weight coefficients and the current round model accuracy of the target client.

[0101] Optionally, the accuracy utility value of the client can be determined by the following formula (5):

[0102]

[0103] S304, based on the Jain fairness index, according to the accuracy utility value of each client and the number of clients, determine the fairness value of the result of this round.

[0104] Optionally, based on the Jain fairness index, according to the accuracy utility value of each client and the number of clients, the fairness value of the result of this round is determined, including: the fairness value of the result of this round can be determined by the following formula (6):

[0105]

[0106] in, The fair value of the result of this round.

[0107] Optionally, determining the accuracy of the system in this round and the fairness value of the results in this round based on the accuracy of each model in this round and the weight coefficient of the client in the previous round can include: using the weight of each client in the client weight coefficient of the previous round to weight the accuracy of the model in this round corresponding to each client to obtain the weighted accuracy of each client in this round; and taking the sum of the weighted accuracy of each client in this round as the system accuracy in this round.

[0108] In one embodiment, this embodiment provides an optional method for determining the fair value of the contribution of this round, such as Figure 4 As shown, according to the contribution amount of each model in this round and the weight coefficient of the client in the previous round, determining the fair value of the contribution in this round may include the following steps:

[0109] S402, determining the current round contribution rate of each client according to the contribution amount of each current round model.

[0110] Optionally, determining the current round contribution rate of each client according to the contribution amount of each current round model includes: taking the ratio of the contribution amount of each current round model to the sum of the contribution amounts of each current round model as the current round contribution rate of each client. For example, the current round contribution rate of each client is determined by the following formula (7):

[0111]

[0112] Among them, F i t is the contribution rate of the i-th client in the t-th round; is the model contribution of the i-th client in the t-th round. When this round is the t-th round, The contribution of the i-th client to the model in this round.

[0113] S404: Determine the contribution utility value of each client according to the current round contribution rate of each client and the client weight coefficient of the previous round.

[0114] The contribution utility value of the target client is the product of the target client's contribution rate in this round and the client weight of the target client in the previous round's client weight coefficient.

[0115] Optionally, the contribution utility value of each client can be determined by the following formula (8):

[0116]

[0117] S406, based on the Jain fairness index, according to the contribution utility value of each client and the number of clients, determine the contribution fairness value of this round.

[0118] Optionally, based on the Jain fairness index, according to the contribution utility value of each client and the number of clients, the contribution fairness value of this round is determined, including: the contribution fairness value of this round can be determined by the following formula (9):

[0119]

[0120] in, Contribute fair value to this round.

[0121] In one embodiment, Figure 5 As shown, a federated learning method is provided, which is applied to Figure 1 The following steps are taken as an example, taking the terminal device in the example or the client installed on the terminal device as an example:

[0122] S502, determining the client's current round model parameters, current round model accuracy and current round model contribution based on the local sample data and the current round global model sent by the server.

[0123] Among them, the local sample data is the data used to train the local model of this round and test the local model of this round.

[0124] S504, reporting the current round model parameters, the current round model accuracy and the current round model contribution to the server.

[0125] The server determines the system parameters of this round based on the client weight coefficients of the previous round, as well as the accuracy and contribution of the model reported by each client. If the system parameters of this round do not meet the end conditions of federated learning, the server determines the next round of global model based on the client weight coefficients obtained by updating the client weight coefficients of the previous round using the system parameters of this round.

[0126] In this embodiment, during the federated learning process, the model parameters, model accuracy and contribution of each client are obtained. According to the accuracy of each client's model, the contribution of each client's model and the weight coefficient of the previous round, the accuracy of the system, the fair value of the result and the fair value of the contribution are determined. The weight coefficient of the client in the previous round is optimized by multi-objective optimization according to the accuracy of the system, the fair value of the result and the fair value of the contribution, and the weight coefficient of the client in the current round is obtained. According to the weight coefficient of the client in the current round and the model parameters of each client in the current round, the global model convergence is completed to obtain the global model of the next round. This application improves the accuracy and global fairness of the global model, which not only meets the requirements of strong performance terminals for contribution fairness, but also meets the requirements of weak performance terminals for result fairness.

[0127] In one embodiment, when the local sample data includes local training data and local test data, this embodiment provides an optional method for determining the current round model parameters, the current round model accuracy and the current round model contribution, such as Figure 6 As shown, according to the local sample data and the global model of this round sent by the server, determining the accuracy of the client's current round model and the contribution of the current round model may include the following steps:

[0128] S602, using local training data to train the current round global model to obtain the current round local model.

[0129] Optionally, the global model of this round can be trained with local training data by the following formula (10) to obtain the local model of this round:

[0130]

[0131] Among them, ω t-1 is the global model of this round, η is the learning rate in the stochastic gradient descent algorithm, For the i-th client, this round of learning is based on the global model ω of this round t-1 The random gradient value of .

[0132] S604: Determine the accuracy of the local model of the client based on the local test data and the local model of this round.

[0133] Optionally, the accuracy of the local model is calculated based on the local test data to obtain the local model accuracy.

[0134] S606: Determine the client's model contribution for this round based on the global model for this round and the local model for this round.

[0135] Optionally, the contribution of the client's current round model is determined based on the current round global model and the current round local model, including: taking the gradient similarity between the current round global model and the current round local model as the client's current round model contribution. For example, the cosine similarity between the first gradient of the current round global model and the second gradient of the current round local model is calculated to obtain the gradient similarity between the current round global model and the current round local model, and the gradient similarity is taken as the current round model contribution. The current round model contribution can be determined by the following formula (11):

[0136]

[0137] Among them, when this round is the tth round, Contribution to this round of model; is the gradient of the local model of the i-th client in this round, that is, the second gradient; ω t-1 is the gradient of the global model in this round, which is also the first gradient.

[0138] It should be noted that in order to prevent the leakage of local data of the client, this application adopts a distributed contribution calculation method. For some clients with higher privacy requirements, it can be combined with auxiliary technologies such as DP (Differential Privacy) or multi-party security technology to perform global model convergence to avoid directly uploading local gradients to leak privacy. The client's contribution evaluation method includes two types of methods: data-based and model-based. Among them, data-based methods such as the classic Shapley value method require large additional calculation and communication overhead, which is not friendly to clients with limited storage and computing resources. Therefore, this application mainly adopts a model-based method, specifically a method for calculating the cosine similarity between models.

[0139] For example, this embodiment provides an optional implementation process based on the above embodiment, see Figure 7 The flowchart of another federated learning method shown in FIG. 1 includes the following steps:

[0140] S702, in the process of at least two clients performing federated learning, obtain current round model parameters, current round model accuracy, and current round model contribution reported by at least two clients based on the current round global model.

[0141] S704, determining the system parameters of this round according to the accuracy of each model of this round, the contribution of each model of this round and the weight coefficient of the client of the previous round; wherein the system parameters of this round include the accuracy of the system of this round, the fair value of the result of this round and the fair value of the contribution of this round.

[0142] S706, determine whether the system parameters of this round meet the end conditions of federated learning, if not, execute S708, if yes, execute S710.

[0143] S708, use the system parameters of this round to update the client weight coefficients of the previous round to obtain the client weight coefficients of this round, and determine the global model of the next round based on the model parameters of each round and the client weight coefficients of this round, and use the global model of the next round as the global model of this round, send it to each client, and jump to execute S702.

[0144] S710, end, input the global model of this round.

[0145] The specific process of S702-S710 can refer to the description of the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0146] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0147] Based on the same inventive concept, the embodiment of the present application also provides a federated learning device for implementing the above-mentioned federated learning method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more federated learning device embodiments provided below can refer to the above-mentioned limitations on the federated learning method, which will not be repeated here.

[0148] In one embodiment, Figure 8 As shown, a federated learning device is provided, which is applied to a server side and includes:

[0149] The data receiving module 810 is used to obtain the current round model parameters, current round model accuracy and current round model contribution reported by at least two clients based on the current round global model during the process of at least two clients performing federated learning;

[0150] The first determination module 820 is used to determine the system parameters of this round according to the accuracy of each model of this round, the contribution of each model of this round and the weight coefficient of the client of the previous round; wherein the system parameters of this round include the accuracy of the system of this round, the fair value of the result of this round and the fair value of the contribution of this round;

[0151] The model determination module 830 is used to update the client weight coefficient of the previous round using the system parameters of this round to obtain the client weight coefficient of this round if the system parameters of this round do not meet the end conditions of federated learning, and determine the global model of the next round based on the model parameters of this round and the client weight coefficient of this round.

[0152] In one of the embodiments, the first determination module 820 includes a result determination unit and a contribution determination unit;

[0153] The result determination unit is used to determine the accuracy of the current round system and the fairness value of the current round result according to the accuracy of each current round model and the weight coefficient of the previous round client;

[0154] The contribution determination unit is used to determine the fair value of the contribution of this round according to the contribution amount of each model in this round and the weight coefficient of the client in the previous round.

[0155] In one of the embodiments, the result determination unit includes an accuracy determination subunit and a result determination subunit;

[0156] The subunit is accurately determined to adopt the weight of each client in the weight coefficient of the client in the previous round, and weight the accuracy of the model in this round corresponding to each client to obtain the accuracy utility value of each client;

[0157] The result determination subunit is used to determine the fairness value of the result of this round based on the Jain fairness index, according to the accuracy utility value of each client and the number of clients.

[0158] In one of the embodiments, the contribution determination unit includes a contribution rate subunit and a contribution utility subunit and a contribution fairness subunit;

[0159] The contribution rate subunit is used to determine the contribution rate of each client in this round according to the contribution amount of each model in this round.

[0160] The contribution utility subunit is used to determine the contribution utility value of each client according to the contribution rate of each client in this round and the weight coefficient of the client in the previous round.

[0161] The contribution fairness subunit is used to determine the contribution fairness value of this round based on the Jain fairness index, according to the contribution utility value of each client and the number of clients.

[0162] In one embodiment, the contribution rate subunit is further used to use the ratio of the contribution amount of each current round model to the sum of the contribution amounts of each current round model as the current round contribution rate of each client.

[0163] In one embodiment, Fig. 9 As shown, another federated learning device is provided, which is applied to the client side and includes:

[0164] The second determination module 910 is used to determine the client's current round model parameters, current round model accuracy and current round model contribution according to the local sample data and the current round global model sent by the server;

[0165] The data reporting module 920 is used to report the model parameters, accuracy and contribution of the model in this round to the server, so that the server can determine the system parameters of this round based on the client weight coefficients of the previous round, as well as the accuracy and contribution of the model in this round reported by each client. If the system parameters of this round do not meet the end conditions of federated learning, the next round of global model is determined based on the model parameters of this round and the client weight coefficients of this round obtained by updating the client weight coefficients of the previous round using the system parameters of this round.

[0166] In one embodiment, the local sample data includes local training data and local test data; the second determination module 910 includes a model determination unit, an accuracy determination unit, and a contribution determination unit;

[0167] A model determination unit, used to train the current round global model using local training data to obtain the current round local model;

[0168] An accuracy determination unit, used to determine the accuracy of the local model of the client according to the local test data and the local model of this round;

[0169] The contribution determination unit is used to determine the client's current round model contribution according to the current round global model and the current round local model.

[0170] In one of the embodiments, the contribution determination unit is further configured to use the gradient similarity between the current round global model and the current round local model as the current round model contribution of the client.

[0171] Each module in the above-mentioned federated learning device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0172] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10As shown. The computer device includes a processor, a memory, a network interface and a transceiver (not shown in the figure) connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as global models (such as the global model of this round and the global model of the next round), model parameters of this round, model accuracy of this round, contribution of this round model and system parameters of this round. The network interface of the computer device is used to communicate with an external terminal through a network connection, and the transceiver of the computer device is used to perform operations of receiving data or sending data under the control of the processor. When the computer program is executed by the processor, a federated learning method is implemented.

[0173] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0174] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the processing logic in the computer program, the steps according to various exemplary embodiments of the present application described in the above “Exemplary Method” section of this specification can be implemented. For example, when the processor executes the processing logic in the computer program, the following steps are also implemented: in the process of at least two clients performing federated learning, the model parameters, the accuracy of the model, and the contribution of the model reported by at least two clients based on the global model of this round are obtained; according to the accuracy of each model, the contribution of each model, and the weight coefficient of the client of the previous round, the system parameters of this round are determined; wherein the system parameters of this round include the accuracy of the system, the fair value of the result of this round, and the fair value of the contribution of this round; if the system parameters of this round do not meet the end condition of federated learning, the weight coefficient of the client of the previous round is updated by the system parameters of this round to obtain the weight coefficient of the client of this round, and the global model of the next round is determined according to the model parameters of each model and the weight coefficient of the client of this round.

[0175] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the processing logic in the computer program is executed by a processor, the steps according to various exemplary embodiments of the present application described in the above "Exemplary Method" section of this specification can be implemented. For example, when the processing logic in the computer program is executed by the processor, the following steps are also implemented: in the process of at least two clients performing federated learning, the model parameters of this round, the accuracy of this round model and the contribution of this round model reported by at least two clients based on the global model of this round are obtained; according to the accuracy of each model of this round, the contribution of each model of this round and the weight coefficient of the client of the previous round, the system parameters of this round are determined; wherein the system parameters of this round include the accuracy of the system of this round, the fair value of the result of this round and the fair value of the contribution of this round; if the system parameters of this round do not meet the end condition of federated learning, the weight coefficient of the client of the previous round is updated by the system parameters of this round to obtain the weight coefficient of the client of this round, and the global model of the next round is determined according to the model parameters of each model of this round and the weight coefficient of the client of this round.

[0176] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, can implement the steps described in the above "Exemplary Method" section of this specification according to various exemplary embodiments of the present application. For example, when the computer program is executed by the processor, the following steps are also implemented: according to the local sample data and the global model of this round sent by the server, the model parameters, accuracy of this round model and contribution of this round model of the client are determined; the model parameters, accuracy of this round model and contribution of this round model of the client are reported to the server, so that the server can determine the system parameters of this round based on the weight coefficient of the client in the previous round, and the accuracy of the model and contribution of this round model reported by each client, and determine the global model of the next round according to the client weight coefficient of the previous round obtained by updating the client weight coefficient of the previous round using the system parameters of this round, if the system parameters of this round do not meet the end condition of federated learning.

[0177] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0178] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0179] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A federated learning method, characterized in that: Applied to a server, the method comprises: In the process of federated learning between at least two clients, obtain the current round model parameters, current round model accuracy and current round model contribution reported by at least two clients based on the current round global model; Determine the system parameters of this round according to the accuracy of each model in this round, the contribution of each model in this round and the weight coefficient of the client in the previous round; wherein the system parameters of this round include the accuracy of the system in this round, the fair value of the result in this round and the fair value of the contribution in this round; If the system parameters of this round do not meet the end conditions of federated learning, the client weight coefficients of the previous round are updated using the system parameters of this round to obtain the client weight coefficients of this round, and the global model of the next round is determined based on the model parameters of each round and the client weight coefficients of this round.

2. The method according to claim 1, characterized in that Determining the system parameters of this round according to the accuracy of each model of this round, the contribution of each model of this round and the weight coefficient of the client of the previous round includes: Determine the accuracy of the current round system and the fairness value of the current round results based on the accuracy of each model in this round and the weight coefficient of the client in the previous round; The fair value of the contribution of this round is determined according to the contribution amount of each model in this round and the weight coefficient of the client in the previous round.

3. The method according to claim 2, characterized in that Determining the accuracy of the current round system and the fairness value of the current round results according to the accuracy of each current round model and the weight coefficient of the previous round client includes: The weight of each client in the previous round of client weight coefficients is used to weight the accuracy of the model in this round corresponding to each client to obtain the accuracy utility value of each client; Based on the Jain fairness index, the fairness value of the result of this round is determined according to the accuracy utility value of each client and the number of clients.

4. The method according to claim 2, characterized in that: Determining the fair value of contribution in this round according to the contribution amount of each model in this round and the weight coefficient of the client in the previous round includes: Determine the contribution rate of each client in this round according to the contribution of each model in this round; Determine the contribution utility value of each client according to the current round contribution rate of each client and the client weight coefficient of the previous round; Based on the Jain fairness index, the contribution fairness value of this round is determined according to the contribution utility value of each client and the number of clients.

5. The method according to claim 4, characterized in that Determining the contribution rate of each client in this round according to the contribution amount of each model in this round includes: The ratio of the contribution of each model in this round to the sum of the contribution of each model in this round is taken as the contribution rate of each client in this round.

6. A federated learning method, characterized in that: Applied to a client, the method comprises: Determine the client's model parameters, model accuracy, and model contribution based on local sample data and the global model sent by the server. The model parameters of this round, the accuracy of this round model and the contribution of this round model are reported to the server, so that the server can determine the system parameters of this round based on the client weight coefficient of the previous round, and the accuracy of this round model and the contribution of this round model reported by each client, and determine the next round of global model according to the client weight coefficient of this round obtained by updating the client weight coefficient of the previous round with the system parameters of this round when the system parameters of this round do not meet the end condition of federated learning.

7. The method according to claim 6, characterized in that The local sample data includes local training data and local test data; According to the local sample data and the current round global model sent by the server, the accuracy of the current round model and the contribution of the current round model of the client are determined, including: Using the local training data, training the current round global model to obtain the current round local model; Determining the accuracy of the local model of the client according to the local test data and the local model of this round; The current round model contribution of the client is determined according to the current round global model and the current round local model.

8. The method according to claim 7, characterized in that The determining, according to the current round global model and the current round local model, a current round model contribution of the client includes: The gradient similarity between the current round global model and the current round local model is used as the current round model contribution of the client.

9. A federated learning device, characterized in that: Applied to the server side, the device comprises: A data receiving module, used for obtaining the current round model parameters, current round model accuracy and current round model contribution reported by at least two clients based on the current round global model during the process of at least two clients performing federated learning; A first determination module is used to determine the system parameters of this round according to the accuracy of each model of this round, the contribution of each model of this round and the weight coefficient of the client of the previous round; wherein the system parameters of this round include the accuracy of the system of this round, the fair value of the result of this round and the fair value of the contribution of this round; The model determination module is used to update the client weight coefficient of the previous round using the system parameters of this round to obtain the client weight coefficient of this round if the system parameters of this round do not meet the end conditions of federated learning, and determine the global model of the next round according to the model parameters of each round and the client weight coefficient of this round.

10. A federated learning device, characterized in that: Applied to the client side, the device includes: The second determination module is used to determine the client's current round model parameters, current round model accuracy and current round model contribution according to the local sample data and the current round global model sent by the server; A data reporting module is used to report the model parameters of this round, the accuracy of the model of this round and the contribution of the model of this round to the server, so that the server can determine the system parameters of this round based on the client weight coefficient of the previous round, and the accuracy of the model of this round and the contribution of the model of this round reported by each client, and determine the next round of global model according to the client weight coefficient of this round obtained by updating the client weight coefficient of the previous round using the system parameters of this round when the system parameters of this round do not meet the end condition of federated learning.

11. A computer device comprising a memory, a transceiver and a processor, wherein the memory stores a computer program, characterized in that: The processor implements the steps of the method described in any one of claims 1 to 5 when executing the computer program, or implements the steps of the method described in any one of claims 6 to 8 when executing the computer program, and the transceiver is used to perform the operation of receiving data or sending data under the control of the processor.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.