Learning Prompt with Distribution-Based Feature Replay for Few-Shot Class-Incremental Learning

Zitong Huang, Ze Chen, Zhixing Chen, Erjin Zhou, Xinxing Xu, Rick Siow Mong Goh, Yong Liu, Wangmeng Zuo, Chunmei Feng

TL;DR

LP-DiF leverages the power of pre-trained vision-language models (CLIP) to solve Few-Shot Class-Incremental Learning (FSCIL) by combining prompt tuning with a novel distribution-based feature replay. By estimating class-specific Gaussian distributions using both real and VAE-synthesized features, the model learns new classes from just a few examples while effectively resisting the "catastrophic forgetting" of old ones.

What Problem Does This Paper Address?

Few-Shot Class-Incremental Learning (FSCIL) is a challenging subset of machine learning where a model must continuously learn new categories from very limited data (e.g., only 5 images per class) without losing its ability to recognize previously learned categories.

This presents a classic "stability-plasticity" dilemma:

  1. Plasticity: The model needs to be flexible enough to learn new things from tiny datasets.
  2. Stability: The model must remain stable enough to not overwrite its existing knowledge (catastrophic forgetting).

Traditional methods rely on pure vision backbones (like ResNet) and often struggle to balance these two needs, leading to significant performance drops as more classes are added.

Methods

The authors propose LP-DiF (Learning Prompt with Distribution-based Feature replay). The framework consists of three main pillars:

  1. Vision-Language Foundation: Instead of training a vision model from scratch, they use CLIP. They found that CLIP’s zero-shot capabilities alone significantly outperform existing state-of-the-art FSCIL methods.
  2. Prompt Tuning: Rather than fine-tuning the massive CLIP model (which would lead to overfitting on the few-shot data), they optimize a small set of learnable "prompt" vectors that are prepended to the class names in the text encoder. This allows the model to adapt to specific session knowledge efficiently.
  3. Distribution-Based Feature Replay: To prevent forgetting, the model "replays" old knowledge. However, instead of storing actual images (which is memory-intensive), they represent each old class as a Gaussian distribution (mean and diagonal covariance).
  4. VAE Enhancement: Because 5 images aren't enough to accurately estimate a distribution, they use a Variational Autoencoder (VAE) to synthesize additional features based on the available images and text descriptions.
  5. Joint Optimization: When learning new classes, the model samples "pseudo-features" from the stored distributions of old classes and trains the prompts on a mix of real new data and replayed old data.
Fig. 2. Overview of our proposed LP-DiF. (a) In each session, we first train a VAE [27], [47] comprised of the V-L model and lightweight components, i.e., MLPs and learnable prompt, based on few training data and textual information of this session. (b) We preserve the knowledge of each class by estimating their feature-level statistical distribution. The mean vector and diagonal covariance matrix of the distribution are estimated by both the features of real images and the synthesized features from trained VAE. (c) Prompt is trained jointly with the combination of the real image of the current session and the pseudo-features sampled from old-class distributions.

Datasets

The authors evaluated their method on three standard benchmarks and introduced two new, more difficult ones:

  • Standard: CIFAR-100, mini-ImageNet, and CUB-200 (birds).
  • SUN-397: A large-scale scene understanding dataset used here to test performance over many incremental sessions (20 sessions).
  • CUB-200*: A variant of the bird dataset that excludes a large "base" training session, testing the model's ability to learn incrementally from scratch.

Key Insights and Ideas

  • CLIP is a "Cheat Code" for FSCIL: The most striking finding is that CLIP in zero-shot mode (no incremental training at all) achieves ~77.6% accuracy on mini-ImageNet, whereas previous specialized SOTA methods were struggling around 61-67%.
  • Feature Distributions are Gaussian: The authors empirically observed that image features extracted by CLIP for a specific class tend to follow a Gaussian distribution across different dimensions. This justifies using simple means and covariances for replay.
Fig. 3. Histogram visualization of the statistical distribution of image features. We take the image features with different dimensions (dim) of classes c1 and c2 as example selected from the mini-ImageNet [35] benchmark by the image encoder of CLIP (ViT-B/16) [32]. Each sub-figure shows the distribution with histogram of corresponding random variable Zcd, where c and d denotes the index of class and feature dimension respectively. Obviously, 1) each dimension of the image features per class approximates Gaussian distribution; 2) distributions of same dimension vary in different classes, e.g., Zc11 vs. Zc21 .
  • VAE as a Data Augmentor for Statistics: The VAE doesn't just generate "more data"; it helps provide a more robust statistical estimate of what a class "looks like" in feature space when you only have a handful of real samples.
  • Prompt Tuning > Linear Classifiers: The paper shows that tuning the input prompts to the text encoder is more effective for incremental learning than simply training a new linear classification layer on top of the image encoder.

Key Results

LP-DiF sets a new state-of-the-art across all tested benchmarks. On the mini-ImageNet 5-shot benchmark:

  • LP-DiF achieved 93.76% average accuracy, a massive jump from the previous vision-based SOTA (BiDistFSCIL at 62.06%).
  • It is remarkably close to the theoretical upper bound (94.81%), which assumes the model has access to all data from all sessions at once.
  • Storage Efficiency: Compared to methods like iCaRL that store image exemplars (requiring ~74 MB), LP-DiF only needs to store distribution parameters, taking up a mere 0.22 MB for the same task.
Fig. 1. Comparison of FSCIL methods in terms of Average Accuracy (%) on the test set of mini-ImageNet benchmark [35] under 5-shot setting. Red-highlighted bars indicate SOTA vision-based models (e.g., CNN [20]), while orange highlights show V-L pretrained models enhancing FSCIL, significantly outperforming those vision-based counterparts. Our method, marked in green, achieves 93.76%, surpassing CLIP+BDF by 9.13%, and comparable to the theoretical upper bound (UB) that highlights in blue achieved through learning prompt in joint-training manner.

Limitations and Future Work

  • Backbone Size: LP-DiF relies on CLIP (ViT-B/16), which is computationally heavier than the ResNet-18 backbones used in older FSCIL research. While training is fast because only prompts are tuned, inference requires a large model.
  • Text Dependency: The method requires class names to function (for the text encoder). In scenarios where classes are anonymous or lack meaningful labels, the performance might degrade.
  • Future Directions: The authors suggest exploring how to further reduce the gap between incremental learning and joint training, perhaps by exploring more complex distribution modeling beyond diagonal Gaussians.

Summary updated

BibTeX
@misc{huang2024learning,
  author = {Zitong Huang and Ze Chen and Zhixing Chen and Erjin Zhou and Xinxing Xu and Rick Siow Mong Goh and Yong Liu and Wangmeng Zuo and Chunmei Feng},
  title = {{Learning Prompt with Distribution-Based Feature Replay for Few-Shot Class-Incremental Learning}},
  year = {2024},
  eprint = {2401.01598},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.01598},
}
Figure