A fine-grained machine learning forgetting method, device and electronic device
By training the clustering model through unsupervised or self-supervised learning, selecting the forgotten subset and performing data forgetting, the problem of being unable to achieve fine-grained data forgetting and unknown data expansion in existing technologies is solved, and efficient fine-grained data forgetting and model performance recovery are achieved.
Patent Information
- Application Number
- CN202310905066.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-21
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2043-07-21
AI Technical Summary
When existing technologies cannot obtain all the information about the data to be deleted, it is difficult to achieve fine-grained forgetting of data subsets with the same characteristics, and it is impossible to expand forgetting from known data to unknown data.
The clustering model is trained through unsupervised or self-supervised learning, and the forgotten subset is selected based on feature similarity. The data forgetting strategy is used to achieve forgetting of fine-grained data within one or two rounds of training. The reconstructed forgotten subset and the remaining data form a forgotten training set to fine-tune the original model.
It achieves forgetting of fine-grained data in the same category without affecting the learning of other data, and achieves performance comparable to retraining the model from scratch.
Smart Images

Figure CN117292167B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of deep learning technology, and more specifically, to a fine-grained machine learning forgetting method, device, and electronic device. Background Art
[0002] With the gradual development of related technologies such as machine learning, deep learning, and artificial intelligence, the privacy and security issues hidden behind these technologies have also begun to attract people's attention. Due to the black box properties of deep learning models, they only focus on the mapping between input and output. Therefore, the model may record some information about the training set, causing the model to be attacked and sensitive data to be leaked or the model function to be destroyed. Membership inference attacks and model inversion attacks are two types of attacks used to extract information about training data from the model; backdoor attacks can cause the model to learn incorrect information on modified images, thereby destroying the model's usability.
[0003] In the field of machine learning, machine forgetting is a way to realize the right to be forgotten of data. It not only requires deleting specific data from the training set, but also requires adjusting the model trained on this part of the data to ensure that the adjusted model cannot learn relevant knowledge from this data. Therefore, the model not only needs to ensure the privacy and security of the data by forgetting the data, but also needs to forget some specific data information to restore normal functions to ensure the reliability of the model. At present, people have proposed many forgetting strategies to study how to forget specified samples from the perspectives of model structure, data classification, training process or application requirements. The focus of these strategies is how to quickly achieve forgetting of given samples and reduce training costs.
[0004] However, they focus on forgetting the entire category or a small amount of known data, and do not consider how to forget a subset of data with the same characteristics through known samples when it is impossible to obtain all the information of the data to be deleted. Among them, the whole category forgetting Unlearning strategy used in the Amnesiac Machine Learning proposed by Laura Graves et al. [1] is similar to the data forgetting strategy used in the present invention. The strategy adopted by Laura Graves is to randomly select an incorrect label for each sensitive data label and re-label it. The forgetting of the entire category is achieved by replacing the label of each example in the class with a randomly selected incorrect label. The forgetting of sensitive data is achieved by removing the sensitive data and inserting a copy with a randomly selected incorrect label. Summary of the Invention
[0005] In order to solve the problem of how to forget a subset of images with the same characteristics through known images when all information of the data to be deleted cannot be obtained, the present application provides a fine-grained machine learning forgetting method, device and electronic device.
[0006] The embodiment of the present application is implemented as follows:
[0007] In a first aspect, the present application provides a fine-grained machine learning forgetting method, comprising:
[0008] According to the training set of the existing classification task, the original classification model is trained;
[0009] Obtaining a target category based on the target data known to be deleted, where the target category is data in the training set that has the same classification label as the target data;
[0010] A fine-grained clustering model is obtained by training according to the target category, and a forgotten subset is obtained through the target data and the fine-grained clustering model, where the forgotten subset is a data subset in the same cluster category as the target data;
[0011] The forgetting subset is forgotten based on a data forgetting strategy.
[0012] In one possible implementation, the training obtains a fine-grained clustering model according to the target category, and obtains a forgotten subset using known target data and the fine-grained clustering model, wherein the forgotten subset is a data subset in the same cluster category as the target data, further comprising:
[0013] Obtain target data and target categories, where the target data is known forgotten data and the target category is data in the training set that has the same label as the target data;
[0014] Training the target category based on deep learning or machine learning to obtain a fine-grained clustering model;
[0015] The target data and the target category are input into the fine-grained clustering model to obtain cluster categories of all data, and a forgotten subset is screened out.
[0016] In a possible implementation, forgetting the forgotten subset based on a data forgetting strategy further includes:
[0017] All data in the forgotten subset are copied multiple times to obtain multiple copies. Except for the classification category where the target data is located, the remaining classification categories have a data copy of the forgotten subset. At the same time, each copy is given a new label, and the forgotten subset is replaced by multiple copies to obtain a reconstructed forgotten subset.
[0018] A forgotten training set is formed based on the reconstructed forgotten subset and the data of the training set excluding the forgotten subset, and the original classification model is fine-tuned using the forgotten training set.
[0019] In a possible implementation, the training of the target categories based on deep learning to obtain a fine-grained clustering model further includes:
[0020] A contrastive learning model is obtained by training according to a contrastive learning method, wherein the contrastive learning model is used as a feature extractor to extract semantic features from data samples;
[0021] Based on the neighbor search principle, the sample and its neighbor samples are regarded as the same category data;
[0022] A fine-grained clustering model is trained using the sample and its neighboring samples.
[0023] In a possible implementation, after the clustering model is obtained by training the sample and its neighboring samples, the method further includes:
[0024] The clustering model is optimized using a loss function formula, which is as follows:
[0025]
[0026]
[0027] In a possible implementation, before copying all the data in the forgotten subset multiple times to obtain multiple copies, assigning each copy a new label, and replacing the forgotten subset with the multiple copies to obtain a reconstructed forgotten subset, the method further includes:
[0028] Each sample in the forgetting subset is embedded into each category of the original classification model task, so that the original classification model believes that the sample can come from any category.
[0029] In a possible implementation, the label of the copy is different from the sample label of the target data.
[0030] In a possible implementation, the forming a forgotten training set based on the reconstructed forgotten subset and the data of the training set excluding the forgotten subset, and fine-tuning the original classification model using the forgotten training set, further includes:
[0031] Combine the reconstructed forgotten subset with the data in the original training set except the forgotten subset to form the forgotten training set;
[0032] The original classification model is fine-tuned using the forgotten training set so that the knowledge of the forgotten training set covers the knowledge learned by the original classification model from the forgotten subset.
[0033] In a second aspect, the present application provides a fine-grained machine learning forgetting device, comprising:
[0034] The model training module is used to train the original classification model based on the training set of the existing classification task;
[0035] A target recognition module is used to obtain a target category based on the target data to be deleted, where the target category is the data in the training set that has the same classification label as the target data;
[0036] A subset selection module is used to obtain a fine-grained clustering model according to target category training, and obtain a forgotten subset through target data and the fine-grained clustering model, wherein the forgotten subset is a data subset in the same cluster category as the target data;
[0037] A data forgetting module is used to forget the forgotten subset based on a data forgetting strategy.
[0038] In a third aspect, the present application provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor calls and executes the computer program from the memory, it implements the steps of the fine-grained machine learning forgetting method shown in any one of the above-mentioned first aspects.
[0039] The technical solution provided by this application can achieve at least the following beneficial effects:
[0040] The fine-grained machine learning forgetting method, device, and electronic device provided in this application are a forgetting solution for fine-grained data. Through a subset selection step, a clustering model is trained using unsupervised or self-supervised learning to segment samples, and a forgotten subset is obtained based on feature similarity, thereby expanding from known data to unknown data with the same features. In addition, data forgetting is used to assign the data on the forgotten subset to each category, perturbing the model's memory of the forgotten subset knowledge, thereby achieving data forgetting within one or two rounds of training. Without affecting the learning of other data, the fine-grained data in the same category is forgotten, and performance comparable to retraining the model from scratch on the remaining data is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0042] Figure 1 1 is a flow chart of a fine-grained machine learning forgetting method according to an exemplary embodiment of the present application;
[0043] Figure 2 This is a schematic diagram of the process framework of a fine-grained machine learning forgetting method shown in an exemplary embodiment of the present application;
[0044] Figure 3 is a flow chart of a subset selection module according to an exemplary embodiment of the present application;
[0045] Figure 4 is a flow chart of a data forgetting module shown in an exemplary embodiment of the present application;
[0046] Figure 5 1 is a schematic diagram of a cluster confusion matrix for clustering four categories in CIFAR100 using a contrastive learning model, as shown in an exemplary embodiment of the present application;
[0047] Figure 6 This is a schematic diagram of the performance change trend of the model shown in an exemplary embodiment of this application, including model fine-tuning, random labeling, retraining from scratch, and fine-grained forgetting.
[0048] Figure 7 1 is a schematic structural diagram of a fine-grained machine learning forgetting device according to an exemplary embodiment of the present application;
[0049] Figure 8 It is a structural diagram of a computer device shown in an exemplary embodiment of the present application.
[0050] Reference numerals:
[0051] 1. Subset selection module; 2. Data forgetting module; 10. Computer device; 11. Processor; 12. Memory; 13. Communication bus; 14. Communication interface; 15. Output device; 16. Input device. DETAILED DESCRIPTION
[0052] In order to make the purpose, implementation methods and advantages of the present application clearer, the exemplary implementation methods of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, not all of the embodiments. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.
[0053] It should be noted that the brief descriptions of terms in this application are only for the purpose of facilitating the understanding of the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their ordinary and usual meanings.
[0054] In the specification and claims of this application and the accompanying drawings, the terms "first," "second," "third," etc. are used to distinguish similar or similar objects or entities, and are not necessarily intended to limit a particular order or sequence, unless otherwise noted. It should be understood that the terms used in this manner are interchangeable under appropriate circumstances.
[0055] The terms "comprise," "include," and "have," and any variations thereof, are intended to cover but not exclude inclusion; for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0056] Before explaining the fine-grained machine learning forgetting method provided in the embodiment of the present application, the application scenario and implementation environment of the embodiment of the present application are first introduced.
[0057] With the gradual development of related technologies such as machine learning, deep learning, and artificial intelligence, the privacy and security issues hidden behind these technologies have also begun to attract people's attention. Due to the black box properties of deep learning models, they only focus on the mapping between input and output. Therefore, the model may record some information about the training set, causing the model to be attacked and sensitive data to be leaked or the model function to be destroyed. Membership inference attacks and model inversion attacks are two types of attacks used to extract information about training data from the model; backdoor attacks can cause the model to learn incorrect information on modified images, thereby destroying the model's usability.
[0058] In the field of machine learning, machine forgetting is a way to realize the right to be forgotten of data. It not only requires deleting specific data from the training set, but also requires adjusting the model trained on this part of the data to ensure that the adjusted model cannot learn relevant knowledge from this data. Therefore, the model not only needs to ensure the privacy and security of the data by forgetting the data, but also needs to forget some specific data information to restore normal functions to ensure the reliability of the model. At present, people have proposed many forgetting strategies to study how to forget specified samples from the perspectives of model structure, data classification, training process or application requirements. The focus of these strategies is how to quickly achieve forgetting of given samples and reduce training costs.
[0059] However, they focus on forgetting the entire category or a small amount of known data, and do not consider how to forget a subset of data with the same characteristics through known samples when it is impossible to obtain all the information of the data to be deleted. Among them, the whole category forgetting Unlearning strategy used in the Amnesiac Machine Learning proposed by Laura Graves et al. [1] is similar to the data forgetting strategy used in the present invention. The strategy adopted by Laura Graves is to randomly select an incorrect label for each sensitive data label and re-label it. The forgetting of the entire category is achieved by replacing the label of each example in the class with a randomly selected incorrect label. The forgetting of sensitive data is achieved by removing the sensitive data and inserting a copy with a randomly selected incorrect label.
[0060] The existing technology has the following disadvantages:
[0061] (1) The whole category forgetting method forgets all the data belonging to a certain category without caring about forgetting the fine-grained data.
[0062] (2) When all sensitive data are unavailable, no consideration is given to how to expand from known data to unknown data and achieve fine-grained forgetting of the same type of data.
[0063] To address the above issues, the key is to implement fine-grained forgetting of data of the same category with the same characteristics using known samples (in extreme cases, only one sample) when sensitive data provides little information but all sensitive data with the same characteristics need to be deleted. Current forgetting solutions cannot achieve selective forgetting of fine-grained data subsets, nor can they extend forgetting from known data to unknown data.
[0064] Based on this, the present application provides a fine-grained machine learning forgetting method, device and electronic device, which uses a single data sample to implement a machine forgetting method for fine-grained data forgetting of the classification category of the sample through two steps of subset selection and data forgetting. First, subset selection uses unsupervised, self-supervised and other clustering methods to perform fine-grained data division on the category data of the target data, and then identifies the fine-grained forgotten subset based on the feature classification of the known data sample and the unsupervised classification results. Then, a forgotten data set is constructed based on the obtained forgotten subset, and then the original classification model of deep learning is fine-tuned to achieve forgetting of fine-grained data. The machine forgetting method proposed in the present invention realizes fine-grained forgetting of data samples with the same classification label, and has the ability to expand forgetting from known sensitive data to unknown sensitive data. It solves the defect that the entire category forgetting strategy in the current forgetting method cannot achieve fine-grained data forgetting, and at the same time, the defect that the current small amount of data forgetting method can only forget the given known data, and cannot forget unknown data with the same data characteristics.
[0065] Next, the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems will be described in detail through embodiments and in conjunction with the accompanying drawings. The various embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. Obviously, the described embodiments are only part of the embodiments of the present application, not all of them.
[0066] Figure 1 It is a flowchart of a fine-grained machine learning forgetting method shown in an exemplary embodiment of the present application.
[0067] In an exemplary embodiment, Figure 1 As shown, a fine-grained machine learning forgetting method is provided, which may include:
[0068] Step 100: Based on the training set of the existing classification task, an original classification model is trained.
[0069] Step 200: Obtain a target category based on target data that is known to be deleted, where the target category is data in a training set that has the same classification label as the target data.
[0070] Step 300: A fine-grained clustering model is obtained according to target category training, and a forgotten subset is obtained through the target data and the fine-grained clustering model. The forgotten subset is a data subset in the same cluster category as the target data.
[0071] Step 400: Forget the forgotten subset based on a data forgetting strategy.
[0072] Figure 2This is a schematic diagram of the process framework of another fine-grained machine learning forgetting method shown in an exemplary embodiment of the present application.
[0073] In one possible implementation, Figure 2 As shown, the fine-grained machine learning forgetting method provided by this application includes:
[0074] Subset selection module and data forgetting module.
[0075] The subset selection module mainly realizes the expansion from known data to unknown data based on feature similarity, while completing the fine-grained selection of forgotten subsets.
[0076] First, unsupervised learning or self-supervised learning is used to train the target category to obtain an unsupervised or self-supervised fine-grained clustering model.
[0077] Secondly, all the target data (known forgotten data) and target category data (data with the same label as the target data in the training set) are input into the clustering model to obtain the clustering category of all data, and a subset of data in the same cluster category as the target data is selected, namely the forgotten subset.
[0078] The data forgetting module mainly forgets the forgotten subset selected in the previous step through the data forgetting strategy.
[0079] First, all the data in the forgotten subset are copied multiple times and a new label is assigned to each copy.
[0080] Secondly, the reconstructed forgotten subset and the remaining data in the training set that do not need to be forgotten are combined into a forgotten training set, and the original classification model is fine-tuned on the forgotten training set to achieve forgetting of the forgotten subset data.
[0081] Figure 3 It is a flowchart of a subset selection module shown in an exemplary embodiment of the present application.
[0082] In one possible implementation, Figure 3 As shown in Figure 2, subset selection is to perform fine-grained division on the data belonging to the same category and then select a specific fine-grained subset.
[0083] Among them, deep neural networks are usually used for end-to-end learning tasks, automatically extracting sample features and completing specific learning tasks based on the features.
[0084] In order to select a specific subset from the samples, we define a feature extractor f φ , which can realize the function of extracting semantic features from data samples.
[0085] Furthermore, inspired by the contrastive learning framework, a contrastive learning model is trained as the feature extractor f using the contrastive learning method. φ .
[0086] Among them, the enhanced sample It is a new sample obtained from the original sample x by data enhancement. The contrast learning model believes that the new sample obtained from the sample x and the sample The sample features z and z1 extracted above should be highly consistent because they both have the same semantics.
[0087] At the same time, the model f φ The parameter optimization goal should be to satisfy the formula Where d(·) is the distance function or similarity function.
[0088] The neighbor search rule is based on the contrast model f φ Extract the distance between sample features and find the nearest sample neighbors for each sample, and treat the sample and its neighbors as data of the same category. Then use the sample and its neighbor samples to train an unsupervised clustering model f θ , and use the following loss function formula to adjust the model f θ To optimize:
[0089]
[0090]
[0091] Among them, x i Indicates the target category D t A sample in j Represents sample x i Neighbors neighbors in , λ represents the constraint coefficient, Represents the clustering model f θ The sample x i The probability of classification into the kth category (the total number of categories of the clustering model is C). Then according to the clustering model f θ Select the forgotten subset D from the clustering results of the target data and target category f .
[0092] Figure 4 It is a flowchart of a data forgetting module shown in an exemplary embodiment of the present application.
[0093] In one possible implementation, Figure 4 As shown in
[15] , data forgetting is another key step to achieve fine-grained forgetting, which aims to forget the knowledge learned from a certain subset of data while keeping the performance of other similar data minimally affected.
[0094] First, each sample in the forgotten subset is embedded into each category of the original model task, so that the model believes that the sample can come from any category and cannot be classified as a certain category with high confidence.
[0095] Among them, data forgetting depends on the subset selected and the target data d f The forgotten subset D of the same cluster category f , for the forgotten subset D f Each sample x in i Make multiple copies and assign a new label t(t≠y i ), y i For sample x i The sample labels in the original classification task.
[0096] Then, all copies of the forgotten subset and their new labels are collected and combined with the data in the original training set that do not need to be forgotten to form the forgotten training set.
[0097] It can be seen that some embodiments of the present application use the forgotten training set to fine-tune the original classification model, and use the knowledge of the new dataset to cover the original model from the forgotten subset D. f The data forgetting achieves the forgetting function by embedding samples into other categories of knowledge learned from the dataset, while the subset selection strategy prevents excessive forgetting of other knowledge and ensures the performance of the model on other retained data.
[0098] Advantages of this application:
[0099] Some embodiments of the present application are aimed at forgetting solutions for fine-grained data. Through a subset selection step, a clustering model is trained using unsupervised or self-supervised learning to segment samples, and a forgotten subset is obtained based on feature similarity, thereby achieving expansion from known data to unknown data with the same features. Data forgetting is then used to assign the data in the forgotten subset to each category, perturbing the model's memory of the knowledge of the forgotten subset, and achieving forgetting of data within one or two rounds of training. Without affecting the learning of other data, fine-grained data in the same category is forgotten, and performance comparable to retraining the model from scratch on the remaining data is achieved.
[0100] Comparison with existing technologies:
[0101] Figure 5 : is a schematic diagram of a cluster confusion matrix for clustering four categories in CIFAR100 using a contrastive learning model, shown in an exemplary embodiment of the present application. Figure 6 This is a schematic diagram of the model performance change trend of model fine-tuning, random labeling, retraining from scratch, and fine-grained forgetting, shown in an exemplary embodiment of the present application.
[0102] To demonstrate the feasibility of the machine forgetting method for fine-grained data proposed in this application, this application conducted experiments on the CIFAR100 dataset.
[0103] By setting the classification task of the CIFAR100 dataset into 20 categories, each category contains 5 subsets (the 5 subsets in each category have the same data label), the goal of fine-grained forgetting is to forget a subset of one of the categories.
[0104] like Figure 5 Figure 2 shows the confusion matrix of unsupervised clustering using contrastive learning on four categories of data in the CIFAR100 dataset. Contrastive learning can achieve over 70% fine-grained clustering accuracy, with the accuracy of subset selection being closely related to the accuracy of unknown data selection.
[0105] like Figure 6 As shown in Figure 3, the effect of data forgetting using the proposed data forgetting strategy is achieved.
[0106] Figure 6 (a) shows the process of achieving data forgetting based on the catastrophic forgetting strategy (fine-tuning the model only on the dataset with the forgotten subset removed). It can be seen that even after 700 rounds of fine-tuning, the recognition rate for the forgotten subset is still around 45%; Figure 6 (b) shows the forgetting process of the original training and the strategy based on randomly selecting an incorrect label proposed by Laura Graves et al. The forgotten data here is not the data of all categories, but the forgotten subset of data, that is, the forgetting process of 500-799 rounds; Figure 6 (c) Performance of the retrained model after removing the forgotten subset; Figure 6 (d) The first half (epochs 0-499) shows the training process of the original model, while the second half (epochs 500-799) demonstrates the effect of fine-grained forgetting. It can be seen that the recognition accuracy of the forgotten subset "forget" is achieved within 1-2 epochs. Meanwhile, the performance of the other categories in the training set "train" and the remaining target category data, as well as the test set "test," is largely unaffected by data forgetting.
[0107] It should be understood that, although the various steps in the flowcharts involved in the above-described embodiments are displayed in sequence according to the instructions, these steps are not necessarily executed in the order indicated. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0108] Corresponding to the aforementioned embodiments of the fine-grained machine learning forgetting method, and adopting the same technical concept, the present application also provides an embodiment of a fine-grained machine learning forgetting device.
[0109] Figure 7 It is a structural diagram of a fine-grained machine learning forgetting device shown in an exemplary embodiment of the present application.
[0110] In an exemplary embodiment, Figure 7 As shown, the fine-grained machine learning forgetting device includes:
[0111] The model training module is used to train the original classification model based on the training set of the existing classification task;
[0112] A target recognition module is used to obtain a target category based on the target data to be deleted, where the target category is the data in the training set that has the same classification label as the target data;
[0113] A subset selection module is used to obtain a fine-grained clustering model according to target category training, and obtain a forgotten subset through target data and the fine-grained clustering model, wherein the forgotten subset is a data subset in the same cluster category as the target data;
[0114] A data forgetting module is used to forget the forgotten subset based on a data forgetting strategy.
[0115] For the specific definition of the fine-grained machine learning forgetting device, please refer to the definition of the fine-grained machine learning forgetting method above, which will not be repeated here. Each module in the above-mentioned fine-grained machine learning forgetting device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0116] In an exemplary embodiment, the fine-grained machine learning forgetting method described above can be applied to Figure 8 In the computer device 10 shown, at this point, the present application can use unsupervised or self-supervised learning to train a clustering model to segment the samples through the subset selection step, and obtain a forgotten subset based on feature similarity, thereby expanding from known data to unknown data with the same features. Then, data forgetting is used to assign the data on the forgotten subset to each category, perturbing the model's memory of the knowledge of the forgotten subset, and achieving forgetting of data within one or two rounds of training. Without affecting the learning of other data, the fine-grained data in the same category is forgotten, and performance comparable to retraining the model from scratch on the remaining data is achieved.
[0117] Figure 8 It is a structural diagram of a computer device shown in an exemplary embodiment of the present application.
[0118] In a possible implementation, the structure of the computer device is as follows: Figure 8 As shown, the computer device 10 includes at least a processor 11 , a memory 12 , a communication bus 13 , and a communication interface 14 .
[0119] The processor 11 may be a general-purpose central processing unit (CPU), a network processor (NP), a microprocessor, or one or more integrated circuits for implementing the solution of the present application, such as an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0120] Optionally, the processor 11 may include one or more CPUs. The computer device 10 may include multiple processors 11. Each of these processors 11 may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU).
[0121] It should be noted that the processor 11 here may refer to one or more devices, circuits and / or processing cores for processing data (such as computer program instructions).
[0122] The memory 12 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, or a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0123] Optionally, the memory 12 may exist independently and be connected to the processor 11 via the communication bus 13 ; the memory 12 may also be integrated with the processor 11 .
[0124] The communication bus 13 is used to transmit information between components (such as between the processor and the memory). The communication bus 12 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one communication bus is used for illustration, but this does not mean that there is only one bus or one type of bus.
[0125] The communication interface 14 is used to enable the computer device 10 to communicate with other devices or communication networks. The communication interface 14 includes a wired communication interface or a wireless communication interface. The wired communication interface may be, for example, an Ethernet interface. The Ethernet interface may be an optical interface, an electrical interface, or a combination thereof. The wireless communication interface may be a wireless local area network (WLAN) interface, a cellular network communication interface, or a combination thereof.
[0126] In some embodiments, the computer device 10 may further include an output device 15 and an input device 16 ( Figure 8(not shown). The output device 15 communicates with the processor 11 and can display information in various ways. For example, the output device 15 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device 16 communicates with the processor 11 and can receive user input in various ways. For example, the input device 16 can be a mouse, a keyboard, a touch screen device, or a sensor device.
[0127] In some embodiments, the memory 12 is used to store a computer program for executing the solution of the present application, and the processor 11 can execute the computer program stored in the memory 12. For example, the computer device 10 can call and execute the computer program stored in the memory 12 through the processor 11 to implement the steps of the fine-grained machine learning forgetting method provided in the embodiments of the present application.
[0128] It should be understood that the fine-grained machine learning forgetting method provided in this application can be applied to a fine-grained machine learning forgetting device, which can be implemented as part or all of the processor 11 through software, hardware, or a combination of software and hardware, and integrated into the computer device 10.
[0129] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0130] The embodiments described above merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A fine-grained forgetting method for machine learning, characterized in that The forgetting method achieves forgetting of a subset of images with the same characteristics through known images, including: According to the training set of the existing classification task, the original classification model is trained; Obtaining a target category based on the target data known to be deleted, where the target category is data in the training set that has the same classification label as the target data; Obtain target data and target categories, where the target data is known forgotten data; A contrastive learning model is obtained by training according to a contrastive learning method, wherein the contrastive learning model is used as a feature extractor to extract sample features from data samples; Based on the neighbor search principle, the distance between sample features extracted by the contrastive learning model is used to find the nearest sample neighbors for each sample, and the sample and its neighbor samples are regarded as data of the same category; Using the sample and its neighboring samples, a fine-grained clustering model is trained; Inputting the target data and the target category into the fine-grained clustering model to obtain cluster categories of all data, and screening out a forgotten subset, where the forgotten subset is a data subset in the same cluster category as the target data; The forgetting subset is forgotten based on a data forgetting strategy.
2. The fine-grained machine learning forgetting method according to claim 1, characterized in that The forgetting of the forgotten subset based on the data forgetting strategy further includes: All data in the forgotten subset are copied multiple times to obtain multiple copies. Except for the classification category where the target data is located, the remaining classification categories have a data copy of the forgotten subset. At the same time, each copy is given a new label, and the forgotten subset is replaced by multiple copies to obtain a reconstructed forgotten subset. A forgotten training set is formed based on the reconstructed forgotten subset and the data of the training set excluding the forgotten subset, and the original classification model is fine-tuned using the forgotten training set.
3. The fine-grained machine learning forgetting method according to claim 1, characterized in that After the fine-grained clustering model is obtained by training the sample and its neighboring samples, the method further includes: The clustering model is optimized using a loss function formula, which is as follows: in, Indicates the target category A sample of Representation sample Neighbors Neighbors in represents the constraint coefficient, Represents a clustering model The sample The probability of classification into the kth category, and then according to the clustering model Select the forgotten subset of the clustering results of the target data and target category , the total number of categories of the clustering model is .
4. The fine-grained machine learning forgetting method according to claim 2, characterized in that Before all data in the forgotten subset are copied multiple times to obtain multiple copies, and except for the classification category where the target data is located, all other classification categories have a data copy of the forgotten subset, and a new label is assigned to each copy, and the forgotten subset is replaced by multiple copies to obtain a reconstructed forgotten subset, the method further includes: Each sample in the forgetting subset is embedded into each category of the original classification model task, so that the original classification model believes that the sample can come from any category.
5. The fine-grained machine learning forgetting method according to claim 2, characterized in that The label of the copy is different from the sample label of the target data.
6. The fine-grained machine learning forgetting method according to claim 2, characterized in that The method further comprises: forming a forgotten training set based on the reconstructed forgotten subset and the data of the training set excluding the forgotten subset, and fine-tuning the original classification model using the forgotten training set; Combine the reconstructed forgotten subset with the data in the original training set except the forgotten subset to form the forgotten training set; The original classification model is fine-tuned using the forgotten training set so that the knowledge of the forgotten training set covers the knowledge learned by the original classification model from the forgotten subset.
7. A fine-grained machine learning forgetting device, characterized in that The forgetting device forgets a subset of images with the same features through known images, including: The model training module is used to train the original classification model based on the training set of the existing classification task; A target recognition module is used to obtain a target category based on the target data to be deleted, where the target category is the data in the training set that has the same classification label as the target data; A subset selection module is configured to obtain target data and target categories, where the target data is known to be forgotten data; train a contrastive learning model based on a contrastive learning method, where the contrastive learning model, as a feature extractor, can extract sample features from data samples; based on a neighbor search principle, search for the nearest sample neighbors for each sample based on the distance between the sample features extracted by the contrastive learning model, and treat the sample and its neighbor samples as data of the same category; train a fine-grained clustering model using the sample and its neighbor samples; input the target data and the target category into the fine-grained clustering model to obtain the cluster categories of all data, and filter out a forgotten subset, which is a data subset in the same cluster category as the target data; A data forgetting module is used to forget the forgotten subset based on a data forgetting strategy.
8. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and is characterized in that the processor implements the steps of the method according to any one of claims 1 to 6 when calling and executing the computer program from the memory.
Citation Information
Patent Citations
Method and device for continuous learning in multi-task data stream
CN112698933A
Text classification method and system for lifelong learning
CN114510572A