Class-Prototype Conditional Diffusion Model for Continual Learning with Generative Replay

Khanh Doan, Quyen Tran, Tuan Nguyen, Dinh Q. Phung, Trung LearXiv 2023

Abstract

Mitigating catastrophic forgetting is a key hurdle in continual learning. Deep Generative Replay (GR) provides techniques focused on generating samples from prior tasks to enhance the model's memory capabilities using generative AI models ranging from Generative Adversarial Networks (GANs) to the more recent Diffusion Models (DMs). A major issue is the deterioration in the quality of generated data compared to the original, as the generator continuously self-learns from its outputs. This degradation can lead to the potential risk of catastrophic forgetting (CF) occurring in the classifier. To address this, we propose the Gradient Projection Class-Prototype Conditional Diffusion Model (GPPDM), a GR-based approach for continual learning that enhances image quality in generators and thus reduces the CF in classifiers. The cornerstone of GPPDM is a learnable class prototype that captures the core characteristics of images in a given class. This prototype, integrated into the diffusion model's denoising process, ensures the generation of high-quality images of the old tasks, hence reducing the risk of CF in classifiers. Moreover, to further mitigate the CF of diffusion models, we propose a gradient projection technique tailored for the cross-attention layer of diffusion models to maximally maintain and preserve the representations of old task data in the current task as close as possible to their representations when they first arrived. Our empirical studies on diverse datasets demonstrate that our proposed method significantly outperforms existing state-of-the-art models, highlighting its satisfactory ability to preserve image quality and enhance the model's memory retention.

Introduction

In artificial intelligence, Continual Learning (CL) aims to enable neural networks to learn a sequence of tasks without losing performance on previously acquired knowledge—a challenge known as Catastrophic Forgetting (CF). Generative Replay (GR) has emerged as a powerful strategy to combat CF by training a generator to produce synthetic data from past tasks, which is then interleaved with new data during training. However, as the generator iteratively learns from its own synthetic outputs, it often suffers from a "quality death spiral," where generated images become increasingly degraded, leading to a breakdown in the classifier's memory.

The Challenge of Generative Replay

While Diffusion Models (DMs) offer superior image generation capabilities compared to GANs, they are not immune to forgetting. In a continual learning setting, as a DM learns Task $t$, its ability to generate high-fidelity samples for Task $t-1$ often diminishes. This "meta-forgetting" means that the replayed data used to train the classifier becomes noisier over time. For instance, a model trained on "Apples" and then "Oranges" might eventually generate blurry red blobs instead of recognizable fruit. This degradation directly impacts the classifier's ability to maintain sharp decision boundaries for old tasks.

Proposed Methodology: GPPDM

To address these issues, the Gradient Projection Class-Prototype Conditional Diffusion Model (GPPDM) introduces two key innovations: learnable class prototypes and a specialized gradient projection technique.

Learnable Class-Prototypes

Instead of relying solely on discrete class labels, GPPDM utilizes a learnable "prototype" for each class. These prototypes are initialized using the image that the current classifier identifies with the highest confidence. By acting as a reserved information channel, these prototypes capture the abstract, core characteristics of a class. This guidance during the denoising process ensures that the generated images remain sharp and representative of the original task data, even after multiple subsequent tasks.

Gradient Projection for Cross-Attention

To further stabilize the diffusion model, the authors employ Gradient Projection Memory (GPM). This technique ensures that weight updates for new tasks are orthogonal to the subspaces spanned by previous tasks, preventing the overwriting of old knowledge. Recognizing the computational intensity of applying GPM to all layers of a U-Net, GPPDM focuses specifically on the cross-attention layers. These layers are the "knowledge hub" where class-specific information (prototypes) is mapped to image features. Protecting these layers provides a balance between preserving old memories and allowing for the acquisition of new information.

Overview of the GPPDM architecture, highlighting the gradient projection subspace (B) and the U-Net cross-attention mechanism with class prototypes (C).

Experimental Evaluation

GPPDM was evaluated across four diverse benchmarks: CIFAR-100, ImageNet, CUB-200 (fine-grained bird classification), and CORe50 (real-world object recognition). These datasets test the model's scalability and its ability to handle subtle class differences and environmental variations.

Results

The empirical results demonstrate that GPPDM significantly outperforms the previous state-of-the-art, Deep Diffusion Generative Replay (DDGR).

  • Accuracy and Forgetting: On CIFAR-100 using an AlexNet backbone, GPPDM achieved an average accuracy of 76.35%, a substantial improvement over DDGR's 59.20%. Furthermore, the average forgetting rate on ImageNet was reduced from 7.82% to 4.40%.
  • Image Quality: Quantitative metrics like Fréchet Inception Distance (FID) confirm that GPPDM maintains superior image quality over long task sequences. Visual evidence shows that while baseline methods produce increasingly unrecognizable samples, GPPDM's generated images remain sharp and distinct.
Comparison of image generation quality over sequential tasks between GPPDM and the baseline DDGR.

Conclusion

GPPDM addresses the fundamental weakness of generative replay in diffusion models by anchoring class representations through learnable prototypes and protecting critical weights via gradient projection. By breaking the "quality death spiral," GPPDM enables more robust and long-term continual learning. Future research may focus on extending this framework to boundary-free learning scenarios and further optimizing the computational efficiency of the gradient projection steps.

Summary updated

BibTeX
@misc{doan2023class,
  author = {Khanh Doan and Quyen Tran and Tuan Nguyen and Dinh Q. Phung and Trung Le},
  title = {{Class-Prototype Conditional Diffusion Model for Continual Learning with Generative Replay}},
  year = {2023},
  eprint = {2312.06710},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.06710},
}
Figure