Layered secure federated learning method, device, electronic device and storage medium
By introducing the middle layer into federated learning for anonymity processing and anomaly detection, the problem of privacy leakage in the local upload process is solved, the efficiency and security of privacy protection are improved, and effective banning of malicious users is achieved.
Patent Information
- Application Number
- CN202111444193.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-11-30
AI Technical Summary
Existing federated learning hides personal private data when training the global model locally, resulting in privacy leakage problems in the local upload process and weak adversarial attacks.
The middle layer is introduced for anonymity processing, and an anonymous model is generated by model shuffling and adding perturbations, and anomaly detection is performed to identify malicious users and ban them, thereby improving the efficiency and security of privacy protection.
Through the anonymity processing and anomaly detection in the middle layer, the efficiency and security of privacy protection are significantly improved, malicious users can be quickly located and accurately blocked, and the ability to resist attacks is improved.
Smart Images

Figure CN114398635B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of federated machine learning technology, and in particular to a hierarchical secure federated learning method, device, electronic device and storage medium. Background Art
[0002] With the breakthrough development of technologies such as the Internet of Things, mobile communications, and portable devices, the amount of data in the network has also shown a sharp growth trend. In addition, most of the information collected in mobile phones and portable devices is related to personal privacy. Due to the frequent occurrence of privacy information leakage incidents, people's awareness of privacy protection has been continuously enhanced. Federated learning has emerged and has been actively adopted.
[0003] In related technologies, federated learning hides personal privacy data in the process of training the global model locally and generating the local model, and then uploads the local model carrying the hidden privacy data. Although privacy is protected to a certain extent, there is also the problem of privacy leakage during the local upload process, which leads to low efficiency of privacy protection and weak ability to deal with attacks. Summary of the invention
[0004] The present invention provides a hierarchical secure federated learning method, device, electronic device and storage medium, which are used to solve the defect of privacy leakage in the local upload link caused by hiding personal privacy data in the process of local training of a global model in federated learning in the prior art, and achieve the purpose of significantly improving the efficiency of privacy protection by introducing an intermediate layer to comprehensively protect privacy data.
[0005] The present invention provides a hierarchical secure federated learning method, comprising:
[0006] Send the global model to each local user, and instruct each local user to send the local model generated after training the global model to the middle layer;
[0007] Obtaining the user behavior identifier and the user behavior score generated by the middle layer after performing anonymization processing on each local model; wherein the anonymization processing includes the middle layer shuffling each local model and adding disturbance to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score;
[0008] Malicious users are identified and banned based on the user behavior identifier and the user behavior score.
[0009] According to a hierarchical secure federated learning method provided by the present invention, when the intermediate layer includes at least two sub-intermediate layers, sending the global model to each local user and instructing each local user to send the local model generated after training the global model to the intermediate layer includes:
[0010] Grouping all local users to obtain at least two user groups and at least two local users in each user group;
[0011] Establishing a corresponding relationship between the user group and the sub-middle layer;
[0012] When the global model is sent down to each local user, the sub-middle layer identifier of the local model generated after the local user trains the global model is carried, so that each local user sends the local model generated by it to the corresponding sub-middle layer.
[0013] According to a hierarchical secure federated learning method provided by the present invention, the step of obtaining a user behavior identifier and a user behavior score generated by the middle layer after performing anonymization processing on each local model includes:
[0014] Obtain the user behavior identifier and user behavior score generated by the intermediate layer after performing anomaly detection processing on each anonymous model; wherein the anonymous model includes the model generated after shuffling processing between model identifiers, shuffling processing between model contents and adding disturbances to each local model.
[0015] According to a hierarchical secure federated learning method provided by the present invention, the malicious user is determined and banned according to the user behavior identifier and the user behavior score, including:
[0016] According to the user behavior identifier and the user behavior score, at least two user scores of each local user in the user group are updated to obtain at least two new user scores;
[0017] When there is a target user score exceeding a preset user score threshold value among the at least two new user scores, it is determined that the target user score corresponds to a malicious user, and a ban process is performed on the malicious user.
[0018] According to a hierarchical secure federated learning method provided by the present invention, after the step of updating at least two user scores of each local user in the user group according to the user behavior identifier and the user behavior score to obtain at least two new user scores, the method further includes:
[0019] Determine the weight of the anonymous model in the corresponding user group based on the user behavior score;
[0020] Performing a model aggregation operation according to the weight of the anonymous model to obtain a new global model, and then returning to the step of sending the global model to each local user and instructing each local user to send the local model generated after training the global model to the intermediate layer to perform the next round of training;
[0021] Until a global model that meets the preset accuracy requirements and meets the convergence conditions is obtained.
[0022] According to a hierarchical secure federated learning method provided by the present invention, before the step of obtaining a global model that meets the preset accuracy requirement and meets the convergence condition, the method further includes:
[0023] When it is determined that the number of training rounds reaches M rounds, after performing an update operation on the corresponding user score according to the new user behavior identifier and the new user behavior score generated by the M-th round of training, at least two new user scores of the M-th round are obtained; wherein M is a positive integer;
[0024] Determine whether there is a target user score that exceeds a preset user score threshold among the at least two new user scores;
[0025] When the target user score exists in the at least two new user scores, it is determined that the target user score corresponds to a malicious user, and a ban process is performed on the malicious user.
[0026] According to a hierarchical secure federated learning method provided by the present invention, when the number of training rounds reaches N, a new global model generated by the Nth round of training is subjected to an accuracy test and a convergence test; wherein N is a positive integer;
[0027] If the new global model generated by the Nth round of training meets the preset accuracy requirement and satisfies the preset convergence condition, the new global model generated by the Nth round of training is determined as the global model that meets the preset accuracy requirement and converges;
[0028] If the new global model generated by the Nth round of training does not meet the preset accuracy requirements and / or does not meet the preset convergence conditions, return to the step of sending the global model to each local user, and instruct each local user to send the local model generated after training the global model to the middle layer to perform training.
[0029] The present invention also provides a hierarchical secure federated learning system, comprising: a central server, a plurality of local users and an intermediate layer; wherein:
[0030] The central server is used to send the global model to each local user, and instruct each local user to send the local model generated after training the global model to the intermediate layer;
[0031] The local user is used to train the received global model to generate a local model, and send the local model to the intermediate layer;
[0032] The intermediate layer is used to generate a user behavior identifier and a user behavior score after performing anonymization processing on each local model; the anonymization processing includes the intermediate layer shuffling each local model and adding disturbances to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score and then synchronize them to the central server; the central server is used to determine malicious users and ban them according to the user behavior identifier and the user behavior score.
[0033] The present invention also provides a hierarchical secure federated learning device, comprising:
[0034] A sending module, used to send the global model to each local user, and instruct each local user to send the local model generated after training the global model to the middle layer;
[0035] An acquisition module, used to acquire the user behavior identifier and the user behavior score generated by the middle layer after performing anonymization processing on each local model; wherein the anonymization processing includes the middle layer shuffling each local model and adding disturbance to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score;
[0036] The processing module is used to determine malicious users and ban them according to the user behavior identifier and the user behavior score.
[0037] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the hierarchical secure federated learning method as described in any one of the above are implemented.
[0038] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the hierarchical secure federated learning method as described in any one of the above are implemented.
[0039] The present invention also provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned hierarchical secure federated learning methods.
[0040] The hierarchical secure federated learning method, device, electronic device and storage medium provided by the present invention, wherein the hierarchical secure federated learning method, by sending the global model to each local user and instructing each local user to send the local model generated after training the global model to the middle layer, instead of directly uploading it to the central server, compensates for the privacy leakage problem in the model upload link in the existing federated learning; further, after the central server obtains the user behavior identifier and user behavior score generated by the middle layer after anonymous processing for each local model, it determines the malicious user based on the user behavior identifier and the user behavior score and bans it. Since the anonymous processing performed by the middle layer includes shuffling each local model and adding disturbances to generate an anonymous model, and then performing anomaly detection processing on each anonymous model to obtain the user behavior identifier and user behavior score of each anonymous model, the privacy information carried by each local model is anonymously protected and anomaly detected by the middle layer, so as to improve the security and reliability of privacy protection, and the central server determines the malicious user according to the user behavior identifier and the user behavior score and performs the ban, so as to achieve the accuracy of quickly locating and banning different malicious users, thereby achieving the purpose of efficient response and defense. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 It is a flowchart of the hierarchical secure federated learning method provided by the present invention;
[0043] Figure 2 It is an interactive schematic diagram of the hierarchical secure federated learning system provided by the present invention;
[0044] Figure 3 It is a structural diagram of a hierarchical secure federated learning device provided by the present invention;
[0045] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] The present invention provides a hierarchical secure federated learning method, the execution subject of the hierarchical secure federated learning method is a central server in a hierarchical secure federated learning system, the hierarchical secure federated learning system includes a central server, a plurality of local users and a central layer, and the central server can be a server with user grouping function, user numbering function, global model aggregation function, and user score updating function. The present invention does not limit the specific form of the terminal device.
[0048] Figure 1 A flowchart of the hierarchical secure federated learning method provided by the present invention is shown in FIG. Figure 1 As shown, the hierarchical secure federated learning method includes:
[0049] Step 110: Send the global model to each local user, and instruct each local user to send the local model generated after training the global model to the middle layer.
[0050] Specifically, the central server stores a table of the correspondence between each local user and their numbers. When the central server sends the global model to each local user, it can carry the intermediate layer identifier of the received local model, so that when each local user trains the received global model and generates a local model, the local model can be further sent to the intermediate layer respectively.
[0051] Step 120: Obtain the user behavior identifier and user behavior score generated by the intermediate layer after anonymization processing for each local model.
[0052] The anonymity processing includes the middle layer shuffling each local model and adding disturbance to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score. Furthermore, adding disturbance may include adding differential privacy.
[0053] Specifically, when the number of local users is set to P and P is an integer greater than or equal to 2, when the middle layer receives the local model sent by each user, each local model may have a corresponding local user identifier, that is, at this time, the middle layer can determine the correspondence between the local model and the local user. At this time, the middle layer can first shuffle the models between each local model and add disturbances to generate anonymous models respectively. At this time, the anonymous model not only has no correspondence with the local user, but also does not carry privacy information, and the number of anonymous models is the same as the number of local models; then further perform anomaly detection processing on each anonymous model to obtain the anomaly detection score of each anonymous model. If there is a score greater than 0 in each anomaly detection score, the maximum anomaly detection score in each anomaly detection score is used as the malicious score of each local user in the P local users and the P local users are all marked with malicious user identifiers; conversely, if each anomaly detection score is equal to 0, each local user in the P local users is marked with a non-malicious user identifier and the non-malicious score of each non-malicious user is 0. Then the determined malicious users and malicious scores are synchronized to the central server.
[0054] Step 130: Determine malicious users and ban them based on the user behavior identifier and the user behavior score.
[0055] Specifically, the central server updates the user score of each local user among P local users according to the received malicious user identification and malicious score, so that the user score of each local user among the P local users is updated, thereby obtaining P new user scores, and then compares the P new user scores with the preset user score threshold respectively, and further determines the local user corresponding to the new user score exceeding the preset user score threshold as a malicious user, and then performs a ban process on the malicious user.
[0056] In the hierarchical secure federated learning method provided by the present invention, the central server sends the global model to each local user and instructs each local user to send the local model generated after training the global model to the middle layer, instead of uploading it directly to the central server, so as to make up for the privacy leakage problem in the model upload link in the existing federated learning; further, after the central server obtains the user behavior identifier and user behavior score generated by the middle layer after anonymous processing for each local model, it determines the malicious user based on the user behavior identifier and the user behavior score and bans it. Since the anonymous processing performed by the middle layer includes shuffling each local model and adding disturbances to generate an anonymous model, and then performing anomaly detection processing on each anonymous model to obtain the user behavior identifier and user behavior score of each anonymous model, the privacy information carried by each local model is anonymously protected and anomaly detected by the middle layer, so as to improve the security and reliability of privacy protection, and the central server determines the malicious user according to the user behavior identifier and the user behavior score and performs the ban, so as to achieve the accuracy of quickly locating and banning different malicious users, thereby achieving the purpose of efficient response and defense.
[0057] Optionally, when the intermediate layer includes at least two sub-intermediate layers, the implementation process of step 110 may include:
[0058] First, all local users are grouped to obtain at least two user groups and at least two local users in each user group; then, a corresponding relationship between the user groups and the sub-middle layer is established; finally, when the global model is sent down to each of the local users, the sub-middle layer identifier of the local model generated after the local user trains the global model is carried, so that each of the local users sends the local model generated by it to the corresponding sub-middle layer.
[0059] Specifically, a correspondence table of the correspondence between each local user and his / her user identifier is pre-stored in the central server, and the correspondence table is randomly grouped to determine the number of user groups based on the number of local users in each user group, and a correspondence between each user group and the sub-middle layer is established. When the global model is sent to each local user, the sub-middle layer identifier of the local model generated after the local user trains the global model is carried. For example, when the number of local users is 100, the 100 local users can be divided into 10 user groups, each user group corresponds to a sub-middle layer of the middle layer, that is, when user group 1 includes local users 1 to 10, it corresponds to sub-middle layer 1, when user group 2 includes local users 11 to 20, it corresponds to sub-middle layer, ..., when user group 10 includes 91 to 100, it corresponds to middle layer 10. Therefore, when the central server sends the global model to local users 1 to 10, it carries the identifier of sub-middle layer 1, so that local users 1 to 10 send the trained local models to sub-middle layer 1, and when the central server sends the global model to local users 11 to 20, it carries the identifier of sub-middle layer 1, so that local users 11 to 20 send the trained local models to sub-middle layer 2, ..., when the central server sends the global model to local users 91 to 100, it carries the identifier of sub-middle layer 10, so that local users 91 to 100 send the trained local models to sub-middle layer 10.
[0060] It should be noted that if the global model is trained in each round to obtain a global model that meets the accuracy requirements and converges, for user grouping, 100 local users can be randomly divided into 10 user groups, each user group corresponds to a sub-middle layer, and the next round of training is to shuffle the 100 local users and group them again. The number of user groups in each round of training and the number of users in each user group remain unchanged. For example, in the first round of training, sub-middle layer 1 collects 10 local models of local users 1-10, and sub-middle layer 2 collects 10 local models of local users 11-20. In the second round of training, sub-middle layer 1 can collect 10 local models of local users 15-24, and sub-middle layer 2 collects 10 local models of local users 53-62. Therefore, based on the characteristics of local users moving in different sub-middle layers, each local user can be called a moving target.
[0061] In the hierarchical secure federated learning method provided by the present invention, the central server determines each user group and divides each user group into a corresponding sub-middle layer, and carries the corresponding sub-middle layer identifier of the received local model when sending the global model to the corresponding local users, so as to achieve the purpose of quickly and reliably hiding information when the number of local users is large, thereby realizing the flexibility and efficiency of protecting the privacy information of each local user.
[0062] Optionally, the implementation process of step 120 may include:
[0063] First, the intermediate layer performs shuffling processing between model identifiers, shuffling processing between model contents, and adding disturbances on each local model to generate each anonymous model; then, anomaly detection processing is performed on each of the anonymous models to obtain user behavior identifiers and user behavior scores.
[0064] Specifically, when the number of local users is small, a small number of local users can be divided into a user group. At this time, the middle layer does not need to be divided into sub-middle layers and directly receives the local model generated by each local user after training the global model; when the number of local users is large, a large number of local users can be divided into multiple user groups, each user group corresponds to a sub-middle layer, and each sub-middle layer receives the local model uploaded by each local user in the corresponding user group. Then, the middle layer or each sub-middle layer shuffles the model identifiers, shuffles the model contents, and adds disturbances for at least two local models received to generate at least two anonymous models. Although the number of anonymous models generated in the middle layer or each sub-middle layer is the same as the number of local models received, there is no corresponding relationship between the local users who sent the local models, and none of them carry privacy information. That is, at this time, the anonymous models generated in the middle layer or each sub-middle layer have no practical significance.
[0065] Then, the middle layer or each sub-middle layer performs anomaly detection processing for each anonymous model, and the anomaly detection processing here can be performed using an existing anomaly detection processing method to obtain a user behavior identifier and a user behavior score. Among them, the existing anomaly detection processing method can include an autoencoder (AutoEncoder) algorithm, a variational autoencoder (VAE) algorithm, a Beta variational autoencoder (Beta-VAE), a single-objective generative adversarial active learning (SO-GAAL) algorithm, a multi-objective generative adversarial active learning (MO-GAAL) algorithm, and a deep one-level classification (DeepSVDD) algorithm, preferably a VAE algorithm.
[0066] It should be noted that the middle layer or each sub-middle layer performs anomaly detection processing for each anonymous model, including: the middle layer or each sub-middle layer performs anomaly detection processing for each anonymous model contained therein, and obtains anomaly detection scores of all anonymous models. Then, it is determined whether there is a group with anomaly detection scores greater than a preset malicious threshold among all anomaly detection scores. When the preset malicious threshold is 0 and it is determined that there is a group with anomaly detection scores greater than 0 among all anomaly detection scores, if the middle layer is only for one user group, then each local user in the user group is marked as a malicious user and the maximum anomaly detection score among all anomaly detection scores is used as the malicious score of each local user in the user group; if the middle layer is divided into multiple sub-middle layers and each sub-middle layer corresponds to one user group, for user groups with anomaly detection scores greater than 0, the maximum anomaly detection score in the user group is selected, and the maximum anomaly detection score is used to mark the malicious score of each local user in the user group, and each local user in the user group is marked as a malicious user.
[0067] For example, when the user groups with the maximum anomaly detection score include user group 1, user group 3 and user group 5, then the maximum anomaly detection score of user group 1 is the malicious score of the local users in user group 1 and all local users in user group 1 are marked as malicious users, the maximum anomaly detection score of user group 3 is the malicious score of the local users in user group 3 and all local users in user group 3 are marked as malicious users, and the maximum anomaly detection score of user group 5 is the malicious score of the local users in user group 5 and all local users in user group 5 are marked as malicious users, and the obtained user groups 1, 3, 5 marked as malicious users and their malicious scores are synchronized to the central server.
[0068] On the contrary, when the preset malicious threshold is 0 and it is determined that there is no group with anomaly detection scores greater than 0 among all anomaly detection scores, it can be considered that there is no malicious user, and the corresponding user group is marked as non-malicious users and the non-malicious scores of local users in the user group are all 0. Then the user groups marked as non-malicious users and their non-malicious scores are also synchronized to the central server.
[0069] In addition, it should be noted that when there is one malicious user among 100 local users, only one user group is marked as a malicious user, and the rest of the user groups are marked as non-malicious users; when there are multiple malicious users among 100 local users, multiple user groups can be marked as malicious users, and the rest of the user groups are also marked as non-malicious users.
[0070] In the hierarchical secure federated learning method provided by the present invention, the central server obtains the user behavior identification and user behavior score generated after the middle layer performs anomaly detection processing on each anonymous model. Since the anonymous model includes the model generated after shuffling the model identifications, shuffling the model contents, and adding disturbances to each local model, the central server can quickly know whether there are malicious users among the local users based on the received user behavior identification and user behavior score, and greatly improve the security of federated learning privacy protection through the hierarchical shuffling dynamic learning mechanism, so as to provide a strong basis for the subsequent accurate positioning of malicious users.
[0071] Optionally, the implementation process of step 130 may include:
[0072] First, at least two user scores of each local user in the user group are updated according to the user behavior identifier and the user behavior score to obtain at least two new user scores; then, when a target user score exceeding a preset user score threshold exists among the at least two new user scores, it is determined that the target user score corresponds to a malicious user, and a ban is performed on the malicious user.
[0073] Specifically, for the global model sent by the central server as a model that meets the accuracy requirements and has converged, when the user behavior identifiers and user behavior scores received by the central server include malicious user identifiers and malicious scores as well as non-malicious user identifiers and non-malicious scores, the user scores of local users with malicious intent can be updated accordingly, and the user scores of local users without malicious intent can be updated accordingly, to obtain multiple new user scores, each of which has a corresponding relationship with each local user. Therefore, it is determined whether there is a target user score that exceeds a preset user score threshold among the multiple new user scores. If there is a target user score that exceeds the preset user score threshold among the multiple new user scores, the local user corresponding to the target user score is marked as a malicious user and the malicious user is marked as a banned user, and the weight of the local model trained by the banned user is marked as 0.
[0074] It should be noted that malicious users can be divided into curious type, semi-malicious type and pure malicious type according to their malicious degree, and when there are multiple malicious users, malicious users are also allowed to cooperate with each other, but the ratio of malicious users cannot be too large. Usually, the ratio of malicious users to all local users is far less than 1. Malicious users can not only have strong background knowledge, but also obtain any information needed to complete the attack, but they cannot locate the data set of local users. Malicious users can also be divided into confidentiality threat attacks, availability threat attacks and integrity threat attacks. Confidentiality threat attacks can represent that the attacker violates the privacy of local users by recovering undisclosed data from public local models and global models. Non-public data may include sensitive information; availability threat attacks can represent that in addition to data leakage, the attacker can also invalidate the global model; integrity threat attacks can represent attacks similar to backdoor attacks or model inversion that manipulate the global model to an aggregated model. The model can be slightly modified to run abnormally in several tasks, while the rest of the main tasks are not affected.
[0075] The hierarchical secure federated learning method provided by the present invention is a method in which a central server determines whether there is a target user score that exceeds a preset user score threshold among at least two new user scores obtained after performing corresponding update operations based on the user behavior identifier and the user behavior score, thereby achieving the purpose of quickly locating malicious users and executing bans under the premise that the global model has been trained and converged, thereby improving the accuracy and reliability of banning malicious users.
[0076] Optionally, if the global model currently obtained by the central server is not a model that meets the accuracy requirements and converges, the global model may be trained while the malicious user is determined and the ban is performed. That is, after the step of updating at least two user scores of each local user in the user group according to the user behavior identifier and the user behavior score to obtain at least two new user scores, the method may further include:
[0077] First, the weight of the anonymous model in the corresponding user group is determined based on the user behavior score; then, a model aggregation operation is performed according to the weight of the anonymous model to obtain a new global model, and then the global model is sent to each local user, and each local user is instructed to send the local model generated after training the global model to the middle layer to perform the next round of training; until a global model that meets the preset accuracy requirements and meets the convergence conditions is obtained.
[0078] Specifically, the central server updates the user scores of local users with malicious intent according to the malicious user identifiers and malicious scores synchronized from the middle layer, and updates the user scores of local users without malicious intent using non-malicious user identifiers and non-malicious scores, and marks the weight of each anonymous model in malicious users as the inverse of the corresponding malicious score, and marks the weight of each anonymous model in non-malicious users as 1. Since the malicious score is usually greater than 0, the purpose of downgrading malicious users can be achieved.
[0079] For example, when user group 1 is marked as a malicious user, the malicious score of user group 1 is used to update the user score of each local user in user group 1, and the weights of the 10 anonymous models of user group 1 are the reciprocals of the malicious score of user group 1; when user group 2 is not marked as a malicious user (for example, the abnormal detection values of the 10 anonymous models in user group 2 are all 0), the normal detection score of user group 2 (for example, the normal detection score is 0) is used to update the user score of each local user in user group 2, and the weights of the 10 anonymous models of user group 2 are all 1.
[0080] It should be noted that the process of the central server updating the user score of each local user includes: firstly calculating the malicious value Err of the mth user group in the tth round of training, and then calculating the malicious value Err of the i-th local user u in the mth user group in the tth round of training. i The time-averaged intensity of potential poisoning attacks against A (u i ; t), and then further calculate u i The user score V(u i ,t), and finally calculate u i The new user score obtained after updating in the tth round of training The formula involved is:
[0081]
[0082]
[0083]
[0084]
[0085] in, w(i',j) is the model to be tested in the mth user group during the tth round of training The elements in The new model reconstructed by the automatic encoder for the model to be detected in the mth user group during the tth round of training The elements in is the mth user group in the τth round of training, is the grouping of all users in the tth round of training, N is the total number of anonymous models uploaded to the central server, and D i is the weight of the i-th anonymous model in the t-th round of training, D j is the weight of the jth anonymous model in the tth round of training; ζ is the preset protection parameter and the value of ζ can be 0.001; L is the preset weight adjustment coefficient and the value of L can be 0.2. In this way, the weights of different models can be dynamically adjusted according to the user scores dynamically adjusted in the previous t-1 rounds, so as to quickly decide and locate malicious users in federated learning training and complete efficient response and defense.
[0086] In the hierarchical secure federated learning method provided by the present invention, a central server obtains a new global model based on the weight of the anonymous model in the corresponding user group determined by the user behavior score, and sends the new model to each local user to execute the next round of training, thereby obtaining a global model that meets the preset accuracy requirements and converges, thereby improving the reliability and accuracy of the central server's training of the global model.
[0087] Optionally, before the step of obtaining a global model that meets the preset accuracy requirement and satisfies the convergence condition, the method may further include:
[0088] First, when it is determined that the number of training rounds reaches M rounds, an update operation of the corresponding user score is performed according to the new user behavior identifier and the new user behavior score generated by the M-th round of training, so as to obtain at least two new user scores of the M-th round; wherein M is a positive integer; then, it is determined whether there is a target user score exceeding a preset user score threshold value among the at least two new user scores; when the target user score exists among the at least two new user scores, it is determined that the target user score corresponds to a malicious user, and a ban is performed on the malicious user.
[0089] Specifically, for the training process of the global model, the central server can initially send the global model automatically generated by the federated learning framework to each local user for the first round of training. When a new global model is obtained, the new global model is sent to each local user for the second round of training, ... until the number of training rounds reaches M. The central server can update the user score of the local user according to the new malicious score and the new malicious user identifier generated by the Mth round of training, and determine whether there is a target user score that exceeds the preset user score among at least two new user scores of the Mth round. If so, the local user corresponding to the target user score is marked as a malicious user and the malicious user is banned. After the ban is executed, the local user can be marked as a banned user, and the weight of the global model trained by the banned user can be further marked as 0.
[0090] For example, when the value of M is 50 and after 50 rounds of training, it is determined that the user score of local user 2 in user group 1 marked as a malicious user exceeds the preset user score threshold after updating. At this time, local user 2 is marked as a banned user. When local user 2 marked as a banned user trains the global model and uploads it, its weight is set to 0. All local users except local user 2 in user group 1 are non-banned users and their weights are set to the inverse of the malicious score of user group 1 when the global model is uploaded; when the user score of each local user in user group 2 does not exceed the preset user score after updating, the weight of each local user in local group 2 is set to 1 when the global model is uploaded.
[0091] The hierarchical secure federated learning method provided by the present invention determines whether there is a preset user score threshold after the central server updates the new user score obtained during the preset round of training of the global model. This enables the central server to train global models that have not converged and whose accuracy does not meet the requirements while determining malicious users and executing bans for all local users. That is, the banning of malicious users does not affect the global model training process. This not only meets the protection requirements of local users' privacy data during the training process of federated learning, but also significantly improves the defense performance of federated learning against various malicious attacks, thereby improving the diversity and flexibility of the central server.
[0092] Optionally, the process of obtaining a global model that meets preset accuracy requirements and converges includes: when it is determined that the number of training rounds has reached N, performing an accuracy test and a convergence test on the new global model generated by the Nth round of training; wherein N is a positive integer, and the value of M may be the same as or different from N; if the new global model generated by the Nth round of training meets the preset accuracy requirements and meets preset convergence conditions, then the new global model generated by the Nth round of training is determined to be a global model that meets the preset accuracy requirements and converges; if the new global model generated by the Nth round of training does not meet the preset accuracy requirements and / or does not meet the preset convergence conditions, then returning to the step of sending the global model to each local user, and instructing each of the local users to send the local model generated after training the global model to the intermediate layer to perform training.
[0093] Specifically, when the central server determines that the current training round is the Nth round, it can perform accuracy test and convergence test on the new global model generated by the Nth round of training. If the accuracy of the new global model reaches the preset accuracy requirement and its loss value reaches the preset loss threshold, it means that the new global model obtained at this time not only meets the accuracy requirement but also converges. At this time, it can be determined that the new global model currently obtained meets the requirements and the training is completed, and the trained global model can be used directly in the future; on the contrary, if the accuracy of the new global model does not meet the preset accuracy requirement and / or its loss value does not reach the preset loss threshold, it means that the new global model obtained at this time has not been trained well, that is, the training cannot be terminated. At this time, based on the new global model generated by the Nth round of training, it can return to step 110 to perform the next N rounds of training. Among them, the preset loss threshold can represent that the loss of the model reaches the lowest, has no downward trend and remains stable, and the preset accuracy requirement can represent that the accuracy of the model is high enough.
[0094] In the hierarchical secure federated learning method provided by the present invention, the central server determines whether to obtain a trained global model or continue training by performing accuracy tests and convergence tests on the new global model generated by the Nth round of training, thereby improving the accuracy and reliability of the central server's training of the global model.
[0095] like Figure 2 As shown, the present invention provides a hierarchical secure federated learning system. Figure 2 In the embodiment, a hierarchical secure federated learning system 200 includes: a central server 210, a plurality of local users 220 and an intermediate layer 230; wherein:
[0096] The central server 210 is used to send the global model to each local user, and instruct each local user to send the local model generated after training the global model to the intermediate layer;
[0097] A local user 220, configured to train the received global model to generate a local model, and send the local model to the intermediate layer;
[0098] The middle layer 230 is used to generate a user behavior identifier and a user behavior score after performing anonymization processing on each local model; the anonymization processing includes the middle layer shuffling each local model and adding disturbances to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score and then synchronize them to the central server; the central server 210 is used to identify malicious users and ban them according to the user behavior identifier and the user behavior score.
[0099] It should be noted that other functions performed by the central server 210, the local users 220 and the intermediate layer 230 can be referenced with the aforementioned method embodiments and will not be described in detail here.
[0100] The hierarchical security federated learning device provided by the present invention is described below. The hierarchical security federated learning device described below and the hierarchical security federated learning method described above can be referenced to each other.
[0101] like Figure 3 As shown, the present invention provides a hierarchical secure federated learning device. Figure 3 In the embodiment, the hierarchical secure federated learning device 300 comprises:
[0102] A sending module 310, configured to send the global model to each local user, and instruct each local user to send the local model generated after training the global model to the middle layer;
[0103] The acquisition module 320 is used to obtain the user behavior identifier and the user behavior score generated by the intermediate layer after performing anonymization processing on each local model; wherein the anonymization processing includes the intermediate layer shuffling each local model and adding disturbance to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score;
[0104] The processing module 330 is used to determine malicious users and ban them according to the user behavior identifier and the user behavior score.
[0105] Optionally, the sending module 310 can be specifically used to group all local users to obtain at least two user groups and at least two local users in each user group; establish a corresponding relationship between the user group and the sub-middle layer; and when sending the global model to each of the local users, carry the sub-middle layer identifier of the local model generated after receiving the local user to train the global model, so that each of the local users sends the local model generated by it to the corresponding sub-middle layer.
[0106] Optionally, the acquisition module 320 can be specifically used to obtain the user behavior identifier and user behavior score generated after the intermediate layer performs anomaly detection processing on each anonymous model; wherein the anonymous model includes each local model performing shuffle processing between model identifiers, shuffle processing between model contents, and a model generated after adding disturbances.
[0107] Optionally, the processing module 330 can be specifically used to update at least two user scores of each local user in the user group according to the user behavior identifier and the user behavior score, and obtain at least two new user scores; when there is a target user score that exceeds a preset user score threshold among the at least two new user scores, it is determined that the target user score corresponds to a malicious user, and the malicious user is banned.
[0108] Optionally, the processing module 330 can also be used to determine the weight of the anonymous model in the corresponding user group based on the user behavior score; perform model aggregation operations according to the weight of the anonymous model to obtain a new global model, and then return to the step of sending the global model to each local user, and instructing each local user to send the local model generated after training the global model to the middle layer to perform the next round of training; until a global model that meets the preset accuracy requirements and meets the convergence conditions is obtained.
[0109] Optionally, the processing module 330 can also be specifically used to determine when the number of training rounds reaches M rounds, and after performing the corresponding user score update operation according to the new user behavior identifier and the new user behavior score generated by the Mth round of training, obtain at least two new user scores of the Mth round; wherein M is a positive integer; determine whether there is a target user score exceeding a preset user score threshold among the at least two new user scores; when the target user score exists among the at least two new user scores, determine that the target user score corresponds to a malicious user, and perform a ban on the malicious user.
[0110] Optionally, the processing module 330 can also be used to determine when the number of training rounds reaches N rounds, and to perform accuracy test and convergence test on the new global model generated by the Nth round of training; wherein N is a positive integer; if the new global model generated by the Nth round of training meets the preset accuracy requirements and meets the preset convergence conditions, then the new global model generated by the Nth round of training is determined as a global model that meets the preset accuracy requirements and converges; if the new global model generated by the Nth round of training does not meet the preset accuracy requirements and / or does not meet the preset convergence conditions, then the step of sending the global model to each local user and instructing each local user to send the local model generated after training the global model to the intermediate layer to perform training is returned.
[0111] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4As shown, the electronic device 400 may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 840. The processor 410 may call the logic instructions in the memory 430 to execute the hierarchical secure federated learning method, which includes:
[0112] Send the global model to each local user, and instruct each local user to send the local model generated after training the global model to the middle layer;
[0113] Obtaining the user behavior identifier and the user behavior score generated by the middle layer after performing anonymization processing on each local model; wherein the anonymization processing includes the middle layer shuffling each local model and adding disturbance to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score;
[0114] Malicious users are identified and banned based on the user behavior identifier and the user behavior score.
[0115] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0116] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can execute the hierarchical secure federated learning method provided by the above methods, the method comprising:
[0117] Send the global model to each local user, and instruct each local user to send the local model generated after training the global model to the middle layer;
[0118] Obtaining the user behavior identifier and the user behavior score generated by the middle layer after performing anonymization processing on each local model; wherein the anonymization processing includes the middle layer shuffling each local model and adding disturbance to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score;
[0119] Malicious users are identified and banned based on the user behavior identifier and the user behavior score.
[0120] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the hierarchical secure federated learning method provided by the above methods, the method comprising:
[0121] Send the global model to each local user, and instruct each local user to send the local model generated after training the global model to the middle layer;
[0122] Obtaining the user behavior identifier and the user behavior score generated by the middle layer after performing anonymization processing on each local model; wherein the anonymization processing includes the middle layer shuffling each local model and adding disturbance to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score;
[0123] Malicious users are identified and banned based on the user behavior identifier and the user behavior score.
[0124] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0125] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A hierarchical secure federated learning method, characterized in that: include: The central server sends the global model to each local user, and instructs each local user to send the local model generated after training the global model to the middle layer; Grouping all local users to obtain at least two user groups and at least two local users in each user group; The central server obtains the user behavior identifier and the user behavior score generated by the intermediate layer after performing anonymization processing on each local model; wherein the anonymization processing includes the intermediate layer shuffling each local model and adding disturbance to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score; According to the user behavior identifier and the user behavior score, at least two user scores of each local user in the user group are updated to obtain at least two new user scores; When there is a target user score exceeding a preset user score threshold among the at least two new user scores, it is determined that the target user score corresponds to a malicious user, and a ban is performed on the malicious user; After the step of correspondingly updating at least two user scores of each local user in the user group according to the user behavior identifier and the user behavior score to obtain at least two new user scores, the method further includes: Based on the user behavior score, the weight of the anonymous model in the corresponding user group is determined; according to the weight of the anonymous model, a model aggregation operation is performed to obtain a new global model, and then the global model is sent to each local user, and each local user is instructed to send the local model generated after training the global model to the middle layer to perform the next round of training; until a global model that meets the preset accuracy requirements and meets the convergence conditions is obtained.
2. The hierarchical secure federated learning method according to claim 1, characterized in that: When the intermediate layer includes at least two sub-intermediate layers, sending the global model to each local user and instructing each local user to send the local model generated after training the global model to the intermediate layer includes: Establishing a corresponding relationship between the user group and the sub-middle layer; When the global model is sent down to each local user, the sub-middle layer identifier of the local model generated after the local user trains the global model is carried, so that each local user sends the local model generated by it to the corresponding sub-middle layer.
3. The hierarchical secure federated learning method according to claim 1, characterized in that: The obtaining of the user behavior identifier and the user behavior score generated by the middle layer after performing anonymization processing on each local model includes: Obtain the user behavior identifier and user behavior score generated by the intermediate layer after performing anomaly detection processing on each anonymous model; wherein the anonymous model includes the model generated after shuffling processing between model identifiers, shuffling processing between model contents and adding disturbances to each local model.
4. The hierarchical secure federated learning method according to any one of claims 1 to 3, characterized in that: Before the step of obtaining a global model that meets the preset accuracy requirement and meets the convergence condition, the method further includes: When it is determined that the number of training rounds reaches M rounds, after performing an update operation on the corresponding user score according to the new user behavior identifier and the new user behavior score generated by the M-th round of training, at least two new user scores of the M-th round are obtained; wherein M is a positive integer; Determine whether there is a target user score that exceeds a preset user score threshold among the at least two new user scores; When the target user score exists in the at least two new user scores, it is determined that the target user score corresponds to a malicious user, and a ban process is performed on the malicious user.
5. The hierarchical secure federated learning method according to any one of claims 1 to 3, characterized in that: The method of obtaining a global model that meets the preset accuracy requirements and converges includes: When it is determined that the number of training rounds reaches N, the new global model generated by the Nth round of training is subjected to accuracy test and convergence test; wherein N is a positive integer; If the new global model generated by the Nth round of training meets the preset accuracy requirement and satisfies the preset convergence condition, the new global model generated by the Nth round of training is determined as the global model that meets the preset accuracy requirement and converges; If the new global model generated by the Nth round of training does not meet the preset accuracy requirements and / or does not meet the preset convergence conditions, return to the step of sending the global model to each local user, and instruct each local user to send the local model generated after training the global model to the intermediate layer to perform training.
6. A hierarchical secure federated learning system, characterized in that: include: Central server, several local users and middle layer; among them: The central server is used to send the global model to each local user and instruct each local user to send the local model generated after training the global model to the intermediate layer; group all local users to obtain at least two user groups and at least two local users in each user group; The local user is used to train the received global model to generate a local model, and send the local model to the intermediate layer; The intermediate layer is used to generate a user behavior identifier and a user behavior score after performing anonymization processing on each local model; the anonymization processing includes the intermediate layer shuffling each local model and adding disturbances to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score and then synchronize them to the central server; the central server is used to update at least two user scores of each local user in the user group according to the user behavior identifier and the user behavior score to obtain at least two new user scores; when there is a target user score that exceeds a preset user score threshold among the at least two new user scores, the target user score is determined to be The method further comprises the steps of: identifying malicious users and banning the malicious users; after the step of updating at least two user scores of each local user in the user group according to the user behavior identifier and the user behavior score to obtain at least two new user scores, the method further comprises: determining the weight of the anonymous model in the corresponding user group based on the user behavior score; performing model aggregation operation according to the weight of the anonymous model to obtain a new global model, and then returning to the step of sending the global model to each local user and instructing each local user to send the local model generated after training the global model to the intermediate layer to perform the next round of training; until a global model that meets the preset accuracy requirements and meets the convergence conditions is obtained.
7. A hierarchical secure federated learning device, characterized in that: include: A sending module, used to send the global model to each local user, and instruct each local user to send the local model generated after training the global model to the middle layer; Grouping all local users to obtain at least two user groups and at least two local users in each user group; An acquisition module, used to acquire the user behavior identifier and the user behavior score generated by the middle layer after performing anonymization processing on each local model; wherein the anonymization processing includes the middle layer shuffling each local model and adding disturbance to generate an anonymous model, and then performing anomaly detection processing on the anonymous model to obtain the user behavior identifier and the user behavior score; A processing module, used to update at least two user scores of each local user in the user group according to the user behavior identifier and the user behavior score to obtain at least two new user scores; when there is a target user score exceeding a preset user score threshold among the at least two new user scores, it is determined that the target user score corresponds to a malicious user, and the malicious user is banned; after the step of updating at least two user scores of each local user in the user group according to the user behavior identifier and the user behavior score to obtain at least two new user scores, it also includes: determining the weight of the anonymous model in the corresponding user group based on the user behavior score; performing a model aggregation operation according to the weight of the anonymous model to obtain a new global model, and then returning to the step of sending the global model to each local user and instructing each local user to send the local model generated after training the global model to the intermediate layer to perform the next round of training; until a global model that meets the preset accuracy requirements and meets the convergence conditions is obtained.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the hierarchical secure federated learning method as described in any one of claims 1 to 5 are implemented.
9. A non-transitory 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 hierarchical secure federated learning method as described in any one of claims 1 to 5 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the hierarchical secure federated learning method as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method and system for detecting abnormal nodes in federated learning
CN112749392A
Layered federal learning method and system applying differential privacy protection
CN113361694A
