Unlocking Continual Learning Abilities in Language Models

Wenyu Du, Shuang Cheng, Tongxu Luo, Zihan Qiu, Zeyu Huang, Ka Chun Cheung, Reynold Cheng, Jie Fu · DOI

Abstract

Large Language Models (LLMs) typically suffer from catastrophic forgetting when trained on sequential tasks. Existing mitigation strategies often rely on storing old data (rehearsal) or requiring explicit task labels, both of which pose practical challenges. This paper introduces MagnItude-based Gradient Updating (MIGU), a simple yet effective method that enables rehearsal-free and task-label-free continual learning. By identifying that different tasks naturally trigger distinct output magnitude distributions in linear layers, MIGU restricts gradient updates to the most active parameters. Experimental results show that MIGU significantly outperforms standard fine-tuning, achieving a 15.2% average accuracy improvement on long-sequence benchmarks and scaling effectively to models like Llama2-7B.

Introduction: The Challenge of Catastrophic Forgetting

Artificial neural networks are notorious for overwriting previous knowledge when learning new information—a phenomenon known as catastrophic forgetting. In the context of LLMs, this means performance on older tasks drops sharply as the model adapts to new data.

Current solutions generally fall into three categories:

  1. Rehearsal-based: Mixing old data with new. This raises privacy concerns and increases storage costs.
  2. Architecture-based: Adding task-specific modules like adapters. This requires knowing which task is being performed at inference time (task labels).
  3. Parameter-based: Freezing important weights. This usually requires task labels to determine weight importance for specific tasks.

MIGU addresses these limitations by providing a rehearsal-free and task-label-free approach, making it suitable for real-world scenarios where data is sensitive or task boundaries are fluid.

Methodology: Magnitude-Based Gradient Updating

The core innovation of MIGU is the discovery that Large Language Models possess an "innate" ability to distinguish tasks through their internal activation magnitudes. Specifically, the distribution of output magnitudes in linear layers (such as Feedforward Networks) is distinct for different tasks.

MIGU implements a two-phase process during training:

  1. Forward Pass: The model processes input data and calculates the L1-normalized magnitude of outputs in its linear layers. These values are then cached.
  2. Backward Pass: Instead of updating all weights, MIGU applies a mask. It only allows gradients to update parameters corresponding to the top $T$ largest output magnitudes (typically $T \approx 0.7$).
The MIGU workflow: The forward pass caches output magnitudes, which are then used to generate a mask for the backward pass, ensuring only high-magnitude "responsible" neurons are updated.

By restricting updates to these high-magnitude paths, the model naturally isolates task-specific learning. This prevents the "quiet" weights—which may store knowledge from previous tasks—from being disrupted.

Key Insights: Innate Task Identification

The most striking finding is that we do not need to explicitly tell a model which task it is performing. The model's internal "volume" distribution already reflects the task type.

Task-specific magnitude distributions: Different tasks like BoolQA, COPA, and Yelp naturally activate different neuron sets, allowing for automatic task isolation.

This parameter isolation via sparsity significantly reduces gradient conflict. When two tasks rely on different sets of high-magnitude neurons, they stop overwriting each other's learned weights. Furthermore, MIGU is "plug-and-play," meaning it can be combined with other techniques like LoRA to further enhance performance.

Evaluation and Results

The authors evaluated MIGU across several benchmarks, including standard text classification (AG News, Amazon, etc.), long-sequence CL (15 tasks), and domain-adaptive settings.

  • Long-Sequence Performance: On a 15-task benchmark, MIGU provided a 15.2% average accuracy improvement over standard parameter-efficient fine-tuning (PEFT).
  • State-of-the-Art (SOTA) Comparison: MIGU achieved results comparable to or better than SOTA methods that require task labels or rehearsal data, despite using neither.
  • Scaling to Llama2-7B: When applied to Llama2-7B using the Magicoder-Evol-Instruct-110K dataset, MIGU demonstrated a superior balance between acquiring new coding skills and retaining general knowledge (e.g., HellaSwag, ARC) compared to vanilla fine-tuning.
  • Efficiency: MIGU is computationally efficient, adding only about 10% overhead in wall time, whereas some regularization-based methods can be up to 10 times slower.

Conclusion and Future Work

MIGU offers a promising path toward truly autonomous continual learning in LLMs. By leveraging the model's own activation patterns, it achieves task isolation without the overhead of data buffers or external labels.

While effective, future work remains. The authors note that scaling to full-parameter continual pre-training of massive models is a hardware-intensive next step. Additionally, exploring other innate features beyond magnitude, such as activation sparsity patterns, may yield even more robust keys to unlocking the full potential of continual learning.

Summary updated

BibTeX
@inproceedings{du2024unlocking,
  author = {Wenyu Du and Shuang Cheng and Tongxu Luo and Zihan Qiu and Zeyu Huang and Ka Chun Cheung and Reynold Cheng and Jie Fu},
  title = {{Unlocking Continual Learning Abilities in Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.379},
}
Figure