Clustering-based Domain-Incremental Learning

Christiaan Lamers, René Vidal, Nabil Belbachir, Niki van Stein, Thomas Bäck, Paris Giampouras

Abstract

We consider the problem of learning multiple tasks in a continual learning setting in which data from different tasks is presented to the learner in a streaming fashion. A key challenge in this setting is the so-called "catastrophic forgetting problem", in which the performance of the learner in an "old task" decreases when subsequently trained on a "new task". Existing continual learning methods, such as Averaged Gradient Episodic Memory (A-GEM) and Orthogonal Gradient Descent (OGD), address catastrophic forgetting by minimizing the loss for the current task without increasing the loss for previous tasks. However, these methods assume the learner knows when the task changes, which is unrealistic in practice. In this paper, we alleviate the need to provide the algorithm with information about task changes by using an online clustering-based approach on a dynamically updated finite pool of samples or gradients. We thereby successfully counteract catastrophic forgetting in one of the hardest settings, namely: domain-incremental learning, a setting for which the problem was previously unsolved. We showcase the benefits of our approach by applying these ideas to projection-based methods, such as A-GEM and OGD, which lead to task-agnostic versions of them. Experiments on real datasets demonstrate the effectiveness of the proposed strategy and its promising performance compared to state-of-the-art methods.

Introduction

In the field of machine learning, "continual learning" represents the ability for a model to learn new tasks sequentially without losing proficiency in previously acquired knowledge. Standard neural networks typically suffer from catastrophic forgetting, where training on a new domain (e.g., recognizing cars) causes the model to lose its ability to perform an earlier task (e.g., recognizing bikes).

Existing solutions like Averaged Gradient Episodic Memory (A-GEM) and Orthogonal Gradient Descent (OGD) are effective but rely on two major assumptions that limit real-world applicability: task awareness and linear memory growth. These methods require a "notification" whenever the task changes and their memory requirements often grow linearly with the number of tasks. This paper addresses the domain-incremental learning setting, where task boundaries are unknown, aiming to maintain a fixed, constant memory footprint.

Comparison between the standard task-incremental approach and the proposed domain-incremental approach.

Methodology

The authors propose "Task Agnostic" (TA) versions of two popular projection-based algorithms: TA-A-GEM and TA-OGD. The core innovation is an online clustering-based memory management system that replaces the need for explicit task labels.

Online Clustering Mechanism

  1. Initialization: The first few samples (or gradients) define the initial cluster centers.
  2. Cluster Assignment: New incoming data is assigned to the nearest cluster based on $L_2$ distance.
  3. Memory Update (FIFO): Each cluster has a maximum size. When a cluster is full, the oldest sample is removed to make room for the new one (First-In-First-Out). This ensures that even if a new task dominates the data stream, samples from older, distinct tasks remain preserved in their own clusters.
  4. Adaptive Learning Rate: The system uses a "soft" task detection mechanism. If the loss function increases steadily, the system assumes a task change and resets the learning rate to a higher value to facilitate adaptation.
The online clustering-based memory management process for TA-A-GEM and TA-OGD.

While TA-A-GEM stores labeled data samples, TA-OGD stores model gradients. The clustering logic applies to both, allowing these algorithms to function without explicit task boundaries.

Experimental Setup

The approach was evaluated using several standard benchmarks modified for domain-incremental scenarios:

  • Image Datasets: MNIST, Fashion MNIST, NOT MNIST, CIFAR10, and SVHN.
  • Task Generation: Three mechanisms were used to simulate domain shifts: task permutation (shuffling pixels), task rotation (rotating images), and class splitting (partitioning the dataset by labels).

Key Results and Insights

The proposed TA-A-GEM and TA-OGD methods significantly outperformed the state-of-the-art task-agnostic baseline, Bayesian Gradient Descent (BGD), across most datasets.

  • Performance: On MNIST class-splitting, TA-OGD achieved an average accuracy of 85.7%, compared to 79.0% for BGD. On Fashion MNIST, TA-A-GEM reached 93.1% accuracy, nearly matching the performance of "task-aware" methods.
  • Clustering as a Proxy: Data from different tasks naturally forms distinct clusters in feature or gradient space. By maintaining these clusters, the algorithm implicitly "remembers" different tasks.
  • Diversity over Recency: Unlike standard buffers that keep only recent data, clustering ensures a diverse set of historical data is preserved, preventing a single new task from overwriting previous learning.

Conclusion

This research demonstrates that a fixed-size, intelligently managed memory pool is sufficient to prevent catastrophic forgetting in task-agnostic settings. Future work will focus on more sophisticated clustering methods, scaling to larger architectures like ResNets, and automating the discovery of the optimal number of clusters to make the system fully autonomous.

Summary updated

BibTeX
@inproceedings{lamers2023clustering,
  author = {Christiaan Lamers and René Vidal and Nabil Belbachir and Niki van Stein and Thomas Bäck and Paris Giampouras},
  title = {{Clustering-based Domain-Incremental Learning}},
  booktitle = {Workshops @ ICCV},
  year = {2023},
  url = {https://openreview.net/forum?id=faXHRv8yVw},
}
Figure