Mixture of Experts Meets Prompt-Based Continual Learning

Minh Le, An Nguyen, Huy Nguyen, Trang Nguyen, Trang Pham, Linh Van Ngo, Nhat Ho

TL;DR

This paper provides a long-missing theoretical foundation for prompt-based continual learning by revealing that self-attention blocks in Transformers are essentially Mixture of Experts (MoE) architectures. Leveraging this insight, the authors introduce NoRGa (Non-linear Residual Gates), a novel gating mechanism that dramatically improves sample efficiency and sets new state-of-the-art performance across multiple continual learning benchmarks.

What Problem Does This Paper Address?

Artificial intelligence models typically suffer from catastrophic forgetting: when trained on a new task, they abruptly lose the knowledge required for previous ones. Continual Learning (CL) seeks to solve this, and recently, "prompt-based" methods have emerged as a top-tier solution. These methods keep a large pre-trained model (like a Vision Transformer) frozen and only learn a small set of "prompts" for each new task.

While these methods work exceptionally well in practice, two problems remained:

  1. Theoretical Gap: There was no rigorous explanation for why prompting prevents forgetting so effectively.
  2. Statistical Suboptimality: The authors found that standard prompt-tuning methods (like prefix tuning) are mathematically "slow learners," requiring an exponential amount of data to estimate parameters accurately because they rely on simple linear gating.

Methods

The researchers bridge the gap between prompting and MoE through a two-step approach:

  1. The Attention-MoE Equivalence: They mathematically prove that a standard Multi-head Self-Attention (MSA) layer is actually a special MoE. In this view, each row in the value matrix acts as a "linear expert," and the attention scores act as "quadratic gating functions" that decide which experts to listen to.
  2. NoRGa (Non-linear Residual Gates): To address the sample efficiency issue, the authors propose a new gating mechanism for prefix tuning. Instead of the standard linear gating, NoRGa adds a non-linear activation function ($\sigma$) and a residual connection to the gating score.

Mathematically, the modified attention score for prompts looks like this: $$\hat{A}^{prompt} = A^{prompt} + \alpha \cdot \sigma(\tau \cdot A^{prompt})$$ where $\alpha$ and $\tau$ are learnable scalar factors. This simple modification allows the model to learn task-specific features much faster than traditional linear methods.

Figure 1: An illustrative depiction of the relationship between self-attention and MoE. Each output vector of a head in the MSA layer can be viewed as the output of a MoE model. These MoE models share the same set of experts encoded in the value matrix. Each entry in the attention matrix corresponds to a score function within this architecture.

Datasets

The authors evaluated NoRGa across a wide variety of challenging Class-Incremental Learning (CIL) benchmarks:

  • Split CIFAR-100: 100 classes divided into 10 sequential tasks.
  • Split ImageNet-R: 200 classes with diverse styles (art, sketches, etc.) divided into 10 tasks.
  • Split CUB-200: A fine-grained classification dataset of 200 bird species.
  • 5-Datasets: A composite benchmark (CIFAR-10, MNIST, Fashion-MNIST, SVHN, and notMNIST) designed to test the model's ability to handle significant variations between tasks.

Key Insights and Ideas

  • Prompting as Expert Expansion: By viewing attention as MoE, prefix tuning can be reframed as simply adding new, task-specific experts to a pre-trained "knowledge base."
  • The Power of Non-linearity: The authors prove that linear gating is statistically inefficient ($O(1/\log^\tau(n))$ convergence). By introducing non-linear residual gates, they achieve parametric convergence ($O(\sqrt{\log(n)/n})$), meaning the model reaches high accuracy with significantly fewer training samples.
  • Parameter Efficiency: Despite the performance boost, NoRGa introduces almost zero extra parameters (just two scalars per head) compared to existing state-of-the-art methods like HiDe-Prompt.
Figure 2: Left: An illustrative depiction of prefix tuning as the introduction of new experts into pre-trained MoE models. Right: Visualization of NoRGa implementation, integrating non-linear activation and residual connections into the prefix tuning attention matrix.

Key Results

NoRGa consistently outperformed all baselines (L2P, DualPrompt, CODA-Prompt, etc.) across different pre-training paradigms (supervised and self-supervised):

  • State-of-the-Art Accuracy: On Split ImageNet-R (using Sup-21K weights), NoRGa achieved a Cumulative Average Accuracy of 79.52%, a nearly 3% improvement over the previous best method (HiDe-Prompt at 76.60%).
  • Minimal Forgetting: The method showed very low "Average Forgetting Measure" (FM) scores, indicating it retains old knowledge exceptionally well while adapting to new tasks.
  • Robustness: The gains were consistent even when using different self-supervised backbones like iBOT, DINO, and MoCo, proving the theory holds regardless of how the model was originally trained.

Limitations and Future Work

  • Expert Complexity: The current implementation treats rows of the value matrix as simple linear experts. The authors suggest that exploring more intricate, non-linear expert architectures within the attention block could be a fruitful next step.
  • Activation Selection: While NoRGa is robust, the choice of the non-linear activation function ($\sigma$) currently requires some manual selection (e.g., choosing between tanh, sigmoid, or GELU). Future work could involve learning the optimal activation function adaptively during training.
  • Task Identity: Like many CIL methods, performance still depends on the accuracy of task-identity inference at test time. Improving this "router" component remains a general challenge in the field.

Summary updated

BibTeX
@inproceedings{le2024mixture,
  author = {Minh Le and An Nguyen and Huy Nguyen and Trang Nguyen and Trang Pham and Linh Van Ngo and Nhat Ho},
  title = {{Mixture of Experts Meets Prompt-Based Continual Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=erwatqQ4p8},
}
Figure