Model forgetting method and apparatus, electronic device, storage medium, and computer program product

CN120354971BActive Publication Date: 2026-10-09INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510547060.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2026-10-09
Estimated Expiration
2045-04-28

AI Technical Summary

Technical Problem

但是,这两个优化目标的优化方向本身是存在冲突的,在实际训练过程中很可能出现在一个优化目标上取得成功,而另一个优化目标却被破坏的现象,即相关技术中难以在机器遗忘的两个优化目标之间取得平衡

Benefits of technology

在本公开中,通过针对遗忘损失的梯度和保留损失的梯度分别在对方的正交方向上进行投影,可以确保这两者之间相冲突的部分被移除。并且,通过将获得的两个投影进行相加,可以获得一个同时兼顾两个优化目标且不会引入冲突的更新方向,按照该更新方向对最终模型的最终损失进行梯度下降以调整最终模型的可训练参数,可以保证遗忘任务的优化方向与保留任务的优化方向相一致,从而可以避免不合理的参数变化。也即在本公开中,通过约束优化过程中的梯度方向,能够在机器遗忘的两个优化目标之间取得较佳的平衡,即可以在有效消除遗忘数据对模型影响的同时,又能最大限度地保护保留数据的特性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120354971B_ABST
    Figure CN120354971B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a model forgetting method, device, electronic equipment, storage medium and computer program product, the method comprising: performing first training and second training on an original model based on forgetting data and retaining data respectively; constructing a final model; inputting the forgetting data and the retaining data into the final model respectively; calculating a forgetting loss; calculating a retaining loss; calculating a final loss of the final model; taking a partial derivative of a trainable parameter using the final loss; projecting a gradient of the forgetting loss and a gradient of the retaining loss in a corresponding orthogonal direction respectively; calculating a sum of an orthogonal forgetting gradient and an orthogonal retaining gradient; and performing gradient descent on the final loss in an optimization gradient direction. In this way, by projecting the gradient of the forgetting loss and the gradient of the retaining loss in the orthogonal direction of each other, it can be ensured that the conflicting parts between the two are removed, and a better balance between the two optimization objectives of machine forgetting can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to model forgetting methods, apparatus, electronic devices, storage media, and computer program products. Background Technology

[0002] Machine learning technology can provide users with intelligent and personalized services, greatly facilitating their work and lives. However, with the emergence of threats such as member inference attacks and model reverse engineering attacks, more and more users are beginning to pay attention to the security and privacy of their personal data. These attack methods can infer sensitive information in the training data by analyzing the model's output and behavior, thus posing a serious threat to user privacy. Therefore, machine forgetting technology has emerged.

[0003] "Machine forgetting" is a machine learning process designed to remove the influence of specific data from a trained model to protect user privacy. Specifically, machine forgetting focuses on how to make a trained model forget specific information related to user privacy while maintaining the model's original learning performance. It is evident that the machine forgetting process has two main optimization objectives: one is to make the model forget specific information as much as possible; the other is to maintain the model's original training performance as much as possible. However, the optimization directions of these two objectives are inherently conflicting. In actual training, it is possible to achieve success in one optimization objective while compromising the other; that is, it is difficult to achieve a balance between the two optimization objectives of machine forgetting in related technologies. Summary of the Invention

[0004] This disclosure provides methods, apparatus, electronic devices, storage media, and computer program products for model forgetting, to at least solve the problem in the aforementioned related technologies of the difficulty in achieving a balance between the two optimization objectives of machine forgetting.

[0005] According to a first aspect of the present disclosure, a model forgetting method is provided, comprising: performing a first training on an original model based on forgotten data to obtain a forgotten model, and performing a second training on the original model based on retained data to obtain a retained model, wherein the forgotten data and the retained data are data included in an original training dataset, the original training dataset including multiple image samples and used to train the original model for image classification; constructing a final model based on the original model, the forgotten model, and the retained model; inputting the forgotten data and the retained data into the final model respectively to obtain a forgotten output and a retained output; and calculating a forgotten output based on the forgotten labels of the forgotten output and the forgotten data. The process involves: calculating the forgetting loss; calculating the retention loss based on the retained output and the retained labels of the retained data; calculating the final loss of the final model based on the forgetting loss and the retention loss; obtaining the gradients of the forgetting loss and the retention loss by taking the partial derivatives of the final loss with respect to the trainable parameters of the final model; projecting the gradients of the forgetting loss and the retention loss onto corresponding orthogonal directions to obtain orthogonal forgetting gradients and orthogonal retention gradients; calculating the sum of the orthogonal forgetting gradients and the orthogonal retention gradients to obtain the optimized gradient direction; and performing gradient descent on the final loss according to the optimized gradient direction to adjust the trainable parameters, thereby training the final model.

[0006] Alternatively, the orthogonal forgetting gradient can be calculated using the following formula:

[0007] The orthogonality-preserving gradient is calculated using the following formula: ; in, The orthogonal forgetting gradient, To preserve the gradient for the orthogonality, Let be the gradient of the forgetting loss. The gradient of the retention loss, Let be the norm of the vector.

[0008] Optionally, constructing the final model based on the original model, the forgetting model, and the retention model includes: The final model is constructed using the following formula:

[0009]

[0010]

[0011] in, For the final model, For the original model, Forgetting vector, To preserve vectors, For the forgetting model, For the retained model, These are the trainable parameters of the final model.

[0012] Optionally, calculating the final loss of the final model based on the forgetting loss and the retention loss includes: The final loss of the final model is calculated using the following formula:

[0013] in, The final loss of the final model, For hyperparameters, For the aforementioned loss of forgetting, The retention loss is mentioned above.

[0014] Optionally, the forgetting loss is expressed by the following formula:

[0015] in, For the forgotten data, Forgotten labels for the forgotten data, This is the final model; The retention loss is expressed by the following formula:

[0016] in, For the reserved data, The retention label for the retained data. This is the final model;

[0017] in, For input, For output, For the number of categories, For input The corresponding tags For the model to input In parameters The predicted score for class i is given below. For the model to input In parameters The following predictions belong to the first The score for the class.

[0018] Optionally, the step of performing a first training on the original model based on forgotten data to obtain a forgotten model includes: adjusting the parameters of a preset number of layers close to the output layer of the original model based on the forgotten data to perform the first training on the original model to obtain the forgotten model.

[0019] According to a second aspect of the present disclosure, a model forgetting apparatus is provided, comprising: a fine-tuning module configured to perform a first training on an original model based on forgotten data to obtain a forgotten model, and to perform a second training on the original model based on retained data to obtain a retained model, wherein the forgotten data and the retained data are data included in an original training dataset, the original training dataset including multiple image samples and used to train the original model for image classification; a construction module configured to construct a final model based on the original model, the forgotten model, and the retained model; a data input module configured to input the forgotten data and the retained data into the final model respectively to obtain a forgotten output and a retained output; a forgetting loss calculation module configured to calculate a forgetting loss based on the forgotten output and the forgotten labels of the forgotten data; and a retention loss calculation module configured to... The system is configured to: calculate retention loss based on the retained output and the retained labels of the retained data; calculate final loss of the final model based on the forgetting loss and the retention loss; obtain gradients of the forgetting loss and the retention loss by taking the partial derivatives of the final loss with respect to the trainable parameters of the final model; project the gradients of the forgetting loss and the retention loss onto corresponding orthogonal directions to obtain orthogonal forgetting gradients and orthogonal retention gradients; calculate the optimized gradient direction by calculating the sum of the orthogonal forgetting gradients and the orthogonal retention gradients to obtain the optimized gradient direction; and perform gradient descent on the final loss according to the optimized gradient direction to adjust the trainable parameters, thereby training the final model.

[0020] Alternatively, the orthogonal forgetting gradient can be calculated using the following formula:

[0021] The orthogonality-preserving gradient is calculated using the following formula: ; in, The orthogonal forgetting gradient, To preserve the gradient for the orthogonality, Let be the gradient of the forgetting loss. The gradient of the retention loss, Let be the norm of the vector.

[0022] Optionally, the building module is configured as follows: The final model is constructed using the following formula:

[0023]

[0024]

[0025] in, For the final model, For the original model, Forgetting vector, To preserve vectors, For the forgetting model, For the retained model, These are the trainable parameters of the final model.

[0026] Optionally, the final loss calculation module is configured as follows: The final loss of the final model is calculated using the following formula:

[0027] in, The final loss of the final model, For hyperparameters, For the aforementioned loss of forgetting, The retention loss is mentioned above.

[0028] Optionally, the forgetting loss is expressed by the following formula:

[0029] in, For the forgotten data, Forgotten labels for the forgotten data, This is the final model; The retention loss is expressed by the following formula:

[0030] in, For the reserved data, The retention label for the retained data. This is the final model;

[0031] in, For input, For output, For the number of categories, For input The corresponding tags For the model to input In parameters The predicted score for class i is given below. For the model to input In parameters The following predictions belong to the first The score for the class.

[0032] Optionally, the fine-tuning module is configured to: adjust the parameters of a preset number of layers close to the output layer of the original model based on the forgotten data to perform the first training on the original model, thereby obtaining the forgotten model.

[0033] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement a model forgetting method according to the present disclosure.

[0034] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform a model forgetting method according to the present disclosure.

[0035] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements a model forgetting method according to the present disclosure.

[0036] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects: In this disclosure, by using the gradient of the forgetting loss and the gradient of the preservation loss Projecting onto each other in orthogonal directions ensures that conflicting parts are removed. Furthermore, by adding the two projections, an update direction that simultaneously considers both optimization objectives without introducing conflict can be obtained. Applying gradient descent to the final loss of the final model according to this update direction to adjust the trainable parameters of the final model ensures that the optimization direction of the forgetting task is consistent with that of the retention task, thus avoiding unreasonable parameter changes. In other words, by constraining the gradient direction during the optimization process, a better balance can be achieved between the two optimization objectives forgotten by the machine, effectively eliminating the impact of forgotten data on the model while maximizing the protection of the characteristics of the retained data.

[0037] Furthermore, by performing gradient projection, the stability and adaptability of the model can be improved, enabling the model to achieve accurate and consistent performance in different forgetting scenarios.

[0038] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0039] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0040] Figure 1 This is a flowchart illustrating a model forgetting method according to an exemplary embodiment of the present disclosure; Figure 2 This is a comparative diagram illustrating the calculation of gradient update direction directly based on the gradient of forgetting loss and the gradient of retention loss in related technologies, and the calculation of optimized gradient direction by gradient projection in an exemplary embodiment of this disclosure; Figure 3 This is a block diagram illustrating a model forgetting device according to an exemplary embodiment of the present disclosure; Figure 4 This is a block diagram illustrating an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation

[0041] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0042] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following examples do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0043] It should be noted that the phrase "at least one of several items" in this disclosure refers to three parallel cases: "any one of the several items", "a combination of any number of the several items", and "all of the several items". For example, "including at least one of A and B" includes the following three parallel cases: (1) including A; (2) including B; (3) including A and B. Another example is "performing at least one of step one and step two", which indicates the following three parallel cases: (1) performing step one; (2) performing step two; (3) performing both step one and step two.

[0044] As mentioned earlier, "machine forgetting" is a machine learning process designed to remove the influence of specific data from a trained model to protect user privacy. Traditionally, this could be achieved by directly deleting the corresponding user data from the backend database and retraining the model. However, as the size of the model and dataset increases, the feasibility and efficiency of this approach decrease significantly. Especially for complex models that require substantial computational resources and time to train, retraining is necessary for each user's forgetting request, resulting in enormous resource consumption and wasted time and effort.

[0045] To efficiently respond to users' privacy protection needs, academia and industry have proposed various machine forgetting methods. Among these, the main machine forgetting methods include: fine-tuning on retained data, gradient ascent on forgotten data, and using a knowledge distillation framework to transfer different knowledge to achieve machine forgetting. Specifically, fine-tuning methods reduce the impact of forgotten data on the model by adjusting the model on retained data; gradient ascent methods optimize model parameters in reverse on forgotten data, gradually erasing the model's memory of forgotten data; and knowledge distillation methods construct a new model and transfer knowledge from the original model to eliminate the influence of forgotten data in the new model, thus achieving the forgetting goal.

[0046] However, while the aforementioned methods achieve machine forgetting to some extent, they do not respond well to different forgetting requests. Furthermore, the effectiveness of these methods tends to be unstable when the proportion of retained data is small. Considering that enterprises cannot hold user data indefinitely, the retained data may only represent a small portion of the total data, further increasing the difficulty of achieving stable and efficient machine forgetting. Therefore, in related technologies, it is difficult to guarantee the forgetting effect and model performance when handling forgetting requests with different proportions of retained data.

[0047] To address the aforementioned problems in related technologies, the model forgetting method, apparatus, electronic device, storage medium, and computer program product provided in this disclosure ensure that conflicting parts between the forgetting loss and the retention loss are removed by projecting the gradients of the forgetting loss and the retention loss onto orthogonal directions of each other. Furthermore, by adding the two projections, an update direction that simultaneously considers both optimization objectives without introducing conflict can be obtained. Gradient descent is then applied to the final loss of the final model according to this update direction to adjust the trainable parameters of the final model, ensuring that the optimization direction of the forgetting task is consistent with the optimization direction of the retention task, thereby avoiding unreasonable parameter changes. In other words, by constraining the gradient direction during the optimization process, a better balance can be achieved between the two optimization objectives of machine forgetting, effectively eliminating the impact of forgotten data on the model while maximizing the protection of the characteristics of the retained data.

[0048] Furthermore, by performing gradient projection, the stability and adaptability of the model can be improved, enabling the model to achieve accurate and consistent performance in different forgetting scenarios.

[0049] Figure 1 This is a flowchart illustrating a model forgetting method according to an exemplary embodiment of the present disclosure.

[0050] Reference Figure 1 In step 101, the original model can be trained first based on the forgotten data to obtain a forgotten model, and the original model can be trained secondly based on the retained data to obtain a retained model. The forgotten data and retained data can be data included in the original training dataset. The original training dataset can include multiple image samples and can be used to train the original model for image classification. Specifically: First, the original training dataset and the pre-trained original model can be selected. When a forgetting request for specific data is received, the original model can be fine-tuned twice independently, once on the forgotten data and once on the remaining data. The goal of this process is to enable the original model to further fit its respective dataset, thereby learning the underlying data distribution characteristics of these datasets.

[0051] For example, in this disclosure, the CIFAR10 dataset can be selected as the original training dataset, and the ResNet-18 model can be selected as the original model. It is assumed that an original model already trained on the complete dataset is available. When a request to forget class 0 data is received, the original model can be independently fine-tuned twice, on the forgotten data (i.e., class 0 data) and the remaining data, respectively.

[0052] According to an exemplary embodiment of this disclosure, the parameters of a predetermined number of layers close to the output layer of the original model can be adjusted based on forgotten data to perform a first training on the original model, thereby obtaining a forgotten model. In other words, the parameters of only a few layers close to the output layer of the original model can be fine-tuned. This reduces computational complexity and speeds up processing.

[0053] In step 102, the final model can be constructed based on the original model, the forgetting model, and the retention model.

[0054] According to exemplary embodiments of this disclosure, the final model can be constructed using the following formula:

[0055]

[0056]

[0057] in, For the final model, For the original model, Forgetting vector, To preserve vectors, For the forgetting model, To preserve the model, These are the trainable parameters of the final model, and... , , which represents the learnable weights assigned layer by layer, and d represents the number of layers in the model. Specifically: When constructing the final model, the difference between the fine-tuned forgotten model and the retained model and the original model in the parameter space can be calculated to obtain the forgetting vector. and preserved vector Forgetting vector It can represent the direction of parameter adjustments needed to forget specific information, preserving the vector. It can indicate the direction of parameter adjustments needed to preserve existing learning outcomes.

[0058] Thus, the model forgetting method provided in this disclosure can effectively handle various types of forgetting requests, providing customized forgetting schemes for different datasets. Furthermore, since this method only requires a small amount of retained data when calculating vector directions, it can provide stable and excellent performance under different retained data ratios, ensuring the model's performance stability, consistency, and adaptability in different data environments.

[0059] In step 103, the forgotten data and the retained data can be input into the final model respectively. This process yields the forgotten output and the retained output, both of which can serve as trainable parameters for the final model. The function.

[0060] In step 104, the forgetting loss can be calculated based on the forgetting output and the forgetting labels of the forgotten data. .

[0061] In step 105, the retention loss can be calculated based on the retention labels of the retained output and the retained data. .

[0062] In step 106, the loss can be based on forgetting. and retention loss Calculate the final model The final loss .

[0063] According to exemplary embodiments of this disclosure, the final model can be calculated using the following formula. The final loss:

[0064] in, For the final model The final loss, For hyperparameters, To forget the loss, To preserve the losses.

[0065] According to an exemplary embodiment of this disclosure, the loss of forgetting can be expressed by the following formula:

[0066] in, For forgotten data, Forgotten labels for forgotten data, For the final model; Retention loss can be expressed by the following formula:

[0067] in, To preserve data, To preserve data, For the final model;

[0068] in, For input, For output, For the number of categories, For input The corresponding tags For the model to input In parameters The predicted score for class i is given below. For the model to input In parameters The following predictions belong to the first The score for the class.

[0069] In step 107, the final loss can be utilized. For the final model Trainable parameters Find the partial derivative to obtain the gradient of the forgetting loss. And the gradient of the retained loss.

[0070] It should be noted that, to make model parameter tuning more precise and flexible, this disclosure provides a fine-grained learnable vector aggregation method. Specifically, independent learnable weights can be set for each layer of the model. These weights allow for more granular adjustments at different levels, thus better adapting to the different needs of forgetting and retaining data. For example, as mentioned above, the final model... Trainable parameters , , where is the learnable weights assigned by layer, and d represents the number of layers in the model. For example, d can take values ​​including, but not limited to, 20.

[0071] Furthermore, the aforementioned learnable weights can be learned and adjusted through optimization algorithms to achieve optimal model performance. Moreover, because this parameter tuning method can combine existing objective functions and optimization strategies, it possesses high flexibility and versatility, thus adapting to different application scenarios and needs. Further, this parameter tuning method can also enable the model to provide robust results under various retained data ratios, thereby enhancing the model's application value in data privacy protection and security.

[0072] It should be noted that in multi-objective optimization, when two optimization objectives (e.g., forgetting loss) are involved... and retention loss When the gradient directions of the loss function are inconsistent, if the gradient directions of the loss function are directly applied... Gradient descent may cause the model to achieve optimization on one optimization objective while destroying the optimization results on another.

[0073] Therefore, in step 108, the gradients of the forgetting loss can be calculated separately. and the gradient of the preservation loss Projecting along the corresponding orthogonal directions yields the orthogonal forgetting gradient. Orthogonal gradient preservation Specifically: The gradient of the forgetting loss can be used Preserve the gradient of the loss. Projecting along orthogonal directions yields the orthogonal forgetting gradient. The orthogonal forgetting gradient This can ensure the gradient of the forgotten loss. Gradient of the retention loss Conflicting parts are removed, thus maintaining stability during the optimization process. Similarly, the gradient of the loss can be preserved. The gradient of the forgetting loss Projecting along orthogonal directions yields orthogonal gradient-preserving results. This orthogonal gradient preservation This ensures that the gradient of the loss is preserved. Gradient of forgetting loss Conflicting parts are removed, thus maintaining stability during the optimization process.

[0074] In this way, during model parameter tuning, gradient projection constructs a feasible region, restricting parameter updates to this region. This ensures that the optimization direction of the forgotten task aligns with that of the retained task, thus avoiding optimization conflicts. Specifically, by constraining the direction of the gradient during optimization, gradient projection maintains a balance between the forgotten and retained tasks, ensuring that model parameter adjustments effectively eliminate the influence of forgotten data while maximizing the preservation of the characteristics of the retained data.

[0075] Furthermore, this gradient projection technique enables the model to provide more accurate and stable results under different data forgetting ratios, improving the model's stability and efficiency in handling data forgetting and protecting retained data. Moreover, the application of this gradient projection technique not only improves the model's accuracy in handling forgetting requests but also enhances its robustness in practical applications.

[0076] According to an exemplary embodiment of this disclosure, the orthogonal forgetting gradient can be calculated using the following formula:

[0077] The orthogonality-preserving gradient can be calculated using the following formula: ; in, For orthogonal forgetting gradients, To preserve gradients for orthogonality, The gradient of the forgetting loss. To preserve the gradient of the loss, Let be the norm of the vector.

[0078] To address potential conflicts during the optimization process, this disclosure provides a gradient projection technique. By projecting gradient updates onto the feasible region, this technique ensures that the optimization direction of the forgetting task aligns with that of the retention task, thus avoiding mutual interference and conflicts in optimization direction. This improves the stability and accuracy of the model in various data forgetting tasks.

[0079] Furthermore, this gradient projection technique enables the model to not only effectively complete the forgetting task when handling forgetting requests, but also to maximize the preservation of the learning effects of the retained data. Moreover, gradient projection improves the model's stability and accuracy under different proportions of forgotten data, thus ensuring strong robustness and high efficiency when dealing with complex data forgetting and privacy protection tasks.

[0080] In step 109, the orthogonal forgetting gradient can be calculated. Orthogonal gradient preservation The sum of these terms yields the optimal gradient direction. .

[0081] Figure 2 This illustrates the gradient directly based on forgetting loss in related techniques. and the gradient of the preservation loss A comparative diagram showing the calculation of gradient update direction and the calculation of optimized gradient direction by gradient projection according to an exemplary embodiment of the present disclosure.

[0082] Reference Figure 2 , Figure 2 The left side of the graph represents the gradient based directly on the forgetting loss without orthogonal projection. and the gradient of the preservation loss To calculate the gradient update direction A schematic diagram; Figure 2 The right side of the graph represents the gradient of the forgetting loss. and the gradient of the preservation loss Projecting along the corresponding orthogonal directions yields the orthogonal forgetting gradient. Orthogonal gradient preservation Then, based on orthogonal forgetting gradients Orthogonal gradient preservation Calculate the optimal gradient direction A schematic diagram.

[0083] In step 1010, the gradient direction can be optimized. Regarding the final loss Perform gradient descent to adjust trainable parameters Thus, for the final model Conduct training.

[0084] This disclosure employs precise model parameter tuning methods and fine-grained learnable vector aggregation methods to effectively handle various data forgetting requests and deliver excellent performance across diverse application scenarios. Furthermore, these methods not only enhance the model's flexibility and stability but also provide reliable technical safeguards for data privacy protection and the security of machine learning models.

[0085] Figure 3 This is a block diagram illustrating a model forgetting device 300 according to an exemplary embodiment of the present disclosure.

[0086] Reference Figure 3 The model forgetting device 300 may include a fine-tuning module 301, a construction module 302, a data input module 303, a forgetting loss calculation module 304, a retention loss calculation module 305, a final loss calculation module 306, a gradient acquisition module 307, a projection module 308, an optimized gradient direction calculation module 309, and a gradient descent module 3010.

[0087] The fine-tuning module 301 can perform a first training on the original model based on forgotten data to obtain a forgotten model, and can perform a second training on the original model based on retained data to obtain a retained model. Forgotten data and retained data can be data included in the original training dataset. The original training dataset can include multiple image samples and can be used to train the original model for image classification. Specifically: First, the original training dataset and the pre-trained original model can be selected. When a forgetting request for specific data is received, the original model can be fine-tuned twice independently, once on the forgotten data and once on the remaining data. The goal of this process is to enable the original model to further fit its respective dataset, thereby learning the underlying data distribution characteristics of these datasets.

[0088] According to an exemplary embodiment of this disclosure, the fine-tuning module 301 can adjust the parameters of a preset number of layers close to the output layer of the original model based on forgotten data to perform a first training on the original model and obtain a forgotten model. That is, the parameters of only a few layers close to the output layer of the original model can be fine-tuned. In this way, the computational complexity can be reduced and the processing speed can be accelerated.

[0089] Module 302 can build the final model based on the original model, the forgotten model, and the retained model.

[0090] According to an exemplary embodiment of this disclosure, the construction module 302 can construct the final model using the following formula:

[0091]

[0092]

[0093] in, For the final model, For the original model, Forgetting vector, To preserve vectors, For the forgetting model, To preserve the model, These are the trainable parameters of the final model, and... , , which represents the learnable weights assigned layer by layer, and d represents the number of layers in the model. Specifically: When constructing the final model, the difference between the fine-tuned forgotten model and the retained model and the original model in the parameter space can be calculated to obtain the forgetting vector. and preserved vector Forgetting vector It can represent the direction of parameter adjustments needed to forget specific information, preserving the vector. It can indicate the direction of parameter adjustments needed to preserve existing learning outcomes.

[0094] Thus, the model forgetting method provided in this disclosure can effectively handle various types of forgetting requests, providing customized forgetting schemes for different datasets. Furthermore, since this method only requires a small amount of retained data when calculating vector directions, it can provide stable and excellent performance under different retained data ratios, ensuring the model's performance stability, consistency, and adaptability in different data environments.

[0095] The data input module 303 can input forgotten data and retained data into the final model separately. This process yields the forgotten output and the retained output, both of which can serve as trainable parameters for the final model. The function.

[0096] The forgetting loss calculation module 304 can calculate the forgetting loss based on the forgetting output and the forgetting labels of the forgetting data. .

[0097] The retention loss calculation module 305 can calculate the retention loss based on the retention labels of the retained output and the retained data. .

[0098] The final loss calculation module 306 can be based on forgetting loss. and retention loss Calculate the final model The final loss .

[0099] According to an exemplary embodiment of this disclosure, the final loss calculation module 306 can calculate the final model using the following formula. The final loss:

[0100] in, For the final model The final loss, For hyperparameters, To forget the loss, To preserve the losses.

[0101] According to an exemplary embodiment of this disclosure, the loss of forgetting can be expressed by the following formula:

[0102] in, For forgotten data, Forgotten labels for forgotten data, For the final model; Retention loss can be expressed by the following formula:

[0103] in, To preserve data, To preserve data, For the final model;

[0104] in, For input, For output, For the number of categories, For input The corresponding tags For the model to input In parameters The predicted score for class i is given below. For the model to input In parameters The following predictions belong to the first The score for the class.

[0105] The gradient acquisition module 307 can utilize the final loss. For the final model Trainable parameters Find the partial derivative to obtain the gradient of the forgetting loss. And the gradient of the retained loss.

[0106] It should be noted that, to make model parameter tuning more precise and flexible, this disclosure provides a fine-grained learnable vector aggregation method. Specifically, independent learnable weights can be set for each layer of the model. These weights allow for more granular adjustments at different levels, thus better adapting to the different needs of forgetting and retaining data. For example, as mentioned above, the final model... Trainable parameters , , where is the learnable weights assigned by layer, and d represents the number of layers in the model. For example, d can take values ​​including, but not limited to, 20.

[0107] Furthermore, the aforementioned learnable weights can be learned and adjusted through optimization algorithms to achieve optimal model performance. Moreover, because this parameter tuning method can combine existing objective functions and optimization strategies, it possesses high flexibility and versatility, thus adapting to different application scenarios and needs. Further, this parameter tuning method can also enable the model to provide robust results under various retained data ratios, thereby enhancing the model's application value in data privacy protection and security.

[0108] It should be noted that in multi-objective optimization, when two optimization objectives (e.g., forgetting loss) are involved... and retention loss When the gradient directions of the loss function are inconsistent, if the gradient directions of the loss function are directly applied... Gradient descent may cause the model to achieve optimization on one optimization objective while destroying the optimization results on another.

[0109] Projection module 308 can project the gradient of the forgetting loss separately. and the gradient of the preservation loss Projecting along the corresponding orthogonal directions yields the orthogonal forgetting gradient. Orthogonal gradient preservation Specifically: The gradient of the forgetting loss can be used Preserve the gradient of the loss. Projecting along orthogonal directions yields the orthogonal forgetting gradient. The orthogonal forgetting gradient This can ensure the gradient of the forgotten loss. Gradient of the retention loss Conflicting parts are removed, thus maintaining stability during the optimization process. Similarly, the gradient of the loss can be preserved. The gradient of the forgetting loss Projecting along orthogonal directions yields orthogonal gradient-preserving results. This orthogonal gradient preservation This ensures that the gradient of the loss is preserved. Gradient of forgetting loss Conflicting parts are removed, thus maintaining stability during the optimization process.

[0110] In this way, during model parameter tuning, gradient projection constructs a feasible region, restricting parameter updates to this region. This ensures that the optimization direction of the forgotten task aligns with that of the retained task, thus avoiding optimization conflicts. Specifically, by constraining the direction of the gradient during optimization, gradient projection maintains a balance between the forgotten and retained tasks, ensuring that model parameter adjustments effectively eliminate the influence of forgotten data while maximizing the preservation of the characteristics of the retained data.

[0111] Furthermore, this gradient projection technique enables the model to provide more accurate and stable results under different data forgetting ratios, improving the model's stability and efficiency in handling data forgetting and protecting retained data. Moreover, the application of this gradient projection technique not only improves the model's accuracy in handling forgetting requests but also enhances its robustness in practical applications.

[0112] According to an exemplary embodiment of this disclosure, the orthogonal forgetting gradient can be calculated using the following formula:

[0113] The orthogonality-preserving gradient can be calculated using the following formula: ; in, For orthogonal forgetting gradients, To preserve gradients for orthogonality, The gradient of the forgetting loss. To preserve the gradient of the loss, Let be the norm of the vector.

[0114] To address potential conflicts during the optimization process, this disclosure provides a gradient projection technique. By projecting gradient updates onto the feasible region, this technique ensures that the optimization direction of the forgetting task aligns with that of the retention task, thus avoiding mutual interference and conflicts in optimization direction. This improves the stability and accuracy of the model in various data forgetting tasks.

[0115] Furthermore, this gradient projection technique enables the model to not only effectively complete the forgetting task when handling forgetting requests, but also to maximize the preservation of the learning effects of the retained data. Moreover, gradient projection improves the model's stability and accuracy under different proportions of forgotten data, thus ensuring strong robustness and high efficiency when dealing with complex data forgetting and privacy protection tasks.

[0116] The optimized gradient direction calculation module 309 can calculate the orthogonal forgetting gradient. Orthogonal gradient preservation The sum of these terms yields the optimal gradient direction. .

[0117] The gradient descent module 3010 can follow the optimized gradient direction. Regarding the final loss Perform gradient descent to adjust trainable parameters Thus, for the final model Conduct training.

[0118] Figure 4 This is a block diagram illustrating an electronic device 400 according to an exemplary embodiment of the present disclosure.

[0119] Reference Figure 4 The electronic device 400 includes at least one memory 401 and at least one processor 402, wherein the at least one memory 401 stores instructions that, when executed by the at least one processor 402, perform a model forgetting method according to an exemplary embodiment of the present disclosure.

[0120] As an example, electronic device 400 may be a PC, tablet, personal digital assistant, smartphone, or other device capable of executing the aforementioned instructions. Here, electronic device 400 is not necessarily a single electronic device, but may be a collection of any devices or circuits capable of executing the aforementioned instructions (or instruction sets) individually or in combination. Electronic device 400 may also be part of an integrated control system or system manager, or may be configured to interconnect with a portable electronic device locally or remotely (e.g., via wireless transmission) through an interface.

[0121] In electronic device 400, processor 402 may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller, or a microprocessor. By way of example and not limitation, processor may also include analog processors, digital processors, microprocessors, multi-core processors, processor arrays, network processors, etc.

[0122] The processor 402 can execute instructions or code stored in the memory 401, which can also store data. Instructions and data can also be sent and received over a network via a network interface device, which can employ any known transmission protocol.

[0123] The memory 401 may be integrated with the processor 402, for example, by placing RAM or flash memory within an integrated circuit microprocessor. Alternatively, the memory 401 may include a separate device, such as an external disk drive, a storage array, or other storage device that can be used by any database system. The memory 401 and the processor 402 may be operatively coupled, or may communicate with each other, for example, via I / O ports, network connections, etc., enabling the processor 402 to read files stored in the memory.

[0124] In addition, the electronic device 400 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, mouse, touch input device, etc.). All components of the electronic device 400 can be interconnected via a bus and / or network.

[0125] According to exemplary embodiments of this disclosure, a computer-readable storage medium may also be provided, which, when executed by a processor of an electronic device, enables the electronic device to perform the model forgetting method described above. Examples of computer-readable storage media include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disc storage, hard disk drive (HDD), solid-state drive (SSD), card storage (such as multimedia cards, secure digital (SD) cards, or ultra-fast digital (XD) cards), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, and any other device configured to store a computer program and any associated data, data files, and data structures in a non-transitory manner and to provide the computer program and any associated data, data files, and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the aforementioned computer-readable storage medium can run in an environment deployed in computer devices such as clients, hosts, agent devices, servers, etc. Furthermore, in one example, the computer program and any associated data, data files, and data structures are distributed across a networked computer system, such that the computer program and any associated data, data files, and data structures are stored, accessed, and executed in a distributed manner through one or more processors or computers.

[0126] According to exemplary embodiments of the present disclosure, a computer program product may also be provided, including a computer program that, when executed by a processor, implements the model forgetting method according to the present disclosure.

[0127] According to the model forgetting method, apparatus, electronic device, storage medium, and computer program product disclosed herein, by projecting the gradients of the forgetting loss and the retention loss onto each other's orthogonal directions, it can be ensured that conflicting parts between the two are removed. Furthermore, by adding the two obtained projections, an update direction that simultaneously considers both optimization objectives without introducing conflict can be obtained. Gradient descent is then applied to the final loss of the final model according to this update direction to adjust the trainable parameters of the final model, ensuring that the optimization direction of the forgetting task is consistent with the optimization direction of the retention task, thereby avoiding unreasonable parameter changes. In other words, by constraining the gradient direction during the optimization process, a better balance can be achieved between the two optimization objectives of machine forgetting, effectively eliminating the impact of forgotten data on the model while maximizing the protection of the characteristics of the retained data. Furthermore, gradient projection can also improve the stability and adaptability of the model, enabling the model to achieve accurate and consistent performance under different forgetting scenarios.

[0128] According to exemplary embodiments of this disclosure, computational complexity can be reduced and processing speed can be increased by fine-tuning only the parameters of a few layers close to the output layer of the original model.

[0129] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0130] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A model forgetting method, characterized in that, include: The original model is first trained based on forgotten data to obtain a forgotten model, and the original model is second trained based on retained data to obtain a retained model. The forgotten data and the retained data are data included in the original training dataset, which includes multiple image samples and is used to train the original model for classifying images. Based on the original model, the forgetting model, and the retention model, a final model is constructed. The forgotten data and the retained data are respectively input into the final model to obtain the forgotten output and the retained output; Based on the forgotten output and the forgotten labels of the forgotten data, the forgetting loss is calculated; Based on the retained output and the retained labels of the retained data, calculate the retention loss; Based on the forgetting loss and the retention loss, calculate the final loss of the final model; The gradients of the forgetting loss and the retention loss are obtained by taking the partial derivatives of the final loss with respect to the trainable parameters of the final model. The gradients of the forgetting loss and the retention loss are projected onto their respective orthogonal directions to obtain the orthogonal forgetting gradient and the orthogonal retention gradient; Calculate the sum of the orthogonal forgetting gradient and the orthogonal retaining gradient to obtain the optimized gradient direction; According to the optimization gradient direction, gradient descent is performed on the final loss to adjust the trainable parameters, thereby training the final model; The orthogonal forgetting gradient is calculated using the following formula: The orthogonality-preserving gradient is calculated using the following formula: ; in, The orthogonal forgetting gradient, Preserve the gradient for the orthogonality. Let be the gradient of the forgetting loss. The gradient of the retention loss, Let be the norm of the vector.

2. The model forgetting method as described in claim 1, characterized in that, The construction of the final model based on the original model, the forgetting model, and the retention model includes: The final model is constructed using the following formula: in, For the final model, For the original model, Forgetting vector, To preserve vectors, For the forgetting model, For the retained model, These are the trainable parameters of the final model.

3. The model forgetting method as described in claim 1, characterized in that, The calculation of the final loss of the final model based on the forgetting loss and the retention loss includes: The final loss of the final model is calculated using the following formula: in, The final loss of the final model, For hyperparameters, For the aforementioned loss of forgetting, The retention loss is mentioned above.

4. The model forgetting method as described in claim 3, characterized in that, The forgetting loss is expressed by the following formula: in, For the forgotten data, Forgotten labels for the forgotten data, This is the final model; The retention loss is expressed by the following formula: in, For the reserved data, The retention label for the retained data. This is the final model; in, For input, For output, For the number of categories, For input The corresponding tags For the model to input In parameters The predicted score for class i is given below. For the model to input In parameters The following predictions belong to the first The score for the class.

5. The model forgetting method as described in claim 1, characterized in that, The process of performing a first training on the original model based on forgotten data to obtain a forgotten model includes: Based on the forgotten data, the parameters of a predetermined number of layers close to the output layer of the original model are adjusted to perform the first training on the original model, thereby obtaining the forgotten model.

6. A model forgetting device, characterized in that, include: The fine-tuning module is configured to perform a first training on the original model based on forgotten data to obtain a forgotten model, and to perform a second training on the original model based on retained data to obtain a retained model, wherein the forgotten data and the retained data are data included in the original training dataset, the original training dataset including multiple image samples and used to train the original model for classifying images; The building module is configured to build the final model based on the original model, the forgotten model, and the retained model; The data input module is configured to input the forgotten data and the retained data into the final model respectively to obtain forgotten output and retained output; The forgetting loss calculation module is configured to calculate the forgetting loss based on the forgetting output and the forgetting labels of the forgetting data. The retention loss calculation module is configured to calculate the retention loss based on the retention output and the retention labels of the retention data; The final loss calculation module is configured to calculate the final loss of the final model based on the forgetting loss and the retention loss; The gradient acquisition module is configured to obtain the gradients of the forgetting loss and the retention loss by taking the partial derivatives of the final loss with respect to the trainable parameters of the final model. The projection module is configured to project the gradient of the forgetting loss and the gradient of the retaining loss onto corresponding orthogonal directions to obtain orthogonal forgetting gradients and orthogonal retaining gradients. The optimized gradient direction calculation module is configured to calculate the sum of the orthogonal forgotten gradient and the orthogonal retained gradient to obtain the optimized gradient direction; The gradient descent module is configured to perform gradient descent on the final loss according to the optimized gradient direction to adjust the trainable parameters, thereby training the final model; The orthogonal forgetting gradient is calculated using the following formula: The orthogonality-preserving gradient is calculated using the following formula: ; in, The orthogonal forgetting gradient, Preserve the gradient for the orthogonality. Let be the gradient of the forgetting loss. The gradient of the retention loss, Let be the norm of the vector.

7. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the model forgetting method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the model forgetting method as described in any one of claims 1 to 5.

9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the model forgetting method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Machine forgetting method and device for deep learning model

    CN116594992A

  • Federal incremental learning method and system based on constrained gradient updating

    CN118313445A