Private model training method based on federal learning
By setting up a personalized private model for member objects in federated learning and optimizing their training losses using federated learning mechanisms, the problem of model homogeneity in federated learning is solved, and the training and use of personalized models is realized.
Patent Information
- Application Number
- CN202411173870.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2025-01-07
AI Technical Summary
In federated learning, member objects can only train the same shared model, which cannot meet the different model usage needs, resulting in the model being too homogeneous and cannot meet the personalized needs.
By setting up a personalized private model for each member object in federated learning, the training loss of the private model is coupled with the training loss of the federated learning model, and the federated learning mechanism is used to optimize the private model, thereby realizing the training of the personalized model.
It realizes that a personalized private model is trained under the federated learning mechanism to meet the model usage needs of each member object and avoids the problem of overly homogeneous model.
Smart Images

Figure CN119272896A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a private model training method based on federated learning. Background Art
[0002] Federated learning, also known as federated machine learning, is a machine learning framework that allows multiple institutional members to conduct joint modeling in compliance with user privacy protection and government regulations. Institutions that are members of federated learning need to send their own private data as model training samples to the centralized computing platform of federated learning in accordance with the multi-party secure computing protocol, and the centralized computing platform will complete the model training. Based on the multi-party secure computing protocol, private data is encrypted to achieve privacy protection, and still has the mathematical calculation effect of plain text, so it will not affect the normal training of the model.
[0003] Under the federated learning mechanism, all member objects can only train the same shared model, but the training data is different. In actual applications, different member objects have different model usage scenarios, and the homogeneity of the federated learning model cannot meet the needs of each member object.
[0004] Therefore, how to enable member objects to utilize the federated learning mechanism to train a personalized model is a technical problem to be solved by this application. Summary of the invention
[0005] The purpose of this application is to provide a private model training method based on federated learning, which enables member objects to use the federated learning mechanism to train personalized private models to meet their own requirements for model usage.
[0006] In order to achieve the above purpose, the embodiment of the present application is implemented as follows:
[0007] In a first aspect, a private model training method based on federated learning is provided, which is applied to member objects of federated learning, including:
[0008] Based on local private data, a local private model and a federated learning model are trained; wherein the training loss of the private model is coupled with the training loss of the federated learning model;
[0009] Providing the model parameters of the federated learning model obtained through local training to other member objects of the federated learning, and receiving the model parameters of the federated learning model provided by the other member objects;
[0010] Based on the model parameters of the federated learning model provided by at least one of the other member objects, the local federated learning model is adjusted, and the local private model and the adjusted federated learning model are trained based on the local private data.
[0011] In the embodiment of the present application, in addition to sharing the same federated learning model, each member object participating in federated learning also sets up a personalized private model that meets its own model usage requirements, and the training loss of the private model is coupled with the training loss of the federated learning model. When each member object uses private data to train the federated learning model according to the federated learning mechanism, it also trains the private model based on the private data. Since the training losses of the two models are coupled, it is equivalent to optimizing the private model with the help of the federated learning mechanism for the training direction of the federated learning model. The private model can be used instead of the federated learning model for subsequent use, thereby solving the problem that the current federated learning makes the model too homogeneous. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0013] Figure 1 A flowchart of a private model training method for federated learning according to an embodiment of the present application.
[0014] Figure 2 This is a schematic diagram of member objects sharing model parameters in the private model training method of federated learning in an embodiment of the present application.
[0015] Figure 3 A schematic diagram of model training for member objects in a private model training method for federated learning in an embodiment of the present application.
[0016] Figure 4 A schematic diagram of the structure of a private model training device for federated learning in an embodiment of the present application.
[0017] Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0018] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0019] An embodiment of the present application proposes a private model training method based on federated learning, which is applied to member objects of federated learning, specifically client devices of member objects. Figure 1 This is a flowchart of the private model training method, including:
[0020] S102, training the local private model and the federated learning model based on the local private data; wherein the training loss of the private model is coupled with the training loss of the federated learning model.
[0021] In this embodiment, the private model and the federated learning model have the same functions. The federated learning model is a shared model of each member object, so the federated learning model of each member object has the same algorithm architecture. The private model is set individually by the member object according to its own model usage requirements. Usually, the private models of different member objects have different algorithm architectures.
[0022] It should be understood that the training principle of the model is: input the private data annotated with labels into the model, calculate the loss between the model output result and the true value result indicated by the label, and adjust the model parameters for the purpose of reducing the loss, so that the model output result and the true value result indicated by the label are close to the same.
[0023] In this embodiment, when the training loss of the private model is coupled with the training loss of the federated learning model, training the federated learning model is also training the private model. This is equivalent to training a personalized private model with the training results of the federated learning model using the federated learning mechanism.
[0024] As an example introduction:
[0025] The training loss of the private model includes the first sub-loss and the second sub-loss. The first sub-loss is the loss generated when the private model is trained independently, which can be calculated based on the cross entropy loss function for the training labels of private data and the output results of the private model for private data; the second sub-loss is the loss generated when the federated learning is trained independently, which can be calculated based on the distillation loss function for the training labels of private data and the output results of the federated learning model for private data.
[0026] The training loss of the federated learning model includes the third sub-loss and the fourth sub-loss. The third sub-loss is the loss generated during independent training of the federated learning model, which can be calculated based on the cross-entropy loss function on the training labels of private data and the output results of the federated learning model for private data. The fourth sub-loss is the loss generated during independent training of the private model, which can be calculated based on the distillation loss function on the training labels of private data and the output results of the private model for private data.
[0027] Since the second sub-loss included in the training loss of the private model is the loss generated when the federated learning model is trained independently, adjusting the model parameters of the private model for the purpose of reducing the training loss is equivalent to taking into account the gradient direction of the independent training of the federated learning model, which makes the training optimization direction of the private model associated with the training optimization direction of the federated learning model.
[0028] Similarly, the fourth sub-loss included in the training loss of the federated learning model is the loss generated when the private model is trained independently. Therefore, adjusting the model parameters of the federated learning model for the purpose of reducing the training loss is equivalent to making the gradient direction of the independent training of the federated learning model close to the direction of the independent training of the private model. This makes the optimization direction of the federated learning model associated with the training optimization direction of the private model.
[0029] S104, providing model parameters of the federated learning model obtained through local training to other member objects of the federated learning, and receiving model parameters of the federated learning model provided by other member objects.
[0030] The federated learning of this embodiment is a decentralized setting, that is, a centralized computing platform is no longer introduced to collect the model parameters of the federated learning model trained by each member object, but the model parameters of the federated learning model are directly shared by each member object.
[0031] In one implementation, a target direct communication rule can be pre-agreed upon between member objects of federated learning. In this step, the model parameters of the locally trained federated learning model are sent to other member objects directly according to the target direct communication rule, and the model parameters of the federated learning model sent by other member objects are received according to the target direct communication rule.
[0032] As an exemplary introduction, the target direct communication rule may be: in the nth round, if the target object is not the nth member object of the federated learning, the model parameters of the federated learning model of all member objects held locally are sent to the nth member object, and if the target object is not the Knth member object of the federated learning, the model parameters of the federated learning model sent by the Knth member object are received, until all the target objects are connected. The round ends after completion; where K is the number of member objects of the federated learning, n is a positive integer greater than zero and less than K, Represents the smallest integer equal to or greater than logK.
[0033] For ease of understanding, the number of member objects of federated learning is defined as K, and the client numbers are 0 to k-1.
[0034] Taking client No. 0 as an example, the process of sharing the model parameters of the federated learning model trained locally includes:
[0035] S1, round 1 communication, client 0 sends model parameters to client 1 and accepts model parameters from client k-1.
[0036] refer to Figure 2 As shown, assuming there are 8 clients, each client defaults to its own number 0, then in the first round of communication, each client sends the model parameters of the federated learning model to the next client.
[0037] S2, the second round of communication, client 0 sends the model parameters of clients 0 and k-1 to client 2, and accepts the model parameters from client k-2;
[0038] Still for reference Figure 2 As shown, assuming there are 8 clients, each client defaults to its own number 0, then in the second round of communication, each client sends the model parameters of the federated learning model every other client.
[0039] S3, thereafter until In round 1 communication, client 0 sends the model parameters of all clients it holds to client 1. And accept from the client The model parameters.
[0040] Still for reference Figure 2 As shown, assuming there are 8 clients and the default number change of each client is 0, in the second round of communication, each client sends the model parameters of the federated learning model every two clients.
[0041] S4. The communication ends and each client holds all client information.
[0042] In the above process, redundant model parameters are shared between the clients of the member objects. At this time, the client will receive RN=2 log K -K repeated client information. For example, when K=6, client 0 will receive repeated information from clients 0 and k-1. Since the purpose of the shared model exchange process is to obtain the aggregated average of all client shared models, in order to reduce the communication cost, Turn In the first round, if the model parameters of the federated learning model of all member objects held locally need to be sent, the model parameters of the federated learning model of all member objects held locally are aggregated and then sent.
[0043] In addition, for scenarios where privacy protection of model parameters is required, this embodiment can encrypt the model parameters of the federated learning model obtained through local training based on the encryption algorithm pre-agreed with other member objects and provide them to other member objects. The encryption algorithm includes homomorphic encryption algorithm, homomorphic encryption algorithm, etc. Among them:
[0044] Homomorphic encryption refers to an encryption algorithm that satisfies the homomorphic operation property of ciphertext. That is, after the data is homomorphically encrypted, a specific calculation is performed on the ciphertext, and the ciphertext calculation result is equivalent to the plaintext directly performing the same calculation on the plaintext data after the corresponding homomorphic decryption, thereby achieving computable but invisible data.
[0045] Secret sharing means splitting secret information into several shards, which are stored separately by several participants. Through the cooperation of the participants, secure calculations are performed on the distributed storage shards, and all shards or shards that reach a threshold number are restored into secret messages.
[0046] It should be noted that existing federated learning technologies usually only use one encryption technology to complete modeling. Different encryption technologies have different requirements for modeling conditions. For a time-consuming modeling process, member objects may not be able to stably provide the modeling conditions required by the current encryption technology, thus failing to achieve ideal modeling expectations.
[0047] For example, some encryption technologies occupy a large amount of bandwidth, while others occupy a small amount of bandwidth. If the member object of federated learning is an enterprise, the enterprise's bandwidth resources will be prioritized for business operations. In the case of high business concurrency, if federated learning uses encryption technologies that occupy a large amount of bandwidth resources to provide data privacy protection, it will either extend the modeling time and trade modeling efficiency for modeling performance, or sacrifice modeling performance for modeling efficiency.
[0048] In response to the above problems, this embodiment can further adjust the privacy protection protocol of federated learning according to the modeling environment, thereby ensuring that the encryption technology adopted by the current privacy protection protocol of federated learning is applicable to the actual modeling environment.
[0049] For example, compared with secret sharing, homomorphic encryption has higher requirements on computing power, but the amount of data transmitted is not large. In view of this feature, when the modeling environment of federated learning corresponding to the target time window cannot meet at least one of the bandwidth requirements, data volume requirements and decryption difficulty requirements of federated learning, and / or when the modeling environment of federated learning corresponding to the target time window meets the computing power requirements of federated learning, it can be determined that federated learning adopts a privacy protection protocol based on secret sharing in the target time window; in other cases, the enabling member object determines that federated learning adopts a privacy protection protocol based on homomorphic encryption in the target time window.
[0050] When the above scheme is implemented, an enabled member object can be selected in federated learning (the rest are non-enabled member objects). Before federated learning, the enabled member object first selects one from the privacy protection protocol based on homomorphic encryption and the privacy protection protocol based on secret sharing according to the modeling requirements of federated learning (modeling requirements in the efficiency dimension and modeling requirements in the security dimension) and the modeling environment of federated learning in the target time window (current time window or future time window), as the privacy protection protocol adopted by federated learning in the target time window. Afterwards, the enabled member object notifies the non-enabled member objects of federated learning of the privacy protection protocol adopted by federated learning in the target time window, so that the enabled member objects and non-enabled member objects interact with model parameters in accordance with the agreed privacy protection protocol within the target time window.
[0051] The above modeling requirements may include: modeling requirements in the efficiency dimension and modeling requirements in the security dimension. The modeling requirements in the efficiency dimension may include the bandwidth requirements of federated learning, the computing power requirements of federated learning, and the data volume requirements of the modeling samples of federated learning; the modeling requirements in the security dimension may include the difficulty of deciphering the modeling samples of federated learning, which is not specifically limited in this article.
[0052] It can be seen that this embodiment selects a more suitable one from the privacy protection protocol based on homomorphic encryption and the privacy protection protocol based on secret sharing as the privacy protection protocol adopted by the federated learning in the target time window according to the modeling requirements of the federated learning and the modeling environment of the federated learning in the target time window, so as to share the model parameters according to the determined privacy protection protocol in the target time window to complete the training of the federated learning model. In practical applications, the federated learning can adopt an encryption method that is most suitable for the current modeling environment to provide data privacy protection, thereby ensuring the security of the federated learning data while maintaining a better balance between the modeling efficiency and the modeling effect according to the modeling requirements of the federated learning.
[0053] S106, adjusting the local federated learning model based on the model parameters of the federated learning model provided by at least one other member object, and training the local private model and the adjusted federated learning model based on the local private data.
[0054] In this embodiment, the model parameters of the federated learning model provided by at least one other member object may be fused to obtain the target model parameters of the federated learning model. Then, based on the target model parameters, the local federated learning model is adjusted. In addition, the model parameters of the local federated learning model may be fused with the model parameters of the federated learning model provided by at least one other member object to obtain the target model parameters of the federated learning model.
[0055] Specifically, in order to ensure the effect of federated learning, before fusion, the contribution of each member object to federated learning can be determined based on the quality evaluation results corresponding to the model parameters of the federated learning model historically provided by each member object. For example, the higher the quality of the model parameters of the provided learning model, the greater the contribution. Correspondingly, this step can perform weighted fusion on the model parameters of the federated learning model provided by at least one other member object according to the corresponding contribution coefficient of the other member object to obtain the target model parameters of the federated learning model.
[0056] As an example, for each member object i, a scoring function A for the amount of private data participating in the training of the federated learning model can be defined: i and the quality score function Q of the model parameters i , then the contribution index C of any member object i The calculation formula is as follows:
[0057]
[0058] Where n is the number of member objects, and i and j are the serial numbers of the member objects.
[0059] By introducing weighted calculation of contribution coefficients during the fusion process, the impact of model parameters currently provided by member objects that previously provided model parameters of poor quality on the fusion calculation can be reduced, thereby ensuring the quality of federated learning to a certain extent.
[0060] In addition, for each member object participating in federated learning, a very realistic demand is that the benefits obtained should be proportional to the costs paid or contributions made, otherwise low-cost institutions will be very enthusiastic about participating in federated modeling because they can enjoy the final model results with a small amount of data contribution, while high-cost institutions are just the opposite. Since this embodiment has determined the sharing degree of each member object, it is possible to configure the use rights of federated learning resources that match the contribution degree for each member object to achieve a balance between input and output.
[0061] For example, according to the contribution index C of the member object i , to configure the federated learning resource usage rights R that match the member objects and their contribution i ,
[0062] It should be noted that this article does not limit the specific form of the rights to use federated learning resources. As an example, the rights to use federated learning resources can be the opportunity to continue to participate in federated learning, the value benefits and services generated after the target model is trained, etc.
[0063] The scheme of the embodiment is described in detail below.
[0064] The method of this embodiment may include: a federated learning initialization module, a private model training module, a shared model training module, a client communication module, and a client sharing aggregation module.
[0065] The federated learning initialization module is used by the member object local client k to initiate federated learning and to transfer the model parameters h of the shared model that it has prepared. θ Sent to other clients participating in federated learning, and then all clients initialize their local private models. At this time, all clients hold private models at the same time and shared models In addition, each client sets hyperparameters such as learning rate according to the situation.
[0066] The private model training module is used in each round of federated learning training. The client takes the local private dataset as input and uses the stochastic gradient descent (SGD) method to train and update the private model parameters based on the constructed private model loss function.
[0067] The shared model training module is used in each round of federated learning training. The client takes the local private dataset as input and uses the differentially private stochastic gradient descent (DP-SGD) method to train and update the shared model parameters based on the constructed shared model loss function.
[0068] The client communication module is used to specify the network topology of directional communication between clients in a decentralized federated learning network.
[0069] The client sharing aggregation module is used to specify the content of information transmission between clients and the aggregation method of the client for the received shared model set.
[0070] Further, refer to Figure 3 As shown in the figure, the private model training module is used in each round of federated learning training. The client takes the local private data set as input and uses the stochastic gradient descent method to train and update the private model parameters according to the constructed private model loss function. The corresponding steps are as follows:
[0071] Step 1: Client k obtains the local private dataset D k Divide it into batches Where BN represents the batch number, b is a counter, b=1 represents the first batch, X b Represents the input feature matrix of each batch, y b Represents the corresponding label (vector).
[0072] Step 2: Build a private model loss function and convert the client's local private dataset label y b Used as input for the cross entropy loss function and applies the shared model to X b Output Used for distillation loss input, loss function used for private model training By the cross entropy loss function And the distillation loss function Together they form.
[0073] Step 3: Client k sends all data in batch B k As input, based on the constructed loss function Update the weights of the private model using stochastic gradient descent Among them, η represents the learning rate, is the gradient operator, φ k is the weight parameter of the private model.
[0074] Furthermore, the loss function of the client k private model in S2 is As follows:
[0075]
[0076]
[0077] Among them, α is a hyperparameter, represents the cross entropy loss function, Represents the distillation loss function, that is, sharing the model As a teacher model, it distills its knowledge into the student model x is the input feature vector of a single sample, y is the one-hot representation of the corresponding label, represents the logits output of the private model for x, n is the total number of output dimensions of the current task, represents the logits output of the shared model and T represents the temperature parameter.
[0078] Furthermore, the shared model training module is used in each round of federated learning training. The client takes the local private dataset as input and uses the differential privacy stochastic gradient descent method to train and update the shared model parameters according to the constructed shared model loss function. The corresponding steps are as follows:
[0079] Step 1: Client k obtains the local private dataset D k Divide it into batches Where BN represents the batch size, X b Represents the input feature matrix of each batch, y bIndicates the corresponding label.
[0080] Step 2: Build a shared model loss function and convert the client's local private dataset label y b Used as input for the cross entropy loss function and applies the private model to X b Output Used for distillation loss input, loss function used for shared model training By the cross entropy loss function And the distillation loss function Together they form.
[0081] Step 3: Client k sends all data in batch B k As input, based on the constructed loss function The weights of the private model are updated using the differentially private stochastic gradient descent method.
[0082] Furthermore, the loss function of the client k private model in S2 is Among them, β is a hyperparameter, represents the cross entropy loss function, Represents the distillation loss function, that is, the private model Acts as a teacher model to distill its knowledge into the shared model and The calculation method is the same as above.
[0083] Furthermore, the differential privacy stochastic gradient descent method in S3 is used to update the weights of the private model as follows:
[0084]
[0085] Among them, θ k represents the shared model weights, represents differential privacy gradient operation, N(0,σ 2 C 2 ) represents Gaussian noise, which is a normal distribution with a mean of 0, and C represents the clipping threshold to ensure σ represents the noise scale. During training, σ and C are set to constants. ||·|| 2 represents the L2 norm, and β is a hyperparameter.
[0086] Furthermore, the client communication module is used to specify the directional communication network topology between clients in the decentralized federated learning network. Its structure is described as follows:
[0087] Define that there are K clients in the communication network and number them from 0 to k-1. Taking client 0 as an example, all clients are processed similarly. The steps are as follows:
[0088] Step 1, in the first round of communication, client 0 sends the model parameters of the shared model to client 1 and receives the model parameters from client k-1;
[0089] Step 2, the second round of communication, client 0 sends the model parameters of clients 0 and k-1 to client 2, and accepts the model parameters from client k-2;
[0090] Step 3, then until In round 1 communication, client 0 sends the model parameters of all clients it holds to client 1. And receive from the client Model parameters of
[0091] Step 4: After the communication ends, each client holds the model parameters of the shared model trained by all clients.
[0092] Furthermore, the client sharing aggregation module is used to specify the content of information transmission between clients, and the aggregation method of the client for the received shared model set. The client training recovery model is used to recover the client training based on the forgetting learning method, including the following contents:
[0093] This process is a supplement to the client communication module. The client will receive For example, when K=6, client 0 will receive repeated information from clients 0 and k-1. Since the purpose of the shared model exchange process is to obtain the aggregated average of all client shared models, in order to reduce the communication cost, the shared model exchange and aggregation process between clients is as follows:
[0094] No. In round-by-round communication, clients transmit all shared models in a list format.
[0095] No. In round-by-round communication, the client transmits the aggregated model after averaging all shared models;
[0096] After the communication is completed, the aggregated shared model is obtained and replace it with the local shared model θ k ←θ k ′.
[0097] In summary, the method of this embodiment can achieve the following features:
[0098] 1) Decentralized architecture: member objects communicate directly with each other to share model parameters, avoiding the single point of failure and privacy leakage risks of centralized servers.
[0099] 2) Privacy protection: Use multi-party secure computing protocol algorithm, homomorphic encryption algorithm and zero-knowledge proof algorithm to encrypt the model parameters of the shared model before sending.
[0100] 3) Integration of heterogeneous datasets: Considering the data distribution and characteristics of different member objects, effective integration of heterogeneous datasets is achieved, thereby improving the performance of the overall shared model.
[0101] 4) Credibility Assessment: The proposal will design a credibility assessment mechanism to evaluate the contribution of each member object and ensure the high quality and reliability of the shared model.
[0102] 5) Private data does not leave the domain: Only model parameters of the shared model are sent between member objects, and private data is not transmitted to avoid the possibility of being exposed.
[0103] In relevant applications, the member objects of federated learning are communication operators, the private data are communication user data, and the private model and the federated learning model are used to identify illegal communication behaviors (such as fraud, marketing, etc.).
[0104] That is, each communications operator holds the information of its own mobile communications users, including real-name information, consumption bill information, call records, IP address ownership, etc.
[0105] However, the information of mobile communication users is sensitive data and cannot be shared between communication operators. To this end, these communication operators can build a decentralized federated learning system. Through the federated learning mechanism, private model training can be achieved without exposing the information of mobile communication users. The corresponding process includes:
[0106] To solve this scenario and other scenarios with similar sharing requirements, the specific steps are as follows:
[0107] Step 1: Each communication operator configures the initial private model and shared model, and builds a direct communication network between each other.
[0108] Specifically, to protect sensitive data, each communication operator can adopt a privacy protection protocol to ensure that the original data is not exposed during transmission and processing between participants. The privacy protection protocol may include but is not limited to homomorphic encryption technology, secret sharing, and differential privacy technology.
[0109] Step 2: Each communication operator trains local private models and shared models based on local private data.
[0110] It should be understood that the private data of each communication operator is not shared and is only used for local training of shared models, thus eliminating the possibility of mobile communication users' private information being exposed.
[0111] Step 3: Each communication operator shares the model parameters of the shared model through the direct communication network, and aggregates the model parameters already held by all communication operators to obtain a target model parameter after weighing the shared model.
[0112] As mentioned above, all communication operators participating in federated learning are sorted in advance according to pre-agreed sorting rules, for example, sorting by letters of the name or by the order in which the communication operators join federated learning.
[0113] The sharing of model parameters is completed in a multi-round iterative manner. That is, in the nth round, if each communication operator is not the nth member object in the sorting, it sends the model parameters of the federated learning model of all member objects held locally to the nth member object in the sorting, and, if it is not the Knth member object in the sorting, it receives the model parameters sent by the Knth member object in the sorting. In the above iterative manner, until the nth round, each communication operator sends the model parameters of the federated learning model of all member objects held locally to the nth member object in the sorting. After the round, all communication operators completed the sharing of local model parameters.
[0114] Step 4: Each communication operator directly configures the local shared model as the target model parameters, and retrains the local private model and shared model with the local private data, so as to optimize the local private model with the help of the knowledge data corresponding to the target model parameters of the shared model.
[0115] It should be understood that by executing steps 2 to 4 above for multiple rounds, the model parameters of the private model can be continuously iteratively optimized along with the shared model, and the training can be terminated after the optimization converges.
[0116] Step 5: Each communication operator uses the private model trained locally to identify illegal communication behaviors.
[0117] Specifically, the communication operator can input the information of local mobile communication users into the private model, and the private model can predict whether there is any illegal communication behavior.
[0118] It should be noted that this step is performed locally by the communication operator and the information of the mobile communication user will not be disseminated externally.
[0119] Corresponds to Figure 1 The method shown, another embodiment of the present application provides a private model training device based on federated learning. Figure 4 4 is a schematic diagram of the structure of the private model training device 400, including:
[0120] The first training module 410 is used to train a local private model and a federated learning model based on local private data; wherein the training loss of the private model is coupled with the training loss of the federated learning model.
[0121] The sharing module 420 provides the model parameters of the federated learning model obtained through local training to other member objects of the federated learning, and receives the model parameters of the federated learning model provided by the other member objects.
[0122] The second training module 420 adjusts the local federated learning model based on the model parameters of the federated learning model provided by at least one of the other member objects, and trains the local private model and the adjusted federated learning model based on local private data.
[0123] Based on the device of this embodiment, each member object participating in federated learning, in addition to sharing the same federated learning model, also sets a personalized private model that meets its own model usage requirements, and the training loss of the private model is coupled with the training loss of the federated learning model. When each member object uses private data to train the federated learning model according to the federated learning mechanism, it also trains the private model based on the private data. Since the training losses of the two models are coupled, it is equivalent to optimizing the private model with the help of the federated learning mechanism for the training direction of the federated learning model. The private model can be used instead of the federated learning model for subsequent use, thereby solving the problem that the current federated learning makes the model too homogeneous.
[0124] Optionally, the sharing module 420 provides the model parameters of the federated learning model obtained by local training to other member objects of the federated learning, and receives the model parameters of the federated learning model provided by the other member objects, including: sending the model parameters of the federated learning model obtained by local training to the other member objects in accordance with the target direct communication rules pre-agreed with the other member objects of the federated learning, and receiving the model parameters of the federated learning model sent by the other member objects in accordance with the target direct communication rules.
[0125] Optionally, all member objects in the federated learning are pre-sorted according to a target sorting rule;
[0126] The target direct communication rule is: in the nth round, if it is not the nth member object of the federated learning, then send the model parameters of the federated learning model of all member objects held locally to the nth member object, and if it is not the Knth member object of the federated learning, then receive the model parameters of the federated learning model sent by the Knth member object, until all The round ends after completion; wherein K is the number of member objects of the federated learning, and n is a positive integer greater than zero and less than K.
[0127] Optionally, the target direct communication rule further includes: Turn Round, if it is necessary to send the model parameters of the federated learning model of all member objects held locally, the model parameters of the federated learning model of all member objects held locally are aggregated and then sent; wherein, RN = 2 log K -K.
[0128] Optionally, the training loss of the private model includes a first sub-loss and a second sub-loss; the first sub-loss is calculated based on a cross entropy loss function on the training label of the private data and the output result of the private model for the private data; the second sub-loss is calculated based on a distillation loss function on the training label of the private data and the output result of the federated learning model for the private data.
[0129] Optionally, the training loss of the federated learning model includes a third sub-loss and a fourth sub-loss; the third sub-loss is calculated based on a cross entropy loss function on the training label of the private data and the output result of the federated learning model for the private data; the fourth sub-loss is calculated based on a distillation loss function on the training label of the private data and the output result of the private model for the private data.
[0130] Optionally, the second training module 420 adjusts the local federated learning model based on the model parameters of the federated learning model provided by at least one of the other member objects, including: weighted fusion of the model parameters of the federated learning model provided by at least one other member object according to the contribution coefficients corresponding to the other member objects, to obtain target model parameters of the federated learning model; wherein the contribution coefficient corresponding to any member object is determined based on the quality assessment results corresponding to the model parameters of the federated learning model historically provided by the member object; and adjusting the local federated learning model based on the target model parameters.
[0131] Optionally, the sharing module 420 provides the model parameters of the federated learning model obtained through local training to other member objects of the federated learning, including: based on an encryption algorithm pre-agreed with the other member objects, encrypting the model parameters of the federated learning model obtained through local training and providing them to other member objects.
[0132] The encryption algorithm includes at least one of a multi-party secure computing protocol algorithm, a homomorphic encryption algorithm and a zero-knowledge proof algorithm.
[0133] Optionally, the member object of the federated learning is a communication operator, the private data is communication user data, and the private model and the federated learning model are used to identify illegal communication behaviors.
[0134] It should be noted that the private model training device of this embodiment can be used as Figure 1 The execution subject of the method shown can thus realize Figure 1 The steps and functions in the method shown are not repeated here.
[0135] Figure 5 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 5 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0136] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0137] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0138] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming the above-mentioned private model training device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0139] Based on local private data, a local private model and a federated learning model are trained; wherein the training loss of the private model is coupled with the training loss of the federated learning model.
[0140] The model parameters of the federated learning model obtained through local training are provided to other member objects of the federated learning, and the model parameters of the federated learning model provided by the other member objects are received.
[0141] Based on the model parameters of the federated learning model provided by at least one of the other member objects, the local federated learning model is adjusted, and the local private model and the adjusted federated learning model are trained based on the local private data.
[0142] The above application Figure 2 The method disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in one or more embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with one or more embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0143] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0144] The present application also provides a computer program product, which includes a computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform the following operations:
[0145] Based on local private data, a local private model and a federated learning model are trained; wherein the training loss of the private model is coupled with the training loss of the federated learning model.
[0146] The model parameters of the federated learning model obtained through local training are provided to other member objects of the federated learning, and the model parameters of the federated learning model provided by the other member objects are received.
[0147] Based on the model parameters of the federated learning model provided by at least one of the other member objects, the local federated learning model is adjusted, and the local private model and the adjusted federated learning model are trained based on the local private data.
[0148] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of the present application shall be included in the protection scope of one or more embodiments of the present application.
[0149] The systems, devices, and modules described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0150] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0151] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0152] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
Claims
1. A private model training method based on federated learning, applied to member objects of federated learning, characterized in that: The method comprises: Based on local private data, a local private model and a federated learning model are trained; wherein the training loss of the private model is coupled with the training loss of the federated learning model; Providing the model parameters of the federated learning model obtained through local training to other member objects of the federated learning, and receiving the model parameters of the federated learning model provided by the other member objects; Based on the model parameters of the federated learning model provided by at least one of the other member objects, the local federated learning model is adjusted, and the local private model and the adjusted federated learning model are trained based on the local private data.
2. The method according to claim 1, characterized in that Providing the model parameters of the federated learning model obtained through local training to other member objects of the federated learning, and receiving the model parameters of the federated learning model provided by the other member objects, including: According to the target direct communication rules pre-agreed with other member objects of the federated learning, the model parameters of the federated learning model obtained by local training are sent to the other member objects, and the model parameters of the federated learning model sent by the other member objects are received according to the target direct communication rules.
3. The method according to claim 2, characterized in that All member objects in the federated learning are pre-sorted according to a target sorting rule; The target direct communication rule is: in the nth round, if it is not the nth member object of the federated learning, then send the model parameters of the federated learning model of all member objects held locally to the nth member object, and if it is not the Knth member object of the federated learning, then receive the model parameters of the federated learning model sent by the Knth member object, until all The round ends after completion; wherein K is the number of member objects of the federated learning, and n is a positive integer greater than zero and less than K.
4. The method according to claim 2, characterized in that: The target direct communication rule further includes: in the Turn Round, if it is necessary to send the model parameters of the federated learning model of all member objects held locally, the model parameters of the federated learning model of all member objects held locally are aggregated and then sent; wherein, RN = 2 logK -K.
5. The method according to claim 1, characterized in that The training loss of the private model includes a first sub-loss and a second sub-loss; the first sub-loss is calculated based on a cross entropy loss function on the training labels of the private data and the output results of the private model for the private data; the second sub-loss is calculated based on a distillation loss function on the training labels of the private data and the output results of the federated learning model for the private data.
6. The method according to claim 1, characterized in that The training loss of the federated learning model includes a third sub-loss and a fourth sub-loss; the third sub-loss is calculated based on the cross entropy loss function on the training label of the private data and the output result of the federated learning model for the private data; the fourth sub-loss is calculated based on the distillation loss function on the training label of the private data and the output result of the private model for the private data.
7. The method according to claim 1, characterized in that Adjusting the local federated learning model based on the model parameters of the federated learning model provided by at least one of the other member objects includes: The model parameters of the federated learning model provided by at least one other member object are weighted and integrated according to the contribution coefficients corresponding to the other member objects, so as to obtain the target model parameters of the federated learning model; wherein the contribution coefficient corresponding to any member object is determined based on the quality assessment results corresponding to the model parameters of the federated learning model historically provided by the member object; Based on the target model parameters, the local federated learning model is adjusted.
8. The method according to claim 1, characterized in that Providing the model parameters of the federated learning model obtained through local training to other member objects of the federated learning, including: Based on the encryption algorithm pre-agreed with the other member objects, the model parameters of the federated learning model obtained through local training are encrypted and provided to the other member objects.
9. The method according to claim 8, characterized in that The encryption algorithm includes at least one of a multi-party secure computing protocol algorithm, a homomorphic encryption algorithm, and a zero-knowledge proof algorithm.
10. The method according to any one of claims 1 to 9, characterized in that: The member objects of the federated learning are communication operators, the private data are communication user data, and the private model and the federated learning model are used for identifying illegal communication behaviors.
Citation Information
Cited By
Federal learning method and device, electronic equipment and storage medium
CN118036778A
Industrial equipment fault diagnosis model training method based on adaptive hierarchical federated learning
CN122674807A