SequeL: A Continual Learning Library in PyTorch and JAX

Nikolaos Dimitriadis, François Fleuret, Pascal FrossardarXiv 2023

Abstract

Continual Learning is an important and challenging problem in machine learning, where models must adapt to a continuous stream of new data without forgetting previously acquired knowledge. While existing frameworks are built on PyTorch, the rising popularity of JAX might lead to divergent codebases, ultimately hindering reproducibility and progress. To address this problem, we introduce SequeL, a flexible and extensible library for Continual Learning that supports both PyTorch and JAX frameworks. SequeL provides a unified interface for a wide range of Continual Learning algorithms, including regularization-based approaches, replay-based approaches, and hybrid approaches. The library is designed towards modularity and simplicity, making the API suitable for both researchers and practitioners. We release SequeL as an open-source library, enabling researchers and developers to easily experiment and extend the library for their own purposes.

Introduction

Continual Learning (CL) aims to develop models capable of learning from a non-stationary stream of data while mitigating "catastrophic forgetting." Despite significant algorithmic progress, the field suffers from a fragmented software landscape. While PyTorch has been the dominant framework, JAX is increasingly favored for its performance and functional paradigm. This "framework schism" often forces researchers to choose between frameworks, making it difficult to compare new JAX-based methods against established PyTorch baselines without costly reimplementations. SequeL addresses this by providing a unified, framework-agnostic interface for CL research.

Architecture and Design

SequeL is built on the principle of modularity, decomposing the CL pipeline into five core components:

  1. Benchmarks: Manages data streams (e.g., Split MNIST, CIFAR).
  2. Backbones: Defines neural architectures like MLPs and ResNets.
  3. Callbacks: Provides hooks to monitor or modify training at granular levels (e.g., after a training step).
  4. Loggers: Integrates with tools like Weights & Biases and TensorBoard.
  5. Algorithms: Contains the core CL logic (e.g., EWC, Experience Replay).

The central abstraction is the BaseAlgorithm class, which handles framework-specific "plumbing"—such as device management and data conversion—allowing researchers to focus on high-level algorithmic logic.

The SequeL training and validation lifecycle, illustrating the various hooks available for modular algorithm development.

As shown in the figure above, SequeL defines a structured lifecycle for training and validation. By exposing hooks at the start and end of tasks, epochs, and steps, the library allows for complex behaviors (like gradient clipping or memory updates) to be injected seamlessly into the training loop. This modularity ensures that the "engineering" of the training loop is separated from the "algorithmic" logic.

Implementation and Reproducibility

SequeL leverages Hydra for configuration-driven research. This allows entire experiments to be defined in YAML files, ensuring that hyperparameters and dataset settings are easily shareable and reproducible.

The library currently supports a wide array of benchmarks, including Split MNIST, CIFAR-10/100, and TinyImageNet. Notably, the Benchmarks module is implemented in PyTorch to leverage its robust data-handling capabilities for dynamic streams, even when the model training uses JAX.

Supported Algorithms and Results

SequeL includes implementations for over a dozen major CL algorithms:

  • Regularization: EWC, SI, MAS, LFL.
  • Replay: Experience Replay (ER), Dark Experience Replay (DER/DER++), A-GEM.
  • Hybrid/Meta-learning: LaMAML, MC-SGD, Stable SGD.

The library's effectiveness is demonstrated by its ability to reproduce results from original papers. For instance, SequeL achieves 82.3% accuracy for MC-SGD and 77.42% for LaMAML on the RotatedMNIST benchmark, matching reported performance.

Conclusion

SequeL provides a bridge between the PyTorch and JAX ecosystems in Continual Learning. By isolating engineering concerns from algorithmic logic, it facilitates cleaner research and better reproducibility. Future work will focus on expanding the library to include Reinforcement Learning tasks and incorporating the latest state-of-the-art supervised CL methods.

Summary updated

BibTeX
@misc{dimitriadis2023sequel,
  author = {Nikolaos Dimitriadis and François Fleuret and Pascal Frossard},
  title = {{SequeL: A Continual Learning Library in PyTorch and JAX}},
  year = {2023},
  eprint = {2304.10857},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.10857},
}
Figure