CAPrompt: Cyclic Prompt Aggregation for Pre-Trained Model Based Class Incremental Learning

Qiwei Li, Jiahuan Zhou

TL;DR

CAPrompt introduces a novel prompt aggregation strategy for Class Incremental Learning (CIL) that eliminates the error-prone step of predicting discrete task IDs during inference. By cyclically refining a weighted sum of learned prompts under explicit geometric constraints, it guarantees lower prediction error and achieves state-of-the-art performance while mitigating catastrophic forgetting.

What Problem Does This Paper Address?

Class Incremental Learning (CIL) requires machine learning models to learn new tasks sequentially from a continuous stream of data without forgetting previously acquired knowledge—a challenge known as catastrophic forgetting.

Recent state-of-the-art methods address this by freezing a large pre-trained model (like a Vision Transformer) and tuning small, task-specific parameters called prompts. During inference, these methods typically use a two-stage approach: first, they predict which task the input belongs to (Task ID prediction) via query-key matching, and second, they select and apply that specific prompt.

The fatal flaw here is prompt inconsistency. If the model mispredicts the Task ID in the first stage, it applies the wrong prompt in the second stage, leading to a massive drop in accuracy. Furthermore, standard task selection mechanisms rely solely on the unprompted pre-trained model, completely ignoring the rich knowledge already embedded within the learned prompts themselves.

Comparison between existing prompt selection methods and the proposed prompt aggregation method.

Methods

To solve the prompt inconsistency problem, the authors propose CAPrompt (Cyclic Prompt Aggregation), which replaces hard prompt selection with soft prompt aggregation.

The core architecture consists of three main pillars:

  1. Prompt Aggregation: Instead of picking a single task prompt, CAPrompt calculates a weighted sum of all learned prompts based on task similarity probabilities. This ensures that even if a task prediction is uncertain, relevant knowledge from multiple prompts is blended together continuously.
  2. Geometric Constraints ($L_{con}$ and $L_l$): The authors prove theoretically that an aggregated prompt yields a lower expected error than a single prompt if the prediction function is concave with respect to the prompt parameters. To enforce this condition, they introduce two novel losses during training:
  3. Concave Constraint ($L_{con}$): Directly penalizes violations of the concavity condition in the prompt parameter space.
  4. Linear Constraint ($L_l$): Forces the prompts of different tasks to align in a linear direction, restricting the parameter space and making the concavity condition much easier for the model to satisfy.
  5. Cyclic Prompt Weight Strategy: Rather than relying on a single, unprompted forward pass to determine task weights, CAPrompt uses an iterative refinement loop. It initializes prompt weights equally, generates an initial aggregated prompt, computes updated task probabilities through a forward pass, and uses these refined probabilities as weights for the next cycle.
Figure 2: The overall pipeline of our proposed CAPrompt. To overcome the inconsistency of prompts between the training phase (a) and inference phase (b), a prompt aggregation strategy is proposed. The concave and linear constraints are proposed to guarantee the prediction error of the aggregated prompt is the lower bound of using one task-specific prompt. Then, to make full use of prompts in predicting weight for prompt aggregation, we propose a cyclic prompt weight that we initiate the prompt with equal weight and cyclically predict the prompt weight. This strategy can be conducted cyclically many times to further improve performance.

Datasets

The authors evaluated CAPrompt on three widely accepted computer vision benchmarks, each split into 10 sequential tasks with disjoint classes:

  • CIFAR-100: 100 classes of general images.
  • ImageNet-R: 200 classes containing various artistic renditions, cartoons, and graffiti of ImageNet categories.
  • CUB200: A fine-grained dataset containing 200 bird species.

Key Insights and Ideas

  • Soft Aggregation > Hard Selection: Moving from discrete task selection to continuous aggregation removes the "performance cliff" caused by incorrect task ID predictions.
  • Leveraging Jensen's Inequality: The paper provides a solid theoretical foundation showing that if you can bound your model's loss surface to be concave relative to your prompts, an aggregated prompt mathematically guarantees a lower bound on expected error compared to task-specific selection.
  • Cyclic Refinement: Prompts shouldn't just be passive tools for final classification; they can be used iteratively to improve the model's own understanding of which prompt weights to apply.

Key Results

CAPrompt consistently outperformed existing state-of-the-art prompt-tuning methods (such as HiDe-Prompt, DualPrompt, and CODA-Prompt) across all datasets:

  • Final Accuracy (ACC): Achieved 95.52% on CIFAR-100, 79.93% on ImageNet-R, and 88.99% on CUB200, representing a absolute performance gain of 2% to 3% over the next-best methods.
  • Average Forgetting (AF): Drastically reduced forgetting, scoring an AF of just 1.76% on CIFAR-100 and 1.46% on CUB200.
  • Robustness to Pre-training: CAPrompt maintained its performance edge even when paired with self-supervised backbones like iBOT and DINO-1k, proving it does not strictly rely on supervised pre-training representations.
  • Benefits of Multiple Cycles: Iterating the cyclic weight prediction beyond the default 2 passes yielded an additional 1.5% to 2% accuracy boost.

Limitations and Future Work

While CAPrompt delivers impressive accuracy gains, the authors note a few trade-offs:

  • Computational Overhead: Running multiple cycles during inference requires multiple forward passes. Although a 2-cycle setup matches the computational cost of standard two-pass query-key matching methods, scaling to more cycles increases latency.
  • Classification Head Forgetting: While prompt aggregation perfectly preserves feature extraction capabilities, the final classification head still experiences minor forgetting, requiring a simple feature-replay mechanism to stabilize.

Future work could explore optimizing the cyclic mechanism to achieve the benefits of multiple iterations within a single, highly efficient forward pass.

Summary updated

BibTeX
@inproceedings{li2025caprompt,
  author = {Qiwei Li and Jiahuan Zhou},
  title = {{CAPrompt: Cyclic Prompt Aggregation for Pre-Trained Model Based Class Incremental Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i17.34027},
}
Figure