Consistent Prototype Learning for Few-Shot Continual Relation Extraction
Year: 2023

Abstract:
Few-shot continual relation extraction aims to continually train a model on incrementally fewshot 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 prototypebased 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 baselines1.

heading: 1 Introduction
text: 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 (Obamuyide and Vlachos, 2019; Han et al., 2020; Zhao
∗Equal contribution. †Correspondence author.
1https://github.com/XiudiChen/ConPL
et al., 2022). Most existing studies adopt memorybased approaches as the principal architecture and achieve great success in CRE. For example, Cui et al. (2021) employ relation prototype to extract useful information of each relation. Wang et al. (2022) 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. Qin and Joty (2022) introduce continual few-shot relation learning (CFRL) 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
7409
learning conditions2. 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 (Wang et al., 2022), 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
2True continual few-shot learning, also known as few-shot continual learning, refers to a model learning to perform fewshot learning on a continuous stream of tasks, with each task typically comprising a small number of labeled examples.
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.

heading: 2 Related Work
text: 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 (Kirkpatrick et al., 2017; Zenke et al., 2017); (ii) architecture-based methods (Fernando et al., 2017; Wortsman et al., 2020); and (iii) memory-based methods (Rolnick et al., 2019; Cha et al., 2021). Memory-based methods, also called rehearsal-based methods, have been shown to be particularly suitable for natural language processing (NLP), especially for CRE (Wang et al., 2019; Han et al., 2020; Cui et al., 2021; Zhao et al., 2022). These methods selectively store old samples in limited memory, training them with new samples to prevent catastrophic forgetting. For example, EMAR (Han et al., 2020) utilizes relation prototypes for memory reconsolidation exercises. RP-CRE (Cui et al., 2021) uses prototypes of all observed relations to refine subsequent sample embeddings. CRECL (Hu et al., 2022) 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 (Tsai and Salakhutdinov, 2017; Benaim and Wolf, 2018); and (ii) meta learning-based, including optimization-based algorithm (Finn et al., 2017) and metric-based algorithm. Among them, prototypical network (Snell et al., 2017) is a simple yet efficient metric-based approach and has become the most mainstream method in few-shot relation extraction (Yang et al., 2020; Qu et al., 2020; Han et al., 2021a). 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 (Brown et al., 2020); and (ii) formalizing downstream tasks into cloze-style tasks, e.g., the discriminative model BERT (Devlin et al., 2018). According to different forms of expression, prompt can be divided into continuous (Lester et al., 2021; Vu et al., 2022) and discrete (Schick et al., 2020; Han et al., 2021a). 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 (Han et al., 2021b; Chen et al., 2022) 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.

heading: 3 Problem Formulation
text: N-way-K-shot Continual Relation Extraction (NKCRE) is a continual relation learning task in the Nway K-shot setting scenario, which aims to continu-
ally train the model on new tasks to learn new relations while avoiding forgetting previously learned ones under the few-shot scenario. Compared to CFRL (Qin and Joty, 2022), NK-CRE strictly adheres to the N-way K-shot setting, which is more challenging yet more representative of real-world applications.
In NK-CRE, the model is trained on a sequence of tasks { T 1, T 2, . . . , T n } , where each task T k(k ∈ [1, . . . , n]) has its own training set Dktrain, test set D k test and corresponding relation set Rk. Each dataset D = {(xi, yi)}N×Ki=1 contains N classes and K samples of each class, where each sample (xi, yi) consists of a sentence xi with a pair of entities (eh, et) and a relation label yi ∈ Rk of the entity pair, and N is the number of current relations in Rk. After being trained on T k at the k-th task to learn the new relations Rk, the model will be evaluated on the test sets of previous k tasks D̂ktest = ∪ki=1Ditest to verify the discriminant ability of the model for all known relations R̂k = ∪ki=1Ri.
Different from the memory used in previous works (Han et al., 2020; Cui et al., 2021; Qin and Joty, 2022), we propose a novel multi-information episodic memory M = { M1,M2, . . . } to alleviate catastrophic forgetting in continual learning, where Mk consists of the most informative samples Sk and prototype representations P k corresponding to relations Rk 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 Ŝk = ∪ki=1Si and prototype set P̂ k = ∪ki=1P i of the previous k tasks.

heading: 4 Methodology
text: 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).

heading: 4.1 Prototype-Based Classification Module
text: Encoder. Given a sentence x with a head entity eh and a tail entity et, we choose BERT (Devlin et al., 2018) as the encoder with parameters θ to obtain the relational representation of entity pairs in x. Specifically, we firstly enrich the sentence x into a specific input sequence xinput = {[CLS], eh, [MASK], et, [SEP], x, [SEP]} based on the prompt learning (Han et al., 2021b; Chen et al., 2022), and then encode the input sequence by the encoder to obtain the contextualized representation. Here we use the vector representation of the special token [MASK] as the relational representation.
h[MASK] = fθ (xinput) (1)
For simplicity, we will use x to refer to the specific input sequence xinput.
Initializing temporary prototypes of new classes. When firstly training on the k-th new task to learn new relations, we use all samples of each new relation in the current task to construct prototypical representations for the corresponding classes. Specifically, we encode all samples in Dktrain, and then use an aggregation operator (such as averaging) to aggregate the embeddings of samples from the same class to calculate the prototypical representation pj of each class.
pj = 1 |Dkj | ∑
(xi,yi)∈Dkj
fθ (xi) (2)
where Dkj = { (xi, yi) | (xi, yi) ∈ Dktrain, yi = rj } , |Dkj | is the number of samples and pj represents the prototypical representation of rj(rj ∈ Rk) in the new task. So the temporary prototypes of current new task is P̃ k =
⋃ rj∈Rk pj . Based on
previous relation prototypes P̂ k−1 of the memory, we can get all current prototypes P̄ k = P̂ k−1 ∪ P̃ k 3 related to all classes we have seen.
Prototype classifier with experience replay. To learn new relations while retaining existing relation knowledge, we use the experience replay to
3In this paper, P̃ k refers to the temporary prototypes of the k-th task and P k refers to the prototypes of the k-th task stored in memory. P̄ k refers to the prototypes of the previous k task that contain the prototypes from memory for the previous k−1 tasks as well as the temporary prototypes for the k-th task. Additionally, P̂ k refers to the prototypes of the previous k task stored in memory.
train the model on the new train dataset D̄ktrain = Dktrain∪Ŝk−1, which combine the training samples of the k-th task with the samples of the previous k−1 tasks in the memory. The relation distribution for each sample xi is computed as:
p(ri|xi) = exp (d (fθ (xi) ,pi))
∑|R̂k| l=1 exp (d (fθ (xi) ,pl)) (3)
where d (., .) represents the distance measurement formula by the cosine similarity, pl is the prototypical representation of rl(rl ∈ R̂k) in P̄ k, and |R̂k| is the number of all known relations in previous k tasks.
The cross entropy loss Lce for classification is calculated in a distance measurement way.
Lce = − ∑
(xi,yi)∈D̄ktrain
log p(ri|xi) (4)
In order to wake up the old relational knowledge, we propose the classification consistency loss Lcc to focus on the consistent correlation between the feature of each sample in Ŝk−1 and the corresponding prototypical representation in P̂ k−1 based on current memory.
Lcc = ∑
(xi,yi)∈Ŝk−1 ∥fθ(xi)− pi∥ (5)
Considering the different correlation between the new relations and previous relations (e.g., the relation “mother” in the new task and previous relations “father” / “spouse” belongs to greatly similar relations.), we select similar classes to highlight their distinction. Specifically, we start by obtaining the most similar negative prototype pmni = argmax(d (fθ (xi) ,ps)) for each sample xi, which is the prototype of the most likely relation of miscalculation. Next, we set a threshold α and automatically screen some confusing negative prototypes p̂sni = {psni | d(fθ(xi),pi)− d(fθ(xi),psni ) < α} that include prototypes that are the most similar to the prototype pi with the target relation. Here ps and psni refer to any prototype other than pi, so ps ̸= pi and psni ̸= pi. The distribution of xi is computed for distinguishing similar classes.
ps(ri|xi) = exp (d (fθ (xi) ,pi))
∑|P simi | l=1 exp (d (fθ (xi) ,pl)) (6)
where P simi = [pi;p mn i ; p̂ sn i ] represents the set of prototypes similar to the output feature of xi and |P simi | is the number.
Therefore, we adopt the focal loss to alleviate the difficulty in predicting similar classes.
Lfc = − ∑
(xi,yi)∈D̄ktrain
log ps(ri|xi) (7)

heading: 4.2 Memory-Enhanced Module
text: Compared to previous memory-based methods (Han et al., 2020; Cui et al., 2021; Qin and Joty, 2022), we add prototypical representations into the episodic memory for enriching the old relations. So the memory of our model is separated into two parts: the Sample Memory Ŝk, which is used to store samples with class labels, and the Prototype Memory P̂ k, which is used to store feature embeddings of class prototypes.
For the sample memory, we calculate the prototypical representation of each relation in the current task T k based on Eq (2), and then select some closest samples as the typical samples to store them in Sk, where each relation of T k only stores one typical sample. During training, prototypical representations computed by all relation samples can be unstable. Therefore, once the typical samples are determined, we use the feature representations of the selected typical samples to update prototypical representations of the current task and store their feature representations in prototype memory P k after T k is trained.

heading: 4.3 Consistent Learning Module
text: Considering the unbalanced distribution of new relations and old ones in the training dataset D̄ktrain, we add an extended training step that solely focuses on the memory M that helps to balance the learning of all known relations and distinguish new and old relations. Therefore, we propose the distribution consistency loss Ldc via computing the consistent constraint between the sample distribution and the prototype distribution.
Ldc = ∑
(xi,yi)∈Ŝk
∥∥∥d ( fθ(xi), P̂ k ) − d ( pi, P̂ k )∥∥∥
(8)

heading: 4.4 Learning Procedure
text: Joint training objective. We adopt a three-stage training strategy to train our model. The overall training objective of the first two stages is computed as follows.
Lclass = λceLce + λccLcc + λfcLfc (9)
Algorithm 1 Training Process for the k-th task. Input: The training set Dktrain and the new relation set Rk; the sample memory Ŝk−1 = ∪k−1i=1 Si and the prototype memory P̂ k−1 = ∪k−1i=1 P i of previous k− 1 tasks; all known relations R̂k−1 = ∪k−1i=1 Ri of previous k−1 tasks; the values of epoch1, epoch2 and epoch3. Output: Configurations of the encoder with parameters θ; the sample memory Sk and the prototype memory P k of the k-th task. Initialize: The encoder with parameters θ.
1: INITIALIZE temporary prototype P̃ k of each relation ri ∈ Rk based on Dktrain 2: R̂k ← R̂k−1 ∪Rk 3: P̄ k ← P̂ k−1 ∪ P̃ k 4: D̄ktrain ← Dktrain ∪ Ŝk−1 5: for i ∈ {1, · · · , epoch1} do 6: UPDATE θ with Lclass on D̄ktrain and Ŝk−1 7: UPDATE P̃ k in P̄ k 8: end for 9: SELECT a key sample of each relation from Dktrain to
store into Sk
10: REINITIALIZE prototype P k of each relation ri ∈ Rk based on Sk 11: Ŝk ← Ŝk−1 ∪ Sk 12: P̄ k ← P̂ k−1 ∪ P k 13: D̄ktrain ← Dktrain ∪ Ŝk 14: for i ∈ {1, · · · , epoch2} do 15: UPDATE θ with Lclass on D̄ktrain and Ŝk 16: UPDATE P k in P̄ k 17: end for 18: for i ∈ {1, · · · , epoch3} do 19: UPDATE θ with Lcons on Ŝk 20: UPDATE P k in P̄ k 21: end for 22: P̂ k ← P̂ k−1 ∪ P k
And the overall training objective of the third stage is defined as follows.
Lcons = λceLce+λccLcc+λfcLfc+λdcLdc (10)
where λce, λcc, λfc and λdc are the relative weights of the component losses, respectively. It is noteworthy that the training set of the different stages is different. The first stage adopts the sample memory Ŝk−1. After storing the sample memory Sk of the k-th task, the second and third stages use Ŝk for training.
Training procedure. The overall training procedure is summarized in Algorithm 1. In the first stage, we use all samples of each class in Dktrain to obtain the prototype representation P̃ k of all classes in Rk. And then based on all prototype P̄ k = P̂ k−1 ∪ P̃ k, the sample memory Ŝk−1, and the current training set D̄ktrain = D k train ∪ Ŝk−1, we let the model learn the knowledge of the new classes (line 1-8). In the second stage, we firstly select key samples Sk closest to the center of
each class and store them in the sample memory Ŝk = Ŝk−1 ∪ Sk, and use Sk to construct new prototype P k of the new classes for subsequently training with P̄ k = P̂ k−1 ∪ P k (line 9-17). In the third stage, we only use Ŝk to predict all known relations and further ensure that the output of the samples in memory is consistent with their stored features (line 18-22).

heading: 5 Experiments

heading: 5.1 Datasets
text: In line with previous work (Qin and Joty, 2022), our experiments will be conducted on two commonly used datasets, FewRel (Han et al., 2018) and TACRED (Zhang et al., 2017). For NK-CRE, we evaluate our method under three different fewshot settings of FewRel, namely 10-way-2-shot, 10- way-5-shot, and 10-way-10-shot, and two different few-shot settings of TACRED, namely 5-way-5shot and 5-way-10-shot. The detailed introduction of two datasets is shown in Appendix A.2.

heading: 5.2 Evaluation Methods
text: After training the model on the k-th task, we use the whole accuracy metric to evaluate the model’s performance on the union of the test sets of previous k tasks D̂ktest = ∪ki=1Ditest . This metric is used to evaluate the model’s ability to alleviate catastrophic forgetting while acquiring new knowledge with a few-shot new task.
In addition, we also measure the degree of catastrophic forgetting using the forgetting metric proposed by Chaudhry et al. (2018). The forgetting metric measures the degree to which the model has forgotten previously learned knowledge after training on new tasks. Specifically, after training on all the tasks, the authors measure the model’s performance on the test sets of all the previous tasks. The specific formula for forgetting is as follows:
Fk = 1 n− k n∑
j=k+1
gjk (11)
gjk = max l∈{k,··· ,j−1} al,k − aj,k (12)
where Fk(k ∈ [1, . . . , n − 1]) represents the forgetting of the k-th task after all tasks have been trained, aj,k(j > k) is the accuracy of the model on the k-th task after the j-th task training is completed, and gjk is the forgetting of the k-th task after the j-th task training is completed.
Considering that the order of task sequences will affect the final performance of the model, we randomly generate 6 task sequences for experiments and calculate their average accuracy as the final result. To ensure a fair comparison between the baselines and the proposed method, we set the same random seed for the baselines and our proposed method to ensure that they are evaluated on the same set of task sequences.

heading: 5.3 Baselines
text: We compare our proposed method with the following baselines:
EMAR (Han et al., 2020): A classical method for continual relation learning, which uses relation prototypes for memory reconsolidation exercise to keep a stable understanding of the old relations.
RP-CRE (Cui et al., 2021): A method for continual relation learning, where prototype embeddings are computed based on memorized samples and are used to re-initialize a memory network to refine subsequent sample embeddings.
ERDA (Qin and Joty, 2022): A SOTA method for continual few-shot relation learning (CFRL) that employs embedding space regularization and data augmentation to improve model performance.
Considering that PLMs (e.g., BERT) have been shown to outperform Bi-LSTM on many NLP tasks, we replace the Bi-LSTM with BERT to reproduce the baselines we mentioned. Furthermore, recent advances in Prompt Learning have shown great performance on many NLP tasks, by enabling models to learn from prompt-based examples and generate coherent outputs. Therefore, we construct prompt templates at the input to generate their variants EMAR(PT), RP-CRE(PT), and ERDA(PT) for better comparison.

heading: 5.4 Training Details
text: During training, we use BERTBASE (Devlin et al., 2018) as the encoder and Adam optimizer with a learning rate of 2e−5 for gradient updates. To prevent gradient overflow, we set the gradient clipping value to 10. The loss weights λce, λcc, λfc and λdc are all set to 1.0, and α is set to 0.1. In Algorithm 1, epoch1 and epoch2 are set to 1, and epoch3 is set to 3.

heading: 5.5 Main Results
text: Table 1 presents the whole accuracy of the FewRel benchmark in the 10-way-5-shot setting and the TACRED benchmark in the 5-way-5-shot setting.
Based on the main results of NK-CRE, we can observe that:
(1) Prompt learning can obtain better semantic representations and improve model performance in few-shot scenarios. Baselines with PT can achieve the desired effect directly on each task in NK-CRE, particularly for the first task, without the need for training on a large amount of labeled data like CFRL (Qin and Joty, 2022). On the FewRel’s 10-way-5-shot, EMAR(PT) is 12.78% higher than EMAR after learning the first task using the 5-shot setting and 3.25% higher than EMAR after learning the first task with a large amount of labeled data. Notably, our method ConPL achieves the highest performances in most of the tasks. In the first task, our method ConPL achieves the accuracy of 95.72%, which was slightly lower than the accuracy achieved by ERDA(PT) at 96.55%. However, it is worth noting that ERDA(PT) leverages external Wikipedia sentences for data augmentation, which may account for its slightly superior performance. On the TACRED’s 5-way-5-shot, ConPL achieves the highest performance on all tasks. (2) Consistent prototype learning with multiinformation memory can significantly improve model performance in NK-CRE. When faced with multiple tasks (T2∼T8), Our method ConPL significantly outperforms all existing methods on FewRel’s 10-way-5-shot and TACRED’s 5-way5-shot. Compared with all baselines, ConPL obtains the highest improvement reaching 26.48% of FewRel’s 10-way-5-shot and 41.19% of TACRED’s 5-way-5-shot after learning all tasks. More specifically, the performance obtained by our ConPL at T8 is better than that of EMAR(PT) at T6, RP-CRE(PT) and ERDA(PT) at T4. It proves that our consistent prototype learning strategy is highly effective. Moreover, we present more detailed results in Table 1 in Appendix A.3, including the means and variances of all sequential results. In T1∼T8 of FewRel’s 10-way-5-shot, the mean deviations of MEAR(PT), RP-CRE(PT), ERDA(PT), and our ConPL are 2.76%, 1.92%, 5.27%, and 1.50% respectively, which indicate that our method ConPL is more stable than other baselines. In addition, Figure 2 presents the results of FewRel’s 10-way-
2-shot, FewRel’s 10-way-10-shot, and TACRED’s 5-way-10-shot. These results also show the effectiveness of our ConPL.

heading: 5.6 Ablation Study
text: We conduct ablation experiments on the FewRel’s 10-way-5-shot from two aspects of the utilization of memory and auxiliary tasks to verify the contribution of each component in our method and study the impact on model performance by removing one module at a time. Utilization of Memory includes (a) without the Prototype Memory (PM), (b) without the Consistent Learning Module (CL), and Auxiliary Tasks includes (c) only removing the classification consistency loss Lcc, (d) only removing the distribution consistency loss Ldc, and (e) only removing the focal loss Lfc. The results of our ablation experiments are shown in Table 2. We observe that each component in our method contributes to the overall performance.
In Utilization of Memory, Prototype Memory (PM) brings a 3.56% boost after training on all tasks, demonstrating the strong effectiveness of our novel multi-information episodic memory. The Consistent Learning Module (CL) gains a 1.52% improvement. Also, we find that training without CL requires fewer epochs than EMAR, ERDA, and RP-CRE, but outperforms these with PT by 2.91%, 7.23%, and 3.38%. The performance of T1 without CL is 0.71% higher than ConPL, as there is no
catastrophic forgetting in the first task, causing the model to overfit on memory. Memory augmentation in T1 could reduce the diversity of the training samples, which leads to lower performance.
In Auxiliary Tasks, The classification consistency loss Lcc and the distribution consistency loss Ldc have a relatively small impact, with only 0.08% and 0.37% improvement, respectively. However, when Lce and Lfc use sample memory to calculate probabilities, they can bring significant improvement. We will elaborate on this phenomenon in 5.7. In addition, we observe that the focal loss Lfc brings the most significant 10.66% improvement to the model’s performance, demonstrating the importance of effectively dealing with the confusion of similar classes. Moreover, Figure 3 displays the t-SNE visualization results of the high similarity relations “father” and “mother”, which show that our focal loss significantly improves the ability of the model to distinguish similar classes in NK-CRE.

heading: 5.7 Importance of Consistency Loss
text: To demonstrate the importance of the classification consistency loss and the distribution consistency loss, we conduct an analysis experiment on FewRel’s 10-way-5-shot. Specifically, we replace the use of prototype memory with sample memory
to calculate probabilities in Lce and Lfc, which is a common prototype calculation method. In this case, we re-selected better hyperparameters and adjusted the relative weights λfc and λdc to 2 and 5, respectively. The ablation experiment is re-performed on (d) and (e) in 5.6, and the results are shown in Figure 4. The classification consistency loss and the distribution consistency loss improve by 0.73% and 2.0% respectively after T8. We think that due to the probabilities of Lce and Lfc being computed by prototype memory, the model can learn correct classifications and inter-class discrepancy, leading to a relatively small improvement from the two consistency losses. However, when using sample memory to calculate probabilities, these two consistency losses can result in significant gains.

heading: 5.8 Forgetting
text: To provide a more intuitive comparison when testing forgetting, we added two baselines as lower and upper bounds.
SeqRun serves as a lower bound, where the model is directly fine-tuned on the new task data without using past data, leading to severe catastrophic forgetting.
JointTrain serves as an upper bound, where all training data for each new task, including previously seen data, is stored in the memory.
The forgetting of each task and their average forgetting on FewRel benchmark’s 10-way-5-shot are presented in Table 3, along with the average forgetting on Fewrel’s 10-way-2-shot, and TACRED’s 5-way-5-shot in Figure 5. These results show that:
(1) The use of Prompt learning can significantly mitigate the issue of catastrophic forgetting.
(2) Compared with existing methods, our
method greatly mitigates catastrophic forgetting in continual learning, which is crucial.
(3) Observing JointTrain, we find that forgetting still exists even when all the training data is available, and our continual learning method is the closest to it among all methods.

heading: 6 Conclusion
text: 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.
Limitations
There are two limitations in this paper: (1) Compared with existing memory-based methods, the proposed prototype memory may bring additional storage space overhead. But since we only require very little additional memory (only one vector per class), we did not discuss it; (2) Although we noted that the distortion and forgetting of the prototype are highly correlated, we did not conduct a detailed analysis of the reasons for special prototypes that do not follow this pattern.

heading: Acknowledgements
text: We would like to express our gratitude to the anonymous reviewers for their valuable feedback and suggestions, which have significantly improved the quality of our work. This research is supported by the Key Support Project of NSFC-Liaoning Joint Foundation (No. U1908216) and the Major Scientific Research Project of the State Language Commission in the 13th Five-Year Plan (No. WT13538).

heading: A Appendix
text: A.1 Prototype Distortion and Forgetting To evaluate the relationship between the change of feature embeddings and the degree of forgetting, we introduce distortion and forgetting metrics for each class prototype. Distortion is calculated using the following formula:
Dr = 1 n− i n∑
j=i+1
djr (13)
djr = 1− s(ei,r, ej,r) (14) where i of ei,r means that the relation r firstly appears in task i and ei,r denotes the embedding of the relation r after task i is trained. s represents the calculation formula of cosine similarity. Dr refers to the mean value of the distortion for relation r from task i to task n.
The formula for the forgetting of the prototype is as follows:
Fr = 1 n− i n∑
j=i+1
gjr (15)
gjr = max l∈{i,··· ,j−1} al,r − aj,r (16)
where al,r represents the whole accuracy of the test set for relation r after the task l is trained, f jr represents the degree of forgetting of relation r after task j is trained, and i represents the relation r firstly appears in task i.
Based on the above formulas, we calculate the distortion and forgetting of each prototype in different methods. Considering that the order of task sequences has a relatively large impact on the change of embedding and forgetting of each class, we randomly generate 50 task sequences and show their average results. Figure 1 illustrates the correlation between the embedding distortion and the degree of forgetting in different methods.
A.2 Datasets The following is the detailed introduction of the FewRel (Han et al., 2018) and TACRED (Zhang et al., 2017) datasets.
FewRel is a few-shot relation classification dataset that was proposed by Han et al. (2018). It consists of 100 relation classes, each of which has 700 instances. The dataset is split into a training set, a validation set, and a test set, with a split of 64/16/20 fraction corresponding to each set. Following CFRL (Qin and Joty, 2022), we randomly divide the publicly accessible 80 relations from the training and validation sets into 8 tasks, each containing 10 relations (10-way). In this paper, we set
2-shot, 5-shot, and 10-shot as different few-shot settings in the NK-CRE benchmark.
TACRED is a relation extraction dataset that was proposed by Zhang et al. (2017). It contains 42 relations and over 100, 000 instances. The dataset is preprocessed by filtering out the special relation “n/a”, resulting in the remaining 41 relation classes and 68, 438 instances to construct the NK-CRE benchmark. Similar to FewRel, we divide the 41 relations into 8 tasks, with one task containing 6 relations and the others containing 5 relations (5- way). We set 5-shot and 10-shot as different fewshot settings in this paper.
A.3 Main Results with Means and Variances Table 4 shows the whole accuracy (%) and variance of different methods after training for each task on FewRel’s 10-way-5-shot. We observe that due to the strict implementation of the few-shot continual learning task, NK-CRE has a larger variance compared to CFRL. Nonetheless, the average variance of our method ConPL is still lower than that of existing methods in CFRL, indicating that our method is robust.
ACL 2023 Responsible NLP Checklist

heading: A For every submission:
text: 3 A1. Did you describe the limitations of your work?
Limitations
3 A2. Did you discuss any potential risks of your work? Limitations
3 A3. Do the abstract and introduction summarize the paper’s main claims? Abstract; 1 Introduction
7 A4. Have you used AI writing assistants when working on this paper? Left blank.
B 7 Did you use or create scientific artifacts? Left blank.
B1. Did you cite the creators of artifacts you used? No response.
B2. Did you discuss the license or terms for use and / or distribution of any artifacts? No response.
B3. Did you discuss if your use of existing artifact(s) was consistent with their intended use, provided that it was specified? For the artifacts you create, do you specify intended use and whether that is compatible with the original access conditions (in particular, derivatives of data accessed for research purposes should not be used outside of research contexts)? No response.
B4. Did you discuss the steps taken to check whether the data that was collected / used contains any information that names or uniquely identifies individual people or offensive content, and the steps taken to protect / anonymize it? No response.
B5. Did you provide documentation of the artifacts, e.g., coverage of domains, languages, and linguistic phenomena, demographic groups represented, etc.? No response.
B6. Did you report relevant statistics like the number of examples, details of train / test / dev splits, etc. for the data that you used / created? Even for commonly-used benchmark datasets, include the number of examples in train / validation / test splits, as these provide necessary context for a reader to understand experimental results. For example, small differences in accuracy on large test sets may be significant, while on small test sets they may not be. No response.
C 3 Did you run computational experiments? 5 Experiments
3 C1. Did you report the number of parameters in the models used, the total computational budget (e.g., GPU hours), and computing infrastructure used? 5.4 Training Details
The Responsible NLP Checklist used at ACL 2023 is adopted from NAACL 2022, with the addition of a question on AI writing assistance.
3 C2. Did you discuss the experimental setup, including hyperparameter search and best-found hyperparameter values? 5.4 Training Details
3 C3. Did you report descriptive statistics about your results (e.g., error bars around results, summary statistics from sets of experiments), and is it transparent whether you are reporting the max, mean, etc. or just a single run? 5.5 Main Results; 5.6 Ablation Study; 5.7 Importance of Consistency Loss; 5.8 Forgetting
3 C4. If you used existing packages (e.g., for preprocessing, for normalization, or for evaluation), did you report the implementation, model, and parameter settings used (e.g., NLTK, Spacy, ROUGE, etc.)? 5.4 Training Details
D 7 Did you use human annotators (e.g., crowdworkers) or research with human participants? Left blank.
D1. Did you report the full text of instructions given to participants, including e.g., screenshots, disclaimers of any risks to participants or annotators, etc.? No response.
D2. Did you report information about how you recruited (e.g., crowdsourcing platform, students) and paid participants, and discuss if such payment is adequate given the participants’ demographic (e.g., country of residence)? No response.
D3. Did you discuss whether and how consent was obtained from people whose data you’re using/curating? For example, if you collected data via crowdsourcing, did your instructions to crowdworkers explain how the data would be used? No response.
D4. Was the data collection protocol approved (or determined exempt) by an ethics review board? No response.
D5. Did you report the basic demographic and geographic characteristics of the annotator population that is the source of the data? No response.

heading: Future Work
text: In future research, we plan to study how to improve the domain adaptability of the model in few-shot continual relation extraction. Limitations
There are two limitations in this paper: (1) Compared with existing memory-based methods, the proposed prototype memory may bring additional storage space overhead. But since we only require very little additional memory (only one vector per class), we did not discuss it; (2) Although we noted that the distortion and forgetting of the prototype are highly correlated, we did not conduct a detailed analysis of the reasons for special prototypes that do not follow this pattern