Scalable Language Model with Generalized Continual Learning

Bohao Peng, Zhuotao Tian, Shu Liu, Ming-Chang Yang, Jiaya Jia

TL;DR

The Scalable Language Model (SLM) is a novel framework for continual learning that enables Large Language Models (LLMs) to acquire new skills sequentially without suffering from catastrophic forgetting. Unlike previous methods, SLM eliminates the need for replaying old data or knowing the specific "Task-ID" during inference, offering a highly practical solution for real-world applications like multi-purpose chatbots.

The Challenge of Catastrophic Forgetting

In deep learning, models often face a frustrating phenomenon known as catastrophic forgetting: when fine-tuned on a new task (Task B), a model frequently loses its ability to perform a previously learned task (Task A).

Existing solutions to this problem typically come with significant limitations:

Existing Continual Learning Paradigms
  1. Experience Replay: Requires storing and re-training on old data. This is resource-intensive and often raises privacy concerns.
  2. Regularization: Attempts to constrain weight updates but often fails over long sequences of tasks, eventually leading to performance collapse.
  3. Architecture-based Methods: Usually require a "Task-ID" at inference time. In real-world scenarios—such as a user asking a chatbot an arbitrary question—the model doesn't know which "task" it is performing beforehand, making these methods difficult to deploy.

The authors aim to create a model that scales across diverse domains and task types (e.g., classification, Q&A, sentiment analysis) in a "generalized" setting. This means achieving continual learning without replay, optimization constraints, or reliance on Task-IDs.

Introducing the Scalable Language Model (SLM)

To overcome these hurdles, the authors introduce the Scalable Language Model (SLM), built on two core innovations:

Joint Adaptive Re-Parameterization via KNN
  • Dynamic Task-related Knowledge Retrieval (DTKR): Think of this as a smart "filing cabinet" for skills. When an input arrives, the model uses a frozen Sentence-BERT to create a semantic "query" vector. It then searches a set of learnable "keys" (representing different task distributions) to find the most relevant knowledge.
  • Joint Adaptive Re-Parameterization (JARe): Instead of selecting just one set of weights, JARe uses the $K$-nearest neighbors from the retrieval step to calculate a weighted average of "weight increments." These increments are stored as low-rank matrices (similar to LoRA). This allows the model to adapt its parameters dynamically based on the input's specific context, interpolating between learned skills.

Training is split into two stages: a preparation stage (optimizing the keys to represent task centroids) and a fine-tune stage (learning the actual weight increments for the tasks). Techniques like "Group-based retrieval" and "Random keys masks" are employed to ensure the model diversifies its learned knowledge rather than over-relying on a few keys.

Evaluation and Datasets

The researchers evaluated SLM across several backbones (BERT, T5, and LLaMA-2-7B) using a variety of benchmarks:

  • Standard CL Benchmarks: AG News, Yelp, Amazon, DBPedia, and Yahoo.
  • A New LLaMA-2 Benchmark: Designed to test generalization by combining Medical Q&A, MMLU (multiple-choice exams across domains), and Finance Sentiment classification.
  • Zero-shot Benchmarks: Arc-c, Arc-e, Piqa, and Wino, testing how well the model retains general reasoning after task-specific fine-tuning.

Key Insights

  • The Power of Interpolation: JARe’s primary advantage is that it interpolates between tasks rather than rigidly switching between them. By reaching a consensus among multiple optimization directions, the model becomes robust to noisy retrievals and leverages shared knowledge between similar tasks.
  • Task-ID Independence: By using semantic retrieval to find relevant weights, the model effectively infers the task context on the fly. This removes the need for a human or secondary classifier to provide a Task-ID.
  • Minimal Overhead: The additional parameters (keys and weight increments) are minuscule compared to the base model. For LLaMA-2-7B, the extra parameters represent only about 0.3% of the total model size.
  • Decoupling Knowledge: Because the base model remains frozen and new knowledge is stored in external "values," the system is highly modular. New tasks can be added without altering the original weights.

Results and Performance

  • State-of-the-Art Performance: SLM outperformed all baselines on BERT and T5 benchmarks. On the BERT benchmark, it achieved an impressive 80% reduction in forgetting compared to standard fine-tuning.
  • LLaMA-2 Scaling: In the complex LLaMA-2 benchmark, SLM maintained high accuracy across medical, finance, and general knowledge tasks. In contrast, the standard fine-tuning baseline saw its performance on early tasks drop to near zero.
  • Zero-Shot Resilience: While standard fine-tuning often degrades a model's general reasoning abilities, SLM actually improved baseline LLaMA-2 performance on several zero-shot reasoning tasks (like Arc-e and Wino), indicating effective knowledge transfer.

Limitations and Future Work

The authors acknowledge that their method introduces an additional retrieval framework, adding a small amount of computational and memory overhead. While inference delay is negligible (e.g., only 0.3% of total time for a long medical generation task), the memory required to store weight increments grows linearly as more tasks are added. Future work may explore ways to compress these increments or merge redundant task distributions to keep the parameter overhead manageable over years of continuous learning.

Summary updated

BibTeX
@inproceedings{peng2024scalable,
  author = {Bohao PENG and Zhuotao Tian and Shu Liu and Ming-Chang Yang and Jiaya Jia},
  title = {{Scalable Language Model with Generalized Continual Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=mz8owj4DXu},
}
Figure