Skip to content
LAMDA-CLPublic

About

[CLS] and [EOS] Tokens are not Enough for CLIP-based Class-Incremental Learning (IEEE TMM 2026)

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

[CLS] and [EOS] Tokens are not Enough for CLIP-based Class-Incremental Learning

Hao Sun1  Tao Hu1  Shixiong Kai2  Siyuan Xu2  Wenqian Zhao2  Mingxuan Yuan2  Da-Wei Zhou1
1School of Artificial Intelligence and State Key Laboratory for Novel Software Technology, Nanjing University
2Huawei Noah's Ark Lab

The official PyTorch implementation of [CLS] and [EOS] Tokens are not Enough for CLIP-based Class-Incremental Learning.

If you find this repository useful in your research, please consider citing our paper:

@article{Sun26pace,
  author       = {Hao Sun and Tao Hu and Shixiong Kai and Siyuan Xu and Wenqian Zhao and Mingxuan Yuan and Da-Wei Zhou},
  title        = {[CLS] and [EOS] Tokens are not Enough for CLIP-based Class-Incremental Learning},
  journal      = {IEEE Transactions on Multimedia},
  year         = {2026},
}

📢 Updates

[10/2026] Accepted to TMM 2026.

[11/2026] Code has been released.

📝 Introduction

Class-Incremental Learning (CIL) aims to empower models to continuously acquire new knowledge while mitigating catastrophic forgetting. With the advent of vision-language models like CLIP, leveraging their cross-modal alignment capabilities to address CIL challenges has emerged as a dominant paradigm. Existing methods leverage CLIP's global representations (i.e., the visual [CLS] token and the textual [EOS] token) for cross-modal alignment. While achieving effective classification, they overlook the rich patch-level visual features and token-level textual semantics inherent in CLIP. For example, the [CLS] token aggregates local information to capture the general concept of "cat", while the patch-level details retain specific localized features essential for recognition, such as the tail, fur, and face. We propose PACE (PAtch-token Cross-modal Enhancement) to uncover the long-neglected local representations within CLIP. First, based on the global representations like [CLS] token and [EOS] token, we identify the top-k most crucial visual patches and textual tokens. Subsequently, to better utilize the extracted key local features, we design a cross-modal fusion module. This module leverages local textual semantics to refine visual representations, while augmenting textual semantics with local visual features. As the fusion module is shared across all tasks, directly fine-tuning it on new tasks would interfere with the knowledge learned from previous tasks, leading to catastrophic forgetting. To alleviate this, we employ a projection-based update strategy to effectively preserve the critical parameter space of previous tasks during the adaptation to new tasks. Extensive experiments demonstrate that PACE significantly outperforms state-of-the-art methods across multiple CIL benchmarks.

🔧 Requirements

Environment

1 torch 1.13.0

2 torchvision 0.15.0

3 open-clip 2.30.0

Dataset

We provide the processed datasets as follows:

  • CIFAR100: will be automatically downloaded by the code.
  • CUB200: Google Drive: link or OneDrive link
  • ImageNet-R: Google Drive: link or Onedrive: link
  • ObjectNet: Onedrive: link You can also refer to the filelist and processing code if the file is too large to download.
  • Cars: Google Drive: link or OneDrive: link
  • UCF: Google Drive: link or OneDrive: link
  • Aircraft: Google Drive: link or OneDrive: link
  • Food: Google Drive: link or OneDrive: link
  • SUN: OneDrive: link

These subsets are sampled from the original datasets. Please note that I do not have the right to distribute these datasets. If the distribution violates the license, I shall provide the filenames instead.

Set DATA_ROOT_PATH in utils/data.py to your dataset directory; its default is data/ relative to the repository root. The prepared layout is:

data/
├── cifar100/
│   └── cifar-100-python/
│       ├── train
│       ├── test
│       └── meta
├── aircraft/{train,test}/
├── cars/{train,test}/
├── cub/{train,test}/
├── food101/{train,test}/
├── imagenet-r/{train,test}/
├── objectnet/{train,test}/
├── sun/{train,test}/
└── ucf/{train,test}/

💡 Running scripts

To prepare your JSON files, refer to the settings in the exps folder and run the following command. All main experiments from the paper are already provided in the exps folder, you can simply execute them to reproduce the results found in the logs folder.

python main.py --config ./exps/[configname].json

🎈 Acknowledgements

This implementation builds on CIL_Survey, PyCIL, C3Box, and OpenCLIP.

💭 Correspondence

If you have any questions, please contact me via email.

About

[CLS] and [EOS] Tokens are not Enough for CLIP-based Class-Incremental Learning (IEEE TMM 2026)

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages