Soft-TransFormers for Continual Learning

Haeyong Kang, Chang D. Yoo · DOI

Abstract

Soft-TransFormers (Soft-TF) is a novel parameter-efficient fine-tuning method designed to address the challenge of catastrophic forgetting in continual learning. By utilizing real-valued "soft masks" applied to frozen, pre-trained weights, Soft-TF leverages the Well-initialized Lottery Ticket Hypothesis (WLTH) to adapt to new tasks. This approach allows the model to "nudge" its existing knowledge toward new domains without overwriting previously learned information. Experimental results across vision and language benchmarks demonstrate that Soft-TF achieves state-of-the-art performance, effectively eliminating forgetting while maintaining high task accuracy.

Introduction

Continual Learning (CL) aims to enable artificial intelligence systems to learn a sequence of tasks sequentially, mimicking human learning. A primary obstacle in CL is Catastrophic Forgetting (CF), where training on a new task leads to the degradation of performance on previously acquired tasks due to weight overwriting. Existing strategies generally fall into regularization, rehearsal, or prompt-based methods. While prompt-based methods like L2P or DualPrompt preserve the backbone, they often lack the capacity to fully adapt the model's internal representations to complex new tasks. Soft-TF addresses this by allowing task-specific adaptation of the backbone weights through soft-masking.

Overview of the Soft-TransFormer architecture and the Well-initialized Lottery Ticket Hypothesis (WLTH) weight space.

Methodology

Soft-Masking and the WLTH

Soft-TF is grounded in the Well-initialized Lottery Ticket Hypothesis (WLTH), which suggests that large pre-trained models contain sub-networks capable of solving various downstream tasks. Instead of traditional fine-tuning, Soft-TF learns a task-specific soft mask $m$. The pre-trained weights $\theta$ remain frozen, and the effective weights for a task are computed as $\theta \odot m$, where $\odot$ denotes element-wise multiplication. These masks are initialized near 1.0, ensuring that the model starts with the pre-trained knowledge and only makes surgical, task-specific adjustments.

Comparison of parameter-efficient fine-tuning methods: (a) Adapter, (b) LoRA, and (c) the proposed Soft-TransFormer.

Gradient-based Task Inference (Gradient ID)

A critical component of CL is identifying which task-specific parameters to use at test time. While standard methods rely on input-to-key matching (Prompt ID), Soft-TF introduces Gradient ID. This method treats task identity as a learnable weight and evaluates the gradient of the entropy loss. The model selects the sub-network that exhibits the highest certainty (lowest entropy gradient) for a given input, leading to more accurate task selection.

Experimental Results

The effectiveness of Soft-TF was evaluated on several vision and language benchmarks:

  • Vision Tasks: Using ViT-B/16 backbones, Soft-TF was tested on Split-CIFAR100, Split-TinyImageNet, and Split-ImageNet-R. On 10-Split-CIFAR100, Soft-TF achieved 98.05% accuracy with a minimal 0.25% forgetting rate, significantly outperforming DualPrompt (86.50% accuracy, 5.77% forgetting).
  • Language Tasks: On a BERT-based benchmark of five text classification datasets, Soft-TF reached approximately 79.4% average accuracy, surpassing other parameter-efficient methods like LoRA and Adapters without requiring data rehearsal.

Key Insights

  • Surgical Adjustments: Analysis of learned masks shows they remain concentrated around 1.0, confirming that Soft-TF "nudges" rather than overwrites pre-trained knowledge.
  • Layer Sparsity: Applying masks only to the final layers of the transformer (e.g., layers 10-12) is sufficient for high performance, reducing parameter overhead.
  • Interpretability: Attention maps indicate that Soft-TF focuses more precisely on task-relevant features compared to baseline methods.

Conclusion and Future Work

Soft-TransFormers provide a robust solution for continual learning by combining the stability of frozen backbones with the flexibility of task-specific masking. While Gradient ID introduces some inference latency (approx. 1.6x), its superior accuracy makes it a compelling choice for high-stakes applications. Future work will focus on scaling Soft-TF to multi-modal large language models and exploring scenarios with non-discrete task boundaries.

Summary updated

BibTeX
@misc{kang2024soft,
  author = {Haeyong Kang and Chang D. Yoo},
  title = {{Soft-TransFormers for Continual Learning}},
  year = {2024},
  eprint = {2411.16073},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.16073},
}
Figure