Prototype Conditioned Generative Replay for Continual Learning in NLP (2025)

Abstract: Generative replay has proven effective in addressing the catastrophic forgetting issue of continual learning (CL) in natural language processing (NLP). However, relying on a single task-specific token or prompt often falls short in generating pseudo-samples that accurately reflect the true data distribution. This leads to issues of semantic inconsistency and scale inconsistency.To tackle these challenges, we propose a Prototype Conditioned Generative Replay (PCGR) method, which enhances generative reply by incorporating task-level statistics through a Prototype Conditioned Variational Autoencoder (PCVAE).Specifically, task-level embedding statistics are stored as prototypes for each old task. When a new task is introduced, PCVAE draws samples from task-specific prototype-based distributions to generate pseudo-samples.By incorporating the prototype, the generated pseudo-samples are both more representative and sufficiently diverse to reflect the real data distribution.Furthermore, as previously stored prototypes may become outdated due to evolving model parameters, we propose a Prototype Shift Estimation (PSE) to adjust for these changes.Experiments on NLP tasks across two different scenarios show that PCGR outperforms previous state-of-the-art (SOTA) methods.

## introduction continual learning (cl) aims at enabling models to continually acquire, accumulate, and exploit novel knowledge from a non-i.i.d. stream of tasks while retaining previously learned knowledge @xcite . in practice, however, when learning new tasks, models often encounter the notorious issue of catastrophic forgetting (cf), which refers to the model updating its parameters for the new task at the cost of forgetting previously acquired knowledge @xcite . in nlp, pre-trained large language models (lms) have demonstrated promising performance, leading to an increasing focus on integrating these models into dynamic data distributions, evolving task structures, and shifting user preferences. generative replay methods @xcite @xcite have emerged as promising approaches to tackle the problem of cf in cl. the core idea is to generate authentic pseudo-samples of previous tasks and combine them with the current training data to jointly tune the model. however, existing generative replay approaches typically rely on a single task-specific token @xcite or prompt @xcite to generate pseudo-samples. due to the limited information @xcite provided by the task-specific tokens or prompts, the generated pseudo-samples often fail to accurately reflect the real data distribution. this leads to two underlying issues: semantic inconsistency, where the pseudo-samples are not semantically aligned with the real data, causing unclear boundaries among tasks and unintended modifications of important parameters; and scale inconsistency, where the pseudo-samples lack the diversity of real data, leading the model to overfit the new task and exacerbating cf. to tackle these problems, we propose the prototype conditioned generative rehearsal method (pcgr), which employs prototype conditioned variational autoencoder (pcvae) to generate pseudo-samples that more accurately reflect the real data distribution, effectively mitigating catastrophic forgetting. drawing inspiration from class incremental learning (cil) in computer vision (cv) @xcite , which utilize prototypes @xcite , the previously saved representation statistics, to mitigate cf in feature classification tasks, we introduce the concept of prototypes into cl in nlp. prototypes, which carry rich "dark knowledge," can faithfully reflect the real data distribution, making them well-suited to address the issues of semantic and scale inconsistency in cl in nlp. in our context, to tackle the semantic and scale inconsistency issues, we define the prototype as the task-level representation mean and standard deviation. pcvae then approximates task-level data distribution by conditioning on the prototype, and utilizes samples drawn from the prototype-based gaussian distribution to guide pseudo generation. this ensures that the pseudo-samples are both representative and sufficiently diverse to accurately reflect the real data distribution. moreover, as model parameters evolve with the introduction of new tasks, the prototypes for previous tasks shift accordingly. however, due to the unavailability of previous data, recalculating these prototypes is not feasible. inspired by @xcite , which estimates representation mean drift using only the current task data, we introduce a prototype shift estimation (pse) method to compensate for the shift of previous prototypes without requiring access to prior data. in summary, our key contributions include: • we propose pcgr, which introduces the concept of prototype from cv to cl in nlp. pcgr leverages a pcvae to generate pseudo-samples that are both representative and diverse, accurately reflecting the real data distribution. this approach effectively mitigates catastrophic forgetting in continual learning. ## conclusions this paper proposes pcgr, a rehearsal method that incorporates task-level statistics to enhance generative replay. in pcgr, task-level embedding statistics are stored as prototypes for each old task. when new task comes, pcgr utilizes samples drawn from task-specific prototype-based distributions to generate pseudo-samples that are both representative and diverse enough to reflect the previous real data distribution. experiments show that pcgr achieves sota performance, demonstrates greater robustness to sequential order length compared to other baselines, and can be scaled to larger backbones.