Efficient knowledge editing method and device in federated learning environment

By splitting and training student models in a federated learning environment, it solves the problem of knowledge editing in the scenario of forgetting some data, achieves the maintenance of global model performance and privacy protection, avoids the problem of low operating efficiency of the central server, and has universal applicability and efficiency.

CN118410860BActive Publication Date: 2024-09-24HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410892912.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-09-24
Estimated Expiration
2044-07-03

AI Technical Summary

Technical Problem

The existing knowledge editing method in the federated learning environment cannot be applied to the scenario of forgetting some data of the target client, and after the forgetting operation, the performance of the global model cannot be equivalent to that of the original global model. At the same time, retaining too many historical training parameters in the central server will Leading to privacy leaks and low operating efficiency.

Method used

The client initiates a forgetting request to the central server, splits the target processing layer in the global model, uses the target processing layer as the teacher model, builds a student model with the same structure, and trains the student model in local data based on the centroid vector and loss When the function determines that the training iteration is stopped, the student model and the global model parameters are combined into the target model to realize knowledge editing and avoid the problems of privacy leakage and low operating efficiency of the central server.

Benefits of technology

It realizes knowledge editing in the scenario of forgetting some data, ensures the maintenance of global model performance, and avoids the problems of privacy leakage and low operating efficiency of the central server. It is universal and efficient.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118410860B
    Figure CN118410860B
Patent Text Reader

Abstract

The embodiments of the present application provide an efficient knowledge editing method and device in a federated learning environment. The method in the present application obtains a target model that meets the knowledge editing requirements by constructing a teacher model and a student model so that the student model learns the teacher model. Compared with the method in the prior art of retraining to obtain a target model that meets the knowledge editing requirements by calibrating the historical training parameters cached in the central server, there is no need to cache historical parameters, which can not only avoid privacy leakage, but also avoid the problem of low central server operation efficiency caused by excessive caching. In addition, the method provided by the present application can also be applied in scenarios where only part of the data needs to be forgotten, and it is universal and can meet the different needs of users.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communications, and in particular to an efficient knowledge editing method and device in a federated learning environment. Background Art

[0002] Because federated learning has the ability to protect data privacy, it is often used to achieve distributed deployment and training of global models in scenarios with high requirements for data privacy, such as smart finance, smart healthcare, and smart communications.

[0003] In the federated learning scenario, the client will initiate a forget request, which is used to indicate the elimination of the contribution of the target client's local data in the global model training. However, how to make the performance of the global model obtained after the forget operation comparable to that of the original global model (that is, how to implement knowledge editing) is an issue that needs attention.

[0004] In the existing knowledge editing method in the federated learning environment, after the target client requests a forget request, the global model is rebuilt by calibrating the historical training parameters cached in the central server. However, this method can only be applied to the scenario of forgetting all the local data of the target client, and cannot be applied to the scenario of forgetting part of the target client's data. In addition, keeping too many historical training parameters in the central server is not conducive to privacy protection. Summary of the invention

[0005] In view of this, the embodiments of the present application provide an efficient knowledge editing device method and device in a federated learning environment, which is not only suitable for the scenario where some data of the target client is forgotten, but also can avoid privacy leakage.

[0006] The present application embodiment provides an efficient knowledge editing method in a federated learning environment, the method is applied to a client, and the method includes:

[0007] Initiate a forget request to the central server to trigger the central server to send the global model F(ω) to the client; the global model F(ω) is trained based on the training data set, and the forgotten data indicated by the forget request to be forgotten is part of the client's local data, and the local data is a subset of the training data set;

[0008] Split the target processing layer from the global model F(ω); the target processing layer refers to the processing layer that is relevant to the forgotten data during the training process of the global model F(ω);

[0009] Obtain data of each category except the forgotten data from the local data. For each category, the target processing layer determines the centroid vector of the category based on the data of the category. The centroid vector of any category is used to describe the characteristics of the data of this category.

[0010] Take the target processing layer as the teacher model, and build a student model with the same structure as the teacher model. Use the remaining data in the local data except the forgotten data to train the student model. Determine when the training iteration stops based on the centroid vectors of each category, the teacher model and the trained student model. Based on the requirements of knowledge editing, the trained student model and the non-target processing layer in the global model parameter F(ω) are combined into a target model. The performance of the target model after the client deletes the forgotten data and the performance difference of the global model F(ω) when the client does not delete the forgotten data are within the set difference range.

[0011] The embodiment of the present application also provides an efficient knowledge editing device in a federated learning environment, the device is applied to a client, and the device includes:

[0012] The sending module is used to initiate a forget request to the central server to trigger the central server to send the global model F(ω) to the client; the global model F(ω) is trained based on the training data set, and the forgotten data indicated by the forget request to be forgotten is part of the local data of the client, and the local data is a subset of the training data set;

[0013] The data processing module is used to obtain data of each category except the forgotten data from the local data. For each category, the global model F(ω) determines the centroid vector of the category based on the data of the category; the centroid vector of any category is used to describe the characteristics of the data of this category;

[0014] A training module is used to split the target processing layer from the global model F(ω); the target processing layer refers to the processing layer that is correlated with the forgotten data during the training of the global model F(ω); the target processing layer is used as the teacher model, and a student model with the same structure as the teacher model is constructed, and the student model is trained using the remaining data in the local data except the forgotten data. When the training iteration stops based on the centroid vectors of each category, the teacher model and the trained student model, based on the requirements of knowledge editing, the trained student model and the non-target processing layer in the global model parameter F(ω) are combined into a target model.

[0015] The present application also provides an image detection method based on federated learning, which is applied to a client and includes:

[0016] Inputting a target image to be detected into a target model deployed in the client, wherein the target model is obtained based on the method provided in the above embodiment, and detecting the target in the target image by using the target model to detect the target object in the target image;

[0017] The target image is any of the following images:

[0018] Computed tomography (CT) images, lane images captured by a camera for a target lane, and face images;

[0019] Wherein, when a CT image is selected as the target image, the target object is a lesion area;

[0020] When a lane image is selected as the target image, the target object is a vehicle;

[0021] When a face image is selected as the target image, the target object is a living human face.

[0022] An embodiment of the present application also provides an electronic device, including: a processor and a memory for storing computer program instructions, and when the computer program instructions are executed by the processor, the processor executes the steps of the above method.

[0023] An embodiment of the present application also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.

[0024] An embodiment of the present application also provides a machine-readable storage medium, which stores computer program instructions. When the computer program instructions are executed, the steps of the above method can be implemented.

[0025] It can be seen from the above technical solution that in this embodiment, the client initiates a forget request to the central server to trigger the central server to send the global model F(ω) to the client. The client splits the target processing layer from the global model F(ω), and obtains data of each category except the forgotten data from the local data. For each category, the target processing layer determines the centroid vector of the category based on the data of the category. The target processing layer is used as the teacher model, and a student model with the same structure as the teacher model is constructed. The student model is trained using local data. When the training iteration stops, it is determined based on the centroid vectors of each category, the teacher model, and the trained student model. Based on the requirements of knowledge editing, the trained student model and the non-target processing layer in the global model parameter F(ω) are combined into a target model.

[0026] This method of obtaining a target model that meets the requirements of knowledge editing by constructing a teacher model and a student model and enabling the student model to learn the teacher model is different from the method in the prior art of retraining the target model that meets the requirements of knowledge editing by calibrating the historical training parameters cached in the central server. This method does not require caching historical parameters, which not only avoids privacy leakage, but also avoids the problem of low operating efficiency of the central server due to excessive caching.

[0027] Furthermore, the method provided in the present application can also be applied in the scenario where only part of the data needs to be forgotten. It is universal and can meet the different needs of users. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 The scenario architecture diagram of federated learning provided in the relevant technology;

[0029] Figure 2 A schematic diagram of a process for a method provided in an embodiment of the present application;

[0030] Figure 3 A schematic diagram of the process of teacher-student model training provided in an embodiment of the present application;

[0031] Figure 4 A schematic diagram of the structure of the device provided in the embodiment of the present application;

[0032] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.

[0034] Before describing the method provided by this application, the problems existing in existing knowledge editing are first elaborated in detail in combination with the federated learning scenario:

[0035] In scenarios with high requirements for data privacy, such as smart finance, smart healthcare, and smart communications, federated learning is often used to achieve distributed deployment and training of global models. The reason for using federated learning is that it can store data in a dispersed manner among multiple clients, and achieve distributed deployment and training of global models through the collaboration of each client. This method of training and deploying models without concentrating all data in one place can meet the privacy requirements of the above scenarios.

[0036] See also Figure 1 , Figure 1 The scenario architecture diagram of federated learning provided in related technologies, such as Figure 1 As shown in Figure 1, the federated learning scenario usually involves a central server and N clients. The central server selects k clients from the N clients to participate in the training, and the central server sends the initial global model F(ω) to the client. In each round of training, each client uses the local data Dk to perform local training on the global model F(ω), and obtains the updated local model F(ω) through gradient descent. k ). Each server will update the local model F(ωk ) is uploaded to the central server. The central server receives the updated local model F(ω) from each of the k clients. k ) performs weighted average aggregation to obtain the updated global model corresponding to this round of training. The central server sends the global model corresponding to this round of training to k clients again, and repeats the iterative training in the above manner until the stop iteration condition is met, and the trained global model Q is obtained.

[0037] In the above process, the data of each client is only stored locally and not transmitted to other clients, which can protect the data privacy of each client.

[0038] On this basis, users can initiate forget requests according to actual needs. Forget requests are used to indicate the removal of the contribution of the client's local data in the global model training. For example, client D among the k clients mentioned above initiates a forget request due to actual needs, requiring the deletion of the contribution of client D's local data to the global model Q. How to make the performance of the global model obtained after the forget operation equivalent to that of the original global model through knowledge editing is an issue that needs attention. Here, the so-called knowledge editing is to perform an operation to make the performance of the global model obtained after the forget operation equivalent to that of the original global model.

[0039] In related technologies, knowledge editing is achieved through the following steps:

[0040] 1. The central server caches all historical training parameters uploaded by the above k clients during the training process.

[0041] 2. After receiving the forget request initiated by the target client, the central server sends the current global model to each client (here, the current global model is the trained global model Q obtained through the above-mentioned federated learning).

[0042] 3. Except for the other k-1 clients before the target client, perform iterative training with fewer rounds than the above training process based on the global model Q (for example, the number of iterative rounds in the above federated learning is 100 times, and in this case, the number of iterative rounds can be 50 times), and send the local model parameters of each iteration to the central server.

[0043] 4. The central server uses the newly received local model parameters to calibrate the stored historical parameters to reconstruct the global model Q'.

[0044] However, this approach has the following problems:

[0045] First of all, this forgetting operation takes the client as the smallest unit, that is, the forgetting operation can only require forgetting all local data of the target client. However, in fact, in more application scenarios, it may be necessary to only forget part of the target client's data. The above method is not applicable in this case.

[0046] Secondly, the central server retains the historical training parameters in each round of iteration. If they are obtained by other people, there will be a risk of privacy leakage, which is not conducive to privacy protection.

[0047] Finally, keeping too many historical training parameters in the central server will occupy a lot of system resources of the central server, which will affect the operating efficiency of the central server.

[0048] Based on this, in order to solve the above problems, the embodiments of the present application provide an efficient knowledge editing device method and device in a federated learning environment.

[0049] The method provided in the embodiment of the present application is described below:

[0050] See also Figure 2 , Figure 2 The following is a schematic diagram of the method flow provided by the embodiment of the present application. The method is applied to the client.

[0051] like Figure 2 As shown, the process may include the following steps:

[0052] S201, initiate a forget request to the central server to trigger the central server to send the global model F(ω) to the client. The global model F(ω) is trained based on the training data set, and the forgotten data indicated by the forget request to be forgotten is part of the client's local data, and the local data is a subset of the training data set.

[0053] As an embodiment, the global model is a classification model, and each training sample in the training sample set has a corresponding label, and the classification of the training data can be determined based on the label.

[0054] S202, obtain data of each category except the forgotten data from the local data, and for each category, determine the centroid vector of the category by the global model F(ω) based on the data of the category; the centroid vector of any category is used to describe the characteristics of the data of this category.

[0055] In this embodiment, it is known that the global model is a classification model, and each data in the local data is used as a training sample, which is configured with a sample label. This sample label indicates the category to which the data belongs. Therefore, based on the labels carried by the data in the local data except the forgotten data, the data under each category can be obtained.

[0056] In the embodiment, the global model F(ω) is composed of a feature extraction layer D(ω) (also referred to as a feature extractor) and a classification layer E(ω) (also referred to as a classifier). The specific implementation method of the global model F(ω) determining the centroid vector of the category based on the data of the category can be as follows: for each remaining data under the category, the feature extraction layer D(ω) in the global model F(ω) is used to extract features of the remaining data to obtain a feature vector of the remaining data. A specified operation is performed on the feature vector of each remaining data under the category to obtain an operation result, and the operation result is used as the centroid vector of the category. For example, each remaining data under category A is input into the feature extraction layer D(ω) to obtain a feature vector of the remaining data, and the average value of the feature vectors of each remaining data under category A is used as the centroid vector under category A.

[0057] S203, split the target processing layer from the global model F(ω); the target processing layer refers to the processing layer that is correlated with the forgotten data during the training process of the global model F(ω); use the target processing layer as the teacher model, and construct a student model with the same structure as the teacher model, use the remaining data in the local data except the forgotten data to train the student model, determine when the training iteration stops based on the centroid vectors of each category, the teacher model and the trained student model, and based on the requirements of knowledge editing, combine the trained student model and the non-target processing layer in the global model parameter F(ω) to form a target model.

[0058] It should be noted that the performance difference between the target model after the client deletes the forgotten data and the performance difference between the global model F(ω) when the client does not delete the forgotten data is within the set difference range. That is, the performance of the target model after the client deletes the forgotten data is equivalent to the performance of the global model F(ω) when the client does not delete the forgotten data.

[0059] In an embodiment, the feature extraction layer D(ω) is the processing layer most relevant to the forgotten data. The feature extraction layer D(ω) is used to extract features of the training data and also extract features of each forgotten data, which is most relevant to the forgotten data. Therefore, the feature extraction layer D(ω) is used as the target processing layer.

[0060] In this embodiment, the target processing layer is split from the global model F(ω) as the teacher model, and the target processing layer is directly copied as the student model. The student model and the teacher model are initialized with the same initial parameters to eliminate the training differences caused by different parameters.

[0061] In this embodiment, the specific implementation method of the above-mentioned training of the teacher-student model will be illustrated in the following text in the form of specific embodiments, and will not be repeated here.

[0062] So far, completed Figure 2 The process shown.

[0063] pass Figure 2 As can be seen from the process shown, the client initiates a forget request to the central server to trigger the central server to send the global model F(ω) to the client. The client splits the target processing layer from the global model F(ω) and obtains the data of each category except the forgotten data from the local data. For each category, the target processing layer determines the centroid vector of the category based on the data of the category. The target processing layer is used as the teacher model, and a student model with the same structure as the teacher model is constructed. The student model is trained using local data. When the training iteration stops, it is determined based on the centroid vectors of each category, the teacher model, and the trained student model. Based on the requirements of knowledge editing, the trained student model and the non-target processing layer in the global model parameter F(ω) are combined into the target model.

[0064] This method of obtaining a target model that meets the requirements of knowledge editing by constructing a teacher model and a student model and enabling the student model to learn the teacher model is different from the method in the prior art of retraining the target model that meets the requirements of knowledge editing by calibrating the historical training parameters cached in the central server. This method does not require caching historical parameters, which not only avoids privacy leakage, but also avoids the problem of low operating efficiency of the central server due to excessive caching.

[0065] Furthermore, the method provided in the present application can also be applied in the scenario where only part of the data needs to be forgotten. It is universal and can meet the different needs of users.

[0066] The following is combined with Figure 3 The specific training process of the above teacher-student model is elaborated in detail:

[0067] like Figure 3 As shown, the process may include the following steps:

[0068] S301, obtaining a set loss function.

[0069] In this embodiment, the loss function consists of the following three parts.

[0070] 1. The loss function of the first part is determined based on the difference between the output result of the teacher model corresponding to each residual data and the output result of the corresponding student model. One of the purposes of training the teacher-student model is to make the feature extraction ability of the student model in the residual data as equivalent as possible to the feature extraction ability of the teacher model in the residual data, so that the obtained target model is equivalent to the original global model in the performance of the residual data. Therefore, determining the loss function of the first part based on the difference between the output result of the teacher model corresponding to each residual data and the output result of the student model can achieve the above purpose.

[0071] For example, the difference between the output result of the teacher model and the output result of the student model corresponding to each residual data is reflected by the Euclidean distance value between the two. The larger the Euclidean distance value, the greater the difference between the two, and vice versa. In this technology, the loss function of the first part is expressed according to the weighted average of the Euclidean distance values ​​corresponding to each residual data.

[0072] For example, the loss function of the first part is L 1 can be expressed by the following formula:

[0073]

[0074] in, Nq Indicates the amount of remaining data;

[0075] x j represents the jth remaining data in all the remaining data Dr;

[0076] Represents the output result of the teacher model corresponding to the jth remaining data;

[0077] Represents the output result of the student model corresponding to the jth remaining data;

[0078] Represents the Euclidean distance between the output result of the teacher model corresponding to the j-th remaining data and the output result of the student model corresponding to the j-th remaining data;

[0079] 2. The loss function of the second part is determined based on the output result of the student model corresponding to each forgotten data in the obtained forgotten data and the difference between the forgotten vectors matching the forgotten data found from the centroid vectors of each category. Here, the forgotten vector is used to represent the target direction of the target feature layer optimization update after the forgotten data is forgotten.

[0080] Since the purpose of training the teacher-student model is to make the student model different from the teacher model in the feature extraction ability of the forgotten data, in other words, the greater the difference between the output result of the forgotten data under the student model and the output result of the forgotten data under the teacher model, the more this purpose can be achieved. The greater the difference between the output result of the forgotten data under the student model and the output result of the forgotten data under the teacher model, the smaller the difference between the output result of the forgotten data under the student model and the characteristics of the forgotten data under non-classification (the characteristics of the forgotten data under non-classification can be reflected by the forgetting vector corresponding to the forgotten data, see the following description for details). Each part of the loss function is optimized towards a smaller trend, therefore, the loss function of the second part is determined based on the difference between the output result of each forgotten data under the student model and the forgetting vector corresponding to the forgotten data.

[0081] For example, the difference between the output result of the student model corresponding to each forgotten data and the forgotten vector corresponding to the forgotten data is reflected by the Euclidean distance value between the two. The larger the Euclidean distance value, the greater the difference between the two, and vice versa. The loss function of the second part is reflected by the weighted average of the Euclidean distance values ​​corresponding to each forgotten data.

[0082] For example, the loss function of the second part is L 2 can be expressed by the following formula:

[0083] The loss function of the second part can be expressed by the following formula:

[0084]

[0085] in, ND f Indicates the amount of forgotten data;

[0086] x i Indicates that all data D is forgotten f The i-th forgotten data in ;

[0087] Represents the output result of the student model corresponding to the i-th forgotten data;

[0088] Represents the forgetting vector corresponding to the i-th forgotten data; Represents the Euclidean distance between the output result of the student model corresponding to the i-th forgotten data and the forgotten vector corresponding to the i-th forgotten data;

[0089] α is the first set weight.

[0090] The fundamental reason why the characteristics of the above-mentioned forgotten data in non-classes can be reflected by the forgetting vector corresponding to the forgotten data is that the forgetting vector corresponding to any forgotten data is obtained by the following steps: for the centroid vector of each class, the similarity value between the centroid vector of the class and the output result of the forgotten data obtained under the teacher model is obtained, and the centroid vector of the class corresponding to the maximum similarity value is determined as the forgetting vector from the centroid vectors of the classes different from the class to which the forgotten data belongs. Since the forgetting vector is the one with the greatest similarity among the centroid vectors of the class different from the class to which the forgotten data belongs, that is, they do not belong to the same class but are very similar, the characteristics of the forgotten data in non-classes can be reflected by the forgetting vector corresponding to the forgotten data.

[0091] 3. The loss function in the third part is a set constraint function, which is used to constrain the adjustment range of each parameter in the student model during the iterative training process. Optionally, the constraint function is obtained by regularizing the parameters of the teacher model and the parameters of the student model.

[0092] For example, the loss function in the third part is L 3 can be expressed by the following formula:

[0093]

[0094] Among them, ω D Represents the parameters corresponding to the teacher model;

[0095] Represents the parameters corresponding to the student model;

[0096] Indicates that the parameters corresponding to the teacher model and the parameters corresponding to the student model are regularized;

[0097] β is the second set weight.

[0098] In summary, the loss function can be expressed by the following formula:

[0099]

[0100] S302, input the output results of the teacher model corresponding to each remaining data, the output results of the student model corresponding to each remaining data, and the centroid vector of each category into a preset loss function to obtain the loss function value.

[0101] S303, judging whether the loss function value meets the set requirements.

[0102] If the execution result of the above step S303 is yes, then execute the following step S304, otherwise, adjust the parameters of the student model and return to execute the above step S302.

[0103] S304, determining whether training iterations are to be stopped.

[0104] In this embodiment, when the above-mentioned loss function value meets the set requirements, when the remaining data is input, the features output by the student model are similar to the features output by the teacher model. This provides a basis for making the obtained target model and the original global model equivalent in performance on the remaining data.

[0105] In this embodiment, the student model obtained when the training iteration stops is determined to be the trained student model. The trained student model and the non-target processing layer in the global model parameter F(ω) form a target model, so that the target model obtained can meet the requirements of knowledge editing, and the performance of the target model is equivalent to the performance of the global model F(ω) when the forgotten data is not deleted.

[0106] In order to explain in more detail, the solution provided by the present application is described in more detail below in combination with specific embodiments:

[0107] In this embodiment, the process includes the following steps:

[0108] 1. The target client initiates a forget request to the central server.

[0109] In this embodiment, the target client initiates a forget request to the central server to forget part of the local data of the client for the purpose of privacy protection or data update. Here, all local data is represented by Dk, and all forgotten data is represented by D f Indicated by; all remaining data are indicated by Dr.

[0110] Dr=Dk-D f

[0111] 2. The central server sends the global model F(ω) to the target client. The global model F(ω) consists of the feature extraction layer D(ω) and the classification layer E(ω). D(ω) is used as the teacher model to construct the student model. , the structure of the student model is equivalent to that of the teacher model.

[0112] 3. Classify all remaining data, and for each category, use the following formula to obtain the centroid vector corresponding to that category:

[0113]

[0114] N m Represents the number of remaining data under category m;

[0115] represents the feature vector of the j-th residual data under category m (this feature vector is obtained using the feature extraction layer D(ω), that is, the output result of the teacher model corresponding to the j-th residual data under category m), and Cm is the centroid vector of category m.

[0116] 5. Forget every data Input to the teacher model D(ω) for feature extraction to obtain the feature vector of the forgotten data (That is, the output result of the teacher model corresponding to the forgotten data), and the forgotten data is obtained by the following formula The corresponding forget vector:

[0117]

[0118] In this way, the corresponding forgetting vector of each forgotten data is obtained.

[0119] 6. Forget every data Input to student model Perform feature extraction to obtain the student model output corresponding to the forgotten data .

[0120] 7. Each remaining data Input them into the teacher model and the student model respectively to get the output result of the teacher model corresponding to the remaining data , and the output of the student model corresponding to the remaining data .

[0121] 8. Output results of the teacher model corresponding to the above remaining data , the output results of the student model corresponding to each remaining data , the output data of the student model corresponding to each forgotten data , and the corresponding forgetting vector of each forgotten data Enter the following formula:

[0122]

[0123] Get the loss function value.

[0124] 9. When the loss function value meets the set requirements, determine that the training iteration stops.

[0125] 10. The trained student model It is concatenated with the classification layer E(ω) to obtain the target model F'(ω) that meets the knowledge requirements.

[0126] After obtaining the target model using the method provided in the above embodiment, Figure 1The above target model is deployed on any client in the network architecture shown. In this way, the above clients obtained based on federated learning can be applied in many fields.

[0127] The application in image detection is described in detail below. The embodiment of the present application also provides an image detection method based on federated learning. Figure 1 In the distributed cluster shown, the target model deployed on any client in the distributed cluster is obtained by training with the method provided in the above embodiment. When any client obtains a target image to be detected, the target image to be detected is input into the locally deployed target model, and the target model is used to detect the target in the target image to detect the target object in the target image. That is, the image detection method is an image detection method based on efficient knowledge editing in a federated learning environment.

[0128] Optionally, as an embodiment, in the process of obtaining the target model, the training sample set is a CT image set, and the sample annotation is an annotation of the lesion area (such as a tumor, etc.). Correspondingly, the target image is also a CT image, and the target object is the lesion area. That is, the target model in the client in the distributed cluster can be used to detect the lesion area in the CT image.

[0129] As an embodiment, in the process of obtaining the target model, the training sample set is a lane image set collected by the camera for the target lane, and the sample label is the annotation of the vehicle. Correspondingly, the target image is also a lane image, and the target object is a vehicle. That is, the target model in the client in the distributed cluster can be used to detect the vehicle in the lane image.

[0130] As an embodiment, in the process of obtaining the target model, the training sample set is a face image set, and the sample label is a label of a live face. Accordingly, the target image is also a face image, and the target object is a live face. That is, the target model in the client in the distributed cluster can be used to detect live faces in face images.

[0131] It should be noted that the application of the target model deployed in any of the above-mentioned clients is not limited to the above-mentioned image detection scenarios, but can also be applied to other scenarios, which is not specifically limited in this embodiment.

[0132] The method provided in the embodiment of the present application is described above. The device provided in the embodiment of the present application is described below:

[0133] See also Figure 4 , Figure 4The device structure diagram provided in the embodiment of the present application is applied to a client, and the device includes: a sending module 401, a data processing module 402 and a training module 403.

[0134] The sending module 401 is used to initiate a forget request to the central server to trigger the central server to send the global model F(ω) to the client; the global model F(ω) is trained based on the training data set, and the forgotten data to be forgotten indicated by the forget request is part of the local data of the client, and the local data is a subset of the training data set;

[0135] The data processing module 402 is used to obtain data of each category except the forgotten data from the local data. For each category, the global model F(ω) determines the centroid vector of the category based on the data of the category; the centroid vector of any category is used to describe the characteristics of the data of this category;

[0136] The training module 403 is used to split the target processing layer from the global model F(ω); the target processing layer refers to the processing layer that is correlated with the forgotten data during the training of the global model F(ω); the target processing layer is used as the teacher model, and a student model with the same structure as the teacher model is constructed, and the student model is trained using the remaining data in the local data except the forgotten data. When the training iteration stops based on the centroid vectors of each category, the teacher model and the trained student model, based on the requirements of knowledge editing, the trained student model and the non-target processing layer in the global model parameter F(ω) are combined into a target model.

[0137] As an embodiment, the global model F(ω) determines the centroid vector of the category based on the data of the category, including:

[0138] For each remaining data under the category, the feature extraction layer in the global model F(ω) is used to extract features of the remaining data to obtain a feature vector of the remaining data;

[0139] A specified operation is performed on the feature vectors of the remaining data under the category to obtain an operation result, and the operation result is used as the centroid vector under the category.

[0140] As an embodiment, the student model is trained using the remaining data in the local data except the forgotten data, and the method of determining when to stop the training iteration based on the centroid vectors of each category, the teacher model, and the trained student model includes:

[0141] For each remaining data in the remaining data, the remaining data is input into the teacher model and the student model respectively to obtain an output result of the teacher model and an output result of the student model respectively;

[0142] Input the output results of the teacher model corresponding to each remaining data, the output results of the student model corresponding to each remaining data, and the centroid vectors of each category into a preset loss function to obtain the loss function value;

[0143] If the loss function value meets the set requirements, the training iteration is stopped;

[0144] Among them, the loss function consists of the following three parts:

[0145] The loss function of the first part is determined according to the difference between the output result of the teacher model and the output result of the student model corresponding to each of the remaining data;

[0146] The loss function of the second part is determined based on the output result of the student model corresponding to each forgotten data in the obtained forgotten data and the difference between the forgotten vectors matching the forgotten data found from the centroid vectors of each category; the forgotten vector is used to represent the target direction of the target feature layer optimization update after the forgotten data is forgotten;

[0147] The loss function in the third part is to set the constraint function, which is used to constrain the adjustment range of each parameter in the student model during the iterative training process.

[0148] As an embodiment, the forgetting vectors matched with the forgetting data obtained from the centroid vectors of each category include:

[0149] For each category of the centroid vector, obtain the similarity value between the centroid vector of the category and the output result of the teacher model corresponding to the obtained forgotten data;

[0150] From the centroid vectors of categories different from the category to which the forgotten data belongs, the centroid vector of the category corresponding to the maximum similarity value is determined as the forgotten vector.

[0151] As an embodiment, the constraint function is obtained by performing regularization calculation on each parameter of the teacher model and each parameter of the student model.

[0152] The embodiment of the present application further provides a device, which is applied to a client, and includes: a detection module, which is used to input a target image to be detected into a target model deployed in the client, and detect the target in the target image through the target model to detect the target object in the target image; wherein the target model is obtained by training the method provided in the above embodiment, and the target image is any one of the following images: a computed tomography (CT) image, a lane image collected by a camera for a target lane, and a face image;

[0153] Among them, when a CT image is selected as the target image, the target object is the lesion area; when a lane image is selected as the target image, the target object is the vehicle; when a face image is selected as the target image, the target object is a living human face.

[0154] See also Figure 5 , Figure 5 This is a structural diagram of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the hardware structure may include: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the method disclosed in the above example of this application.

[0155] Based on the same application concept as the above method, an embodiment of the present application also provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the method disclosed in the above example of the present application can be implemented.

[0156] Exemplarily, the above-mentioned machine-readable storage medium can be any electronic, magnetic, optical or other physical storage device, which can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof.

[0157] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. An efficient knowledge editing method in a federated learning environment, characterized in that: The method is applied to a client, and the method comprises: Initiate a forget request to the central server to trigger the central server to send the global model F(ω) to the client; the global model F(ω) is trained based on the training data set, and the forgotten data to be forgotten indicated by the forget request is part of the local data of the client, and the local data is a subset of the training data set; Obtain data of each category except the forgotten data from the local data, and for each category, determine the centroid vector of the category according to the data of the category by the global model F(ω); the centroid vector of any category is used to describe the characteristics of the data of this category; A target processing layer is split out from the global model F(ω); the target processing layer refers to a processing layer that is correlated with the forgotten data during the training of the global model F(ω); the target processing layer is used as a teacher model, and a student model with the same structure as the teacher model is constructed, and the student model is trained using the remaining data in the local data except the forgotten data, and when the training iteration stops based on the centroid vectors of each category, the teacher model and the trained student model, based on the requirements of knowledge editing, the trained student model and the non-target processing layer in the global model parameter F(ω) are combined into a target model.

2. The method according to claim 1, characterized in that The global model F(ω) determines the centroid vector of the category based on the data of the category, including: For each remaining data under the category, extract features of the remaining data using the feature extraction layer in the global model F(ω) to obtain a feature vector of the remaining data; A specified operation is performed on the feature vector of each remaining data under the category to obtain an operation result, and the operation result is used as the centroid vector under the category.

3. The method according to claim 1, characterized in that: The method of training the student model by using the remaining data in the local data except the forgotten data, and determining when to stop the training iteration based on the centroid vectors of each category, the teacher model and the trained student model comprises: For each of the remaining data, the remaining data is input into the teacher model and the student model respectively, so as to obtain an output result of the teacher model and an output result of the student model respectively; Input the output results of the teacher model corresponding to each remaining data, the output results of the student model corresponding to each remaining data, and the centroid vectors of each category into a preset loss function to obtain the loss function value; If the loss function value meets the set requirements, it is determined that the training iteration is stopped; The loss function consists of the following three parts: The loss function of the first part is determined according to the difference between the output result of the teacher model and the output result of the student model corresponding to each of the remaining data; The loss function of the second part is determined based on the output result of the student model corresponding to each forgotten data in the forgotten data obtained, and the difference between the forgotten vectors matching the forgotten data found from the centroid vectors of each category; the forgotten vector is used to represent the target direction of the target processing layer optimization update after the forgotten data is forgotten; The loss function in the third part is a set constraint function, which is used to constrain the adjustment range of each parameter in the student model during the iterative training process.

4. The method according to claim 3, characterized in that The forgetting vectors obtained from the centroid vectors of each category and matching the forgetting data include: For each category of the centroid vector, obtain the similarity value between the centroid vector of the category and the output result of the teacher model corresponding to the obtained forgotten data; From the centroid vectors of categories different from the category to which the forgotten data belongs, the centroid vector of the category corresponding to the maximum similarity value is determined as the forgotten vector.

5. The method according to claim 3, characterized in that: The constraint function is obtained by performing regularization calculation on each parameter of the teacher model and each parameter of the student model.

6. An efficient knowledge editing device in a federated learning environment, characterized in that: The device is applied to a client, and comprises: A sending module is used to initiate a forget request to the central server to trigger the central server to send the global model F(ω) to the client; the global model F(ω) is trained based on the training data set, and the forgotten data to be forgotten indicated by the forget request is part of the local data of the client, and the local data is a subset of the training data set; A data processing module, used to obtain data of each category except the forgotten data from the local data, and for each category, the global model F(ω) determines the centroid vector of the category according to the data of the category; the centroid vector of any category is used to describe the characteristics of the data of this category; A training module is used to split a target processing layer from the global model F(ω); the target processing layer refers to a processing layer that is correlated with the forgotten data during the training of the global model F(ω); the target processing layer is used as a teacher model, and a student model with the same structure as the teacher model is constructed, and the student model is trained using the remaining data in the local data except the forgotten data, and when the training iteration stops based on the centroid vectors of each category, the teacher model and the trained student model, based on the requirements of knowledge editing, the trained student model and the non-target processing layer in the global model parameter F(ω) are combined into a target model.

7. The device according to claim 6, characterized in that The global model F(ω) determines the centroid vector of the category based on the data of the category, including: For each remaining data under the category, extract features of the remaining data using the feature extraction layer in the global model F(ω) to obtain a feature vector of the remaining data; Perform a specified operation on the feature vector of each remaining data under the category to obtain an operation result, and use the operation result as the centroid vector under the category; and / or, The method of training the student model by using the remaining data in the local data except the forgotten data, and determining when to stop the training iteration based on the centroid vectors of each category, the teacher model and the trained student model comprises: For each of the remaining data, the remaining data is input into the teacher model and the student model respectively, so as to obtain an output result of the teacher model and an output result of the student model respectively; Input the output results of the teacher model corresponding to each remaining data, the output results of the student model corresponding to each remaining data, and the centroid vectors of each category into a preset loss function to obtain the loss function value; If the loss function value meets the set requirements, it is determined that the training iteration is stopped; The loss function consists of the following three parts: The loss function of the first part is determined according to the difference between the output result of the teacher model and the output result of the student model corresponding to each residual data in the residual data; The loss function of the second part is determined based on the output result of the student model corresponding to each forgotten data in the forgotten data obtained, and the difference between the forgotten vectors matching the forgotten data found from the centroid vectors of each category; the forgotten vector is used to represent the target direction of the target processing layer optimization update after the forgotten data is forgotten; The loss function of the third part is a set constraint function, which is used to constrain the adjustment range of each parameter in the student model during the iterative training process; and / or, The forgetting vectors obtained from the centroid vectors of each category and matching the forgetting data include: For each category of the centroid vector, obtain the similarity value between the centroid vector of the category and the output result of the teacher model corresponding to the obtained forgotten data; From the centroid vectors of categories different from the category to which the forgotten data belongs, determine the centroid vector of the category corresponding to the maximum similarity value as the forgotten vector; and / or, The constraint function is obtained by performing regularization calculation on each parameter of the teacher model and each parameter of the student model.

8. An image detection method based on federated learning, characterized in that: The method is applied to a client, and the method comprises: Inputting a target image to be detected into a target model deployed in the client, wherein the target model is obtained based on the method described in any one of claims 1 to 5, and detecting a target in the target image by using the target model to detect a target object in the target image; The target image is any of the following images: Computed tomography (CT) images, lane images captured by a camera for a target lane, and face images; Wherein, when a CT image is selected as the target image, the target object is a lesion area; When a lane image is selected as the target image, the target object is a vehicle; When a face image is selected as the target image, the target object is a living human face.

9. An electronic device, characterized in that: include: processor; as well as A memory, in which computer program instructions are stored, and when the computer program instructions are executed by the processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 5 and 8.

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 method described in any one of claims 1 to 5 and 8 are implemented.