Continual Few-shot Relation Extraction via Adaptive Gradient Correction and Knowledge Decomposition (2024)

Abstract: Continual few-shot relation extraction (CFRE) aims to continually learn new relations with limited samples. However, current methods neglect the instability of embeddings in the process of different task training, which leads to serious catastrophic forgetting. In this paper, we propose the concept of the following degree from the perspective of instability to analyze catastrophic forgetting and design a novel method based on adaptive gradient correction and knowledge decomposition to alleviate catastrophic forgetting. Specifically, the adaptive gradient correction algorithm is designed to limit the instability of embeddings, which adaptively constrains the current gradient to be orthogonal to the embedding space learned from previous tasks. To reduce the instability between samples and prototypes, the knowledge decomposition module decomposes knowledge into general and task-related knowledge from the perspective of model architecture, which is asynchronously optimized during training. Experimental results on two standard benchmarks show that our method outperforms the state-of-the-art CFRE model and effectively improves the following degree of embeddings.

## introduction the purpose of cfre is to continuously train a model on limited new data. compared to traditional continual relation extraction(cre) models, it can learn new relations without accessing a large number of previous task data, and avoid catastrophic forgetting @xcite of the old relations. due to limited training data, the features learned by the model at each time step of continual learning are relatively unstable and are easily modified by the model when learning other class samples in subsequent time steps. as a result, traditional cre methods cannot be directly applied to cfre @xcite . to fully utilize data resources, scholars have explored many methods @xcite @xcite . and the methods based on memory replay @xcite @xcite made great achievements in cfre. however, these models mainly focus on the strategies of in-memory samples in the process of replaying or learning and perform direct fine-tuning of the model parameters through the gradient of the loss function. furthermore, in-memory samples are used to generate gradients that benefit the performance on previous tasks, but the direction optimized by these gradients may contradict the optimization direction of the current task gradient, which leads to the instability of samples with respect to prototypes. in metric learning @xcite , the prototype of one class is the center of this class. in essence, during continuous learning with minimal data usage, when samples are equivalently shifted with the embedding of prototypes, the la-bels of samples will not be easily changed and catastrophic forgetting of the model will be alleviated. thus, we formally provide the definition of following degree of class y at time step t: the degree of deviation between class y samples and class y prototype before and after training at t. obviously, the smaller the offset between the previous sample embedding and its prototype, the higher the following degree of this class, and the less unstable the samples are. in this way, the model can have less catastrophic forgetting of previous samples. intuitively, there are two main reasons for the low following degree of the model on a task: 1) the model is not sufficiently optimized for some samples, which makes the prototypes deviate from the optimization direction of the samples; 2) after optimization, all embeddings change too much compared with the previous will also increase the risk of low following degree. relative offset distance (rod) and absolute offset distance (aod) are proposed to express the above two factors, respectively. as shown in fig. 1 , in this paper, an adaptive gradient correction algorithm is proposed to directly constrain and correct the vector space of the gradient in transformerbased language models. since the modified gradients are orthogonal to the embeddings of the previous sample, this special optimization method for the transformer can effectively reduce aod. specifically, for each previous task, we calculate a gradient direction, which has the greatest impact on in-memory samples, as the correction criteria. when updating the gradient of the current task, the correction matrix based on this criteria is used to make a linear transformation of the gradient, which can constrain the subspace of parameters orthogonal to the previous tasks. in addition, knowledge contained in model parameters is decomposed into general and taskrelated knowledge. based on this decomposition, general knowledge is used to identify a generic representation of relations with the corresponding entities. we employ task-related knowledge to identify categorical decision boundaries between specific tasks based on general knowledge. in practice, we apply a pre-trained language model (plm) to encode the general knowledge and use an adaptive gradient correction algorithm to avoid mutual coverage of knowledge. since there is no gradient transmission between task prototypes, we integrate task-related knowledge into task prototype embedding. these prototypes are updated discretely and continuously in three different training stages to reduce rod. in the continuous optimization stage, we add an additional loss to increase the distance between prototypes, which can prevent confusion between the new and the old task prototypes. to sum up, the contributions of this paper mainly include the following three aspects: experimental results on two public datasets show that our method can effectively alleviate the catastrophic forgetting in cfre. ## related work re aims to extract the implied relation from sentences. for example, given the sentence "steve jobs is the co-founder of apple", the model needs to determine the relation "ceo_of" between the entity "steve jobs" and "apple". it is a basic step for many downstream tasks such as language understanding, question answering, and knowledge graph construction @xcite . most traditional re models are built based on a fixed dataset @xcite @xcite @xcite . however, re is often an open vocabulary problem @xcite , and it is difficult to model all relations for any limited set. therefore, the continual learning ability @xcite of the re model has gradually attracted attention @xcite . but there will be serious catastrophic forgetting for the model in continual learning, that is, the model will forget the old knowledge when learning new tasks. to solve this problem, the existing methods for continual learning mainly include: regularization-based approach @xcite , memory-based approach @xcite , optimization-based approach @xcite , representation-based approach @xcite , and architecture-based approach @xcite . the existing methods @xcite are often based on a large number of labeled data for training, which is time-consuming and expensive. when the number of training is small, overfitting of memory data and knowledge coverage @xcite is also one of the causes of catastrophic forgetting. the existing methods mainly solve this problem from the following three levels: data level @xcite , feature level @xcite , and task level @xcite . directly adjusting the gradient is also one of the methods to overcome catastrophic forgetting with limited data @xcite . @xcite proposed concept aided backprop for disaster forgetting, in which the gradient is shielded by a conceptor to prevent the degradation of previous tasks. @xcite introduced orthogonal projection and context-dependent processing module for the current gradient. @xcite put forward the paranoid factor related to the previous task to estimate the input space, but the accumulation strategy for embedding of different samples may lead to confusion in the projection space. although, the gem algorithm @xcite introduced gradient projection to make the loss of previous tasks slowly increase in subsequent training, the embeddings computed by this method are not equivariant and cannot be applied to transformer-based language models. in contrast, our method innovatively uses the correction matrix calculated by in-memory samples to directly constrain the gradient update in backpropagation to reduce the overall aod, so as to limit the risk of reduced following degree. a model architecture based on knowledge decomposition and the corresponding asynchronous optimization method is designed to further reduce the rod of samples. ## conclusion in this paper, a method of direct decoupling parameters and modifying gradient is proposed to improve the following degree of samples, which can eventually reduce the catastrophic forgetting for cfre. specifically, we first propose the concept of the following degree and analyze it from the perspectives of aod and rod. the parameters of the model are decomposed into general and task-related knowledge based on metric learning. for general knowledge, an adaptive gradient correction algorithm is proposed to reduce the impact of gradient updates on previous knowledge, which can reduce the aod of samples. for task-related knowledge, we update the parameters discretely and continuously in three different training stages to optimize rod between prototypes and samples. the theoretical derivation and experimental results on two standard benchmarks verify the superiority of agckd.