Continual Learning with Weight Interpolation

Jedrzej Kozal, Jan Wasilewski, Bartosz Krawczyk, Michal Wozniak

Abstract

Continual learning poses a fundamental challenge for modern machine learning systems, requiring models to adapt to new tasks while retaining knowledge from previous ones. Addressing this challenge necessitates the development of efficient algorithms capable of learning from data streams and accumulating knowledge over time. This paper proposes a novel approach to continual learning utilizing the weight consolidation method. Our method, a simple yet powerful technique, enhances robustness against catastrophic forgetting by interpolating between old and new model weights after each novel task, effectively merging two models to facilitate exploration of local minima emerging after arrival of new concepts. Moreover, we demonstrate that our approach can complement existing rehearsal-based replay approaches, improving their accuracy and further mitigating the forgetting phenomenon. Additionally, our method provides an intuitive mechanism for controlling the stability-plasticity trade-off. Experimental results showcase the significant performance enhancement to state-of-the-art experience replay algorithms the proposed weight consolidation approach offers.

Introduction

The primary challenge in continual learning (CL) is catastrophic forgetting, where a model loses previously acquired knowledge upon learning new tasks. This stems from the fundamental tension between plasticity (the ability to integrate new information) and stability (the preservation of existing knowledge). While rehearsal-based methods—which replay a small buffer of old data—are a common solution, they often struggle to find an optimal balance.

This paper introduces CLeWI (Continual Learning with Weight Interpolation), a modular approach that leverages the concept of mode connectivity in the neural network loss landscape. By interpolating between the model's state before and after a new task, CLeWI identifies a "middle ground" that maintains high performance across the entire task sequence.

Methodology

CLeWI functions as a "plugin" for standard rehearsal-based algorithms. The process follows a structured five-step workflow after the arrival of each new task:

  1. Store: Before training on task $t$, the current model weights ($\theta_P$) are saved.
  2. Train: The model is trained on the new task using a standard replay algorithm (e.g., Experience Replay) to produce updated weights ($\theta$).
  3. Align (Permutation): Because neural networks are permutation-invariant, $\theta$ and $\theta_P$ may be functionally similar but structurally misaligned. CLeWI uses a permutation algorithm to align the neurons of the old weights with the new ones.
  4. Interpolate: The weights are merged via linear interpolation: $\theta_{final} = (1 - \alpha)\theta + \alpha \pi(\theta_P)$, where $\alpha$ is a coefficient that directly controls the stability-plasticity trade-off.
  5. Repair: Batch Normalization statistics are updated using the memory buffer to ensure the merged model remains stable.
The CLeWI workflow: storing old weights, training on new data, and interpolating to find the final task weights.

Experimental Results

The researchers evaluated CLeWI on three standard class-incremental benchmarks: CIFAR-10 (5 tasks), CIFAR-100 (10 tasks), and Tiny-ImageNet (20 tasks). All experiments utilized a ResNet-18 architecture and a fixed memory buffer of 500 samples.

Performance Gains

CLeWI consistently improved the performance of baseline rehearsal methods across all datasets. The most significant gains were observed when integrated with simpler replay strategies. For instance, on CIFAR-10, adding CLeWI to Experience Replay (ER) boosted average accuracy from 53.22% to 62.8% and reduced forgetting from 44.02% to 31.8%. Even more dramatic results were seen with Maximally Interfered Retrieval (MIR), where accuracy jumped by nearly 25%.

Main experimental results comparing CLeWI against various baselines across CIFAR and Tiny-ImageNet datasets.

Key Insights

  • Permutation is Critical: Simple weight averaging fails because neurons are often in different orders across training iterations. Alignment via permutation is essential for finding a low-loss interpolation path.
  • The Alpha Knob: The hyperparameter $\alpha$ acts as a direct control for the model's behavior. A higher $\alpha$ favors stability (retaining old knowledge), while a lower $\alpha$ favors plasticity (learning the current task).
  • Architecture Sensitivity: Wider networks (those with more filters) tend to respond better to weight interpolation, suggesting that increased capacity creates a more favorable loss landscape for merging models.

Conclusion and Future Work

CLeWI provides a simple yet effective mechanism to mitigate catastrophic forgetting by navigating the loss landscape through weight interpolation. While the method requires additional memory to store a copy of the model weights during the interpolation step, the substantial accuracy gains and reduced forgetting across multiple benchmarks justify this overhead. Future research will explore automated mechanisms for selecting the optimal interpolation coefficient and extending the method to complex domains like object detection and semantic segmentation.

Summary updated

BibTeX
@inproceedings{kozal2024continual,
  author = {Jedrzej Kozal and Jan Wasilewski and Bartosz Krawczyk and Michal Wozniak},
  title = {{Continual Learning with Weight Interpolation}},
  booktitle = {Workshops @ CVPR},
  year = {2024},
}
Figure