CLIP model is an Efficient Continual Learner

Vishal Thengane, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan

TL;DR

This paper demonstrates that a frozen CLIP model, used in a zero-shot fashion, serves as an "embarrassingly simple" yet incredibly powerful baseline for continual learning. By leveraging broad pre-trained representations, it outperforms complex state-of-the-art methods across various incremental learning scenarios without any retraining, memory buffers, or parameter growth.

What Problem Does This Paper Address?

Deep neural networks are notoriously bad at learning new things over time. When trained on a sequence of tasks, they suffer from catastrophic forgetting: the process of learning new information overwrites and destroys previously acquired knowledge.

To combat this, the field of Continual Learning (CL) has developed a suite of "bells and whistles," including:

  • Memory Replay: Storing a subset of old data to "rehearse" later.
  • Knowledge Distillation: Using old model versions to teach the new one.
  • Dynamic Expansion: Growing the network architecture as new tasks arrive.

While effective, these methods are complex, require significant tuning, and often have growing memory or computational footprints. The authors of this paper ask a provocative question: Can we bypass these complexities by using a powerful, frozen foundation model?

Figure 1: Left: Traditional continual learning approaches can require memory buffers, complex hyper-parameter tuning, saving a copy of previous models and their number of classifier heads in- creases at each learning step. Right: Our goal is to design a simplistic unified model that works well across multiple continual learning settings without incurring task-wise training, dedicated mem- ory requirements and careful hyper-parameter selection. A CLIP-based continual model is shown to perform exceptionally well on a number of continual learning settings without requiring any training/fine-tuning, memory buffers or increase in model size with the growing number of tasks.

Methods

The authors propose Continual-CLIP, which is essentially a standard CLIP (Contrastive Language-Image Pre-training) model evaluated in a zero-shot manner across various CL protocols.

Unlike traditional CL models that update their weights at every new task, Continual-CLIP remains frozen. For classification, it uses the standard CLIP approach:

  1. Text Encoding: Class names are inserted into prompt templates (e.g., "a photo of a {category}") and passed through a text encoder to create "classifier heads" in the embedding space.
  2. Image Encoding: Input images are passed through an image encoder.
  3. Zero-Shot Inference: The model calculates the cosine similarity between the image embedding and all observed text embeddings. The highest similarity determines the predicted class.

Because the model is never updated, it is mathematically impossible for it to "forget" in the traditional sense. The "learning" process simply involves adding new class names to the text encoder's vocabulary as they appear in the data stream.

Datasets

The authors evaluated Continual-CLIP across four diverse CL settings (Task-Incremental, Class-Incremental, Domain-Incremental, and Task-Agnostic) using seven popular benchmarks:

  • CIFAR-100: A standard small-image dataset split into 10, 20, and 50 steps.
  • ImageNet-100 & 1K: Large-scale high-resolution image benchmarks.
  • TinyImageNet: A smaller version of ImageNet with 200 classes.
  • CORe50: Designed specifically for object recognition in changing domains.
  • CLEAR-10 & 100: Benchmarks for continual learning on real-world, time-varying imagery.
  • Gaussian scheduled CIFAR-100: Used for task-agnostic (task-free) evaluation.

Key Insights and Ideas

  • The Power of Generalization: CLIP’s massive pre-training on 400 million image-text pairs provides a representation space so robust that it can handle new tasks out-of-the-box better than specialized models can after retraining.
  • Zero-Shot as a Strong Baseline: The authors argue that zero-shot performance should be the de facto baseline for CL research. If a complex retraining method can't beat a frozen model, its practical utility is questionable.
  • Prompt Engineering Matters: The choice of text prompt affects performance. For instance, using "a bad photo of a {category}" worked better for low-resolution datasets like CIFAR-100, while "a good photo of a..." was superior for high-resolution ImageNet.
  • Scalability: As the number of tasks increases (e.g., moving from 10 steps to 50 steps on CIFAR-100), the performance gap between CLIP and traditional methods actually widens, showing that CLIP is more resilient to long-term incremental learning.

Key Results

Continual-CLIP consistently outperformed state-of-the-art (SOTA) methods like DyTox and DER, often by significant margins:

  • CIFAR-100 (50 steps): Continual-CLIP achieved 76.49% average accuracy, compared to 68.90% for the next best method (DyTox+).
  • ImageNet-1K: It reached 75.51% average accuracy, beating the SOTA by over 4.6%.
  • TinyImageNet: The model showed a massive 20.30% improvement in average accuracy over DyTox.
  • Task-Agnostic Learning: On the CORe50 dataset, CLIP achieved 66.72% accuracy, nearly doubling the performance of previous specialized encoders (39.0%).
Performance trends on CIFAR-100 across different step sizes

Limitations and Future Work

The primary limitation discussed is information leakage. Because CLIP was pre-trained on a massive, uncurated scrape of the internet, it is highly likely that it encountered images or class names from the evaluation datasets during its initial training. This makes the "zero-shot" comparison slightly unfair to models starting from scratch, though it reflects the reality of how foundation models are used in production.

Future work suggested by the authors includes:

  • Developing fast adaptation techniques to fine-tune CLIP for specific downstream tasks without losing its zero-shot robustness.
  • Rethinking CL benchmarks to account for the existence of these powerful foundational representations.

Summary updated

BibTeX
@misc{thengane2022clip,
  author = {Vishal Thengane and Salman Khan and Munawar Hayat and Fahad Shahbaz Khan},
  title = {{CLIP model is an Efficient Continual Learner}},
  year = {2022},
  eprint = {2210.03114},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.03114},
}
Figure