arXiv(opens in a new tab)Computer ScienceNov 2023

Manuscript Offprint

arXiv:2311.14028

Continual Learning of Diffusion Models with Generative Distillation

Sergi Masip, Pau Rodríguez, T. Tuytelaars, Gido M. van de Ven

Abstract

Diffusion models are powerful generative models that achieve state-of-the-art performance in image synthesis. However, training them demands substantial amounts of data and computational resources. Continual learning would allow for incrementally learning new tasks and accumulating knowledge, thus enabling the reuse of trained models for further learning. One potentially suitable continual learning approach is generative replay, where a copy of a generative model trained on previous tasks produces synthetic data that are interleaved with data from the current task. However, standard generative replay applied to diffusion models results in a catastrophic loss in denoising capabilities. In this paper, we propose generative distillation, an approach that distils the entire reverse process of a diffusion model. We demonstrate that our approach substantially improves the continual learning performance of generative replay with only a modest increase in the computational costs.

1 Introduction

Diffusion models for likelihood-based data generation (Song & Ermon, 2019; Ho et al., 2020; Song et al., 2020b) have shown impressive results in tasks such as conditional and unconditional image generation. However, a disadvantage of these models is that they must be trained on vast datasets while using large amounts of computational resources, making their training very costly. Furthermore, once a diffusion model has been trained, incorporating new knowledge incrementally is challenging as the performance on previously learned tasks severely decreases when trained on new tasks. This phenomenon is known as catastrophic forgetting (McCloskey & Cohen, 1989; Ratcliff, 1990) and it is common when training neural networks in a sequential manner (De Lange et al., 2022). For this reason, deep learning practitioners typically retrain their models using all the data seen so far each time they incorporate new data. Especially for diffusion models, this is an extremely costly process. It would therefore be valuable to devise a way to leverage already trained diffusion models more efficiently and allow them to continuously expand their knowledge.

The continual learning field studies how to mitigate catastrophic forgetting to enable neural networks to incrementally learn new tasks, domains or classes while retaining previous knowledge (van de Ven et al., 2022). Among the existing approaches for continual learning, rehearsal methods, which store a fixed replay buffer of samples from previous tasks, have shown promising initial results for diffusion models (Zając et al., 2023). However, previous data are sometimes unavailable or their use might be undesirable or even infeasible (e.g., due to privacy policies or computational cost). An alternative is generative replay (Shin et al., 2017), where the replay buffer is replaced with a generative model that produces synthetic samples. Previous works (Zając et al., 2023; Gao & Liu, 2023) that used generative replay for continually training diffusion models employed the original sampler from “Denoising Diffusion Probabilistic Models” (DDPM) (Ho et al., 2020) to generate the synthetic samples.

An important limitation of DDPM is that its generation times are prohibitively slow. This restriction forced Zając et al. (2023) and Gao & Liu (2023) to generate a fixed buffer of synthetic samples, thereby limiting the diversity advantage that diffusion models could offer. An alternative solution is to employ the sampler introduced in “Denoising Implicit Probabilistic Models” (DDIM) (Song et al., 2020a), which allows for much faster generation in exchange for a small reduction in image quality, enabling generative replay to use a considerably larger amount of samples. Nonetheless, we find that generative replay with the approximate samples yielded by DDIM results in a fast decrease in image quality, which seems to be due to a catastrophic loss in the model’s ability to denoise images from previous tasks. Previous works have observed severe forgetting with generative replay for diffusion models also when using DDPM (Smith et al., 2023; Gao & Liu, 2023). We hypothesize that the reason for this is that, in the case of diffusion models, the transfer of knowledge in standard generative replay is rather inefficient. As illustrated in Figure 1a, when training on a new task, standard generative replay transfers knowledge from the previous task model to the current task model only at the endpoint of the reverse process of the diffusion model (i.e., through the generated replay samples).

To improve generative replay for diffusion models, in this paper we propose to transfer knowledge more effectively by combining generative replay with knowledge distillation. This approach, which we call generative distillation, distils the entire reverse process of a teacher diffusion model trained on previous tasks to the student model being trained on the current task. The teacher generates a sample with DDIM, then Gaussian noise is added according to the variance schedule (Ho et al., 2020) and, finally, the objective matches the noise predictions of both the teacher and the student (Figure 1b). We conduct experiments on Fashion-MNIST (Xiao et al., 2017) and CIFAR-10 (Krizhevsky, 2009) where we continually train a diffusion model with generative distillation and demonstrate its effectiveness compared to generative replay at mitigating forgetting and the catastrophic loss in denoising capabilities, while increasing the computational cost by just one forward pass.

The main contributions of this paper can be summarized as follows:

  • We show that continually training diffusion models using standard generative replay with DDIM results in a catastrophic loss in denoising capabilities (Section 4.1).
  • To mitigate this issue, we introduce generative distillation, an approach that combines generative replay with knowledge distillation (Section 3.2).
  • We demonstrate that generative distillation mitigates the loss in denoising capabilities and substantially improves upon generative replay, while using almost the same computational budget (Section 4.2).
  • We further highlight the effectiveness of distillation for the continual training of diffusion models in additional experiments by applying it to input images of various quality, including Gaussian noise (Section 4.3).

References (42)