Continuous relation extraction model combining waking and sleeping memory cycle and experience iteration
By combining the methods of wakeful memory loop and empirical iteration, the training process of the continuous relationship extraction model is optimized, and the problems of 'catastrophic forgetting', overfitting and representation bias are solved, and better generalization ability and classification effects are achieved.
Patent Information
- Application Number
- CN202411652732.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-11-19
AI Technical Summary
When learning new relationship types, existing continuous relationship extraction methods are prone to 'catastrophic forgetting', that is, the ability to classify existing relationships has a significant decline, and there are problems of overfitting and representation bias.
Using a method combining wake-up memory cycle and empirical iteration, through data augmentation, K-Means clustering, empirical iteration framework and dream data generation, the training process of the model is optimized, the distribution of relational samples is dynamically adjusted, and overfitting and correcting representation bias is reduced.
It effectively alleviates the overfitting phenomenon, enhances the generalization ability of the model, corrects the representation bias, and improves the model's ability to classify the old and new relationships.
Smart Images

Figure CN119558311A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information extraction, and in particular relates to a continuous relationship extraction method combining wake-sleep memory cycle and experience iteration. Background Art
[0002] The core goal of the relation extraction task is to identify the specific relationship between two given entities from text data. Traditional relation extraction tasks usually assume that all relation types are known, without considering the new relation types that continue to emerge in the real world. In the face of these newly emerging relations, existing work usually adopts the strategy of retraining the model. However, with limited storage and computing resources, this retraining method has become no longer feasible, which has prompted researchers to explore more efficient solutions. Therefore, the concept of continuous relation extraction (CRE) came into being to address this challenge.
[0003] The core of CRE is to enable the model to learn new relationships while maintaining its ability to process learned relationships. Unlike the supervised learning paradigm, where all relationship types are known during model training, during the continuous relationship extraction process, the model does not know all relationship types, but continuously acquires new relationship types and training data as it learns. While learning new relationship types, due to changes in key parameters, the model's ability to classify existing relationships decreases significantly while learning to classify new relationships. This phenomenon is called "catastrophic forgetting."
[0004] The memory-based continuous relation extraction method has been widely used in CRE tasks. Its core is to store and retrain the model using a small number of typical samples to alleviate the forgetting phenomenon. However, this method has some problems: On the one hand, as the number of training times increases, the model may overfit to a small number of typical samples, thereby damaging its generalization ability to handle new tasks; On the other hand, this method may introduce representation bias, that is, the overlap of new and old relations in the feature representation space, resulting in previously learned knowledge being overwritten by new knowledge.
[0005] Therefore, the present invention provides a continuous relationship extraction method that combines wake-sleep memory cycle and experience iteration. Summary of the invention
[0006] The purpose of the present invention is to provide a continuous relationship extraction method that combines the waking and sleeping memory cycle and experience iteration. By combining the playback of experience memory and the generation of diversified dream data, an experience iteration framework is designed. The framework prioritizes high-quality experience, eliminates low-quality experience, and dynamically adjusts the distribution of relationship samples, which solves existing problems, effectively alleviates overfitting, and corrects the representation bias of the model.
[0007] To achieve the above object, the present invention provides a continuous relationship extraction method combining wake-sleep memory cycle and experience iteration, comprising the following steps: S1: Add a new task Input into the model; S2: Use data augmentation techniques to expand new relation instances and Tasks jointly construct synthetic short-term memory ; S3: Using K-Means algorithm to use Select representative instances from the dataset and store them in long-term memory For use in subsequent stages of training; S4: During the awake phase, the model updates its processing capacity by quickly adapting to new relational samples and incorporating these samples into the experience pool; S5: Use the experience iteration framework to dynamically adjust the distribution of relation samples during model learning to better correct the representation bias of the model; S6: During the sleep stage, the model goes through two sub-stages: non-rapid eye movement (NREM) and rapid eye movement (REM); in the NREM stage, the neural network replays the long-term memory in the hippocampus. In the REM stage, the model prepares for the ability to handle new relationships in the future by simulating dream data of new relationships.
[0008] Furthermore, the new task in step S1 is equipped with its own independent data set and relationship set , respectively contain training sets , validation set And the test set , and each Covers at least one type of relationship; sets of relationships between different tasks Do not overlap.
[0009] Furthermore, the specific process of step S2 is as follows: S2-1: The enhanced dataset was obtained by using two data enhancement strategies: hybrid enhancement and inversion enhancement. ; S2-1-1: Hybrid Enhanced Task-Based Existing relationship , by randomly pairing these relations, we generate Based on these relationship pairs, mixed synthetic categories can be constructed to obtain a data set ; S2-1-2: Reversal enhancement creates an additional reverse category by swapping the positions of the head and tail entities in the corresponding instances, and obtains the dataset ; S2-1-3: Combining Datasets and dataset Get the enhanced dataset , which is calculated as follows: ; S2-2: Change the current task The original training dataset With the enhanced dataset Combined to form short-term memory The calculation formula is as follows: Furthermore, the specific process of step S3 is as follows: S3-1: For Tasks ,Will All instances in are encoded as a set of embedding vectors .
[0010] S3-2: Apply the K-Means clustering algorithm twice to the encoded instances to obtain some instances closest to the centroid and store them in long-term memory middle.
[0011] S3-2-1: First, cluster these embedding vectors and divide them into In each cluster, we select the instance closest to the cluster center to form a representative instance set, denoted as .
[0012] S3-2-2: Statistics The number of instances of each relationship in is used to evaluate the importance of the relationship. For these more important relationships, at least Instances are stored in long-term memory For relatively unimportant relationships, select at most If a relation does not have enough instances to fill its allocated memory, its unused memory capacity is reallocated to other relations.
[0013] S3-2-3: Cluster the selected instances of each relationship again and select the instance closest to the centroid to store in long-term memory middle.
[0014] Furthermore, the specific process of step S4 is as follows: S4-1: Using the pre-trained language model BERT to handle short-term memory Examples in , and the result is expressed as The calculation formula is as follows: in and is the hidden representation of the head entity and the tail entity, and are two training parameters.
[0015] S4-2: Use a linear Softmax classifier to compute input instances The classification probability is defined as the classification loss function To optimize the model parameters. The classification probability and loss function calculation formula are as follows: in Is the model in the current task The parameter set during is the trainable weight matrix of the classifier, is the model prediction input instance Belong to relationship The probability of is an instance The actual label if , then the indicator function The value of is 1, otherwise it is 0; S4-3: Generated short-term memory representation And the corresponding classification loss values are stored in the experience pool.
[0016] Furthermore, the specific process of step S5 is as follows: S5-1: In the experience propagation phase, the model continues to expand its experience pool by learning from previous tasks. When the model can use all the previously accumulated experience To execute the current task , and according to a specific experience propagation strategy, the newly acquired experience is added to the experience pool. The process can be described as: in It is a pool of accumulated experience. Represents a task batch Utilization of experience.
[0017] S5-2: In the experience elimination stage, in order to effectively optimize the structure of the experience pool, based on the frequency of experience usage After each task batch is completed, the retained experience set is filtered by the following formula : in In the current task batch The filtered experience collection. Indicates ranking the experiences according to the loss value sorting criteria. Function Represents each experience frequency of use. is an experience retention threshold.
[0018] S5-3: Improve the quality and operational efficiency of the experience pool using linear classification loss and knowledge distillation loss. The linear classification loss function is used to measure the difference between the model's predicted distribution and the true distribution, and adjust the model parameters by minimizing the difference to make the prediction closer to the true distribution. The distillation loss aims to transfer the knowledge of the previous model to the current model, improving its performance and generalization ability while reducing representation bias.
[0019] in and Represent the linear classification loss and knowledge distillation loss respectively. is a weight coefficient used to balance the contribution of these two losses to the total loss.
[0020] S5-3-1: In the process of calculating the linear classification loss, the model first uses the empirical examples Make predictions and get empirical examples The probability of belonging to a certain category: in Is the current task Model parameters of is the trainable parameter matrix of the linear classifier; Represents experience pool Input example Hidden feature representation of ; S5-3-2: Use cross entropy loss to calculate the linear classification loss function: in It is an experience pool The total number of samples in ; Is the current task A collection of relationships. is the indicator function, when the true label Equal to the predicted label 1 when it is, otherwise 0; S5-3-3: In the calculation process of knowledge distillation loss, the current model and the previous model are first used to predict the input sample and generate the corresponding soft label probability distribution. The soft label generation process uses a temperature parameter , used to smooth the predicted probability so that the model can better capture the relative relationship between different categories. Soft label probability distribution of the current model and the previous model and as follows: , in and is the current model and the previous model for the sample The unnormalized output of . is the temperature parameter.
[0021] S5-3-4: Use Kullback-Leibler divergence (KL divergence) to measure the soft label distribution of the current model Soft label distribution with previous model The difference between: .
[0022] Furthermore, the specific process of step S6 is as follows: S6-1: First, the long-term memories in each task batch are aggregated and integrated into a long-term memory set; Then, a prototype set is generated for each known relationship , by using the prototype set We perform feature extraction on all instances in the relation to compute the prototype embedding of the relation.
[0023] in It's a relationship Prototype embedding. It is an example The feature extraction function.
[0024] S6-2: In the NREM stage, first the long-term memory is collected Extract samples from the model to consolidate and strengthen the existing knowledge that was partially frozen in the awake stage. Use contrastive learning loss and knowledge distillation loss to optimize model parameters. The total loss at this stage can be expressed as: in and denote contrastive learning loss and knowledge distillation loss respectively.
[0025] In contrastive learning loss, the model's consolidation of previous memory is strengthened through contrastive learning network. Specifically, the loss function is defined as follows: in Represents an input instance Hidden representation of Embedding with relational prototypes The similarity between . is the temperature parameter.
[0026] The calculation of the knowledge distillation loss function is as follows: S6-3: In the REM stage, we first introduce dream data containing randomness and variability. Then, we use adversarial linear loss, adversarial composite and The loss and smooth adversarial compound loss are used to optimize the model parameters.
[0027] S6-3-1: First, random noise is added to the data in the short-term memory and long-term memory collections. The generated noise has the same shape as the memory data.
[0028] S6-3-2: Use normalization, scaling and other techniques to control the noise amplitude and adjust the noise impact.
[0029] S6-3-3: Combine the processed noise with the original memory data to generate dream data containing memory data and random noise. The resulting dream data set can be expressed as: in Represents generation and Standard normally distributed noise of the same shape. is a scaling parameter that controls the influence of noise.
[0030] S6-3-4: Define the total loss function , which combines three key components: adversarial linear loss , antagonistic compound and loss and smooth adversarial compound sum loss .
[0031] in , and They are , as well as The weight hyperparameter is used to balance the contribution of each loss term.
[0032] Linear loss The model is optimized by minimizing the cross entropy between the true label and the predicted probability, ensuring that high-precision classification performance can be maintained even in the face of adversarial samples. The specific loss function is defined as follows: in Represents the predicted input Belong to relationship probability. for The real label.
[0033] Antagonistic compound and The loss further takes into account the edge effect of the model output (i.e., the confidence difference between different categories), aiming to improve the overall robustness of the model by optimizing the edge performance in an adversarial environment. The specific loss function is defined as follows: in Indicates finding the perturbation range under the p-norm constraint The worst disturbance within .function is a smooth function. Symbol For all wrong labels The sum is calculated, which reflects the overall loss of the model on the wrong labels. Used to measure the model's accuracy on the correct label and error labels The score difference between . and Respectively indicate that in the input Next error label and the correct label The prediction score of .
[0034] Smoothed adversarial compound loss In the antagonistic compound and A smoothing term is introduced on the basis of the loss to reduce the instability in the optimization, thereby improving the stability and optimizability of the training. The loss function is in the form of: The parameters Used to control the degree of smoothing to reduce instability during training. Symbol Represents the input of the dream dataset The disturbance neighborhood In the above example, we find the maximum adversarial perturbation . It means that the model is correct for the correct label before and after the perturbation and error labels L2 norm of the difference in prediction scores.
[0035] The present invention has the following beneficial effects: Compared with the existing known technologies, the technical solution provided by the present invention has the following significant effects: 1. In view of the problem that the existing methods may overfit a small number of typical samples as the number of training times increases, thereby damaging its generalization ability to handle new tasks, the present invention proposes a wake-sleep memory cycle method. This method combines the playback of experiential memory and the generation of diversified dream data, effectively reducing the risk of overfitting and enhancing the generalization ability of the model.
[0036] 2. In order to address the problem that existing methods may introduce representation bias, that is, the overlap of new and old relations in the feature representation space, which causes previously learned knowledge to be covered by new knowledge, the present invention designs an experience iteration framework that prioritizes retaining high-quality experience, eliminates low-quality experience, and dynamically adjusts the distribution of relationship samples, thereby correcting the representation error of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 The flowchart of the continuous relationship extraction method combining the wake-sleep memory cycle and experience iteration of the present invention.
[0038] Figure 2 It is the overall framework diagram of the present invention.
[0039] Figure 3 It is a diagram of the empirical iteration framework of the present invention. DETAILED DESCRIPTION
[0040] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0041] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0042] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0043] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0044] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0045] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0046] Reference Figure 1-3 The present invention provides a method for continuous relationship extraction combining wake-sleep memory cycle and experience iteration, comprising the following steps: S1: Add a new task Input into the continuous relation extraction model of this application; S2: Use data augmentation techniques to expand new relation instances and Tasks jointly construct synthetic short-term memory ; S2-1: The enhanced dataset was obtained by using two data enhancement strategies: hybrid enhancement and inversion enhancement; S2-2: Change the current task The original training dataset With the enhanced dataset Combined to form short-term memory The specific formula is as follows: S3: Using K-Means algorithm to use Select representative instances from the dataset and store them in long-term memory For use in subsequent stages of training; S4: During the awake phase, the model updates its processing capacity by quickly adapting to new relational samples and incorporating these samples into the experience pool; S5: Use the experience iteration framework to dynamically adjust the distribution of relation samples during model learning to correct the representation bias of the model; S6: During the sleep stage, the model goes through two sub-stages: non-rapid eye movement and rapid eye movement.
[0047] As an embodiment provided by the present invention, preferably, S2: using data enhancement technology to expand the new relationship instance, and Tasks jointly construct synthetic short-term memory The method is: S2-1-1: Hybrid Enhanced Task-Based Existing relationship , by randomly pairing these relations, we generate Based on these relationship pairs, mixed synthetic categories can be constructed to obtain a data set This process includes the following steps: First, extract the entity containing the header But does not include the tail entity The span , and contains the tail entity But does not contain the header entity The span ; Then and Splicing to form a mixed instance Through this hybrid enhancement, new tasks can be constructed Additional synthesis categories.
[0048] S2-1-2: Reversal enhancement creates an additional reverse category by swapping the positions of the head and tail entities in the corresponding instances. For each asymmetric relationship , an additional reverse category is created by swapping the positions of the head and tail entities in their corresponding instances .
[0049] S2-1-3: Combining Datasets and dataset Get the enhanced dataset , which is calculated as follows: .
[0050] As an embodiment provided by the present invention, preferably, a K-Means algorithm is used to utilize Select representative instances from the dataset and store them in long-term memory The method in is: S3-1: For Tasks ,Will All instances in are encoded as a set of embedding vectors .
[0051] S3-2: Apply the K-Means clustering algorithm twice to the encoded instances to obtain some instances closest to the centroid and store them in long-term memory middle.
[0052] S3-2-1: Apply the K-Means clustering algorithm to divide these embedding vectors into In each cluster, we select the instance closest to the cluster center to form a representative instance set, denoted as .
[0053] S3-2-2: Statistics The number of instances of each relationship in is used to assess the importance of the relationship. Relationships that contain more than a threshold set by the administrator are considered more important; for these more important relationships, at least Instances are stored in long-term memory For relatively unimportant relationships, select at most If a relation does not have enough instances to fill its allocated memory, its unused memory capacity is reallocated to other relations.
[0054] S3-2-3: Cluster the selected instances of each relationship again and select the instance closest to the centroid to store in long-term memory middle.
[0055] As an embodiment provided by the present invention, preferably, in the awake stage, the model updates its processing capability by quickly adapting to new relationship samples and incorporates these samples into the experience pool, specifically: S4-1: Using the pre-trained language model BERT to handle short-term memory Examples in , and the result is expressed as The specific formula is as follows: S4-2: Use the linear Softmax classifier to calculate the classification probability of the input instance x and define the classification loss function To optimize the model parameters. The classification probability and loss function are calculated as follows: in Is the model in the current task A collection of parameters for the period. is the trainable weight matrix of the classifier. is the model prediction input instance Belong to relationship probability. is an instance The actual label of . If , then the indicator function The value is 1 if yes, otherwise it is 0.
[0056] S4-3: Generated short-term memory representation And the corresponding classification loss values are stored in the experience pool.
[0057] S5: Use the experience iteration framework to dynamically adjust the distribution of relation samples during model learning to better correct the representation bias of the model.
[0058] As an embodiment provided by the present invention, preferably, an experience iteration framework is used to dynamically adjust the distribution of relationship samples during the model learning process to correct the representation bias of the model. Specifically: S5-1: Reference Figure 3 In the experience propagation phase, the model continues to expand its experience pool by learning from previous tasks. When the model can use all the previously accumulated experience To execute the current task , and according to a specific experience propagation strategy, the newly acquired experience is added to the experience pool. The process can be described as: in It is a pool of accumulated experience. Represents a task batch Utilization of experience.
[0059] S5-2: In the experience elimination stage, in order to effectively optimize the structure of the experience pool, based on the frequency of experience usage After each task batch is completed, the retained experience set is filtered by the following formula : in In the current task batch The filtered experience collection. Indicates ranking the experiences according to the loss value sorting criteria. Function Represents each experience frequency of use. is an experience retention threshold.
[0060] S5-3: Improve the quality and operational efficiency of the experience pool using linear classification loss and knowledge distillation loss. The linear classification loss function is used to measure the difference between the model's predicted distribution and the true distribution, and adjust the model parameters by minimizing the difference to make the prediction closer to the true distribution. The distillation loss aims to transfer the knowledge of the previous model to the current model, improving its performance and generalization ability while reducing representation bias.
[0061] in and Represent the linear classification loss and knowledge distillation loss respectively. is a weight coefficient used to balance the contribution of these two losses to the total loss.
[0062] S5-3-1: In the process of calculating the linear classification loss, the model first uses the empirical examples Make predictions and get empirical examples The probability of belonging to a certain category: in Is the current task The model parameters. is the trainable parameter matrix of the linear classifier. Represents experience pool Input example Hidden feature representation of .
[0063] S5-3-2: Use cross entropy loss to calculate the linear classification loss function: in It is an experience pool The total number of samples in . Is the current task A collection of relationships. is the indicator function, when the true label Equal to the predicted label 1 if the value is 0, otherwise it is 0.
[0064] S5-3-3: In the calculation process of knowledge distillation loss, the current model and the previous model are first used to predict the input sample and generate the corresponding soft label probability distribution. The soft label generation process uses a temperature parameter , used to smooth the predicted probability so that the model can better capture the relative relationship between different categories. Soft label probability distribution of the current model and the previous model and as follows: , in and is the current model and the previous model for the sample The unnormalized output of . is the temperature parameter.
[0065] S5-3-4: Use Kullback-Leibler divergence (KL divergence) to measure the soft label distribution of the current model Soft label distribution with previous model The difference between: .
[0066] As an embodiment provided by the present invention, preferably, during the sleep stage, the model goes through two sub-stages: non-rapid eye movement (NREM) and rapid eye movement (REM). In the NREM stage, the neural network replays the long-term memory in the hippocampus. In the REM stage, the model prepares for the ability to handle new relationships in the future by simulating dream data of new relationships. Specifically: S6-1: First, the long-term memories in each task batch are aggregated and integrated into a long-term memory set; Then, a prototype set is generated for each known relationship , by using the prototype set We perform feature extraction on all instances in the relation to compute the prototype embedding of the relation.
[0067] in It's a relationship Prototype embedding. Indicates the instance The feature extraction function.
[0068] S6-2: During NREM, the memory is collected from long-term memory Extract samples from the model to consolidate and strengthen the existing knowledge that is partially frozen in the wakeful stage. The frozen existing knowledge refers to the memory or knowledge that has been formed in the wakeful state and is relatively stable but not yet fully consolidated; use contrastive learning loss and knowledge distillation loss to optimize the model parameters. The total loss at this stage can be expressed as: in and denote contrastive learning loss and knowledge distillation loss respectively.
[0069] In contrastive learning loss, the model's consolidation of previous memory is strengthened through contrastive learning network. Specifically, the loss function is defined as follows: in Represents an input instance Hidden representation of Embedding with relational prototypes The similarity between . is the temperature parameter.
[0070] The calculation of the knowledge distillation loss function is as follows: S6-3: In the REM stage, we first introduce dream data containing randomness and variability. Then, we use adversarial linear loss, adversarial composite and The loss and smooth adversarial compound loss are used to optimize the model parameters.
[0071] S6-3-1: First, random noise is added to the data in the short-term memory and long-term memory collections. The generated noise has the same shape as the memory data.
[0072] S6-3-2: Use normalization, scaling and other techniques to control the noise amplitude and adjust the noise impact.
[0073] S6-3-3: Combine the processed noise with the original memory data to generate dream data containing memory data and random noise. The resulting dream data set can be expressed as: in Represents generation and Standard normally distributed noise of the same shape. is a scaling parameter that controls the influence of noise.
[0074] S6-3-4: Define the total loss function , which combines three key components: adversarial linear loss , antagonistic compound and loss and smooth adversarial compound sum loss .
[0075] in , and They are , as well as The weight hyperparameter is used to balance the contribution of each loss term.
[0076] Linear loss The model is optimized by minimizing the cross entropy between the true label and the predicted probability, ensuring that high-precision classification performance can be maintained even in the face of adversarial samples. The specific loss function is defined as follows: in Represents the predicted input Belong to relationship probability. for The real label.
[0077] Antagonistic compound and The loss further takes into account the edge effect of the model output (i.e., the confidence difference between different categories), aiming to improve the overall robustness of the model by optimizing the edge performance in an adversarial environment. The specific loss function is defined as follows: in Indicates finding the perturbation range under the p-norm constraint The worst disturbance within .function is a smooth function. Symbol For all wrong labels The sum is calculated, which reflects the overall loss of the model on the wrong labels. Used to measure the model's accuracy on the correct label and error labels The score difference between . and Respectively indicate that in the input Next error label and the correct label The prediction score of .
[0078] Smoothed adversarial compound loss In the antagonistic compound and A smoothing term is introduced on the basis of the loss to reduce the instability in the optimization, thereby improving the stability and optimizability of the training. The loss function is in the form of: The parameters Used to control the degree of smoothing to reduce instability during training. Symbol Represents the input of the dream dataset The disturbance neighborhood In the above example, we find the maximum adversarial perturbation . It means that the model is correct for the correct label before and after the perturbation and error labels L2 norm of the difference in prediction scores.
[0079] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0080] The preferred embodiments of the present invention disclosed above are only used to help illustrate the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A continuous relationship extraction method combining wake-sleep memory cycle and experience iteration, characterized in that: The steps include: Step S1: Add a new task Input into the continuous relation extraction model; Step S2: Use hybrid enhancement and inversion enhancement strategies to expand new relation instances, consistent with the task Co-construction of synthetic short-term memory ; Step S3: Use K-Means algorithm to Filter out the instances closest to the centroid and store them in long-term memory middle; Step S4: During the awake phase, short-term memory is processed through the pre-trained language model BERT Examples in , the generated short-term memory and the corresponding classification loss value are included in the experience pool; Step S5: Use the experience iteration framework to dynamically adjust the distribution of relation samples during model learning to correct the representation bias of the model; Step S6: During the sleep stage, the model goes through two sub-stages: non-rapid eye movement and rapid eye movement; During the non-REM phase, the neural network replays long-term memories in the hippocampus; In the REM phase, the model simulates dream data of new relation samples using adversarial linear loss, adversarial composite and The loss and smooth adversarial compound loss are used to optimize the model parameters.
2. According to claim 1, a method for continuous relationship extraction combining wake-sleep memory cycle and experience iteration is characterized in that: In step S1, the task Equipped with independent data sets and relationship set ; The dataset The training set , validation set and test set ; Each relationship set Covers at least one type of relationship; sets of relationships between different tasks Do not overlap.
3. The method for extracting continuous relations combining wake-sleep memory cycle and experience iteration according to claim 1, characterized in that: In step S2, a synthetic short-term memory is constructed The steps are as follows: Step S21: Use hybrid enhancement and inversion enhancement strategies to obtain the enhanced data set D aug ; Step S22: Set the task The original training dataset With the enhanced dataset D aug Combined to form short-term memory ; in, .
4. According to claim 1, a method for extracting continuous relations combining wake-sleep memory cycle and experience iteration is characterized in that: In step S21, the data set D aug The generation steps are as follows: Step S211: Based on the task Existing relationship , the hybrid reinforcement strategy is implemented by randomly pairing tasks The existing relationship of For relationship pairs; based on relationship pairs, construct mixed synthetic categories to obtain data sets ; Step S212: The inversion enhancement strategy creates an additional reverse category by swapping the positions of the head and tail entities in the corresponding instance to obtain a data set ; Step S213: Combine data sets and dataset Get the enhanced dataset , calculated as follows: 。 5. The method for extracting continuous relations combining wake-sleep memory cycle and experience iteration according to claim 1, characterized in that: In step S3, the specific steps of selecting the instance closest to the centroid are as follows: Step S31: For the kth task T k ,Will All instances in are encoded as a set of embedding vectors ; Step S32: Apply the K-Means clustering algorithm twice to the encoded embedding vector set to obtain the instance closest to the centroid and store it in long-term memory middle.
6. The method for continuous relationship extraction combining wake-sleep memory cycle and experience iteration according to claim 5, characterized in that: In step S32, the method for obtaining the instance closest to the centroid includes the following steps: Step S321: cluster the embedded vector set and divide the embedded vector into clusters; in each cluster, select the instance closest to the cluster center to form a representative instance set, denoted as ; Step S322: Statistics The number of instances of each relation in is used to evaluate the importance of the relation; Specifically, relations that contain more than a threshold set by the administrator are considered more important; for these more important relations, at least Instances are stored in long-term memory Middle; R k For the task existing relationship, ; For the remaining relatively unimportant relationships, select at most Instances; If the number of instances of a relation is insufficient to fill its allocated memory, its unused memory capacity is reallocated to other relations; Step S323: Cluster the selected instances of each relationship again and select the instance closest to the centroid and store it in long-term memory middle.
7. The method for continuous relationship extraction combining wake-sleep memory cycle and experience iteration according to claim 1, characterized in that: In step S4, the method of incorporating the generated short-term memory and the corresponding classification loss value into the experience pool includes the following steps: Step S41: Use the pre-trained language model BERT to process short-term memory The result is represented as h x ; Step S42: Use the linear Softmax classifier to calculate the classification probability of the input instance x and define the classification loss function L new To optimize model parameters; Step S43: Store the generated short-term memory and the corresponding classification loss value in the experience pool.
8. The method for continuous relationship extraction combining wake-sleep memory cycle and experience iteration according to claim 1, characterized in that: In step S5, the specific method of dynamically adjusting the relationship sample distribution using the experience iteration framework is: Step S51: In the experience propagation phase, the experience pool of the model is continuously expanded by learning previous tasks; Step S52: In the experience elimination stage, based on the frequency of use of experience and the importance of experience to screen the experiences in the experience pool; Specifically, the importance of experience is to rank the experience according to the loss value ranking criterion of the classification loss function. The smaller the loss value, the more important the experience; Step S53: Use the linear classification loss function and the knowledge distillation loss function to correct the representation bias of the model.
9. The method for extracting continuous relations combining wake-sleep memory cycle and experience iteration according to claim 1, characterized in that: In step S6, the specific manner in which the model undergoes two sub-stages, non-rapid eye movement and rapid eye movement, is as follows: Step S61: Summarize the long-term memories in each task batch and integrate them into a long-term memory set , and generate a prototype set for each known relationship , and by Perform feature extraction operations on all instances in and calculate the prototype embedding of the corresponding relationship; Step S62: In the non-rapid eye movement phase, from the long-term memory collection Extract samples from the model to consolidate and strengthen the existing knowledge that is partially frozen in the wakeful stage; the frozen existing knowledge refers to the memory or knowledge that has been formed in the wakeful state and is relatively stable but not yet fully consolidated; use contrastive learning loss and knowledge distillation loss to optimize model parameters; Step S63: In the REM stage, introduce dream data containing randomness and variability, and use adversarial linear loss, adversarial composite loss and smooth adversarial compound and loss to optimize model parameters.
10. The method for continuous relationship extraction combining wake-sleep memory cycle and experience iteration according to claim 9, characterized in that: In step S63, the dream data is generated as follows: Step S631: adding random noise to the data in the short-term memory and long-term memory sets, the generated noise having the same shape as the memory data; Step S632: using normalization and scaling techniques to control the noise amplitude and adjust the noise influence; Step S633: Combine the processed noise with the original memory data to generate dream data containing memory data and random noise.
Citation Information
Patent Citations
Continuous relation extraction method based on semantic embedding and relation prototype
CN117494808A
Construction method and application of transgenic mouse
CN118844389A
Compositions and methods for ameliorating anterodorsal thalamus hyperexcitability
WO2023278295A1
Cited By
Big language model knowledge ability continuous expansion method based on dual-mode dynamic loop
CN120806083A