DualPrompt: Complementary Prompting for Rehearsal-free Continual Learning

Zifeng Wang, Zizhao Zhang, Sayna Ebrahimi, Ruoxi Sun, Han Zhang, Chen-Yu Lee, Xiaoqi Ren, Guolong Su, Vincent Perot, Jennifer Dy, Tomas Pfister

TL;DR

DualPrompt is a breakthrough rehearsal-free continual learning framework that enables pre-trained models to learn a sequence of tasks without storing any past data. By decoupling learnable "prompts" into task-invariant and task-specific spaces, it achieves state-of-the-art performance while adding less than 1% additional parameters.

What Problem Does This Paper Address?

The "holy grail" of continual learning (CL) is a model that can learn new tasks sequentially without forgetting previous ones—a phenomenon known as catastrophic forgetting.

Currently, the best-performing methods rely on a "rehearsal buffer" to store and replay actual images from past tasks. However, this approach is often a non-starter in the real world due to strict memory constraints or data privacy regulations (e.g., healthcare or personal devices). While recent prompt-based methods like L2P tried to solve this by using a "prompt pool," they failed to distinguish between features shared across all tasks and those unique to a specific task. DualPrompt addresses this gap by explicitly modeling these two types of knowledge.

Methods

DualPrompt builds on a frozen, pre-trained Vision Transformer (ViT) backbone. Instead of fine-tuning the massive backbone, it learns a tiny set of parameters called prompts that "instruct" the model on how to process new data.

The core innovation is the use of two complementary prompt spaces:

  1. G-Prompt (General): A single set of prompts shared across all tasks to capture task-invariant knowledge (e.g., basic shapes or textures common to all objects).
  2. E-Prompt (Expert): A pool of task-specific prompts. During training, the model learns a unique E-Prompt for each task. At test time, a query mechanism matches the input image to the most relevant "expert" prompt.
Fig. 2: Overview of DualPrompt. Left: At test time, an input is transformed by a query function to match the closest task key kt and the corresponding E-Prompt et. Then the shared G(eneral)-Prompt g and the matched E(xpert)-Prompt et are attached to multiple MSA layers of a pre-trained transformer. At training time, the E-Prompt is selected by task identity and the selected E-Prompt and G-Prompt are trained together with the classifier. Right: A prompting function is illustrated where the G-prompt is split equally and attached to the key and value replicas of the hidden feature (see Section 4.2) before passing them to the preceding MSA layer.

Technically, the authors utilize Prefix Tuning, where prompts are split into key-value pairs and prepended to the Multi-Head Self-Attention (MSA) layers. This is more efficient than standard prompt tuning because it doesn't increase the sequence length as data moves through the model.

Datasets

The authors evaluate DualPrompt on several benchmarks:

  • Split CIFAR-100: The standard CL benchmark divided into 10 tasks.
  • Split ImageNet-R (New): A more challenging benchmark introduced in this paper. It contains 200 classes with significant intra-class diversity (e.g., different artistic styles like cartoons or origami), making it much harder for rehearsal-based methods to represent past tasks with just a few stored images.
  • 5-datasets: A collection of diverse datasets including MNIST, SVHN, and Fashion-MNIST.

Key Insights and Ideas

  • The "Where" Matters: One of the most significant findings is that the position of prompts in the transformer hierarchy is crucial. The authors discovered that G-Prompts perform best at shallower layers (capturing general features), while E-Prompts are most effective at deeper layers (capturing task-specific details).
  • CLS Theory in Action: The design is inspired by the Complementary Learning Systems (CLS) theory of the human brain, which suggests a synergy between the neocortex (slowly learning generalities) and the hippocampus (rapidly learning specifics).
  • Robustness to Errors: Interestingly, DualPrompt is robust to "query errors." Even if the model picks the wrong E-Prompt at test time, the shared G-Prompt provides enough general instruction to maintain high accuracy.
  • Extreme Efficiency: DualPrompt adds only ~0.55% additional parameters and requires zero rehearsal buffer, yet it outperforms models using thousands of stored images.

Key Results

DualPrompt consistently sets a new state-of-the-art for rehearsal-free class-incremental learning:

  • Superior Accuracy: On Split ImageNet-R, DualPrompt achieved 68.13% average accuracy, significantly outperforming the previous best prompt-based method, L2P (61.57%).
  • Beating Rehearsal: Remarkably, DualPrompt outperformed rehearsal-based methods like DER++ even when those methods were given a buffer of 1,000 images.
  • Minimal Forgetting: The "forgetting" rate was slashed to just 4.68% on ImageNet-R, compared to nearly 10% for L2P and over 30% for standard rehearsal methods with small buffers.
Fig. 1: The average accuracy comparison on Split ImageNet-R, suggesting that the accuracy degradation is significant for representative rehearsal-based methods like DER++ [4] and ER [8] when buffer size shrinks. Notably, they require a large rehearsal buffer (5000 images ≈20% of the whole training set) to close the gap to our method. In contrast, GDumb [47] matches their result by training only on the i.i.d sampled buffer, without continual learning. The additional parameters size required by DualPrompt is only about the bytes of one 224×224 RGB image. See Experiments section for discussion on compared methods.

Limitations and Future Work

  • Backbone Dependency: DualPrompt relies on a strong, pre-trained backbone (like ViT trained on ImageNet-21k). Its performance on tasks very far outside the pre-training distribution remains an open question.
  • Heuristic Search: The optimal layers for attaching prompts were found via heuristic search. The authors suggest that automated architecture search for prompt positioning could be a fruitful future direction.
  • Query Mechanism: While robust, the query mechanism for selecting E-Prompts at test time is a potential bottleneck for scaling to hundreds or thousands of tasks.

Summary updated

Abstract

Continual learning aims to enable a single model to learn a sequence of tasks without catastrophic forgetting. Top-performing methods usually require a rehearsal buffer to store past pristine examples for experience replay, which, however, limits their practical value due to privacy and memory constraints. In this work, we present a simple yet effective framework, DualPrompt, which learns a tiny set of parameters, called prompts, to properly instruct a pre-trained model to learn tasks arriving sequentially without buffering past examples. DualPrompt presents a novel approach to attach complementary prompts to the pre-trained backbone, and then formulates the objective as learning task-invariant and task-specific "instructions". With extensive experimental validation, DualPrompt consistently sets state-of-the-art performance under the challenging class-incremental setting. In particular, DualPrompt outperforms recent advanced continual learning methods with relatively large buffer sizes. We also introduce a more challenging benchmark, Split ImageNet-R, to help generalize rehearsal-free continual learning research. Source code is available at https://github.com/google-research/l2p.
BibTeX
@inproceedings{wang2022dualprompt,
  author = {Zifeng Wang and Zizhao Zhang and Sayna Ebrahimi and Ruoxi Sun and Han Zhang and Chen-Yu Lee and Xiaoqi Ren and Guolong Su and Vincent Perot and Jennifer Dy and Tomas Pfister},
  title = {{DualPrompt: Complementary Prompting for Rehearsal-free Continual Learning}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-19809-0\_36},
}
Figure