Long-term continuous learning method based on task core memory management and consolidation
By using the task-core memory management and long-term memory consolidation modules, key memory units are identified and updated, difficult and discrepancy samples are selectively retained, and a memory cache is built for experience replay. This solves the problem of catastrophic forgetting in long-term continuous learning and improves the model's performance in long-term tasks.
Patent Information
- Application Number
- CN202511342780.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-19
- Publication Date
- 2025-11-21
AI Technical Summary
In existing technologies, it is difficult to effectively solve the catastrophic forgetting problem of models when tasks change in real-world tasks and non-stationary long-term data streams. In particular, the catastrophic forgetting problem is exacerbated in heterogeneous task types and non-stationary long-term data streams.
We adopt a long-term continuous learning approach based on task-core memory management and consolidation. The task-core memory management module identifies key memory units and updates them adaptively. Combined with the long-term memory consolidation module, we selectively retain difficult and differential samples, build a memory cache, and perform experience replay to achieve a balance between new and old knowledge.
It significantly alleviates the catastrophic forgetting problem in long-term continuous learning and improves the performance of the model in long-term sequence tasks.
Smart Images

Figure CN120996090A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and machine learning, and is particularly applicable to continuous learning scenarios for large language models and visual language models. Specifically, it relates to a long-term continuous learning method based on task-core memory management and consolidation. Background Technology
[0002] Continual learning (CL) is an important paradigm in machine learning that enables models to learn sequentially from a time-series stream of tasks. This setup mimics how humans accumulate knowledge, gradually integrating new information while retaining previously acquired skills. However, a major challenge in continuous learning is catastrophic forgetting, where the model's performance on earlier tasks deteriorates as it learns new tasks.
[0003] Existing continuous learning methods can be broadly categorized into several types: regularization-based methods, architecture-based methods, experience replay-based methods, and cue-based methods. For regularization-based methods, EWC introduces a method using Fisher information to compute the importance of parameters from past tasks, while O-LoRA constrains model updates for different tasks within mutually orthogonal low-rank subspaces. For architecture-based methods, CL-MoE introduces a dual-momentum expert framework. For experience replay-based methods, EMR employs a working memory mechanism to strategically replay stored samples. For cue-based methods, L2P introduces a cue-based approach where task-specific cueing is learned to adapt the pre-trained model to new tasks without modifying its backbone.
[0004] While previous research has proven effective, most existing methods perform continuous learning on a limited number of task types within relatively short data streams. In contrast, real-world scenarios always require models to learn continuously across heterogeneous task types and non-stationary long-term data streams. This necessitates a shift towards long-term continuous learning. The main challenge of long-term continuous learning is the exacerbation of catastrophic forgetting due to the sheer number of tasks and the extended learning duration. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a long-term continuous learning method based on task-core memory management and consolidation. To mitigate the problem of catastrophic forgetting in long-term continuous learning, this method proposes a framework inspired by human memory mechanisms. This method introduces a task-core memory management strategy to effectively retrieve and update key memories; it develops a long-term memory consolidation mechanism to selectively retain difficult and discriminative samples, ensuring robust knowledge retention.
[0006] To achieve the above objectives, the present invention adopts the following technical solution:
[0007] A long-term continuous learning method based on task-core memory management and consolidation, comprising task-core memory management and long-term memory consolidation, is completed according to the following steps:
[0008] Step 1: Task Input and Command Fine-tuning
[0009] 1a. Use the low-rank adaptation (LoRA) technique to efficiently fine-tune the parameters of large language models and obtain the parameters of models from previous tasks. and current task parameters ;
[0010] Step 2: Task Core Memory Management, comprising a task core memory index and adaptive memory updates. Inspired by human memory mechanisms, this module simulates the human brain's process of identifying and dynamically updating key memory locations when learning new knowledge. When learning new skills, the human brain automatically identifies which neural connections are most important for the new task and adjusts the strength of these connections accordingly. Similarly, our task core memory management module performs differential analysis on the model parameters of the current task and previous tasks, identifies core task memory units, and performs intelligent adaptive updates based on the semantic relationships between tasks.
[0011] 2a, 2b. The core memory index for the task involves identifying key memory units by comparing the changes in model parameters before and after learning a new task. When a model learns a new task, different parameter positions will change to varying degrees; those parameter positions with larger changes often play a more important role in learning the new task. Calculate the previous model... and the current model The differences between the data are estimated to identify the core memories of the task. Based on the calculated offset, the top K memory units with the most significant changes are selected as the core memory index set for the current task. yes:
[0012] , (1)
[0013] in, Represents the previous model and the current model The Euclidean distance at position i, where N represents the total number of model parameters. This represents selecting the element with the largest value among the top K values, and is usually set as a percentage of the total number of parameters (e.g., 10%). That is, the selected core memory index set;
[0014] 2c. To support memory accumulation and updating during long-term learning, this invention introduces a dynamically updated mask matrix mechanism. This mask matrix records all memory locations identified as important up to the current task: constructing the mask matrix... Dynamically update the critical memory unit index:
[0015] (2)
[0016] in For indicator functions, where This means that when the condition is met, i.e., i is in the set... If the condition is met, return 1; otherwise, return 0. This cumulative update strategy ensures that once a parameter is identified as important in any historical task, it will receive continuous attention and protection in subsequent learning processes, thereby avoiding the loss of important knowledge.
[0017] 2.d After identifying the core memory locations, the optimal balance between new task learning and historical knowledge retention is found. The semantic similarity between different tasks determines that their required memory update strategies should differ. When the new task is semantically similar to the historical task, a relatively conservative update strategy is adopted; while when the new task has strong semantic novelty, a more aggressive parameter update is needed to adapt to the new knowledge structure. To achieve this adaptive memory update, the semantic representation of each task needs to be extracted first. The semantic features of the task are abstracted into task prototypes, which are obtained by average pooling the encoded features of all samples within the task.
[0018] ; (3)
[0019] in, This refers to feature encoders (such as pre-trained language model encoders). This represents the i-th sample in task t. This represents the total number of samples for task t. This is the prototype for this task. It captures the overall semantic features of the current task, providing a foundation for subsequent similarity calculations.
[0020] 2e. After obtaining the prototype representations of each task, calculate the semantic novelty of the current task relative to historical tasks. This novelty is assessed through adaptive weights. To quantify this, the calculation formula combines the distance between the current task and all historical tasks, as well as the internal distances between historical tasks:
[0021] (4)
[0022] The numerator calculates the cumulative distance from the current task prototype to all historical task prototypes, reflecting the overall novelty of the current task. The denominator calculates the average distance between historical tasks, serving a normalization function to ensure that the weights are not affected by the number of historical tasks. According to The value is determined by its magnitude; a value between 0 and 1 indicates that more parameters need to be updated; when the current task differs significantly from historical tasks, Larger values require more parameter updates; conversely, when tasks are similar, The value is relatively small, indicating a tendency towards conservative updates.
[0023] 2f. Next, we construct a position-aware weight matrix, combining adaptive weights with a core memory mask:
[0024] (5)
[0025] The design of this weight matrix reflects a fine-grained parameter update strategy: for locations identified as core memories ( Its update weight is It will adaptively adjust based on the novelty of the task; for non-core memory locations ( Its update weight is ( This design employs a complementary update strategy. This ensures that important memory locations receive sufficient attention, while non-critical locations also participate appropriately in the learning process.
[0026] 2g. The final adaptive memory fusion is achieved through the following formula:
[0027] (6)
[0028] Step 3: The design of the long-term memory consolidation module is inspired by the selective retention mechanism of human memory. During long-term learning, the brain automatically selects and retains the most valuable memory fragments, including challenging learning experiences (difficult memories) and general knowledge that can be transferred across domains (discretionary memories). Simulating this mechanism, this invention designs a dual-sample selection strategy to construct a high-quality replay buffer that helps the model cope with current task challenges while maintaining the stability of historical knowledge. Long-term memory consolidation includes difficult sample selection and discrepancy sample selection;
[0029] 3a. For each training sample in task t We first extract its semantic representation through a feature encoder, and then compute its representation to the task prototype. Euclidean distance:
[0030] (6)
[0031] The dataset representing task t. Distance values. Quantified the sample The distance value represents the degree of deviation from the overall task distribution. A larger distance indicates a less typical sample, thus increasing the likelihood of it being classified as a difficult sample. Based on the calculated distance values, we select the samples with the largest distances. % of samples as a set of difficult samples .
[0032] 3b. First, calculate the cumulative semantic distance from each current task sample to all historical task prototypes. This cumulative distance reflects the semantic relevance of a sample to the overall historical knowledge. However, considering only the cumulative distance may lead to an over-biased selection of samples for a particular historical task. To avoid this bias, this invention introduces a local distance constraint mechanism. Specifically, we calculate the minimum distance from a sample to each historical task prototype. :
[0033] , (7)
[0034] Based on cumulative distance and local constraints, the candidate with the smallest cumulative distance that satisfies the conditions is selected. % of the samples are considered as a set of differential samples:
[0035] (8)
[0036] in , Represents the minimum distance threshold. This is the set of differential samples. This selection strategy ensures that the differential samples are representative across tasks while avoiding over-reliance on specific tasks, thereby maximizing their contribution to long-term memory consolidation.
[0037] 3c. Difficult samples and divergent samples each contribute to long-term memory consolidation from different perspectives: difficult samples focus on improving the model's ability to handle complex situations in the current task, while divergent samples are dedicated to maintaining knowledge consistency and transferability across tasks. To fully leverage the complementary effects of these two types of samples, they are merged to form the final replay buffer:
[0038] (9)
[0039] Step 4: Model Training
[0040] 4a. Using a unified generation paradigm, optimize the negative log-likelihood loss for a given instruction X and answer Y:
[0041] (10)
[0042] Where X represents a prompt sequence containing task instructions and input information. Represents the sequence of target answers. Let L represent all the labels preceding position j in the answer sequence, and L be the length of the answer sequence. This loss function ensures that the model learns to generate correct and coherent answers based on the given input.
[0043] 4b: Utilizing the experience replay buffer The samples in the dataset are used for additional training to maintain memory of historical tasks.
[0044] 4c: Achieve long-term continuous learning by jointly optimizing current task learning and historical knowledge retention.
[0045] To achieve a balance between learning new tasks and acquiring historical knowledge, a joint training strategy based on memory replay was designed. During the training process for each new task, not only is the training data of the current task used, but representative samples from historical tasks are also sampled from the previously constructed replay buffer for mixed training.
[0046] The technical solution of the present invention has the following beneficial effects: The present invention focuses on solving the catastrophic forgetting problem in long-term continuous learning, and significantly improves the performance of the model in long-term sequence tasks. Attached Figure Description
[0047] Figure 1 This is a schematic diagram of the method flow of the present invention;
[0048] Figure 2 This is a schematic diagram of the process of an embodiment of the present invention. Detailed Implementation
[0049] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.
[0050] The overall framework of this invention consists of two parts: task-core memory management and long-term memory consolidation. First, task-core memory management identifies key memory units by comparing the parameter differences between the current task and historical models, and generates adaptive weights based on the task prototype, achieving dynamic fusion of new and old knowledge. Then, long-term memory consolidation constructs a memory cache and performs experience replay by retaining samples with significant differences from the task prototype as difficult samples and retaining samples with strong cross-task consistency as dissimilar samples. These two processes work synergistically, enabling the model to absorb new knowledge while effectively reducing forgetting during long-term task learning.
[0051] like Figure 1 As shown, the method of the present invention mainly includes the following steps:
[0052] Step 1: Task Input and Command Fine-tuning
[0053] 1a. Use the low-rank adaptation (LoRA) technique to efficiently fine-tune the parameters of large language models and obtain the parameters of models from previous tasks. and current task parameters ;
[0054] Step 2: Task Core Memory Management, comprising a task core memory index and adaptive memory updates. Inspired by human memory mechanisms, this module simulates the human brain's process of identifying and dynamically updating key memory locations when learning new knowledge. When learning new skills, the human brain automatically identifies which neural connections are most important for the new task and adjusts the strength of these connections accordingly. Similarly, our task core memory management module performs differential analysis on the model parameters of the current task and previous tasks, identifies core task memory units, and performs intelligent adaptive updates based on the semantic relationships between tasks.
[0055] 2a. The core memory index for a task involves identifying key memory units by comparing parameter changes in the model before and after learning a new task. When a model learns a new task, different parameter positions change to varying degrees; those parameter positions with larger changes often play a more significant role in learning the new task. (Calculate the previous model...) and the current model Difference estimation between them, identifying core memories for the task:
[0056] (1)
[0057] 2b. Based on the calculated offset, select the K memory units with the most significant changes as the core memory index set for the current task. :
[0058]
[0059] in, Represents the previous model and the current model The Euclidean distance at position i, where N represents the total number of model parameters. This represents selecting the element with the largest value among the top K values, and is usually set as a percentage of the total number of parameters (e.g., 10%). That is, the selected core memory index set;
[0060] 2c. To support memory accumulation and updating during long-term learning, this invention introduces a dynamically updated mask matrix mechanism. This mask matrix records all memory locations identified as important up to the current task: constructing the mask matrix... Dynamically update the critical memory unit index:
[0061] (2)
[0062] in For indicator functions, where This means that when the condition is met, i.e., i is in the set... If the condition is met, return 1; otherwise, return 0. This cumulative update strategy ensures that once a parameter is identified as important in any historical task, it will receive continuous attention and protection in subsequent learning processes, thereby avoiding the loss of important knowledge.
[0063] 2.d After identifying the core memory locations, the optimal balance between new task learning and historical knowledge retention is found. The semantic similarity between different tasks determines that their required memory update strategies should differ. When the new task is semantically similar to the historical task, a relatively conservative update strategy is adopted; while when the new task has strong semantic novelty, a more aggressive parameter update is needed to adapt to the new knowledge structure. To achieve this adaptive memory update, the semantic representation of each task needs to be extracted first. The semantic features of the task are abstracted into task prototypes, which are obtained by average pooling the encoded features of all samples within the task.
[0064] ; (3)
[0065] in, This refers to feature encoders (such as pre-trained language model encoders). This represents the i-th sample in task t. This represents the total number of samples for task t. This is the prototype for this task. It captures the overall semantic features of the current task, providing a foundation for subsequent similarity calculations.
[0066] 2e. After obtaining the prototype representations of each task, calculate the semantic novelty of the current task relative to historical tasks. This novelty is assessed through adaptive weights. To quantify this, the calculation formula combines the distance between the current task and all historical tasks, as well as the internal distances between historical tasks:
[0067] (4)
[0068] The numerator calculates the cumulative distance from the current task prototype to all historical task prototypes, reflecting the overall novelty of the current task. The denominator calculates the average distance between historical tasks, serving a normalization function to ensure that the weights are not affected by the number of historical tasks. According to The value is determined by its magnitude; a value between 0 and 1 indicates that more parameters need to be updated; when the current task differs significantly from historical tasks, Larger values require more parameter updates; conversely, when tasks are similar, The value is relatively small, indicating a tendency towards conservative updates.
[0069] 2f. Next, we construct a position-aware weight matrix, combining adaptive weights with a core memory mask:
[0070] (5)
[0071] The design of this weight matrix reflects a fine-grained parameter update strategy: for locations identified as core memories ( Its update weight is It will adaptively adjust based on the novelty of the task; for non-core memory locations ( Its update weight is ( This design employs a complementary update strategy. This ensures that important memory locations receive sufficient attention, while non-critical locations also participate appropriately in the learning process.
[0072] 2g. The final adaptive memory fusion is achieved through the following formula:
[0073] (6)
[0074] Step 3: The design of the long-term memory consolidation module is inspired by the selective retention mechanism of human memory. During long-term learning, the brain automatically selects and retains the most valuable memory fragments, including challenging learning experiences (difficult memories) and general knowledge that can be transferred across domains (discretionary memories). Simulating this mechanism, this invention designs a dual-sample selection strategy to construct a high-quality replay buffer that helps the model cope with current task challenges while maintaining the stability of historical knowledge. Long-term memory consolidation includes difficult sample selection and discrepancy sample selection;
[0075] 3a. For each training sample in task t We first extract its semantic representation through a feature encoder, and then compute its representation to the task prototype. Euclidean distance:
[0076] (6)
[0077] The dataset representing task t. Distance values. Quantified the sample The distance value represents the degree of deviation from the overall task distribution. A larger distance indicates a less typical sample, thus increasing the likelihood of it being classified as a difficult sample. Based on the calculated distance values, we select the samples with the largest distances. % of samples as a set of difficult samples .
[0078] 3b. First, calculate the cumulative semantic distance from each current task sample to all historical task prototypes. This cumulative distance reflects the semantic relevance of a sample to the overall historical knowledge. However, considering only the cumulative distance may lead to an over-biased selection of samples for a particular historical task. To avoid this bias, this invention introduces a local distance constraint mechanism. Specifically, we calculate the minimum distance from a sample to each historical task prototype. :
[0079] , (7)
[0080] Based on cumulative distance and local constraints, the candidate with the smallest cumulative distance that satisfies the conditions is selected. % of the samples are considered as a set of differential samples:
[0081] (8)
[0082] in , Represents the minimum distance threshold. This is the set of differential samples. This selection strategy ensures that the differential samples are representative across tasks while avoiding over-reliance on specific tasks, thereby maximizing their contribution to long-term memory consolidation.
[0083] 3c. Difficult samples and divergent samples each contribute to long-term memory consolidation from different perspectives: difficult samples focus on improving the model's ability to handle complex situations in the current task, while divergent samples are dedicated to maintaining knowledge consistency and transferability across tasks. To fully leverage the complementary effects of these two types of samples, they are merged to form the final replay buffer:
[0084] (9)
[0085] Step 4: Model Training
[0086] 4a. Using a unified generation paradigm, optimize the negative log-likelihood loss for a given instruction X and answer Y:
[0087] (10)
[0088] Where X represents a prompt sequence containing task instructions and input information. Represents the sequence of target answers. Let L represent all the labels preceding position j in the answer sequence, and L be the length of the answer sequence. This loss function ensures that the model learns to generate correct and coherent answers based on the given input.
[0089] 4b: Utilizing the experience replay buffer The samples in the dataset are used for additional training to maintain memory of historical tasks.
[0090] 4c: Achieve long-term continuous learning by jointly optimizing current task learning and historical knowledge retention.
[0091] To achieve a balance between learning new tasks and acquiring historical knowledge, a joint training strategy based on memory replay was designed. During the training process for each new task, not only is the training data of the current task used, but representative samples from historical tasks are also sampled from the previously constructed replay buffer for mixed training.
[0092] Example 1, such as Figure 1 , Figure 2 As shown:
[0093] Step 1: Task Input and Command Fine-tuning
[0094] Receive data streams containing multiple tasks Each task contains training data. .like Figure 2 As shown, at time t, using the data from the t-th task and historical samples stored in the cache, including hard samples and difference samples, the historical model is... Fine-tune the instructions to obtain the current task model parameters. .
[0095] Step 2: Task Core Memory Management
[0096] The task core memory management module identifies task core memories through difference estimation:
[0097] 2.1 Calculate the previous model and the current model We estimate the differences between them, identify the core memories of the task, and based on the calculated offsets, select the top 25% of memory units with the most significant changes as the core memory set for the current task:
[0098] , (1)
[0099] in, Represents the previous model and the current model The Euclidean distance at position i, where N represents the total number of model parameters. This represents selecting the element with the largest value among the top K values, and is usually set as a percentage of the total number of parameters, such as 25%. This refers to the set of indexes of the selected core memory units.
[0100] For example The parameters are ,and The parameters are Then d is When K is 25% (k=1), we will insert (1,1) into The Euclidean distance is greatest at this location.
[0101] 2.2 Constructing the mask matrix Dynamically update the critical memory unit index:
[0102] (2)
[0103] in For indicator functions, where This means that when the condition is met (i.e., i is in the set...) If the parameter is identified as important in any historical task, it will be continuously monitored and protected in subsequent learning processes, thus avoiding the loss of important knowledge.
[0104] For example, in the second task, for Therefore, after updating formula (2), Will become .
[0105] 2.3 To achieve this adaptive memory update, the semantic representation of each task needs to be extracted first. The semantic features of the task are abstracted into a task prototype, which is obtained by average pooling the encoded features of all samples within the task.
[0106] ; (3)
[0107] in, This refers to feature encoders (such as pre-trained language model encoders). This represents the i-th sample in task t. This represents the total number of samples for task t. This is the prototype for this task. It captures the overall semantic features of the current task, providing a foundation for subsequent similarity calculations.
[0108] 2.4 After obtaining the prototype representations of each task, the semantic novelty of the current task relative to historical tasks is calculated. This novelty is determined through adaptive weights. To quantify this, the calculation formula combines the distance between the current task and all historical tasks, as well as the internal distances between historical tasks:
[0109] (4)
[0110] The numerator calculates the cumulative distance from the current task prototype to all historical task prototypes, reflecting the overall novelty of the current task. The denominator calculates the average distance between historical tasks, serving a normalization function to ensure the weights are not affected by the number of historical tasks. When the current task differs significantly from historical tasks, A larger value, such as 0.4, indicates that more parameters need to be updated; conversely, when the tasks are similar, Smaller values, such as 0.1, tend to be updated conservatively.
[0111] 2.5 Next, a location-aware weight matrix is constructed, combining adaptive weights with a core memory mask:
[0112] (5)
[0113] The design of this weight matrix reflects a fine-grained parameter update strategy: for locations identified as core memories ( Its update weight is It will adaptively adjust based on the novelty of the task; for non-core memory locations ( Its update weight is ( This design employs a complementary update strategy. This ensures that important memory locations receive sufficient attention, while non-critical locations also participate appropriately in the learning process.
[0114] 2.6 The final adaptive memory fusion is achieved through the following formula:
[0115] (6)
[0116] Step 3: Long-term memory consolidation
[0117] The long-term memory consolidation module constructs a replay cache through a dual-sample selection strategy:
[0118] 3.1 For each training sample in task t First, its semantic representation is extracted through a feature encoder, and then its representation to the task prototype is calculated. Euclidean distance:
[0119] (6)
[0120] This distance value Quantified the sample The degree of deviation relative to the overall task distribution. A larger distance value indicates a less typical sample, thus increasing the likelihood of it being classified as a difficult sample. Based on the calculated distance values, the samples with the largest distances are selected. % of samples as a set of difficult samples .
[0121] 3.2 First, calculate the cumulative semantic distance from each current task sample to all historical task prototypes. This cumulative distance reflects the semantic relevance of a sample to the overall historical knowledge. However, considering only the cumulative distance may lead to an over-biased selection of samples for a particular historical task. To avoid this bias, this invention introduces a local distance constraint mechanism. Specifically, it calculates the minimum distance from a sample to each historical task prototype. :
[0122] , (7)
[0123] Based on cumulative distance and local constraints, the candidate with the smallest cumulative distance that satisfies the conditions is selected. % of the samples are considered as a set of differential samples:
[0124] (8)
[0125] in , This represents the minimum distance threshold. This selection strategy ensures that the differential samples are representative across tasks while avoiding over-reliance on specific tasks, thereby maximizing their contribution to long-term memory consolidation.
[0126] 3.3 Difficult and dissimilar samples each contribute to long-term memory consolidation from different perspectives: difficult samples focus on improving the model's ability to handle complex situations in the current task, while dissimilar samples are dedicated to maintaining knowledge consistency and transferability across tasks. To fully leverage the complementary effects of these two types of samples, they are merged to form the final replay buffer:
[0127] (9)
[0128] like Figure 2 As shown, The sample belongs to Because the sample is far from its prototype, it also belongs to... Because the sum of the distances of this sample to other prototypes is small, it is both a difficult sample and a differential sample.
[0129] Step 4: Experience Replay and Joint Training
[0130] 4.1 Using a unified generative paradigm, given instruction X and answer Y, we optimize the negative log-likelihood loss. This is a loss function in machine learning and statistics based on the principle of maximum likelihood estimation, commonly used in classification problems. It optimizes model parameters by minimizing the negative log-likelihood.
[0131] (10)
[0132] Where X represents a prompt sequence containing task instructions and input information. Represents the sequence of target answers. Let L represent all the labels preceding position j in the answer sequence, and L be the length of the answer sequence. This loss function ensures that the model learns to generate correct and coherent answers based on the given input.
[0133] 4.2 To achieve a balance between learning new tasks and retaining historical knowledge, a joint training strategy based on memory replay was designed. During the training of each new task, not only the training data of the current task is used, but also representative samples from historical tasks are sampled from the previously constructed replay buffer for mixed training.
[0134] For example, at time t, the model from the previous time step is compared using the dataset t and the data stored in the buffer. Train the model to obtain the model It then executes the core memory management process (MemMan) to obtain the updated model. In addition, long-term memory consolidation (Memcon) needs to be performed to select difficult and differential samples and store them in a buffer for subsequent task training.
Claims
1. A long-term continuous learning method based on task-centric memory management and consolidation, comprising the following steps: Step 1: Task input and instruction fine-tuning; Step 2: Perform a difference analysis on the model parameters of the current task and the previous task, identify the core memory units of the task, and calculate adaptive weights based on the similarity of the task prototype to dynamically update the memory units; Step 3: Construct an experience replay buffer using hard sample selection and differential sample selection strategies; Step 4: Train the model using a joint loss function to retain the memory of historical tasks while learning new tasks.
2. The long-term continuous learning method based on task-centric memory management and consolidation according to claim 1, characterized in that, Step 1 includes: 1a: Use Low-Rank Adaptation (LoRA) technique to efficiently fine-tune the parameters of large language models and obtain the parameters of models from previous tasks. and current task parameters ; Step 2 includes: 2a: Calculate the Euclidean distance offset of each memory cell i in the previous model and the current model: ;in Represents Euclidean distance; in, Represents the previous model and the current model The Euclidean distance at position i, and N represents the total number of model parameters; 2b: Select the K largest offset memory cell indices to form the core memory index set: ,in This represents selecting the element with the largest value among the first K elements; in, This represents selecting the element with the largest value among the first K elements. That is, the selected core memory index set; 2c: Constructing the mask matrix Dynamically update the critical memory unit index: , in, For indicator functions, This indicates that when the condition is met, i.e., i is in the core memory index set... If the condition is met, return 1; otherwise, return 0. 2d: Extract the prototype representation of the current task : ; in, Represents the feature encoder. This represents the i-th sample in task t. It is the total number of samples for task t; 2e: Calculate adaptive weights : ; 2f: Constructing the position-aware weight matrix : ; A matrix representing the recorded memories, ( ) indicates that position i is the core memory, ( This is represented as updating the weights; 2g: Perform adaptive memory update to obtain model parameters : ; Step 3 includes: 3a: Difficult sample selection, calculate the distance of each sample to the task prototype; , ; The dataset representing task t. Distance values. Quantified the sample Choose the one with the largest distance relative to the overall task distribution deviation. Sample composition is difficult. ; 3b: Differential sample selection, calculating the cumulative distance of the sample to all previous task prototypes: , ; Choose the option with the minimum cumulative distance that satisfies the local distance constraint. of The samples constitute the differential sample set , ; in , Represents the minimum distance threshold; 3c: Constructing the final experience replay buffer: ; Step 4 includes: 4a: For a given instruction X and answer Y, calculate the standard generation loss: ; Where X represents a prompt sequence containing task instructions and input information. Represents the sequence of target answers. This represents all the tags preceding position j in the answer sequence, where L is the length of the answer sequence; 4b: Utilizing the experience replay buffer The samples in the dataset are used for additional training to maintain the memory of historical tasks; 4c: Achieve long-term continuous learning by jointly optimizing current task learning and historical knowledge retention.
Citation Information
Patent Citations
Life-life learning method based on sample replay and knowledge distillation
CN116776950A
Methods for continual learning and systems implementing such methods
EP4510041A1
Cited By
Taskless boundary continuous learning production dynamic prediction method based on playback mechanism
CN121579940A
Task-boundless continuous learning production dynamic prediction method based on playback mechanism
CN121579940B