One-Prompt Strikes Back: Sparse Mixture of Experts for Prompt-based Continual Learning (ICLR 2026)

March 29, 2026 ยท View on GitHub

License: MIT Paper Code Conference

Official PyTorch implementation of the ICLR 2026 paper.

Poster

๐Ÿ“– Abstract

Prompt-based methods have recently gained prominence in Continual Learning (CL) due to their strong performance and memory efficiency. However, existing methods face a dilemma: Task-specific prompts incur high computational overhead and linear memory scaling, while Shared prompts suffer from knowledge interference and degraded performance.

To reconcile this trade-off, we propose SMoPE, a novel framework that integrates the benefits of both strategies. Inspired by the relationship between Prefix Tuning and Mixture of Experts (MoE), SMoPE organizes a shared prompt into multiple "prompt experts" within a sparse MoE architecture.

Key Contributions:

  • ๐Ÿง  Sparse Activation: Introduces a prompt-attention score aggregation mechanism to dynamically activate only a subset of relevant experts, effectively mitigating interference.
  • โš–๏ธ Adaptive Noise: A mechanism to encourage balanced expert utilization while preserving knowledge from prior tasks.
  • ๐Ÿ”‘ Prototype-based Loss: Leverages prefix keys as implicit memory representations to enhance expert specialization.

Extensive experiments demonstrate that SMoPE consistently outperforms task-specific methods and competes with state-of-the-art approaches while significantly reducing parameter counts and computational costs.

Model Architecture

๐Ÿ“Œ Table of Contents

๐Ÿ› ๏ธ Requirements

We recommend using Anaconda to manage the environment.

  1. Create environment:

    conda create -n smope python=3.8
    conda activate smope
    
  2. Install dependencies:

    # Install PyTorch and core libraries
    pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118
    
    # Install other requirements
    pip install timm==0.9.12 scikit-learn==1.3.2 numpy pyaml pillow opencv-python pandas openpyxl
    

    Alternatively, you can use the provided file:

    pip install -r requirements.txt
    

๐Ÿ“‚ Data Preparation

Please organize your project directory as follows. You will need to create data/ and pretrained/ directories.

1. Datasets (data/)

Download and extract the following datasets into the data/ folder:

2. Pre-trained Checkpoints (pretrained/)

Download the ViT backbones and place them in pretrained/:

๐Ÿ“‚ Project Structure

This is the expected folder structure after setting up the data and environment:

SMoPE/
โ”œโ”€โ”€ configs/                     # Configuration files for different datasets
โ”‚   โ”œโ”€โ”€ cifar-100_prompt_smope.yaml
โ”‚   โ”œโ”€โ”€ cub-200_prompt_smope.yaml
โ”‚   โ”œโ”€โ”€ imnet-r_prompt_smope.yaml
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ data/                        # Dataset storage
โ”‚   โ”œโ”€โ”€ cifar-100-python/
โ”‚   โ”œโ”€โ”€ imagenet-r/
โ”‚   โ””โ”€โ”€ CUB_200_2011/
โ”œโ”€โ”€ dataloaders/                 # Data loading logic and splits
โ”‚   โ”œโ”€โ”€ splits/
โ”‚   โ”œโ”€โ”€ dataloader.py
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ experiments/                 # Shell scripts to run training
โ”‚   โ”œโ”€โ”€ cifar-100.sh
โ”‚   โ”œโ”€โ”€ cub-200.sh
โ”‚   โ””โ”€โ”€ imagenet-r_all.sh
โ”œโ”€โ”€ figures/                     # Images for README
โ”œโ”€โ”€ learners/                    # Training logic & prompt definitions
โ”‚   โ”œโ”€โ”€ default.py
โ”‚   โ””โ”€โ”€ prompt.py
โ”œโ”€โ”€ models/                      # ViT Backbone
โ”œโ”€โ”€ pretrained/                  # Pre-trained ViT weights
โ”œโ”€โ”€ utils/                       # Metrics and helper functions
โ”œโ”€โ”€ run.py                       # Entry point for single runs
โ”œโ”€โ”€ trainer.py                   # Main training loop
โ””โ”€โ”€ requirements.txt

๐Ÿš€ Running Experiments

We evaluate our approach on standard CL benchmarks. The scripts are configured for 1 GPU.

The main entry point is the shell scripts located in experiments/, which utilize run.py and the configurations in configs/.

DatasetCommand
CIFAR-100sh experiments/cifar-100.sh
ImageNet-Rsh experiments/imagenet-r_all.sh
CUB-200sh experiments/cub-200.sh

Note: Results (logs, checkpoints, and excel sheets) will be automatically saved to a folder named outputs/.

๐Ÿค Acknowledgements

We thank the authors of the following repositories for their code, which aided our research:

๐Ÿ“š Citation

If you find our work or this codebase helpful, please consider citing:

@article{le2025one,
  title={One-Prompt Strikes Back: Sparse Mixture of Experts for Prompt-based Continual Learning},
  author={Le, Minh and Dao, Bao-Ngoc and Nguyen, Huy and Tran, Quyen and Nguyen, Anh and Ho, Nhat},
  journal={arXiv preprint arXiv:2509.24483},
  year={2025}
}