Mixture of Experts Meets Prompt-Based Continual Learning

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

Abstract

This paper establishes a mathematical equivalence between the self-attention mechanism in Vision Transformers (ViTs) and Mixture of Experts (MoE) architectures. By reframing prompt-based continual learning through this lens, the authors identify that standard linear gating in prompting is statistically suboptimal. To address this, they introduce NoRGa (Non-linear Residual Gates), a novel gating mechanism that incorporates non-linear activations and residual connections. NoRGa significantly improves learning efficiency and sets new state-of-the-art benchmarks across several continual learning datasets without increasing parameter overhead.

Introduction

Artificial Intelligence often suffers from catastrophic forgetting, where learning new tasks overwrites knowledge from previous ones. While humans learn incrementally, AI models typically require retraining on all data to maintain performance. Recent "prompt-based" approaches have mitigated this by attaching small, learnable "prompts" to frozen, pre-trained models like ViTs. Despite their empirical success, the theoretical reason why these methods work has remained elusive. This research bridges that gap by viewing self-attention as a hidden MoE architecture.

The MoE-Attention Connection

The core theoretical contribution of this work is the proof that a standard self-attention head is mathematically equivalent to an MoE model. In this framework, the rows of the "Value" matrix function as experts, while the attention scores—calculated from Query and Key matrices—serve as gating functions.

The mathematical mapping of self-attention components to a Mixture of Experts architecture.

Under this interpretation, "prefix tuning" (a common prompting technique) is seen as adding new, task-specific experts to the model. This realization allows researchers to apply established MoE theory to optimize modern transformer prompting.

NoRGa: Non-linear Residual Gates

Theoretical analysis revealed that the standard linear gating used in most prompting methods is "statistically suboptimal," requiring an exponential amount of data to converge. To solve this, the authors proposed NoRGa, which modifies the gating score with two key components:

  1. Non-linear Activation: Utilizing functions like tanh or sigmoid to allow the model to learn faster from fewer examples (achieving polynomial rather than exponential convergence rates).
  2. Residual Connections: Adding the original linear score back to the non-linear output to prevent vanishing gradients and ensure training stability.
The NoRGa architecture featuring non-linear activation and residual connections for improved gating.

Experimental Results

The authors evaluated NoRGa on several standard continual learning benchmarks, including Split CIFAR-100, Split ImageNet-R, Split CUB-200, and a composite 5-Datasets benchmark.

Key findings include:

  • State-of-the-Art Performance: On Split CIFAR-100, NoRGa achieved a Final Average Accuracy of 94.48%, surpassing the previous best of 92.61%.
  • Versatility: The method proved robust across different pre-training regimes, including both supervised and self-supervised (e.g., iBOT, DINO) models.
  • Efficiency: NoRGa provides these performance gains while maintaining the same parameter count as existing prefix-tuning methods, making it ideal for memory-constrained environments.

Conclusion

By identifying the inherent MoE structure within self-attention, this work provides a rigorous foundation for understanding and improving prompt-based continual learning. NoRGa demonstrates that moving beyond simple linear gating can drastically improve a model's ability to learn incrementally. Future research may explore more complex expert architectures and adaptive activation functions to further enhance these capabilities.

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