Knowledge exchange method based on first learning and second forgetting and application thereof

By constructing retention sets, forgetting sets, and learning sets, and combining the knowledge exchange method of LoRA fine-tuning and sparse regularization modules, the contradiction between forgetting useless knowledge and learning new knowledge during knowledge updating in deep learning models is resolved, and the stability and adaptability of the model are improved. It is suitable for tasks such as image classification, semantic segmentation, and target detection.

CN120707915APending Publication Date: 2025-09-26HEFEI UNIV OF TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510566020.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

In existing technologies, deep learning models are unable to effectively learn new knowledge and selectively forget useless or sensitive knowledge during knowledge updating, resulting in catastrophic forgetting and privacy protection problems.

Method used

A knowledge exchange method based on learning first and forgetting later is adopted. By constructing a retention set, a forgetting set and a learning set, and combining the LoRA fine-tuning module and the sparse regularization module, new knowledge learning and specific knowledge forgetting are achieved. The LoRA fine-tuning module is used to introduce a low-rank matrix in the linear layer of the Transformer for parameter fine-tuning, and the sparse regularization module is used for parameter constraints to ensure the controllability of new knowledge learning and forgetting.

Benefits of technology

It achieves the selective forgetting of useless or sensitive knowledge while learning new knowledge, improves the adaptability and stability of the model, avoids knowledge rebound, and is suitable for tasks such as image classification, semantic segmentation, and target detection, ensuring privacy protection and model adaptive optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120707915A_ABST
    Figure CN120707915A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge exchange method based on learning before forgetting and application thereof, and relates to the technical field of machine learning and knowledge management, a pre-trained deep learning model is selected as a basic model, and a retention set, a forgetting set and a learning set are constructed; the basic model carries out new knowledge learning on the learning set, and the training target of the model in the stage is that the accuracy of the learning set is close to 1, and meanwhile the accuracy of the reserved set is kept unchanged; after the basic model completes new knowledge learning, knowledge irrelevant to a new task is forgotten through a selective forgetting mechanism, and the training target of the model at the stage is that the accuracy rate of a forgetting set is close to 0, and meanwhile the accuracy rates of a reserved set and a learning set are kept unchanged. According to the method, continuous learning and machine forgetting are integrated together, so that the problem of contradiction between useless knowledge forgetting and new knowledge learning when a deep learning model processes knowledge updating of a pre-training model is solved. According to the knowledge exchange method based on first learning and then forgetting, the specified knowledge can be selectively forgotten while efficient learning of new knowledge is ensured, so that more refined knowledge regulation and control are realized, and the adaptability and the stability of the model are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine learning and knowledge management, and in particular to a knowledge exchange method based on learning first and forgetting later and its application. Background Art

[0002] With the rapid development of deep learning technology, pre-trained models have been widely used in various tasks. By training on large-scale datasets, pre-trained models can acquire a wealth of knowledge and feature representations, which can then be fine-tuned to adapt to specific tasks. This fine-tuning process can effectively improve the model's performance on specific tasks. However, as the number of tasks increases, the model needs to continuously learn new knowledge, which also poses the problem of catastrophic forgetting: learning new tasks often causes the model to forget previously learned knowledge. To address this challenge, continuous learning methods have emerged. The goal of continuous learning is to enable the model to gradually learn new tasks without forgetting existing knowledge. Furthermore, with the increasing challenges of data privacy and security, machine forgetting has become a key research direction. The goal of machine forgetting is to remove specific user data or knowledge from the trained model to meet data privacy compliance requirements. However, as user needs diversify, users may want the model to mask or forget certain sensitive content while learning new knowledge. Despite this increasingly urgent need, methods that can simultaneously achieve new knowledge learning and specific content forgetting remain underexplored. Summary of the Invention

[0003] In order to overcome the defects in the above-mentioned prior art, the present invention provides a knowledge exchange method based on learning first and forgetting later and its application, which solves the contradiction faced by the deep learning model in the prior art between forgetting useless knowledge and learning new knowledge at the same time when processing the knowledge update of the pre-trained model.

[0004] To achieve the above object, the present invention adopts the following technical solutions, including:

[0005] A knowledge exchange method based on learning first and forgetting later includes the following steps:

[0006] S1, select a pre-trained deep learning model as the base model to provide initial parameters for subsequent learning and forgetting; construct a retention set, a forgetting set, and a learning set, where the retention set and the forgetting set are the data sets learned when the base model is pre-trained; the learning set is the data set learned when the base model is fine-tuned to adapt to the new task;

[0007] S2, the basic model learns the learning set to achieve new knowledge learning;

[0008] In the new knowledge learning phase, the training goal of the model is to make the accuracy of the learning set close to 1 while keeping the accuracy of the retention set unchanged;

[0009] S3, after the basic model completes learning of new knowledge, it forgets knowledge that is not relevant to the new task through the selective forgetting mechanism;

[0010] In the knowledge forgetting stage, the training goal of the model is to make the accuracy of the forgotten set close to 0 while keeping the accuracy of the retained set and the learning set unchanged.

[0011] Preferably, the model includes a LoRA fine-tuning module and a sparse regularization module;

[0012] In the new knowledge learning phase, the LoRA fine-tuning module introduces an additional low-rank matrix into the linear layer of the transformer through low-rank adaptation, and only fine-tunes the parameters of the linear layer of the transformer; in the knowledge forgetting phase, the LoRA fine-tuning module only adjusts the parameters related to the forgotten knowledge, while the parameters of the rest remain unchanged;

[0013] In the new knowledge learning stage, the sparse regularization module constrains the model through regularization so that the learning of new knowledge only affects relevant parameters; in the knowledge forgetting stage, the sparse regularization module actively weakens the parameters related to the forgotten knowledge.

[0014] Preferably, in step S2, the total loss function in the new knowledge learning phase is Including learning losses for new tasks Retention loss of retained knowledge and structural losses The details are as follows:

[0015]

[0016] Where f(·) represents the model function; represents the loss function; X l ,Y l is the paired data in the learning set, X r ,Y r To retain the paired data in the set; A k and B k Represents the trainable matrix in the k-th LoRA module; represents the square of the F norm; α and β are weight coefficients.

[0017] Preferably, in step S3, the total loss function in the knowledge forgetting stage is Including the loss of useless or harmful knowledge Retention loss of retained knowledge Retention loss of learned knowledge and structural losses The details are as follows:

[0018]

[0019]

[0020] Among them, the ReLU(·) function is used to achieve lower bound truncation to prevent the loss function from increasing infinitely; BND is a constant boundary value that specifies the maximum degree of forgetting to prevent the model from not converging during training; f(·) represents the model function; represents the loss function; X f ,Y f is the paired data in the forget set; X l ,Y l is the paired data in the learning set; X r ,Y r To retain the paired data in the set; A k and B k Represents the trainable matrix in the k-th LoRA module; represents the square of the F norm; α', β' are weight coefficients.

[0021] The present invention provides an image classification method based on knowledge exchange, which comprises selecting a pre-trained image classification model; obtaining a learning set for a new task; and utilizing the knowledge exchange method based on learning first and forgetting later to perform new knowledge learning and specific knowledge forgetting on the pre-trained image classification model, thereby obtaining a fine-tuned image classification model.

[0022] The present invention provides a target detection method based on knowledge exchange, which includes selecting a pre-trained target detection model; obtaining a learning set for a new task; and utilizing the knowledge exchange method based on learning first and forgetting later to perform new knowledge learning and specific knowledge forgetting on the pre-trained target detection model to obtain a fine-tuned target detection model.

[0023] The present invention provides a semantic segmentation method based on knowledge exchange, which includes selecting a pre-trained semantic segmentation model; obtaining a learning set for a new task; and utilizing the knowledge exchange method based on learning first and forgetting later to perform new knowledge learning and specific knowledge forgetting on the pre-trained semantic segmentation model to obtain a fine-tuned semantic segmentation model.

[0024] The present invention provides a computer program product, characterized in that it includes a computer program / instruction, which, when executed by a processor, implements the knowledge exchange method based on learning first and then forgetting.

[0025] The advantages of the present invention are:

[0026] (1) The present invention proposes a knowledge exchange method, which combines continuous learning and machine forgetting to solve the contradiction between forgetting useless knowledge and learning new knowledge at the same time, which is faced by deep learning models in the prior art when processing knowledge updates of pre-trained models. Traditional methods can only learn new knowledge or forget useless knowledge in a single way, but cannot guarantee the effectiveness of learning new knowledge and the thoroughness of forgetting old knowledge in the same process. The present invention proposes a knowledge exchange method based on learning first and then forgetting, which can selectively forget specified knowledge while ensuring the efficient learning of new knowledge, thereby achieving more refined knowledge regulation and improving the adaptability and stability of the model.

[0027] (2) The knowledge exchange strategy based on learning first and forgetting later proposed in the present invention has achieved remarkable technical effects in various tasks such as image classification, semantic segmentation and target detection. Compared with the strategy of forgetting first and learning later, the method of the present invention achieves more stable and thorough knowledge forgetting while ensuring learning ability, avoiding knowledge rebound caused by low-level feature recovery, and ensuring the controllability and stability of model knowledge regulation. It is suitable for application scenarios such as privacy protection, knowledge updating and adaptive optimization of artificial intelligence models. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 Schematic diagram of knowledge exchange.

[0029] Figure 2 Schematic diagram of a deep learning model training method based on knowledge exchange.

[0030] Figure 3 This is an example diagram of forgetting first and then learning.

[0031] Figure 4 This is an example diagram of learning first and then forgetting. DETAILED DESCRIPTION

[0032] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0033] This invention aims at the deep learning model, and proposes a knowledge exchange method to achieve the needs of learning new knowledge and forgetting specific knowledge at the same time. The knowledge exchange diagram is shown as follows: Figure 1 shown.

[0034] The purpose of knowledge exchange is to effectively forget the specified content while retaining existing abilities, and to successfully learn new knowledge to adapt to new tasks.

[0035] The learn-first-then-forget knowledge exchange method for deep learning models aims to avoid catastrophic forgetting by selectively forgetting some knowledge, retaining core knowledge and learning new knowledge, while improving the adaptability of the model.

[0036] The present invention provides a more flexible and practical knowledge management mechanism for the model by finely dividing and controlling three types of data, including the retaining set, the forgetting set, and the learning set.

[0037] The retention set contains the important knowledge that the model has learned in the pre-training phase and still needs to retain in the new task. The retention set is denoted as D r =(X r ,Y r ), X r ,Y r The paired data (samples and corresponding labels) in the holdout set. During model training, we hope that the model will continue to maintain high accuracy on the holdout set to ensure that its original capabilities are not destroyed.

[0038] The Forgetting Set contains the knowledge that needs to be removed or blocked from the deep learning model during training. This type of knowledge may involve user privacy, outdated information, or potentially risky content. The Forgetting Set is denoted as D. f =(X f ,Y f ), X f ,Y f The paired data in the forget set. During model training, we hope that the model cannot correctly identify samples in the forget set, that is, to minimize the model's prediction accuracy for the original labels in the forget set.

[0039] The learning set contains new knowledge that the model needs to learn, which usually comes from a completely new task or domain and is not included in the original pre-training data. The learning set is denoted as D l =(X l ,Y l ), X l ,Y l For paired data in the learning set. During the model training process, it is hoped that the model can correctly understand and predict the labels of these new samples to achieve better generalization ability.

[0040] like Figure 2 As shown in the figure, the model architecture includes: LoRA fine-tuning module and sparse regularization module.

[0041] The LoRA fine-tuning module is used to efficiently adjust model parameters while avoiding interference with core knowledge. During the new knowledge learning phase, the LoRA fine-tuning module introduces an additional low-rank matrix into the linear layer of the transformer through low-rank adaptation, and only adjusts a small number of parameters (only fine-tuning the parameters of the linear layer of the transformer), enabling the model to quickly adapt to new tasks while reducing computational overhead. During the specific knowledge forgetting phase, the LoRA fine-tuning module only adjusts the parameters related to the forgetting target, while keeping the rest unchanged, ensuring that the forgetting operation does not affect the overall capabilities of the model. This approach ensures the effective learning of new knowledge while precisely controlling the forgetting process.

[0042] The sparse regularization module selectively strengthens or weakens the weight of specific knowledge. During the new knowledge learning phase, the sparse regularization module constrains the model through L1 regularization, ensuring that the learning of new knowledge only affects relevant parameters, reducing interference with existing knowledge and improving the stability of knowledge integration. During the specific knowledge forgetting phase, the sparse regularization module actively weakens parameters related to the forgotten target, bringing them close to zero or directly removing them, ensuring that the forgotten knowledge cannot be recovered in subsequent tasks. This effectively increases the irreversibility of knowledge forgetting while avoiding negative impacts on the overall model performance.

[0043] The present invention provides a knowledge exchange method based on learning first and forgetting later, comprising the following steps:

[0044] S1, select a pre-trained deep learning model as the base model to provide initial parameters for subsequent learning and forgetting. The model has been trained on large-scale datasets (such as ImageNet, COCO, ADE20K) and has certain basic knowledge.

[0045] Construct a retention set, a forgetting set, and a learning set. The retention set and the forgetting set are the datasets learned when pre-training the basic model. The learning set is the dataset learned when fine-tuning the basic model to adapt to the new task.

[0046] S2, new knowledge learning stage.

[0047] In this stage, the model needs to learn a new task dataset, namely the learning set D l(e.g., CUB-200, Oxford-IIIT Pet) to adapt to new categories or scenarios. To ensure the stability of existing core knowledge during the new knowledge learning phase, LoRA (Low-Rank Adaptation) technology is used to fine-tune parameters only in the linear layer of the Transformer to reduce computational overhead while minimizing the impact on low-level features. In addition, Group Sparse Regularization (GSR) constrains some parameters to ensure the accuracy of knowledge regulation. The goal of this phase is to achieve a learning set accuracy close to 1 while maintaining the accuracy of the holdout set unchanged.

[0048] Total loss function in the new knowledge learning stage Including learning losses for new tasks Retention loss of retained knowledge And structural loss (L1 regularization loss) The details are as follows:

[0049]

[0050] Where f(·) represents the model function; represents the loss function; X l ,Y l is the paired data in the learning set, X r ,Y r To retain the paired data in the set; A k and B k Represents the trainable matrix in the k-th LoRA module; represents the square of the F norm; α and β are weight coefficients.

[0051] In this embodiment, for the task of image classification, α=0.005, β=0.2; for the task of semantic segmentation, α=0.01, β=0.9; for the task of object detection, α=0.01, β=0.9.

[0052] S3, the stage of forgetting specific knowledge (useless and harmful knowledge)

[0053] After learning new knowledge, the model enters the knowledge forgetting phase. Through the selective forgetting mechanism, the model forgets knowledge irrelevant to the new task as needed. This phase is primarily achieved by adjusting group sparsity regularization and LoRA techniques to ensure that high-level semantic features in the forgetting set are forgotten, thereby preventing the stability of lower-level features. The goal of this phase is to bring the accuracy of the forgetting set close to zero while maintaining the accuracy of the retained set and the previously learned set.

[0054] Total loss function in the knowledge forgetting stage Including the loss of useless or harmful knowledge Retention loss of retained knowledge Retention loss of learned knowledge And structural loss (L1 regularization loss) The details are as follows:

[0055]

[0056] Among them, the ReLU(·) function is used to achieve lower bound truncation to prevent the loss function from increasing infinitely; BND is a constant boundary value that specifies the maximum degree of forgetting to prevent the model from not converging during training; f(·) represents the model function; represents the loss function; X f ,Y f is the paired data in the forget set; X l ,Y l is the paired data in the learning set; X r ,Y r To retain the paired data in the set; A k and B k Represents the trainable matrix in the k-th LoRA module; represents the square of the F norm; α', β' are weight coefficients.

[0057] In this embodiment, for the task of image classification, α'=0.005, β'=0.2, BND=105; for the task of semantic segmentation, α'=0.01, β'=0.9, BND=115; for the task of target detection, α'=0.01, β'=0.9, BND=15.

[0058] In this embodiment, a knowledge exchange method based on learning first and forgetting later is used in image classification tasks, semantic segmentation tasks and object detection tasks.

[0059] A knowledge exchange-based image classification method comprises the following steps: selecting a pre-trained image classification model; obtaining a learning set for a new task; and utilizing the aforementioned knowledge exchange method based on learning first and forgetting to perform new knowledge learning and specific knowledge forgetting on the pre-trained image classification model, thereby obtaining a fine-tuned image classification model.

[0060] A target detection method based on knowledge exchange includes selecting a pre-trained target detection model; obtaining a learning set for a new task; and using the above-mentioned knowledge exchange method based on learning first and forgetting to perform new knowledge learning and specific knowledge forgetting on the pre-trained target detection model to obtain a fine-tuned target detection model.

[0061] A semantic segmentation method based on knowledge exchange, comprising the steps of selecting a pre-trained semantic segmentation model; obtaining a learning set for a new task; and utilizing the aforementioned knowledge exchange method based on learning first and forgetting to perform new knowledge learning and specific knowledge forgetting on the pre-trained semantic segmentation model, thereby obtaining a fine-tuned semantic segmentation model.

[0062] In the image classification task, the ViT-B16 model is used, the subclasses of ImageNet100 are used as the retention set and the forget set, and the subclasses of CUB-200, RESISC45, Oxford-IIITPet and PlantVillage are used as the learning set, for model training and testing. The experimental results are shown in Table 1 below, where Acc r 、Acc l 、Acc f Represents the accuracy on the retention set, learning set, and forgetting set respectively. The experiment is set to retain 95 categories (i.e., 95 classes), learn 5 categories, forget 5 categories, and retain 90 categories, learn 10 categories, forget 10 categories. From Table 1, it can be seen that under the learn first and forget later (L→F) strategy, the model can successfully learn new categories, making the accuracy of the learning set (Acc l ) is increased to more than 90% on the above four learning sets, while the accuracy of the forgotten set (Acc f ) can be steadily reduced to 0%. In contrast, the forget-first-learn-later (F→L) method can significantly reduce the accuracy of the forgotten set (Acc f ), but in the subsequent learning process, due to the adjustment of low-level features, the originally forgotten categories are partially restored, resulting in the accuracy of the forgotten set (Acc f ) rebounds to 70%-80%, indicating that the forgetting stability of this method in the knowledge exchange task is poor. This further proves that the learn-first-then-forget (L→F) strategy can achieve more thorough forgetting while ensuring the learning effect of new knowledge, and will not cause the rebound of forgotten knowledge due to changes in low-level features, thus ensuring the controllability and stability of knowledge regulation.

[0063] Table 1

[0064]

[0065] In the semantic segmentation task, the Mask2Former model is used, the subclasses of ADE20K are used as the retention set and the forget set, and the subclasses of COCO, PascalVOC, Oxford-IIITPet and DeepGlobe Land are used as the learning set, for model training and testing. The experimental results are shown in Table 2 below. The evaluation indicator is the mean intersection over union (mIoU). As can be seen from Table 2, under the learn-first-then-forget (L→F) strategy, the mean intersection over union (mIoU) of the learning set is l It can be increased to more than 50%, while the average intersection over union (mIoU) of the forgotten set is f The learning-first-then-forget strategy can ensure that the model can effectively learn new categories while completely eliminating the characteristic information of the forgotten target category. Figure 4 As shown in the figure, lamp and sconce are forgotten classes (marked with red lines), cow is learned class (marked with green lines), and the remaining classes are retained. It can be seen that in the initial state, all classes can be recognized; during the new knowledge learning phase, the model successfully learns the new cow class; and under the learn-first-then-forget (L→F) training strategy, the model not only successfully forgets targets such as lamp and sconce (integrates them into the background), but also accurately retains the newly learned cow class and the original important classes. This result verifies the effectiveness of the proposed "learn-first-then-forget" strategy in maintaining model stability and achieving knowledge selective regulation.

[0066] In contrast, under the forget-first-learn (F→L) strategy in Table 2, although the average intersection-over-union (mIoU) of the forgotten set in the knowledge forgetting stage is f However, in the subsequent new knowledge learning stage, affected by the update of low-level features, the average intersection-over-union (mIoU) of the forgotten set f The results of qualitative analysis of forgetting first and learning later are as follows: Figure 3 As shown in the figure, the category to be forgotten is mountain (marked with a red line). Mountain is successfully cleared during the knowledge forgetting phase, but reappears in the segmentation results after learning new knowledge. This indicates that when forgetting precedes learning (F→L), subsequent learning may interfere with the forgetting effect, causing the originally cleared knowledge to be reactivated. The strategy of learning first and then forgetting (L→F) can avoid this problem, making forgetting more thorough, thereby improving the reliability of the knowledge exchange task.

[0067] Table 2

[0068]

[0069] In the object detection task, the DINO model was used, with subclasses of the COCO dataset as the retention set and the forget set, and subclasses of the CUB-200 and Oxford-dog datasets as the learning sets, for model training and testing. The experimental results are shown in Table 3 below, and the evaluation metric is the average precision (mAP) of all classes. As can be seen from Table 3, the learn-first-then-forget (L→F) strategy can also stably achieve effective knowledge exchange. Under this strategy (L→F), the model can successfully learn new target categories, making the average precision (mAP) of all classes of the learning set l (meanAverage Precision) increased from 0% to more than 60%. At the same time, the average precision mAP of the whole class of the forgotten set f It can be stably reduced to below 1%, ensuring that the forgotten target category is completely forgotten. In contrast, when the forget-first-learn-later (F→L) strategy is adopted, although the mAP of the forgotten set after the knowledge forgetting stage is f However, in the subsequent new learning phase, due to the adjustment of low-level features, the mAP of the forgotten set f The accuracy remains around 10%, indicating that this strategy (F→L) cannot completely eliminate forgotten targets and exhibits a certain degree of knowledge recovery. This further validates the applicability of the learn-before-forget (L→F) strategy in object detection tasks. It ensures that while learning new targets, the detection accuracy of forgotten targets approaches zero, thereby improving the model's practicality in data privacy protection and dynamic task adjustment.

[0070] Table 3

[0071]

[0072] In summary, the knowledge exchange strategy based on learning first and forgetting later proposed in the present invention has achieved remarkable technical effects in various tasks such as image classification, semantic segmentation and target detection. Compared with the strategy of forgetting first and learning later (F→L), the method of the present invention achieves more stable and thorough knowledge forgetting while ensuring learning ability, avoids knowledge rebound caused by low-level feature recovery, ensures the controllability and stability of model knowledge regulation, and is suitable for application scenarios such as privacy protection, knowledge updating and adaptive optimization of artificial intelligence models.

[0073] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A knowledge exchange method based on learning first and forgetting later, characterized in that: The steps include: S1, select a pre-trained deep learning model as the base model to provide initial parameters for subsequent learning and forgetting; construct a retention set, a forgetting set, and a learning set, where the retention set and the forgetting set are the data sets learned when pre-training the base model; The learning set is a dataset learned when fine-tuning the base model to adapt to new tasks; S2, the basic model learns the learning set to achieve new knowledge learning; In the new knowledge learning phase, the training goal of the model is to make the accuracy of the learning set close to 1 while keeping the accuracy of the retention set unchanged; S3, after the basic model completes learning of new knowledge, it forgets knowledge that is not relevant to the new task through the selective forgetting mechanism; In the knowledge forgetting stage, the training goal of the model is to make the accuracy of the forgotten set close to 0 while keeping the accuracy of the retained set and the learning set unchanged.

2. The knowledge exchange method based on learning first and forgetting later according to claim 1, characterized in that: The model includes a LoRA fine-tuning module and a sparse regularization module; In the new knowledge learning phase, the LoRA fine-tuning module introduces an additional low-rank matrix into the linear layer of the transformer through low-rank adaptation, and only fine-tunes the parameters of the linear layer of the transformer; in the knowledge forgetting phase, the LoRA fine-tuning module only adjusts the parameters related to the forgotten knowledge, while the parameters of the rest remain unchanged; In the new knowledge learning stage, the sparse regularization module constrains the model through regularization so that the learning of new knowledge only affects relevant parameters; in the knowledge forgetting stage, the sparse regularization module actively weakens the parameters related to the forgotten knowledge.

3. The knowledge exchange method based on learning first and forgetting later according to claim 2, characterized in that: In step S2, the total loss function in the new knowledge learning phase is Including learning losses for new tasks Retention loss of retained knowledge and structural losses The details are as follows: Where f(·) represents the model function; represents the loss function; X l ,Y l is the paired data in the learning set, X r ,Y r To retain the paired data in the set; A k and B k Represents the trainable matrix in the k-th LoRA module; represents the square of the F norm; α and β are weight coefficients.

4. The method for knowledge exchange based on learning first and forgetting later according to claim 2, characterized in that: In step S3, the total loss function in the knowledge forgetting stage is Including the loss of useless or harmful knowledge Retention loss of retained knowledge Retention loss of learned knowledge and structural losses The details are as follows: Among them, the ReLU(·) function is used to achieve lower bound truncation to prevent the loss function from increasing infinitely; BND is a constant boundary value that specifies the maximum degree of forgetting to prevent the model from not converging during training; f(·) represents the model function; represents the loss function; X f ,Y f is the paired data in the forget set; X l ,Y l is the paired data in the learning set; X r ,Y r To retain the paired data in the set; A k and B k Represents the trainable matrix in the k-th LoRA module; represents the square of the F norm; α', β' are weight coefficients.

5. A method for image classification based on knowledge exchange, characterized in that: Select a pre-trained image classification model; obtain a learning set for a new task; and use a knowledge exchange method based on learning first and forgetting later as described in any one of claims 1 to 4 above to perform new knowledge learning and specific knowledge forgetting on the pre-trained image classification model to obtain a fine-tuned image classification model.

6. A target detection method based on knowledge exchange, characterized in that: Select a pre-trained target detection model; obtain a learning set for a new task; and use a knowledge exchange method based on learning first and forgetting later as described in any one of claims 1-4 above to perform new knowledge learning and specific knowledge forgetting on the pre-trained target detection model to obtain a fine-tuned target detection model.

7. A semantic segmentation method based on knowledge exchange, characterized in that: Select a pre-trained semantic segmentation model; obtain a learning set for a new task; and use a knowledge exchange method based on learning first and forgetting later as described in any one of claims 1 to 4 to perform new knowledge learning and specific knowledge forgetting on the pre-trained semantic segmentation model to obtain a fine-tuned semantic segmentation model.

8. A computer program product, characterized in that It includes a computer program / instruction, which, when executed by a processor, implements a knowledge exchange method based on learning first and forgetting later as described in any one of claims 1-4.

Citation Information

Cited By

  • Large model anti-forgetting fine tuning method and device, computer equipment and medium

    CN121212374A