Consistent Prototype Learning for Few-Shot Continual Relation Extraction (2023)

Abstract: Few-shot continual relation extraction aims to continually train a model on incrementally few-shot data to learn new relations while avoiding forgetting old ones. However, current memory-based methods are prone to overfitting memory samples, resulting in insufficient activation of old relations and limited ability to handle the confusion of similar classes. In this paper, we design a new N-way-K-shot Continual Relation Extraction (NK-CRE) task and propose a novel few-shot continual relation extraction method with Consistent Prototype Learning (ConPL) to address the aforementioned issues. Our proposed ConPL is mainly composed of three modules: 1) a prototype-based classification module that provides primary relation predictions under few-shot continual learning; 2) a memory-enhanced module designed to select vital samples and refined prototypical representations as a novel multi-information episodic memory; 3) a consistent learning module to reduce catastrophic forgetting by enforcing distribution consistency. To effectively mitigate catastrophic forgetting, ConPL ensures that the samples and prototypes in the episodic memory remain consistent in terms of classification and distribution. Additionally, ConPL uses prompt learning to extract better representations and adopts a focal loss to alleviate the confusion of similar classes. Experimental results on two commonly-used datasets show that our model consistently outperforms other competitive baselines.

## introduction continual relation extraction (cre) aims to continually train a model on new data to learn new relations while avoiding forgetting old relations. due to its wide applicability to real-world applications, cre has attracted increasing attention @xcite @xcite figure 1 : the scatter plot that reflects the relationship between distortion and forgetting in four methods, namely emar @xcite , rp-cre @xcite , erda @xcite and our proposed conpl. the abscissa "distortion" indicates the degree of change in feature embedding, and the ordinate "forgetting" indicates the degree of forgetting. each point on the plot represents a prototype of a relation class. the detailed calculations are shown in @xcite . most existing studies adopt memorybased approaches as the principal architecture and achieve great success in cre. for example, @xcite employ relation prototype to extract useful information of each relation. @xcite adopt a simple yet effective adversarial class augmentation mechanism to learn more precise and robust representations. however, obtaining large labeled data can be time-consuming and expensive. @xcite introduce continual few-shot relation learning @xcite and propose a novel method of embedding space regularization and data augmentation. but, the first task in the cfrl setting still involves a substantial amount of training data, and the evaluation results obtained in this setting may not completely reflect the performance of the model under true continual few-shot learning conditions foot_0 . this is because a portion of the test set is drawn from the first task, which can lead to a big gap between the results obtained in the cfrl setting and those obtained under true continual few-shot relation learning conditions. to this end, we propose the n-way-k-shot continual relation extraction (nk-cre), which strictly adheres to the n-way k-shot few-shot setting and all classes contain only a small amount of labeled instances. in the nk-cre setting, we employ existing cre methods to conduct a series of experimental analyses for few-shot continual relation learning, as illustrated in figure 1 . we observe that existing cre methods, particularly erda, exhibit significant distortion and forgetting. additionally, we find that the prototype distortion is highly relevant to forgetting in nk-cre. based on these findings, we hypothesize that reducing the prototype distortion can greatly mitigate catastrophic forgetting in nk-cre. however, existing cre methods in the nk-cre setting face the challenge of overfitting the memory samples due to the limited memory available, leading to insufficient activation of the old relations and resulting in significant distortion and forgetting. besides, the confusion of similar classes is also a major cause of catastrophic forgetting in cre @xcite , which is particularly acute in nk-cre. for instance, the prototype embeddings of similar classes, like "father" and "mother", tend to be highly similar due to their similar context and entity pairs. when "father" has already been learned in a previous task and "mother" is shown in a new task, the model prioritizes learning the representation of the current class "mother", but may disregard the subtle differences between "mother" and "father", leading to catastrophic forgetting. to deal with the above issues, we propose a novel consistent prototype learning (conpl) method for few-shot continual relation extraction in order to effectively activate old relations and mitigate catastrophic forgetting. conpl consists of three primary modules: 1) a prototype-based classification module, which leverages prompt learning to extract better relation representations and utilizes temporary prototypes constructed from new task data and several distance metric-based losses for basic classification; 2) a memory-enhanced module that comprises sample memory for storing vital labeled samples and prototype memory for storing optimal prototype representations; 3) a consistent learning module that addresses the problem of unbalanced distribution of new and old relations through consistency learning between sample distribution. in addition, we introduce a focal loss to mitigate the impact of the confusion of similar classes on catastrophic forgetting. this loss function allows the model to focus on the training of similar classes, enabling it to pay more attention to the distinctions between similar classes and reducing the impact of confusion. in this study, experimental results of fewrel and tacred datasets in the nk-cre setting demonstrate that conpl outperforms existing models by a significant margin. further, ablation experiments show that each component of our method contributes to its effectiveness. our analysis also reveals that conpl not only significantly reduces the distortion of class prototypes, but also effectively minimizes catastrophic forgetting. overall, our conpl offers a robust and effective approach to few-shot continual relation extraction. ## related work continual learning, also known as lifelong learning and incremental learning, is the process of training models to perform well on task streams with different data distributions. its main methods can be divided into three categories: (i) regularizationbased methods @xcite ; (ii) architecture-based methods @xcite ; and (iii) memory-based methods @xcite . memory-based methods, also called rehearsal-based methods, have been shown to be particularly suitable for natural language processing (nlp), especially for cre @xcite @xcite . these methods selectively store old samples in limited memory, training them with new samples to prevent catastrophic forgetting. for example, emar @xcite utilizes relation prototypes for memory reconsolidation exercises. rp-cre @xcite uses prototypes of all observed relations to refine subsequent sample embeddings. crecl @xcite builds a classification network and a prototypical contrastive network. however, these methods only compute temporary prototypes before training a new task and store memory samples, which can lead to significant distortion and forgetting as the number of tasks increases. in contrast, our approach stores prototypes in memory without modification. few-shot learning aims to address the overfitting issue that may arise when there is a limited amount of labeled training data for model training. existing methods can be divided into two categories: (i) data-based @xcite ; and (ii) meta learning-based, including optimization-based algorithm @xcite and metric-based algorithm. among them, prototypical network @xcite is a simple yet efficient metric-based approach and has become the most mainstream method in few-shot relation extraction @xcite @xcite . in this paper, our method is built on the prototypical network and proposes storing class prototypes in memory. prompt learning is a simple yet effective method for fine-tuning pre-trained language models (plms), which uses prompt information to enrich the input and enable better mining of prior knowledge in plms. according to the pre-training objectives, the structure of prompts is mainly divided into two types: (i) adding the task description before the input, e.g., the generative model gpt-3 @xcite ; and (ii) formalizing downstream tasks into cloze-style tasks, e.g., the discriminative model bert @xcite . according to different forms of expression, prompt can be divided into continuous @xcite and discrete @xcite . continuous prompts are composed of vectors and the optimal prompt embedding can be learned automatically by the model, while discrete prompts are manually constructed by people based on their experience. for relation extraction, several works @xcite have investigated the utilization of the prior knowledge of plms through prompt learning, which has been shown to be effective in few-shot learning. in this paper, we use discrete prompts with cloze-style to extract better representations in few-shot cre. in nk-cre, the model is trained on a sequence of tasks t 1 , t 2 , . . . , t n , where each task t k (@xmath0, . . . , n]) has its own training set d k train , test set d k test and corresponding relation set r k . each dataset @xmath1, y i )} n ×k @xmath2, where each sample (x i , y i ) consists of a sentence x i with a pair of entities (e h , e t ) and a relation label y @xmath3, and n is the number of current relations in r k . after being trained on t k at the k-th task to learn the new relations r k , the model will be evaluated on the test sets of previous k tasks dk @xmath4. different from the memory used in previous works @xcite @xcite , we propose a novel multi-information episodic memory @xmath5, m 2 , . . . to alleviate catastrophic forgetting in continual learning, where m k consists of the most informative samples s k and prototype representations p k corresponding to relations r k in t k . although each relation in the memory can store multiple samples, we store a sample per relation under a limited capacity. after the k-th task is trained, the memory m contains sample set ŝk = ∪ k @xmath6. ## methodology in this section, we elaborate on our proposed method conpl, which is composed of three modules: a prototype-based classification module (section 4.1), a memory-enhanced module (section 4.2), and a consistent learning module (section 4.3). prototype-based classification module is the basic component of conpl. memory-enhanced module introduces a novel multi-information episodic memory equipped with some samples and corresponding prototypical representations. consistency learning module adds an extended training process to balance the predictions of all known relations. finally, we give a detailed description of the overall training procedure (section 4.4). ## conclusion we introduce n-way-k-shot continual relation extraction (nk-cre), a novel problem in the realm of continual relation extraction, where all tasks are conducted in the n-way k-shot setting scenario. this problem presents a significant challenge, yet is highly applicable in real-world scenarios. to address this problem, we propose consistent prototype learning (conpl), a novel method that effectively alleviates catastrophic forgetting caused by insufficient activation of old relations and the confusion among similar classes. through a series of experimental and analytical results, we demonstrate that conpl outperforms existing methods in nk-cre. in future research, we plan to study how to improve the domain adaptability of the model in few-shot continual relation extraction.